Skip to contentSkip to conversation

KVM: X86: Fix missing local pCPU when executing wbinvd on all dirty pCPUs

PATCH Applied Wanpeng Li 2 participants 2 messages Mar 12, 2021 – Mar 18, 2021

Subsystems (3)
lore
Share & tools
lore

Wanpeng Li

author
#0 lore raw

PATCH 1/1 KVM: X86: Fix missing local pCPU when executing wbinvd on all dirty pCPUs

From: Wanpeng Li <[email protected]>

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().

---
 arch/x86/kvm/x86.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kvm/x86.c +1 -1
index 012d5df..aa6d667 100644
@@ -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);
Signature · 1 line
2.7.4
maintainer Applied
#1 lore raw
Quoted 20 lines · Wanpeng Li

From: Wanpeng Li <[email protected]>

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().

---
  arch/x86/kvm/x86.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/kvm/x86.c +0 -0
index 012d5df..aa6d667 100644

arch/x86/kvm/x86.c static int kvm_emulate_wbinvd_noskip(struct kvm_vcpu *vcpu) · line 6644

Quoted 8 lines
arch/x86/kvm/x86.c +1 -1
@@ -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