xcp-1.6-updates/xen-4.1.hg

changeset 23202:bb365e21314d

x86/mm/p2m: fix pod locking

The path p2m-lookup -> p2m-pt->get_entry -> 1GB PoD superpage ->
pod_demand_populate ends in the pod code performing a p2m_set_entry with
no locks held (in order to split the 1GB superpage into 512 2MB ones)

Further, it calls p2m_unlock after that, which will break the spinlock.

This patch attempts to fix that.

Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
Acked-by: George Dunlap <george.dunlap@eu.citrix.com>
Acked-by: Tim Deegan <tim@xen.org>
xen-unstable changeset: 24189:7da681c490e0
xen-unstable date: Thu Nov 24 15:20:57 2011 +0000
author Tim Deegan <tim@xen.org>
date Thu Dec 15 11:20:19 2011 +0000 (2011-12-15)
parents 1c89f7d29fbb
children c62738ea1bb4
files xen/arch/x86/mm/p2m.c
line diff
     1.1 --- a/xen/arch/x86/mm/p2m.c	Thu Dec 08 16:50:28 2011 +0000
     1.2 +++ b/xen/arch/x86/mm/p2m.c	Thu Dec 15 11:20:19 2011 +0000
     1.3 @@ -1244,7 +1244,6 @@ p2m_pod_demand_populate(struct p2m_domai
     1.4          set_p2m_entry(p2m, gfn_aligned, _mfn(POPULATE_ON_DEMAND_MFN), 9,
     1.5                        p2m_populate_on_demand, p2m->default_access);
     1.6          audit_p2m(p2m, 1);
     1.7 -        p2m_unlock(p2m);
     1.8          return 0;
     1.9      }
    1.10  
    1.11 @@ -1602,7 +1601,8 @@ pod_retry_l3:
    1.12              {
    1.13                  if ( q != p2m_query )
    1.14                  {
    1.15 -                    if ( !p2m_pod_demand_populate(p2m, gfn, 18, q) )
    1.16 +                    if ( !p2m_pod_check_and_populate(p2m, gfn,
    1.17 +                              (l1_pgentry_t *) &l3e, 18, q) )
    1.18                          goto pod_retry_l3;
    1.19                  }
    1.20                  else
    1.21 @@ -1733,7 +1733,8 @@ static mfn_t p2m_gfn_to_mfn_current(stru
    1.22                  /* The read has succeeded, so we know that mapping exists */
    1.23                  if ( q != p2m_query )
    1.24                  {
    1.25 -                    if ( !p2m_pod_demand_populate(p2m, gfn, 18, q) )
    1.26 +                    if ( !p2m_pod_check_and_populate(p2m, gfn,
    1.27 +                              (l1_pgentry_t *) &l3e, 18, q) )
    1.28                          goto pod_retry_l3;
    1.29                      p2mt = p2m_invalid;
    1.30                      printk("%s: Allocate 1GB failed!\n", __func__);