Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1294617 > unrolled thread

[PATCH] KVM: x86: MMU: Use clear_page() instead of init_shadow_page_table()

Started byTakuya Yoshikawa <yoshikawa_takuya_b1@lab.ntt.co.jp>
First post2015-12-18 10:50 +0100
Last post2015-12-18 19:10 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] KVM: x86: MMU: Use clear_page() instead of  init_shadow_page_table() Takuya Yoshikawa <yoshikawa_takuya_b1@lab.ntt.co.jp> - 2015-12-18 10:50 +0100
    Re: [PATCH] KVM: x86: MMU: Use clear_page() instead of  init_shadow_page_table() Paolo Bonzini <pbonzini@redhat.com> - 2015-12-18 19:10 +0100

#1294617 — [PATCH] KVM: x86: MMU: Use clear_page() instead of init_shadow_page_table()

FromTakuya Yoshikawa <yoshikawa_takuya_b1@lab.ntt.co.jp>
Date2015-12-18 10:50 +0100
Subject[PATCH] KVM: x86: MMU: Use clear_page() instead of init_shadow_page_table()
Message-ID<qGZPH-3SO-1@gated-at.bofh.it>
Not just in order to clean up the code, but to make it faster by using
enhanced instructions: the initialization became 20-30% faster on our
testing machine.

Signed-off-by: Takuya Yoshikawa <yoshikawa_takuya_b1@lab.ntt.co.jp>
---
 arch/x86/kvm/mmu.c | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index a1a3d19..7f5a82b 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -2041,14 +2041,6 @@ static void mmu_sync_children(struct kvm_vcpu *vcpu,
 	}
 }
 
-static void init_shadow_page_table(struct kvm_mmu_page *sp)
-{
-	int i;
-
-	for (i = 0; i < PT64_ENT_PER_PAGE; ++i)
-		sp->spt[i] = 0ull;
-}
-
 static void __clear_sp_write_flooding_count(struct kvm_mmu_page *sp)
 {
 	sp->write_flooding_count = 0;
@@ -2128,7 +2120,7 @@ static struct kvm_mmu_page *kvm_mmu_get_page(struct kvm_vcpu *vcpu,
 		account_shadowed(vcpu->kvm, sp);
 	}
 	sp->mmu_valid_gen = vcpu->kvm->arch.mmu_valid_gen;
-	init_shadow_page_table(sp);
+	clear_page(sp->spt);
 	trace_kvm_mmu_get_page(sp, true);
 	return sp;
 }
-- 
2.1.0



--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1295082

FromPaolo Bonzini <pbonzini@redhat.com>
Date2015-12-18 19:10 +0100
Message-ID<qH7DA-By-3@gated-at.bofh.it>
In reply to#1294617

On 18/12/2015 10:54, Takuya Yoshikawa wrote:
> Not just in order to clean up the code, but to make it faster by using
> enhanced instructions: the initialization became 20-30% faster on our
> testing machine.
> 
> Signed-off-by: Takuya Yoshikawa <yoshikawa_takuya_b1@lab.ntt.co.jp>

Applied locally, but I'm not sure when it will appear on kernel.org...
it depends on the amount of testing I can do next week before the
holidays.  Anyway, it's not lost. :)

Paolo

> ---
>  arch/x86/kvm/mmu.c | 10 +---------
>  1 file changed, 1 insertion(+), 9 deletions(-)
> 
> diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
> index a1a3d19..7f5a82b 100644
> --- a/arch/x86/kvm/mmu.c
> +++ b/arch/x86/kvm/mmu.c
> @@ -2041,14 +2041,6 @@ static void mmu_sync_children(struct kvm_vcpu *vcpu,
>  	}
>  }
>  
> -static void init_shadow_page_table(struct kvm_mmu_page *sp)
> -{
> -	int i;
> -
> -	for (i = 0; i < PT64_ENT_PER_PAGE; ++i)
> -		sp->spt[i] = 0ull;
> -}
> -
>  static void __clear_sp_write_flooding_count(struct kvm_mmu_page *sp)
>  {
>  	sp->write_flooding_count = 0;
> @@ -2128,7 +2120,7 @@ static struct kvm_mmu_page *kvm_mmu_get_page(struct kvm_vcpu *vcpu,
>  		account_shadowed(vcpu->kvm, sp);
>  	}
>  	sp->mmu_valid_gen = vcpu->kvm->arch.mmu_valid_gen;
> -	init_shadow_page_table(sp);
> +	clear_page(sp->spt);
>  	trace_kvm_mmu_get_page(sp, true);
>  	return sp;
>  }
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web