debuggers.hg

changeset 16968:193afcdb85b2

x86: Fix shadow pinning logic (for PV live relo).
From: Tim Deegan <Tim.Deegan@citrix.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
author Keir Fraser <keir.fraser@citrix.com>
date Tue Jan 29 11:50:30 2008 +0000 (2008-01-29)
parents 128f7bc0a277
children 98c2665056ea
files xen/arch/x86/mm/shadow/multi.c
line diff
     1.1 --- a/xen/arch/x86/mm/shadow/multi.c	Tue Jan 29 11:47:42 2008 +0000
     1.2 +++ b/xen/arch/x86/mm/shadow/multi.c	Tue Jan 29 11:50:30 2008 +0000
     1.3 @@ -3518,8 +3518,18 @@ sh_set_toplevel_shadow(struct vcpu *v,
     1.4      v->arch.shadow_table[slot] = new_entry;
     1.5  
     1.6      /* Decrement the refcount of the old contents of this slot */
     1.7 -    if ( !pagetable_is_null(old_entry) )
     1.8 -        sh_put_ref(v, pagetable_get_mfn(old_entry), 0);
     1.9 +    if ( !pagetable_is_null(old_entry) ) {
    1.10 +        mfn_t old_smfn = pagetable_get_mfn(old_entry);
    1.11 +        /* Need to repin the old toplevel shadow if it's been unpinned
    1.12 +         * by shadow_prealloc(): in PV mode we're still running on this
    1.13 +         * shadow and it's not safe to free it yet. */
    1.14 +        if ( !mfn_to_shadow_page(old_smfn)->pinned && !sh_pin(v, old_smfn) )
    1.15 +        {
    1.16 +            SHADOW_ERROR("can't re-pin %#lx\n", mfn_x(old_smfn));
    1.17 +            domain_crash(v->domain);
    1.18 +        }
    1.19 +        sh_put_ref(v, old_smfn, 0);
    1.20 +    }
    1.21  }
    1.22  
    1.23