debuggers.hg

changeset 22687:a8d69de8eb31

x86/mm: Add p2m_lock in set_shared_p2m_entry

This avoids the immediate problem (calling set_p2m_entry() without the
lock held) but leaves the underlying problem (no consistent locking
order between page-sharing and p2m code) for later.

Signed-off-by: Jui-Hao Chiang <juihaochiang@gmail.com>
Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
author Tim Deegan <Tim.Deegan@citrix.com>
date Tue Jan 04 11:32:20 2011 +0000 (2011-01-04)
parents 4e108cf56d07
children 959e87a1117f
files xen/arch/x86/mm/p2m.c
line diff
     1.1 --- a/xen/arch/x86/mm/p2m.c	Mon Dec 27 08:00:09 2010 +0000
     1.2 +++ b/xen/arch/x86/mm/p2m.c	Tue Jan 04 11:32:20 2011 +0000
     1.3 @@ -2650,6 +2650,7 @@ int
     1.4  set_shared_p2m_entry(struct p2m_domain *p2m, unsigned long gfn, mfn_t mfn)
     1.5  {
     1.6      int rc = 0;
     1.7 +    int need_lock = !p2m_locked_by_me(p2m);
     1.8      p2m_type_t ot;
     1.9      mfn_t omfn;
    1.10  
    1.11 @@ -2665,7 +2666,11 @@ set_shared_p2m_entry(struct p2m_domain *
    1.12      set_gpfn_from_mfn(mfn_x(omfn), INVALID_M2P_ENTRY);
    1.13  
    1.14      P2M_DEBUG("set shared %lx %lx\n", gfn, mfn_x(mfn));
    1.15 +    if ( need_lock ) 
    1.16 +        p2m_lock(p2m);
    1.17      rc = set_p2m_entry(p2m, gfn, mfn, 0, p2m_ram_shared);
    1.18 +    if ( need_lock ) 
    1.19 +        p2m_unlock(p2m);
    1.20      if ( 0 == rc )
    1.21          gdprintk(XENLOG_ERR,
    1.22              "set_mmio_p2m_entry: set_p2m_entry failed! mfn=%08lx\n",