public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] KVM: SVM: use __GFP_ZERO instead of clear_page()
@ 2020-09-16  8:36 lihaiwei.kernel
  2020-09-17  9:45 ` Maxim Levitsky
  2020-09-22 13:26 ` Paolo Bonzini
  0 siblings, 2 replies; 3+ messages in thread
From: lihaiwei.kernel @ 2020-09-16  8:36 UTC (permalink / raw)
  To: linux-kernel, kvm, x86
  Cc: pbonzini, sean.j.christopherson, vkuznets, wanpengli, jmattson,
	joro, tglx, mingo, bp, hpa, Haiwei Li

From: Haiwei Li <lihaiwei@tencent.com>

Use __GFP_ZERO while alloc_page().

Signed-off-by: Haiwei Li <lihaiwei@tencent.com>
---
 arch/x86/kvm/svm/avic.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/arch/x86/kvm/svm/avic.c b/arch/x86/kvm/svm/avic.c
index ac830cd50830..f73f84d56452 100644
--- a/arch/x86/kvm/svm/avic.c
+++ b/arch/x86/kvm/svm/avic.c
@@ -153,20 +153,18 @@ int avic_vm_init(struct kvm *kvm)
 		return 0;
 
 	/* Allocating physical APIC ID table (4KB) */
-	p_page = alloc_page(GFP_KERNEL_ACCOUNT);
+	p_page = alloc_page(GFP_KERNEL_ACCOUNT | __GFP_ZERO);
 	if (!p_page)
 		goto free_avic;
 
 	kvm_svm->avic_physical_id_table_page = p_page;
-	clear_page(page_address(p_page));
 
 	/* Allocating logical APIC ID table (4KB) */
-	l_page = alloc_page(GFP_KERNEL_ACCOUNT);
+	l_page = alloc_page(GFP_KERNEL_ACCOUNT | __GFP_ZERO);
 	if (!l_page)
 		goto free_avic;
 
 	kvm_svm->avic_logical_id_table_page = l_page;
-	clear_page(page_address(l_page));
 
 	spin_lock_irqsave(&svm_vm_data_hash_lock, flags);
  again:
-- 
2.18.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] KVM: SVM: use __GFP_ZERO instead of clear_page()
  2020-09-16  8:36 [PATCH] KVM: SVM: use __GFP_ZERO instead of clear_page() lihaiwei.kernel
@ 2020-09-17  9:45 ` Maxim Levitsky
  2020-09-22 13:26 ` Paolo Bonzini
  1 sibling, 0 replies; 3+ messages in thread
From: Maxim Levitsky @ 2020-09-17  9:45 UTC (permalink / raw)
  To: lihaiwei.kernel, linux-kernel, kvm, x86
  Cc: pbonzini, sean.j.christopherson, vkuznets, wanpengli, jmattson,
	joro, tglx, mingo, bp, hpa, Haiwei Li

On Wed, 2020-09-16 at 16:36 +0800, lihaiwei.kernel@gmail.com wrote:
> From: Haiwei Li <lihaiwei@tencent.com>
> 
> Use __GFP_ZERO while alloc_page().
> 
> Signed-off-by: Haiwei Li <lihaiwei@tencent.com>
> ---
>  arch/x86/kvm/svm/avic.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/x86/kvm/svm/avic.c b/arch/x86/kvm/svm/avic.c
> index ac830cd50830..f73f84d56452 100644
> --- a/arch/x86/kvm/svm/avic.c
> +++ b/arch/x86/kvm/svm/avic.c
> @@ -153,20 +153,18 @@ int avic_vm_init(struct kvm *kvm)
>  		return 0;
>  
>  	/* Allocating physical APIC ID table (4KB) */
> -	p_page = alloc_page(GFP_KERNEL_ACCOUNT);
> +	p_page = alloc_page(GFP_KERNEL_ACCOUNT | __GFP_ZERO);
>  	if (!p_page)
>  		goto free_avic;
>  
>  	kvm_svm->avic_physical_id_table_page = p_page;
> -	clear_page(page_address(p_page));
>  
>  	/* Allocating logical APIC ID table (4KB) */
> -	l_page = alloc_page(GFP_KERNEL_ACCOUNT);
> +	l_page = alloc_page(GFP_KERNEL_ACCOUNT | __GFP_ZERO);
>  	if (!l_page)
>  		goto free_avic;
>  
>  	kvm_svm->avic_logical_id_table_page = l_page;
> -	clear_page(page_address(l_page));
>  
>  	spin_lock_irqsave(&svm_vm_data_hash_lock, flags);
>   again:
Reviewed-by: Maxim Levitsky <mlevitsk@redhat.com>

Best regards,
	Maxim Levitsky


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] KVM: SVM: use __GFP_ZERO instead of clear_page()
  2020-09-16  8:36 [PATCH] KVM: SVM: use __GFP_ZERO instead of clear_page() lihaiwei.kernel
  2020-09-17  9:45 ` Maxim Levitsky
@ 2020-09-22 13:26 ` Paolo Bonzini
  1 sibling, 0 replies; 3+ messages in thread
From: Paolo Bonzini @ 2020-09-22 13:26 UTC (permalink / raw)
  To: lihaiwei.kernel, linux-kernel, kvm, x86
  Cc: sean.j.christopherson, vkuznets, wanpengli, jmattson, joro, tglx,
	mingo, bp, hpa, Haiwei Li

On 16/09/20 10:36, lihaiwei.kernel@gmail.com wrote:
> From: Haiwei Li <lihaiwei@tencent.com>
> 
> Use __GFP_ZERO while alloc_page().
> 
> Signed-off-by: Haiwei Li <lihaiwei@tencent.com>
> ---
>  arch/x86/kvm/svm/avic.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/x86/kvm/svm/avic.c b/arch/x86/kvm/svm/avic.c
> index ac830cd50830..f73f84d56452 100644
> --- a/arch/x86/kvm/svm/avic.c
> +++ b/arch/x86/kvm/svm/avic.c
> @@ -153,20 +153,18 @@ int avic_vm_init(struct kvm *kvm)
>  		return 0;
>  
>  	/* Allocating physical APIC ID table (4KB) */
> -	p_page = alloc_page(GFP_KERNEL_ACCOUNT);
> +	p_page = alloc_page(GFP_KERNEL_ACCOUNT | __GFP_ZERO);
>  	if (!p_page)
>  		goto free_avic;
>  
>  	kvm_svm->avic_physical_id_table_page = p_page;
> -	clear_page(page_address(p_page));
>  
>  	/* Allocating logical APIC ID table (4KB) */
> -	l_page = alloc_page(GFP_KERNEL_ACCOUNT);
> +	l_page = alloc_page(GFP_KERNEL_ACCOUNT | __GFP_ZERO);
>  	if (!l_page)
>  		goto free_avic;
>  
>  	kvm_svm->avic_logical_id_table_page = l_page;
> -	clear_page(page_address(l_page));
>  
>  	spin_lock_irqsave(&svm_vm_data_hash_lock, flags);
>   again:
> 

Queued, thanks.

Paolo


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-09-22 13:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-09-16  8:36 [PATCH] KVM: SVM: use __GFP_ZERO instead of clear_page() lihaiwei.kernel
2020-09-17  9:45 ` Maxim Levitsky
2020-09-22 13:26 ` Paolo Bonzini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox