Skip to contentSkip to conversation

x86/VT-x: Disable MSR intercept for SHADOW_GS_BASE.

PATCH In review Andrew Cooper 3 participants 3 messages Nov 14, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 x86/VT-x: Disable MSR intercept for SHADOW_GS_BASE.

Intercepting this MSR is pointless - The swapgs instruction does not cause a vmexit, so the cached result of this is potentially stale after the next guest instruction. It is correctly saved and restored on vcpu context switch.

Furthermore, 64bit Windows writes to this MSR on every thread context switch, so interception causes a substantial performance hit.

From: Paul Durrant <[email protected]>

CC Keir Fraser <[email protected]>
CC Jan Beulich <[email protected]>
CC Tim Deegan <[email protected]>
CC Jun Nakajima <[email protected]>
CC Eddie Dong <[email protected]>
---
 xen/arch/x86/hvm/vmx/vmcs.c |    1 +
 1 file changed, 1 insertion(+)
xen/arch/x86/hvm/vmx/vmcs.c +1 -0
index 290b42f..4aab971 100644
@@ -950,6 +950,7 @@ static int construct_vmcs(struct vcpu *v)
 
         vmx_disable_intercept_for_msr(v, MSR_FS_BASE, MSR_TYPE_R | MSR_TYPE_W);
         vmx_disable_intercept_for_msr(v, MSR_GS_BASE, MSR_TYPE_R | MSR_TYPE_W);
+        vmx_disable_intercept_for_msr(v, MSR_SHADOW_GS_BASE, MSR_TYPE_R | MSR_TYPE_W);
         vmx_disable_intercept_for_msr(v, MSR_IA32_SYSENTER_CS, MSR_TYPE_R | MSR_TYPE_W);
         vmx_disable_intercept_for_msr(v, MSR_IA32_SYSENTER_ESP, MSR_TYPE_R | MSR_TYPE_W);
         vmx_disable_intercept_for_msr(v, MSR_IA32_SYSENTER_EIP, MSR_TYPE_R | MSR_TYPE_W);
Signature · 1 line
1.7.10.4
Reviewed-by on v1 1/1
#1 lore raw
Quoted 10 lines · Andrew Cooper

Intercepting this MSR is pointless - The swapgs instruction does not cause a vmexit, so the cached result of this is potentially stale after the next guest instruction. It is correctly saved and restored on vcpu context switch.

Furthermore, 64bit Windows writes to this MSR on every thread context switch, so interception causes a substantial performance hit.

From: Paul Durrant <[email protected]>

Acked-by
#2 lore raw
Quoted 8 lines · Tim Deegan
Quoted 1 line · Andrew Cooper

Intercepting this MSR is pointless - The swapgs instruction does not

cause a

Quoted 1 line

vmexit, so the cached result of this is potentially stale after the next

guest

Quoted 3 lines

instruction. It is correctly saved and restored on vcpu context switch.

Furthermore, 64bit Windows writes to this MSR on every thread context

Quoted 9 lines

switch,

Quoted 5 lines

so interception causes a substantial performance hit.

From: Paul Durrant <[email protected]>

Signature · 2 lines
Jun
Intel Open Source Technology Center

_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel