From: Bhavna Sarathy <bnagendr@redhat.com> Date: Fri, 19 Jun 2009 13:42:36 -0400 Subject: [xen] disable 2MB support on PAE kernels Message-id: 20090619174248.16950.77533.sendpatchset@allegro.boston.redhat.com O-Subject: [RHEL5.4 PATCH] [Xen] Disable 2MB support on PAE kernels Bugzilla: 503737 RH-Acked-by: Don Dutile <ddutile@redhat.com> RH-Acked-by: Rik van Riel <riel@redhat.com> RH-Acked-by: Chris Lalancette <clalance@redhat.com> RH-Acked-by: Justin M. Forbes <jforbes@redhat.com> Resolves BZ 503737 Chris Lalancette found a bug where the RHEL5.4 FV i686 -PAE kernel guest was hanging. We root caused this to the 2MB supports that is dependent on Nested Paging, however on the PAE kernels Nested Paging is diabled due to a hardware limitation. So the fix is to disable 2MB when Nested Paging is disabled. It's a simple patch. AMD has tested the following test matrix (both 2MB and 1GB). Chris has tested the patch on his system. Guests: windows XP 32bit 1G, 6G (guest will see 4G only) RHEL 5.3 32bit 1G, 6G (guest will see 4G only) RHEL 5.3 PAE 1G, 6G RHEL 5.4 64bit 1G, 6G (won't work on kernel Xen PAE) Kernel Xen PAE - hap=0, hap_1gb=0 - hap=1, hap_1gb=0 - hap=0, hap_1gb=1 - hap=1, hap_1gb=1 Kernel Xen 64bit - hap=0, hap_1gb=0 - hap=1, hap_1gb=0 - hap=0, hap_1gb=1 - hap=1, hap_1gb=1 The issue exists upstream and has been submitted. http://article.gmane.org/gmane.comp.emulators.xen.devel/67674 Please review and ACK. diff --git a/arch/x86/mm/p2m.c b/arch/x86/mm/p2m.c index dd45d70..767d483 100644 --- a/arch/x86/mm/p2m.c +++ b/arch/x86/mm/p2m.c @@ -412,9 +412,13 @@ int set_p2m_entry(struct domain *d, unsigned long gfn, mfn_t mfn, while ( todo ) { /* decide which page mode to use */ - order = ( (((gfn | mfn_x(mfn) | todo) & ((1ul << 18) - 1)) == 0) && - hap_1gb_pgtb(d) && opt_hap_1gb ) ? 18 : - (((gfn | mfn_x(mfn) | todo) & ((1ul << 9) - 1)) == 0) ? 9 : 0; + if ( hap_enabled(d) ) + order = ( (((gfn | mfn_x(mfn) | todo) & ((1ul << 18) - 1)) == 0) && + hap_1gb_pgtb(d) && opt_hap_1gb ) ? 18 : + (((gfn | mfn_x(mfn) | todo) & ((1ul << 9) - 1)) == 0) ? 9 : 0; + else + order = 0; + rc = d->arch.p2m.set_entry(d, gfn, mfn, order, l1e_flags); gfn += 1ul << order; if ( mfn_x(mfn) != INVALID_MFN )