All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1] KVM: SVM: Switch to bitmap_zalloc()
@ 2018-08-30 11:49 Andy Shevchenko
  2018-09-14 17:57 ` Paolo Bonzini
  0 siblings, 1 reply; 2+ messages in thread
From: Andy Shevchenko @ 2018-08-30 11:49 UTC (permalink / raw)
  To: Joerg Roedel, Paolo Bonzini, Radim Krčmář,
	kvm, Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86,
	linux-kernel
  Cc: Andy Shevchenko

Switch to bitmap_zalloc() to show clearly what we are allocating.
Besides that it returns pointer of bitmap type instead of opaque void *.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 arch/x86/kvm/svm.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
index 6276140044d0..5d7e9f76caba 100644
--- a/arch/x86/kvm/svm.c
+++ b/arch/x86/kvm/svm.c
@@ -1226,8 +1226,7 @@ static __init int sev_hardware_setup(void)
 	min_sev_asid = cpuid_edx(0x8000001F);
 
 	/* Initialize SEV ASID bitmap */
-	sev_asid_bitmap = kcalloc(BITS_TO_LONGS(max_sev_asid),
-				sizeof(unsigned long), GFP_KERNEL);
+	sev_asid_bitmap = bitmap_zalloc(max_sev_asid, GFP_KERNEL);
 	if (!sev_asid_bitmap)
 		return 1;
 
@@ -1405,7 +1404,7 @@ static __exit void svm_hardware_unsetup(void)
 	int cpu;
 
 	if (svm_sev_enabled())
-		kfree(sev_asid_bitmap);
+		bitmap_free(sev_asid_bitmap);
 
 	for_each_possible_cpu(cpu)
 		svm_cpu_uninit(cpu);
-- 
2.18.0


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

* Re: [PATCH v1] KVM: SVM: Switch to bitmap_zalloc()
  2018-08-30 11:49 [PATCH v1] KVM: SVM: Switch to bitmap_zalloc() Andy Shevchenko
@ 2018-09-14 17:57 ` Paolo Bonzini
  0 siblings, 0 replies; 2+ messages in thread
From: Paolo Bonzini @ 2018-09-14 17:57 UTC (permalink / raw)
  To: Andy Shevchenko, Joerg Roedel, Radim Krčmář,
	kvm, Thomas Gleixner, Ingo Molnar, H. Peter Anvin, x86,
	linux-kernel

On 30/08/2018 13:49, Andy Shevchenko wrote:
> Switch to bitmap_zalloc() to show clearly what we are allocating.
> Besides that it returns pointer of bitmap type instead of opaque void *.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---
>  arch/x86/kvm/svm.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/x86/kvm/svm.c b/arch/x86/kvm/svm.c
> index 6276140044d0..5d7e9f76caba 100644
> --- a/arch/x86/kvm/svm.c
> +++ b/arch/x86/kvm/svm.c
> @@ -1226,8 +1226,7 @@ static __init int sev_hardware_setup(void)
>  	min_sev_asid = cpuid_edx(0x8000001F);
>  
>  	/* Initialize SEV ASID bitmap */
> -	sev_asid_bitmap = kcalloc(BITS_TO_LONGS(max_sev_asid),
> -				sizeof(unsigned long), GFP_KERNEL);
> +	sev_asid_bitmap = bitmap_zalloc(max_sev_asid, GFP_KERNEL);
>  	if (!sev_asid_bitmap)
>  		return 1;
>  
> @@ -1405,7 +1404,7 @@ static __exit void svm_hardware_unsetup(void)
>  	int cpu;
>  
>  	if (svm_sev_enabled())
> -		kfree(sev_asid_bitmap);
> +		bitmap_free(sev_asid_bitmap);
>  
>  	for_each_possible_cpu(cpu)
>  		svm_cpu_uninit(cpu);
> 

Queued, thanks.

Paolo

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

end of thread, other threads:[~2018-09-14 17:57 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-30 11:49 [PATCH v1] KVM: SVM: Switch to bitmap_zalloc() Andy Shevchenko
2018-09-14 17:57 ` Paolo Bonzini

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.