From: Jan Beulich Date: Thu, 23 Jun 2016 15:46:55 +0000 (+0200) Subject: VMX: use non-atomic bitops to manage MSR state X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~872 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=3528b5b4c3b1695ecc7af5622b32042aafbdf6f4;p=xen.git VMX: use non-atomic bitops to manage MSR state All host_msr_state accesses are solely on the owning CPU, and all guest_msr_state ones solely when the vCPU is current or being switched to. This, btw, is also in line with the use of find_first_set_bit() (which would be bogus if ->flags could get updated behind its back). Signed-off-by: Jan Beulich Reviewed-by: Andrew Cooper Acked-by: Kevin Tian --- diff --git a/xen/arch/x86/hvm/vmx/vmx.c b/xen/arch/x86/hvm/vmx/vmx.c index 4edf283340..65ee89e1ec 100644 --- a/xen/arch/x86/hvm/vmx/vmx.c +++ b/xen/arch/x86/hvm/vmx/vmx.c @@ -339,9 +339,9 @@ void vmx_save_host_msrs(void) #define WRITE_MSR(address) do { \ guest_msr_state->msrs[VMX_INDEX_MSR_ ## address] = msr_content; \ - set_bit(VMX_INDEX_MSR_ ## address, &guest_msr_state->flags); \ + __set_bit(VMX_INDEX_MSR_ ## address, &guest_msr_state->flags); \ wrmsrl(MSR_ ## address, msr_content); \ - set_bit(VMX_INDEX_MSR_ ## address, &host_msr_state->flags); \ + __set_bit(VMX_INDEX_MSR_ ## address, &host_msr_state->flags); \ } while ( 0 ) static enum handler_return @@ -462,7 +462,7 @@ static void vmx_restore_host_msrs(void) { i = find_first_set_bit(host_msr_state->flags); wrmsrl(msr_index[i], host_msr_state->msrs[i]); - clear_bit(i, &host_msr_state->flags); + __clear_bit(i, &host_msr_state->flags); } } @@ -495,9 +495,9 @@ static void vmx_restore_guest_msrs(struct vcpu *v) HVM_DBG_LOG(DBG_LEVEL_2, "restore guest's index %d msr %x with value %lx", i, msr_index[i], guest_msr_state->msrs[i]); - set_bit(i, &host_msr_state->flags); + __set_bit(i, &host_msr_state->flags); wrmsrl(msr_index[i], guest_msr_state->msrs[i]); - clear_bit(i, &guest_flags); + __clear_bit(i, &guest_flags); } if ( (v->arch.hvm_vcpu.guest_efer ^ read_efer()) & EFER_SCE )