* [PATCH] VMX: use non-atomic bitops to manage MSR state
@ 2016-06-20 11:31 Jan Beulich
2016-06-20 12:25 ` Andrew Cooper
2016-06-23 7:36 ` Tian, Kevin
0 siblings, 2 replies; 3+ messages in thread
From: Jan Beulich @ 2016-06-20 11:31 UTC (permalink / raw)
To: xen-devel; +Cc: Kevin Tian, Jun Nakajima
[-- Attachment #1: Type: text/plain, Size: 1882 bytes --]
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 <jbeulich@suse.com>
--- 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(struc
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 )
[-- Attachment #2: VMX-msr_state-no-lock.patch --]
[-- Type: text/plain, Size: 1926 bytes --]
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 <jbeulich@suse.com>
--- 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(struc
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 )
[-- Attachment #3: Type: text/plain, Size: 126 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] VMX: use non-atomic bitops to manage MSR state
2016-06-20 11:31 [PATCH] VMX: use non-atomic bitops to manage MSR state Jan Beulich
@ 2016-06-20 12:25 ` Andrew Cooper
2016-06-23 7:36 ` Tian, Kevin
1 sibling, 0 replies; 3+ messages in thread
From: Andrew Cooper @ 2016-06-20 12:25 UTC (permalink / raw)
To: Jan Beulich, xen-devel; +Cc: Kevin Tian, Jun Nakajima
[-- Attachment #1.1: Type: text/plain, Size: 427 bytes --]
On 20/06/16 12:31, Jan Beulich wrote:
> 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 <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
[-- Attachment #1.2: Type: text/html, Size: 967 bytes --]
[-- Attachment #2: Type: text/plain, Size: 126 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] VMX: use non-atomic bitops to manage MSR state
2016-06-20 11:31 [PATCH] VMX: use non-atomic bitops to manage MSR state Jan Beulich
2016-06-20 12:25 ` Andrew Cooper
@ 2016-06-23 7:36 ` Tian, Kevin
1 sibling, 0 replies; 3+ messages in thread
From: Tian, Kevin @ 2016-06-23 7:36 UTC (permalink / raw)
To: Jan Beulich, xen-devel; +Cc: Nakajima, Jun
> From: Jan Beulich [mailto:JBeulich@suse.com]
> Sent: Monday, June 20, 2016 7:31 PM
>
> 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 <jbeulich@suse.com>
>
Acked-by: Kevin Tian <kevin.tian@intel.com>
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-06-23 7:36 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-20 11:31 [PATCH] VMX: use non-atomic bitops to manage MSR state Jan Beulich
2016-06-20 12:25 ` Andrew Cooper
2016-06-23 7:36 ` Tian, Kevin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).