linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] kvm: svm: de-allocate svm_cpu_data for all cpus in svm_cpu_uninit()
@ 2020-12-03 20:56 Jacob Xu
  0 siblings, 0 replies; 3+ messages in thread
From: Jacob Xu @ 2020-12-03 20:56 UTC (permalink / raw)
  To: Paolo Bonzini, Sean Christopherson, Jim Mattson, Oliver Upton
  Cc: kvm, linux-kernel, Jacob Xu

The cpu arg for svm_cpu_uninit() was previously ignored resulting in the
per cpu structure svm_cpu_data not being de-allocated for all cpus.

Signed-off-by: Jacob Xu <jacobhxu@google.com>
---
 arch/x86/kvm/svm/svm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c
index 79b3a564f1c9..da7eb4aaf44f 100644
--- a/arch/x86/kvm/svm/svm.c
+++ b/arch/x86/kvm/svm/svm.c
@@ -530,12 +530,12 @@ static int svm_hardware_enable(void)
 
 static void svm_cpu_uninit(int cpu)
 {
-	struct svm_cpu_data *sd = per_cpu(svm_data, raw_smp_processor_id());
+	struct svm_cpu_data *sd = per_cpu(svm_data, cpu);
 
 	if (!sd)
 		return;
 
-	per_cpu(svm_data, raw_smp_processor_id()) = NULL;
+	per_cpu(svm_data, cpu) = NULL;
 	kfree(sd->sev_vmcbs);
 	__free_page(sd->save_area);
 	kfree(sd);
-- 
2.29.2.576.ga3fc446d84-goog


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

* Re: [PATCH] kvm: svm: de-allocate svm_cpu_data for all cpus in svm_cpu_uninit()
  2020-12-03 20:59 Jacob Xu
@ 2020-12-04  8:47 ` Paolo Bonzini
  0 siblings, 0 replies; 3+ messages in thread
From: Paolo Bonzini @ 2020-12-04  8:47 UTC (permalink / raw)
  To: Jacob Xu, Sean Christopherson, Jim Mattson, Oliver Upton
  Cc: kvm, linux-kernel

On 03/12/20 21:59, Jacob Xu wrote:
> The cpu arg for svm_cpu_uninit() was previously ignored resulting in the
> per cpu structure svm_cpu_data not being de-allocated for all cpus.
> 
> Signed-off-by: Jacob Xu <jacobhxu@google.com>
> ---
>   arch/x86/kvm/svm/svm.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c
> index 79b3a564f1c9..da7eb4aaf44f 100644
> --- a/arch/x86/kvm/svm/svm.c
> +++ b/arch/x86/kvm/svm/svm.c
> @@ -530,12 +530,12 @@ static int svm_hardware_enable(void)
>   
>   static void svm_cpu_uninit(int cpu)
>   {
> -	struct svm_cpu_data *sd = per_cpu(svm_data, raw_smp_processor_id());
> +	struct svm_cpu_data *sd = per_cpu(svm_data, cpu);
>   
>   	if (!sd)
>   		return;
>   
> -	per_cpu(svm_data, raw_smp_processor_id()) = NULL;
> +	per_cpu(svm_data, cpu) = NULL;
>   	kfree(sd->sev_vmcbs);
>   	__free_page(sd->save_area);
>   	kfree(sd);
> 

Queued, thanks.

Paolo


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

* [PATCH] kvm: svm: de-allocate svm_cpu_data for all cpus in svm_cpu_uninit()
@ 2020-12-03 20:59 Jacob Xu
  2020-12-04  8:47 ` Paolo Bonzini
  0 siblings, 1 reply; 3+ messages in thread
From: Jacob Xu @ 2020-12-03 20:59 UTC (permalink / raw)
  To: Paolo Bonzini, Sean Christopherson, Jim Mattson, Oliver Upton
  Cc: kvm, linux-kernel, Jacob Xu

The cpu arg for svm_cpu_uninit() was previously ignored resulting in the
per cpu structure svm_cpu_data not being de-allocated for all cpus.

Signed-off-by: Jacob Xu <jacobhxu@google.com>
---
 arch/x86/kvm/svm/svm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kvm/svm/svm.c b/arch/x86/kvm/svm/svm.c
index 79b3a564f1c9..da7eb4aaf44f 100644
--- a/arch/x86/kvm/svm/svm.c
+++ b/arch/x86/kvm/svm/svm.c
@@ -530,12 +530,12 @@ static int svm_hardware_enable(void)
 
 static void svm_cpu_uninit(int cpu)
 {
-	struct svm_cpu_data *sd = per_cpu(svm_data, raw_smp_processor_id());
+	struct svm_cpu_data *sd = per_cpu(svm_data, cpu);
 
 	if (!sd)
 		return;
 
-	per_cpu(svm_data, raw_smp_processor_id()) = NULL;
+	per_cpu(svm_data, cpu) = NULL;
 	kfree(sd->sev_vmcbs);
 	__free_page(sd->save_area);
 	kfree(sd);
-- 
2.29.2.576.ga3fc446d84-goog


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

end of thread, other threads:[~2020-12-04  8:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-03 20:56 [PATCH] kvm: svm: de-allocate svm_cpu_data for all cpus in svm_cpu_uninit() Jacob Xu
2020-12-03 20:59 Jacob Xu
2020-12-04  8:47 ` Paolo Bonzini

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).