[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] vmx: Do not disable real EFER.NXE even when disabled by guest.
# HG changeset patch # User Keir Fraser <keir.fraser@xxxxxxxxxx> # Date 1229428451 0 # Node ID c3df4b8ea2fc2e86ecf4de97cf3f5516cac8eade # Parent 5b73fa1b9562d18ecdde2b3c8556989bdb2117e0 vmx: Do not disable real EFER.NXE even when disabled by guest. We must not disable EFER.NXE in host mode since shadow code relies on accessing shadow mappings with NX set. We do not want to write EFER on every vmentry/vmexit if we can avoid it, since it will be somewhat slow. Finally, we don't believe that any guest relies on NX really being disabled when EFER.NXE is cleared. This given, it makes sense to ignore the guest's setting of EFER.NXE. Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx> --- xen/arch/x86/hvm/vmx/vmx.c | 33 +++++++-------------------------- 1 files changed, 7 insertions(+), 26 deletions(-) diff -r 5b73fa1b9562 -r c3df4b8ea2fc xen/arch/x86/hvm/vmx/vmx.c --- a/xen/arch/x86/hvm/vmx/vmx.c Tue Dec 16 11:49:20 2008 +0000 +++ b/xen/arch/x86/hvm/vmx/vmx.c Tue Dec 16 11:54:11 2008 +0000 @@ -306,9 +306,6 @@ static void vmx_restore_host_msrs(void) wrmsrl(msr_index[i], host_msr_state->msrs[i]); clear_bit(i, &host_msr_state->flags); } - - if ( cpu_has_nx && !(read_efer() & EFER_NX) ) - write_efer(read_efer() | EFER_NX); } static void vmx_save_guest_msrs(struct vcpu *v) @@ -342,39 +339,23 @@ static void vmx_restore_guest_msrs(struc clear_bit(i, &guest_flags); } - if ( (v->arch.hvm_vcpu.guest_efer ^ read_efer()) & (EFER_NX | EFER_SCE) ) + if ( (v->arch.hvm_vcpu.guest_efer ^ read_efer()) & EFER_SCE ) { HVM_DBG_LOG(DBG_LEVEL_2, "restore guest's EFER with value %lx", v->arch.hvm_vcpu.guest_efer); - write_efer((read_efer() & ~(EFER_NX | EFER_SCE)) | - (v->arch.hvm_vcpu.guest_efer & (EFER_NX | EFER_SCE))); + write_efer((read_efer() & ~EFER_SCE) | + (v->arch.hvm_vcpu.guest_efer & EFER_SCE)); } } #else /* __i386__ */ #define vmx_save_host_msrs() ((void)0) - -static void vmx_restore_host_msrs(void) -{ - if ( cpu_has_nx && !(read_efer() & EFER_NX) ) - write_efer(read_efer() | EFER_NX); -} +#define vmx_restore_host_msrs() ((void)0) #define vmx_save_guest_msrs(v) ((void)0) - -static void vmx_restore_guest_msrs(struct vcpu *v) -{ - if ( (v->arch.hvm_vcpu.guest_efer ^ read_efer()) & EFER_NX ) - { - HVM_DBG_LOG(DBG_LEVEL_2, - "restore guest's EFER with value %lx", - v->arch.hvm_vcpu.guest_efer); - write_efer((read_efer() & ~EFER_NX) | - (v->arch.hvm_vcpu.guest_efer & EFER_NX)); - } -} +#define vmx_restore_guest_msrs(v) ((void)0) static enum handler_return long_mode_do_msr_read(struct cpu_user_regs *regs) { @@ -1190,8 +1171,8 @@ static void vmx_update_guest_efer(struct #endif if ( v == current ) - write_efer((read_efer() & ~(EFER_NX|EFER_SCE)) | - (v->arch.hvm_vcpu.guest_efer & (EFER_NX|EFER_SCE))); + write_efer((read_efer() & ~EFER_SCE) | + (v->arch.hvm_vcpu.guest_efer & EFER_SCE)); } static void vmx_flush_guest_tlbs(void) _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |