[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 02/11] x86: extend frame table virtual space


  • To: "xen-devel" <xen-devel@xxxxxxxxxxxxx>
  • From: "Jan Beulich" <JBeulich@xxxxxxxx>
  • Date: Tue, 22 Jan 2013 10:50:02 +0000
  • Delivery-date: Tue, 22 Jan 2013 10:50:23 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xen.org>

... 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 <jbeulich@xxxxxxxx>

--- a/xen/arch/x86/mm.c
+++ b/xen/arch/x86/mm.c
@@ -146,8 +146,7 @@ unsigned long max_page;
 unsigned long total_pages;
 
 unsigned long __read_mostly pdx_group_valid[BITS_TO_LONGS(
-    (FRAMETABLE_SIZE / sizeof(*frame_table) + PDX_GROUP_COUNT - 1)
-    / PDX_GROUP_COUNT)] = { [0] = 1 };
+    (FRAMETABLE_NR + PDX_GROUP_COUNT - 1) / PDX_GROUP_COUNT)] = { [0] = 1 };
 
 bool_t __read_mostly machine_to_phys_mapping_valid = 0;
 
@@ -218,7 +217,7 @@ static void __init init_spagetable(void)
     BUILD_BUG_ON(XEN_VIRT_END > SPAGETABLE_VIRT_START);
 
     init_frametable_chunk(spage_table,
-                          mem_hotplug ? (void *)SPAGETABLE_VIRT_END
+                          mem_hotplug ? spage_table + SPAGETABLE_NR
                                       : pdx_to_spage(max_pdx - 1) + 1);
 }
 
--- 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 = DIRECTMAP_SIZE >> PAGE_SHIFT;
 
-    if ( max_pdx > FRAMETABLE_SIZE / sizeof(*frame_table) )
-        max_pdx = FRAMETABLE_SIZE / sizeof(*frame_table);
+    if ( max_pdx > FRAMETABLE_NR )
+        max_pdx = FRAMETABLE_NR;
 
     max_page = 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 = cidx = pfn_to_pdx(spfn)/PDX_GROUP_COUNT;
 
     ASSERT( pfn_to_pdx(epfn) <= (DIRECTMAP_SIZE >> PAGE_SHIFT) &&
-         (pfn_to_pdx(epfn) <= FRAMETABLE_SIZE / sizeof(struct page_info)) );
+            pfn_to_pdx(epfn) <= FRAMETABLE_NR );
 
     if ( test_bit(cidx, pdx_group_valid) )
         cidx = find_next_zero_bit(pdx_group_valid, eidx, cidx);
@@ -1406,7 +1406,7 @@ int mem_hotadd_check(unsigned long spfn,
     if ( (spfn >= epfn) )
         return 0;
 
-    if (pfn_to_pdx(epfn) > (FRAMETABLE_SIZE / sizeof(*frame_table)))
+    if (pfn_to_pdx(epfn) > FRAMETABLE_NR)
         return 0;
 
     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-271]
  *    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))


Attachment: x86-va-layout.patch
Description: Text document

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.