[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <f72d8d77-80f5-e21c-39d2-48789c232c51@amd.com>
Date: Wed, 7 Aug 2024 09:27:30 +0200
From: "Gupta, Pankaj" <pankaj.gupta@....com>
To: Sean Christopherson <seanjc@...gle.com>,
Paolo Bonzini <pbonzini@...hat.com>
Cc: kvm@...r.kernel.org, linux-kernel@...r.kernel.org,
Isaku Yamahata <isaku.yamahata@...el.com>, Chao Gao <chao.gao@...el.com>,
Yuan Yao <yuan.yao@...el.com>
Subject: Re: [PATCH] KVM: x86: Use this_cpu_ptr() instead of
per_cpu_ptr(smp_processor_id())
On 8/2/2024 10:16 PM, Sean Christopherson wrote:
> From: Isaku Yamahata <isaku.yamahata@...el.com>
>
> Use this_cpu_ptr() instead of open coding the equivalent in various
> user return MSR helpers.
>
> Signed-off-by: Isaku Yamahata <isaku.yamahata@...el.com>
> Reviewed-by: Chao Gao <chao.gao@...el.com>
> Reviewed-by: Yuan Yao <yuan.yao@...el.com>
> [sean: massage changelog]
> Signed-off-by: Sean Christopherson <seanjc@...gle.com>
Reviewed-by: Pankaj Gupta <pankaj.gupta@....com>
> ---
>
> Not entirely sure where this came from, found it in one of my myriad branches
> while doing "spring" cleaning.
>
> arch/x86/kvm/x86.c | 6 ++----
> 1 file changed, 2 insertions(+), 4 deletions(-)
>
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index af6c8cf6a37a..518baf47ef1c 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -427,8 +427,7 @@ static void kvm_user_return_msr_cpu_online(void)
>
> int kvm_set_user_return_msr(unsigned slot, u64 value, u64 mask)
> {
> - unsigned int cpu = smp_processor_id();
> - struct kvm_user_return_msrs *msrs = per_cpu_ptr(user_return_msrs, cpu);
> + struct kvm_user_return_msrs *msrs = this_cpu_ptr(user_return_msrs);
> int err;
>
> value = (value & mask) | (msrs->values[slot].host & ~mask);
> @@ -450,8 +449,7 @@ EXPORT_SYMBOL_GPL(kvm_set_user_return_msr);
>
> static void drop_user_return_notifiers(void)
> {
> - unsigned int cpu = smp_processor_id();
> - struct kvm_user_return_msrs *msrs = per_cpu_ptr(user_return_msrs, cpu);
> + struct kvm_user_return_msrs *msrs = this_cpu_ptr(user_return_msrs);
>
> if (msrs->registered)
> kvm_on_user_return(&msrs->urn);
>
> base-commit: 332d2c1d713e232e163386c35a3ba0c1b90df83f
Powered by blists - more mailing lists