George Dunlap
2011-Dec-01  12:56 UTC
[PATCH] Backport fixes to PoD codepaths related to 1GiB pages
Backport of xen-unstable.hg c/s 24189:7da681c490e0 to xen-4.1-testing
The codepaths in p2m_gfn_to_mfn() and p2m_gfn_to_mfn_current() should
call p2m_pod_check_and_popualte(), as the 2MiB and 4k codepaths do.
This properly grabs the p2m lock.
Also, p2m_pod_demand_populate() shouldn''t call p2m_unlock(), as it
didn''t grab the lock in the first place.
Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org>
Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
diff -r c613d436ca09 -r 3ab01c6cd13f xen/arch/x86/mm/p2m.c
--- a/xen/arch/x86/mm/p2m.c	Tue Nov 22 19:03:04 2011 +0000
+++ b/xen/arch/x86/mm/p2m.c	Thu Dec 01 12:56:18 2011 +0000
@@ -1244,7 +1244,6 @@ p2m_pod_demand_populate(struct p2m_domai
         set_p2m_entry(p2m, gfn_aligned, _mfn(POPULATE_ON_DEMAND_MFN), 9,
                       p2m_populate_on_demand, p2m->default_access);
         audit_p2m(p2m, 1);
-        p2m_unlock(p2m);
         return 0;
     }
 
@@ -1602,7 +1601,8 @@ pod_retry_l3:
             {
                 if ( q != p2m_query )
                 {
-                    if ( !p2m_pod_demand_populate(p2m, gfn, 18, q) )
+                    if ( !p2m_pod_check_and_populate(p2m, gfn,
+                              (l1_pgentry_t *) &l3e, 18, q) )
                         goto pod_retry_l3;
                 }
                 else
@@ -1733,7 +1733,8 @@ static mfn_t p2m_gfn_to_mfn_current(stru
                 /* The read has succeeded, so we know that mapping exists */
                 if ( q != p2m_query )
                 {
-                    if ( !p2m_pod_demand_populate(p2m, gfn, 18, q) )
+                    if ( !p2m_pod_check_and_populate(p2m, gfn,
+                              (l1_pgentry_t *) &l3e, 18, q) )
                         goto pod_retry_l3;
                     p2mt = p2m_invalid;
                     printk("%s: Allocate 1GB failed!\n", __func__);
Jan Beulich
2011-Dec-15  09:34 UTC
Re: [PATCH] Backport fixes to PoD codepaths related to 1GiB pages
Should this get applied?>>> On 01.12.11 at 13:56, George Dunlap <george.dunlap@eu.citrix.com> wrote: > Backport of xen-unstable.hg c/s 24189:7da681c490e0 to xen-4.1-testing > > The codepaths in p2m_gfn_to_mfn() and p2m_gfn_to_mfn_current() should > call p2m_pod_check_and_popualte(), as the 2MiB and 4k codepaths do. > This properly grabs the p2m lock. > > Also, p2m_pod_demand_populate() shouldn''t call p2m_unlock(), as it > didn''t grab the lock in the first place. > > Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org> > Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com> > > diff -r c613d436ca09 -r 3ab01c6cd13f xen/arch/x86/mm/p2m.c > --- a/xen/arch/x86/mm/p2m.c Tue Nov 22 19:03:04 2011 +0000 > +++ b/xen/arch/x86/mm/p2m.c Thu Dec 01 12:56:18 2011 +0000 > @@ -1244,7 +1244,6 @@ p2m_pod_demand_populate(struct p2m_domai > set_p2m_entry(p2m, gfn_aligned, _mfn(POPULATE_ON_DEMAND_MFN), 9, > p2m_populate_on_demand, p2m->default_access); > audit_p2m(p2m, 1); > - p2m_unlock(p2m); > return 0; > } > > @@ -1602,7 +1601,8 @@ pod_retry_l3: > { > if ( q != p2m_query ) > { > - if ( !p2m_pod_demand_populate(p2m, gfn, 18, q) ) > + if ( !p2m_pod_check_and_populate(p2m, gfn, > + (l1_pgentry_t *) &l3e, 18, q) ) > goto pod_retry_l3; > } > else > @@ -1733,7 +1733,8 @@ static mfn_t p2m_gfn_to_mfn_current(stru > /* The read has succeeded, so we know that mapping exists > */ > if ( q != p2m_query ) > { > - if ( !p2m_pod_demand_populate(p2m, gfn, 18, q) ) > + if ( !p2m_pod_check_and_populate(p2m, gfn, > + (l1_pgentry_t *) &l3e, 18, q) ) > goto pod_retry_l3; > p2mt = p2m_invalid; > printk("%s: Allocate 1GB failed!\n", __func__); > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xensource.com > http://lists.xensource.com/xen-devel
Tim Deegan
2011-Dec-15  10:35 UTC
Re: [PATCH] Backport fixes to PoD codepaths related to 1GiB pages
At 09:34 +0000 on 15 Dec (1323941670), Jan Beulich wrote:> Should this get applied?Yes. I thought it already had my Ack, but if not: Ack. Tim> >>> On 01.12.11 at 13:56, George Dunlap <george.dunlap@eu.citrix.com> wrote: > > Backport of xen-unstable.hg c/s 24189:7da681c490e0 to xen-4.1-testing > > > > The codepaths in p2m_gfn_to_mfn() and p2m_gfn_to_mfn_current() should > > call p2m_pod_check_and_popualte(), as the 2MiB and 4k codepaths do. > > This properly grabs the p2m lock. > > > > Also, p2m_pod_demand_populate() shouldn''t call p2m_unlock(), as it > > didn''t grab the lock in the first place. > > > > Signed-off-by: Andres Lagar-Cavilla <andres@lagarcavilla.org> > > Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com> > > > > diff -r c613d436ca09 -r 3ab01c6cd13f xen/arch/x86/mm/p2m.c > > --- a/xen/arch/x86/mm/p2m.c Tue Nov 22 19:03:04 2011 +0000 > > +++ b/xen/arch/x86/mm/p2m.c Thu Dec 01 12:56:18 2011 +0000 > > @@ -1244,7 +1244,6 @@ p2m_pod_demand_populate(struct p2m_domai > > set_p2m_entry(p2m, gfn_aligned, _mfn(POPULATE_ON_DEMAND_MFN), 9, > > p2m_populate_on_demand, p2m->default_access); > > audit_p2m(p2m, 1); > > - p2m_unlock(p2m); > > return 0; > > } > > > > @@ -1602,7 +1601,8 @@ pod_retry_l3: > > { > > if ( q != p2m_query ) > > { > > - if ( !p2m_pod_demand_populate(p2m, gfn, 18, q) ) > > + if ( !p2m_pod_check_and_populate(p2m, gfn, > > + (l1_pgentry_t *) &l3e, 18, q) ) > > goto pod_retry_l3; > > } > > else > > @@ -1733,7 +1733,8 @@ static mfn_t p2m_gfn_to_mfn_current(stru > > /* The read has succeeded, so we know that mapping exists > > */ > > if ( q != p2m_query ) > > { > > - if ( !p2m_pod_demand_populate(p2m, gfn, 18, q) ) > > + if ( !p2m_pod_check_and_populate(p2m, gfn, > > + (l1_pgentry_t *) &l3e, 18, q) ) > > goto pod_retry_l3; > > p2mt = p2m_invalid; > > printk("%s: Allocate 1GB failed!\n", __func__); > > > > _______________________________________________ > > Xen-devel mailing list > > Xen-devel@lists.xensource.com > > http://lists.xensource.com/xen-devel > > >