Re: KVM: VMX: do not overwrite uptodate vcpu->arch.cr3 on KVM_SET_SREGS

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

 



On Tue, Jun 07, 2011 at 11:24:49AM +0300, Avi Kivity wrote:
> On 06/06/2011 08:27 PM, Marcelo Tosatti wrote:
> >Only decache guest CR3 value if vcpu->arch.cr3 is stale.
> >Fixes loadvm with live guest.
> >
> >
> >@@ -2049,7 +2049,9 @@ static void ept_update_paging_mode_cr0(unsigned long *hw_cr0,
> >  					unsigned long cr0,
> >  					struct kvm_vcpu *vcpu)
> >  {
> >-	vmx_decache_cr3(vcpu);
> >+
> >+	if (!test_bit(VCPU_EXREG_CR3, (ulong *)&vcpu->arch.regs_avail))
> >+		vmx_decache_cr3(vcpu);
> >  	if (!(cr0&  X86_CR0_PG)) {
> >  		/* From paging/starting to nonpaging */
> >  		vmcs_write32(CPU_BASED_VM_EXEC_CONTROL,
> 
> Applied and queued, but I think there is something rotten here.  How
> does arch.cr3 get into GUEST_CR3 after KVM_SET_SREGS?  arch.cr3 is a
> supposed to be write-through cache - it only has a bit in
> regs_avail, not regs_dirty.


KVM_SET_SREGS sets good kvm->arch.cr3. Then vmx_decache_cr3 overwrites
kvm->arch.cr3 from GUEST_CR3, which is stale.


--
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