# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1202985192 0
# Node ID 0769835cf50fb8c50399f592c3ef65e02f0018dd
# Parent 80428fb872be14fe121c796c468f4a11cd234ee4
x86 shadow: Reduce scope of shadow lock.
emulate_map_dest doesn't require holding lock, since
only shadow related operation possibly involved is to
remove shadow which is less frequent and can acquire
lock inside. Rest are either guest table walk or
per-vcpu monitor table manipulation
Signed-off-by Kevin Tian <kevin.tian@xxxxxxxxx>
---
xen/arch/x86/mm/shadow/multi.c | 22 ++++++----------------
1 files changed, 6 insertions(+), 16 deletions(-)
diff -r 80428fb872be -r 0769835cf50f xen/arch/x86/mm/shadow/multi.c
--- a/xen/arch/x86/mm/shadow/multi.c Thu Feb 14 10:31:01 2008 +0000
+++ b/xen/arch/x86/mm/shadow/multi.c Thu Feb 14 10:33:12 2008 +0000
@@ -4216,15 +4216,12 @@ sh_x86_emulate_write(struct vcpu *v, uns
if ( (vaddr & (bytes - 1)) && !is_hvm_vcpu(v) )
return X86EMUL_UNHANDLEABLE;
- shadow_lock(v->domain);
addr = emulate_map_dest(v, vaddr, bytes, sh_ctxt);
if ( emulate_map_dest_failed(addr) )
- {
- shadow_unlock(v->domain);
return ((addr == MAPPING_EXCEPTION) ?
X86EMUL_EXCEPTION : X86EMUL_UNHANDLEABLE);
- }
-
+
+ shadow_lock(v->domain);
memcpy(addr, src, bytes);
emulate_unmap_dest(v, addr, bytes, sh_ctxt);
@@ -4246,16 +4243,12 @@ sh_x86_emulate_cmpxchg(struct vcpu *v, u
if ( (vaddr & (bytes - 1)) && !is_hvm_vcpu(v) )
return X86EMUL_UNHANDLEABLE;
- shadow_lock(v->domain);
-
addr = emulate_map_dest(v, vaddr, bytes, sh_ctxt);
if ( emulate_map_dest_failed(addr) )
- {
- shadow_unlock(v->domain);
return ((addr == MAPPING_EXCEPTION) ?
X86EMUL_EXCEPTION : X86EMUL_UNHANDLEABLE);
- }
-
+
+ shadow_lock(v->domain);
switch ( bytes )
{
case 1: prev = cmpxchg(((u8 *)addr), old, new); break;
@@ -4294,18 +4287,15 @@ sh_x86_emulate_cmpxchg8b(struct vcpu *v,
if ( (vaddr & 7) && !is_hvm_vcpu(v) )
return X86EMUL_UNHANDLEABLE;
- shadow_lock(v->domain);
-
addr = emulate_map_dest(v, vaddr, 8, sh_ctxt);
if ( emulate_map_dest_failed(addr) )
- {
- shadow_unlock(v->domain);
return ((addr == MAPPING_EXCEPTION) ?
X86EMUL_EXCEPTION : X86EMUL_UNHANDLEABLE);
- }
old = (((u64) old_hi) << 32) | (u64) old_lo;
new = (((u64) new_hi) << 32) | (u64) new_lo;
+
+ shadow_lock(v->domain);
prev = cmpxchg(((u64 *)addr), old, new);
if ( prev != old )
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|