Re: [PATCH 2/4] KVM: Add accessor for reading cr4 (or some bits of cr4)

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

 



On Tue, Dec 08, 2009 at 11:36:59AM +0200, Avi Kivity wrote:
> On 12/08/2009 09:57 AM, Sheng Yang wrote:
> >vcpu->arch.cr0 = cr0;
> >>-		vmx_set_cr4(vcpu, vcpu->arch.cr4);
> >>+		vmx_set_cr4(vcpu, kvm_read_cr4(vcpu));
> >>  	}
> >Another place accessed cr4 directly, in ept_update_paging_mode_cr4()
> >
> 
> That one is called from vmx_set_cr4(); at that time CR4_READ_SHADOW
> is not up-to-date and vmx_decache_cr4_guest_bits() will actually
> corrupt vcpu->arch.cr4 (except it won't be called, since cr4.pae is
> never guest owned).

Yes, you are right...
> 
> But you are right, I should have placed a comment.  I'll add a patch
> that inlines ept_update_paging_mode_cr4 into its caller so it can
> access the cr4 parameter directly instead of vcpu->arch.cr4.

Just notice another thing, seems the cr4_guest_owned_bits' initial value is
wrong. It should be ~KVM_GUEST_CR4_MASK rather than KVM_GUEST_CR4_MASK in this
patch IIUC.

-- 
regards
Yang, Sheng
--
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