Re: [PATCH 08/31] nVMX: Fix local_vcpus_link handling

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, May 18, 2011 at 08:52:36AM +0300, Nadav Har'El wrote:
> On Tue, May 17, 2011, Marcelo Tosatti wrote about "Re: [PATCH 08/31] nVMX: Fix local_vcpus_link handling":
> > On Tue, May 17, 2011 at 10:30:30PM +0300, Nadav Har'El wrote:
> > > So we'll have two fields, vmx.vcpu.cpu and vmx.vmcs.cpu, which are supposed
> > > to always contain the same value. Are you fine with that?
> > 
> > Yes. Avi?
> 
> Oops, it's even worse than I said, because if the new vmclear_local_vmcss
> clears the vmcs currently used on some vcpu, it will update vmcs.cpu on that
> vcpu to -1, but will *not* update vmx.vcpu.cpu, which remain its old value,
> and potentially cause problems when it is used (e.g., in x86.c) instead
> of vmx.vmcs.cpu.

Humpf, right. OK, you can handle the x86.c usage with

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 64edf57..b5fd9b4 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -2118,7 +2118,7 @@ void kvm_arch_vcpu_load(struct kvm_vcpu *vcpu, int cpu)
 	if (need_emulate_wbinvd(vcpu)) {
 		if (kvm_x86_ops->has_wbinvd_exit())
 			cpumask_set_cpu(cpu, vcpu->arch.wbinvd_dirty_mask);
-		else if (vcpu->cpu != -1 && vcpu->cpu != cpu)
+		else if (vcpu->cpu != -1 && vcpu->cpu != cpu && cpu_online(vcpu->cpu))
 			smp_call_function_single(vcpu->cpu,
 					wbinvd_ipi, NULL, 1);
 	}

Note this is not just about the code being nicer, but simplicity is
crucial, the code is tricky enough with one linked list.

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux