From: "Jan Beulich" Subject: [PATCH 02/11] x86: extend frame table virtual space Date: Tue, 22 Jan 2013 10:50:02 +0000 Message-ID: <50FE7CEA02000078000B8317@nat28.tlf.novell.com> References: <50FE7BF502000078000B82F8@nat28.tlf.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=__Part6253C1CA.0__=" Return-path: In-Reply-To: <50FE7BF502000078000B82F8@nat28.tlf.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel List-Id: xen-devel@lists.xenproject.org This is a MIME message. If you are reading this text, you may want to consider changing to a mail reader or gateway that understands how to properly handle MIME multipart messages. --=__Part6253C1CA.0__= Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Content-Disposition: inline ... to allow frames for up to 16Tb. At the same time, add the super page frame table coordinates to the comment describing the address space layout. Signed-off-by: Jan Beulich --- a/xen/arch/x86/mm.c +++ b/xen/arch/x86/mm.c @@ -146,8 +146,7 @@ unsigned long max_page; unsigned long total_pages; =20 unsigned long __read_mostly pdx_group_valid[BITS_TO_LONGS( - (FRAMETABLE_SIZE / sizeof(*frame_table) + PDX_GROUP_COUNT - 1) - / PDX_GROUP_COUNT)] =3D { [0] =3D 1 }; + (FRAMETABLE_NR + PDX_GROUP_COUNT - 1) / PDX_GROUP_COUNT)] =3D { [0] = =3D 1 }; =20 bool_t __read_mostly machine_to_phys_mapping_valid =3D 0; =20 @@ -218,7 +217,7 @@ static void __init init_spagetable(void) BUILD_BUG_ON(XEN_VIRT_END > SPAGETABLE_VIRT_START); =20 init_frametable_chunk(spage_table, - mem_hotplug ? (void *)SPAGETABLE_VIRT_END + mem_hotplug ? spage_table + SPAGETABLE_NR : pdx_to_spage(max_pdx - 1) + 1); } =20 --- a/xen/arch/x86/setup.c +++ b/xen/arch/x86/setup.c @@ -378,8 +378,8 @@ static void __init setup_max_pdx(void) if ( max_pdx > (DIRECTMAP_SIZE >> PAGE_SHIFT) ) max_pdx =3D DIRECTMAP_SIZE >> PAGE_SHIFT; =20 - if ( max_pdx > FRAMETABLE_SIZE / sizeof(*frame_table) ) - max_pdx =3D FRAMETABLE_SIZE / sizeof(*frame_table); + if ( max_pdx > FRAMETABLE_NR ) + max_pdx =3D FRAMETABLE_NR; =20 max_page =3D pdx_to_pfn(max_pdx - 1) + 1; } --- a/xen/arch/x86/x86_64/mm.c +++ b/xen/arch/x86/x86_64/mm.c @@ -958,7 +958,7 @@ static int extend_frame_table(struct mem nidx =3D cidx =3D pfn_to_pdx(spfn)/PDX_GROUP_COUNT; =20 ASSERT( pfn_to_pdx(epfn) <=3D (DIRECTMAP_SIZE >> PAGE_SHIFT) && - (pfn_to_pdx(epfn) <=3D FRAMETABLE_SIZE / sizeof(struct page_info)= ) ); + pfn_to_pdx(epfn) <=3D FRAMETABLE_NR ); =20 if ( test_bit(cidx, pdx_group_valid) ) cidx =3D find_next_zero_bit(pdx_group_valid, eidx, cidx); @@ -1406,7 +1406,7 @@ int mem_hotadd_check(unsigned long spfn, if ( (spfn >=3D epfn) ) return 0; =20 - if (pfn_to_pdx(epfn) > (FRAMETABLE_SIZE / sizeof(*frame_table))) + if (pfn_to_pdx(epfn) > FRAMETABLE_NR) return 0; =20 if ( (spfn | epfn) & ((1UL << PAGETABLE_ORDER) - 1) ) --- a/xen/include/asm-x86/config.h +++ b/xen/include/asm-x86/config.h @@ -152,9 +152,11 @@ extern unsigned char boot_edid_info[128] * High read-only compatibility machine-to-phys translation table. * 0xffff82c480000000 - 0xffff82c4bfffffff [1GB, 2^30 bytes, PML4:261] * Xen text, static data, bss. - * 0xffff82c4c0000000 - 0xffff82f5ffffffff [197GB, PML4:261] + * 0xffff82c4c0000000 - 0xffff82dffbffffff [109GB - 64MB, PML4:261] * Reserved for future use. - * 0xffff82f600000000 - 0xffff82ffffffffff [40GB, 2^38 bytes, PML4:261] + * 0xffff82dffc000000 - 0xffff82dfffffffff [64MB, 2^26 bytes, PML4:261] + * Super-page information array. + * 0xffff82e000000000 - 0xffff82ffffffffff [128GB, 2^37 bytes, PML4:261] * Page-frame information array. * 0xffff830000000000 - 0xffff87ffffffffff [5TB, 5*2^40 bytes, PML4:262-2= 71] * 1:1 direct mapping of all physical memory. @@ -218,15 +220,17 @@ extern unsigned char boot_edid_info[128] /* Slot 261: xen text, static data and bss (1GB). */ #define XEN_VIRT_START (HIRO_COMPAT_MPT_VIRT_END) #define XEN_VIRT_END (XEN_VIRT_START + GB(1)) -/* Slot 261: superpage information array (20MB). */ +/* Slot 261: superpage information array (64MB). */ #define SPAGETABLE_VIRT_END FRAMETABLE_VIRT_START -#define SPAGETABLE_SIZE ((DIRECTMAP_SIZE >> SUPERPAGE_SHIFT) * \ - sizeof(struct spage_info)) -#define SPAGETABLE_VIRT_START (SPAGETABLE_VIRT_END - SPAGETABLE_SIZE) -/* Slot 261: page-frame information array (40GB). */ +#define SPAGETABLE_NR (((FRAMETABLE_NR - 1) >> (SUPERPAGE_SHIFT = - \ + PAGE_SHIFT)) + = 1) +#define SPAGETABLE_SIZE (SPAGETABLE_NR * sizeof(struct spage_info)= ) +#define SPAGETABLE_VIRT_START ((SPAGETABLE_VIRT_END - SPAGETABLE_SIZE) = & \ + (-1UL << SUPERPAGE_SHIFT)) +/* Slot 261: page-frame information array (128GB). */ #define FRAMETABLE_VIRT_END DIRECTMAP_VIRT_START -#define FRAMETABLE_SIZE ((DIRECTMAP_SIZE >> PAGE_SHIFT) * \ - sizeof(struct page_info)) +#define FRAMETABLE_SIZE GB(128) +#define FRAMETABLE_NR (FRAMETABLE_SIZE / sizeof(*frame_table)) #define FRAMETABLE_VIRT_START (FRAMETABLE_VIRT_END - FRAMETABLE_SIZE) /* Slot 262-271: A direct 1:1 mapping of all of physical memory. */ #define DIRECTMAP_VIRT_START (PML4_ADDR(262)) --=__Part6253C1CA.0__= Content-Type: text/plain; name="x86-va-layout.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="x86-va-layout.patch" x86: extend frame table virtual space=0A=0A... to allow frames for up to = 16Tb.=0A=0AAt the same time, add the super page frame table coordinates to = the=0Acomment describing the address space layout.=0A=0ASigned-off-by: Jan = Beulich =0A=0A--- a/xen/arch/x86/mm.c=0A+++ b/xen/arch/x= 86/mm.c=0A@@ -146,8 +146,7 @@ unsigned long max_page;=0A unsigned long = total_pages;=0A =0A unsigned long __read_mostly pdx_group_valid[BITS_TO_LON= GS(=0A- (FRAMETABLE_SIZE / sizeof(*frame_table) + PDX_GROUP_COUNT - = 1)=0A- / PDX_GROUP_COUNT)] =3D { [0] =3D 1 };=0A+ (FRAMETABLE_NR + = PDX_GROUP_COUNT - 1) / PDX_GROUP_COUNT)] =3D { [0] =3D 1 };=0A =0A bool_t = __read_mostly machine_to_phys_mapping_valid =3D 0;=0A =0A@@ -218,7 +217,7 = @@ static void __init init_spagetable(void)=0A BUILD_BUG_ON(XEN_VIRT_EN= D > SPAGETABLE_VIRT_START);=0A =0A init_frametable_chunk(spage_table,= =0A- mem_hotplug ? (void *)SPAGETABLE_VIRT_END=0A+= mem_hotplug ? spage_table + SPAGETABLE_NR=0A = : pdx_to_spage(max_pdx - 1) + 1);=0A = }=0A =0A--- a/xen/arch/x86/setup.c=0A+++ b/xen/arch/x86/setup.c=0A@@ = -378,8 +378,8 @@ static void __init setup_max_pdx(void)=0A if ( = max_pdx > (DIRECTMAP_SIZE >> PAGE_SHIFT) )=0A max_pdx =3D = DIRECTMAP_SIZE >> PAGE_SHIFT;=0A =0A- if ( max_pdx > FRAMETABLE_SIZE / = sizeof(*frame_table) )=0A- max_pdx =3D FRAMETABLE_SIZE / sizeof(*fra= me_table);=0A+ if ( max_pdx > FRAMETABLE_NR )=0A+ max_pdx =3D = FRAMETABLE_NR;=0A =0A max_page =3D pdx_to_pfn(max_pdx - 1) + 1;=0A = }=0A--- a/xen/arch/x86/x86_64/mm.c=0A+++ b/xen/arch/x86/x86_64/mm.c=0A@@ = -958,7 +958,7 @@ static int extend_frame_table(struct mem=0A nidx =3D = cidx =3D pfn_to_pdx(spfn)/PDX_GROUP_COUNT;=0A =0A ASSERT( pfn_to_pdx(ep= fn) <=3D (DIRECTMAP_SIZE >> PAGE_SHIFT) &&=0A- (pfn_to_pdx(epfn) = <=3D FRAMETABLE_SIZE / sizeof(struct page_info)) );=0A+ = pfn_to_pdx(epfn) <=3D FRAMETABLE_NR );=0A =0A if ( test_bit(cidx, = pdx_group_valid) )=0A cidx =3D find_next_zero_bit(pdx_group_valid, = eidx, cidx);=0A@@ -1406,7 +1406,7 @@ int mem_hotadd_check(unsigned long = spfn,=0A if ( (spfn >=3D epfn) )=0A return 0;=0A =0A- if = (pfn_to_pdx(epfn) > (FRAMETABLE_SIZE / sizeof(*frame_table)))=0A+ if = (pfn_to_pdx(epfn) > FRAMETABLE_NR)=0A return 0;=0A =0A if ( = (spfn | epfn) & ((1UL << PAGETABLE_ORDER) - 1) )=0A--- a/xen/include/asm-x8= 6/config.h=0A+++ b/xen/include/asm-x86/config.h=0A@@ -152,9 +152,11 @@ = extern unsigned char boot_edid_info[128]=0A * High read-only compatibil= ity machine-to-phys translation table.=0A * 0xffff82c480000000 - = 0xffff82c4bfffffff [1GB, 2^30 bytes, PML4:261]=0A * Xen text, static = data, bss.=0A- * 0xffff82c4c0000000 - 0xffff82f5ffffffff [197GB, = PML4:261]=0A+ * 0xffff82c4c0000000 - 0xffff82dffbffffff [109GB - 64MB, = PML4:261]=0A * Reserved for future use.=0A- * 0xffff82f600000000 = - 0xffff82ffffffffff [40GB, 2^38 bytes, PML4:261]=0A+ * 0xffff82dffc00000= 0 - 0xffff82dfffffffff [64MB, 2^26 bytes, PML4:261]=0A+ * Super-page = information array.=0A+ * 0xffff82e000000000 - 0xffff82ffffffffff [128GB, = 2^37 bytes, PML4:261]=0A * Page-frame information array.=0A * = 0xffff830000000000 - 0xffff87ffffffffff [5TB, 5*2^40 bytes, PML4:262-271]= =0A * 1:1 direct mapping of all physical memory.=0A@@ -218,15 +220,17 = @@ extern unsigned char boot_edid_info[128]=0A /* Slot 261: xen text, = static data and bss (1GB). */=0A #define XEN_VIRT_START (HIRO_COMP= AT_MPT_VIRT_END)=0A #define XEN_VIRT_END (XEN_VIRT_START + = GB(1))=0A-/* Slot 261: superpage information array (20MB). */=0A+/* Slot = 261: superpage information array (64MB). */=0A #define SPAGETABLE_VIRT_END = FRAMETABLE_VIRT_START=0A-#define SPAGETABLE_SIZE ((DIRECTMAP_SI= ZE >> SUPERPAGE_SHIFT) * \=0A- sizeof(struc= t spage_info))=0A-#define SPAGETABLE_VIRT_START (SPAGETABLE_VIRT_END - = SPAGETABLE_SIZE)=0A-/* Slot 261: page-frame information array (40GB). = */=0A+#define SPAGETABLE_NR (((FRAMETABLE_NR - 1) >> (SUPERPAGE_S= HIFT - \=0A+ = PAGE_SHIFT)) + 1)=0A+#define SPAGETABLE_SIZE (SPAGETABLE_NR * = sizeof(struct spage_info))=0A+#define SPAGETABLE_VIRT_START ((SPAGETABLE_= VIRT_END - SPAGETABLE_SIZE) & \=0A+ (-1UL = << SUPERPAGE_SHIFT))=0A+/* Slot 261: page-frame information array (128GB). = */=0A #define FRAMETABLE_VIRT_END DIRECTMAP_VIRT_START=0A-#define = FRAMETABLE_SIZE ((DIRECTMAP_SIZE >> PAGE_SHIFT) * \=0A- = sizeof(struct page_info))=0A+#define FRAMETABLE_SIZE = GB(128)=0A+#define FRAMETABLE_NR (FRAMETABLE_SIZE / = sizeof(*frame_table))=0A #define FRAMETABLE_VIRT_START (FRAMETABLE_VIRT_E= ND - FRAMETABLE_SIZE)=0A /* Slot 262-271: A direct 1:1 mapping of all of = physical memory. */=0A #define DIRECTMAP_VIRT_START (PML4_ADDR(262))=0A --=__Part6253C1CA.0__= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xen.org http://lists.xen.org/xen-devel --=__Part6253C1CA.0__=--