From: Marcelo Tosatti Date: Tue, 16 Apr 2013 02:30:13 +0000 (-0300) Subject: KVM: x86: fix maintenance of guest/host xcr0 state X-Git-Tag: v3.10-rc1~11^2~5 X-Git-Url: http://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=42bdf991f4cad9678ee2b98c5c2e9299a3f986ef;p=pandora-kernel.git KVM: x86: fix maintenance of guest/host xcr0 state Emulation of xcr0 writes zero guest_xcr0_loaded variable so that subsequent VM-entry reloads CPU's xcr0 with guests xcr0 value. However, this is incorrect because guest_xcr0_loaded variable is read to decide whether to reload hosts xcr0. In case the vcpu thread is scheduled out after the guest_xcr0_loaded = 0 assignment, and scheduler decides to preload FPU: switch_to { __switch_to __math_state_restore restore_fpu_checking fpu_restore_checking if (use_xsave()) fpu_xrstor_checking xrstor64 with CPU's xcr0 == guests xcr0 Fix by properly restoring hosts xcr0 during emulation of xcr0 writes. Analyzed-by: Ulrich Obergfell Signed-off-by: Marcelo Tosatti Reviewed-by: Paolo Bonzini Signed-off-by: Gleb Natapov --- Reading git-diff-tree failed