ia64/xen-unstable

changeset 14212:a69d98bf0c55

[XEN] Remove a race condition in shadow mark_dirty code.
Signed-off-by: Tim Deegan <Tim.Deegan@xensource.com>
author Tim Deegan <Tim.Deegan@xensource.com>
date Fri Mar 02 13:46:39 2007 +0000 (2007-03-02)
parents 3ac19fda0bc2
children 8103284bcede
files xen/arch/x86/mm/shadow/common.c
line diff
     1.1 --- a/xen/arch/x86/mm/shadow/common.c	Fri Mar 02 12:11:52 2007 +0000
     1.2 +++ b/xen/arch/x86/mm/shadow/common.c	Fri Mar 02 13:46:39 2007 +0000
     1.3 @@ -2912,7 +2912,16 @@ void sh_mark_dirty(struct domain *d, mfn
     1.4       * can be called from __hvm_copy during emulation).
     1.5       * If the lock isn't held, take it for the duration of the call. */
     1.6      do_locking = !shadow_locked_by_me(d);
     1.7 -    if ( do_locking ) shadow_lock(d);
     1.8 +    if ( do_locking ) 
     1.9 +    { 
    1.10 +        shadow_lock(d);
    1.11 +        /* Check the mode again with the lock held */ 
    1.12 +        if ( unlikely(!shadow_mode_log_dirty(d)) )
    1.13 +        {
    1.14 +            shadow_unlock(d);
    1.15 +            return;
    1.16 +        }
    1.17 +    }
    1.18  
    1.19      ASSERT(d->arch.paging.shadow.dirty_bitmap != NULL);
    1.20