kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] KVM: X86: Fix missing local pCPU when executing wbinvd on all dirty pCPUs
@ 2021-03-12  2:45 Wanpeng Li
  2021-03-18 17:55 ` Paolo Bonzini
  0 siblings, 1 reply; 2+ messages in thread
From: Wanpeng Li @ 2021-03-12  2:45 UTC (permalink / raw)
  To: linux-kernel, kvm
  Cc: Paolo Bonzini, Sean Christopherson, Vitaly Kuznetsov, Wanpeng Li,
	Jim Mattson, Joerg Roedel, Nadav Amit

From: Wanpeng Li <wanpengli@tencent.com>

We should execute wbinvd on all dirty pCPUs when guest wbinvd exits 
to maintain datat consistency in order to deal with noncoherent DMA.
smp_call_function_many() does not execute the provided function on 
the local core, this patch replaces it by on_each_cpu_mask().

Reported-by: Nadav Amit <namit@vmware.com>
Cc: Nadav Amit <namit@vmware.com>
Signed-off-by: Wanpeng Li <wanpengli@tencent.com>
---
 arch/x86/kvm/x86.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 012d5df..aa6d667 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -6638,7 +6638,7 @@ static int kvm_emulate_wbinvd_noskip(struct kvm_vcpu *vcpu)
 		int cpu = get_cpu();
 
 		cpumask_set_cpu(cpu, vcpu->arch.wbinvd_dirty_mask);
-		smp_call_function_many(vcpu->arch.wbinvd_dirty_mask,
+		on_each_cpu_mask(vcpu->arch.wbinvd_dirty_mask,
 				wbinvd_ipi, NULL, 1);
 		put_cpu();
 		cpumask_clear(vcpu->arch.wbinvd_dirty_mask);
-- 
2.7.4


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

* Re: [PATCH] KVM: X86: Fix missing local pCPU when executing wbinvd on all dirty pCPUs
  2021-03-12  2:45 [PATCH] KVM: X86: Fix missing local pCPU when executing wbinvd on all dirty pCPUs Wanpeng Li
@ 2021-03-18 17:55 ` Paolo Bonzini
  0 siblings, 0 replies; 2+ messages in thread
From: Paolo Bonzini @ 2021-03-18 17:55 UTC (permalink / raw)
  To: Wanpeng Li, linux-kernel, kvm
  Cc: Sean Christopherson, Vitaly Kuznetsov, Wanpeng Li, Jim Mattson,
	Joerg Roedel, Nadav Amit

On 12/03/21 03:45, Wanpeng Li wrote:
> From: Wanpeng Li <wanpengli@tencent.com>
> 
> We should execute wbinvd on all dirty pCPUs when guest wbinvd exits
> to maintain datat consistency in order to deal with noncoherent DMA.
> smp_call_function_many() does not execute the provided function on
> the local core, this patch replaces it by on_each_cpu_mask().
> 
> Reported-by: Nadav Amit <namit@vmware.com>
> Cc: Nadav Amit <namit@vmware.com>
> Signed-off-by: Wanpeng Li <wanpengli@tencent.com>
> ---
>   arch/x86/kvm/x86.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index 012d5df..aa6d667 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -6638,7 +6638,7 @@ static int kvm_emulate_wbinvd_noskip(struct kvm_vcpu *vcpu)
>   		int cpu = get_cpu();
>   
>   		cpumask_set_cpu(cpu, vcpu->arch.wbinvd_dirty_mask);
> -		smp_call_function_many(vcpu->arch.wbinvd_dirty_mask,
> +		on_each_cpu_mask(vcpu->arch.wbinvd_dirty_mask,
>   				wbinvd_ipi, NULL, 1);
>   		put_cpu();
>   		cpumask_clear(vcpu->arch.wbinvd_dirty_mask);
> 

Queued, thanks.

Paolo


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

end of thread, other threads:[~2021-03-18 17:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-12  2:45 [PATCH] KVM: X86: Fix missing local pCPU when executing wbinvd on all dirty pCPUs Wanpeng Li
2021-03-18 17:55 ` 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).