[PATCH 5/7] KVM: x86: Use wbinvd_on_cpu() instead of an open-coded equivalent

Sean Christopherson posted 7 patches 11 months, 2 weeks ago
There is a newer version of this series
[PATCH 5/7] KVM: x86: Use wbinvd_on_cpu() instead of an open-coded equivalent
Posted by Sean Christopherson 11 months, 2 weeks ago
Use wbinvd_on_cpu() to target a single CPU instead of open-coding an
equivalent.  In addition to deduplicating code, this will allow removing
KVM's wbinvd_ipi() once the other usage is gone.

No functional change intended.

Signed-off-by: Sean Christopherson <seanjc@google.com>
---
 arch/x86/kvm/x86.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 58b82d6fd77c..eab1e64a19a2 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -4983,8 +4983,7 @@ void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
 		if (kvm_x86_call(has_wbinvd_exit)())
 			cpumask_set_cpu(cpu, vcpu->arch.wbinvd_dirty_mask);
 		else if (vcpu->cpu != -1 && vcpu->cpu != cpu)
-			smp_call_function_single(vcpu->cpu,
-					wbinvd_ipi, NULL, 1);
+			wbinvd_on_cpu(vcpu->cpu);
 	}
 
 	kvm_x86_call(vcpu_load)(vcpu, cpu);
-- 
2.48.1.711.g2feabab25a-goog
Re: [PATCH 5/7] KVM: x86: Use wbinvd_on_cpu() instead of an open-coded equivalent
Posted by Tom Lendacky 11 months, 1 week ago
On 2/26/25 19:48, Sean Christopherson wrote:
> Use wbinvd_on_cpu() to target a single CPU instead of open-coding an
> equivalent.  In addition to deduplicating code, this will allow removing
> KVM's wbinvd_ipi() once the other usage is gone.
> 
> No functional change intended.
> 
> Signed-off-by: Sean Christopherson <seanjc@google.com>

Reviewed-by: Tom Lendacky <thomas.lendacky@amd.com>

> ---
>  arch/x86/kvm/x86.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index 58b82d6fd77c..eab1e64a19a2 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -4983,8 +4983,7 @@ void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
>  		if (kvm_x86_call(has_wbinvd_exit)())
>  			cpumask_set_cpu(cpu, vcpu->arch.wbinvd_dirty_mask);
>  		else if (vcpu->cpu != -1 && vcpu->cpu != cpu)
> -			smp_call_function_single(vcpu->cpu,
> -					wbinvd_ipi, NULL, 1);
> +			wbinvd_on_cpu(vcpu->cpu);
>  	}
>  
>  	kvm_x86_call(vcpu_load)(vcpu, cpu);