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

[Xen-devel] [PATCH RFC] libxl: set 1GB MMIO hole for PVH



This prevents page-shattering, by being able to populate the RAM
regions below 4GB using 1GB pages, provided the guest memory size is
set to a multiple of a GB.

Note that there are some special and ACPI pages in the MMIO hole that
will be populated using smaller order pages, but those shouldn't be
accessed as often as RAM regions.

Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
---
Cc: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
Cc: Wei Liu <wei.liu2@xxxxxxxxxx>
Cc: Jan Beulich <jbeulich@xxxxxxxx>
Cc: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
Cc: Juergen Gross <jgross@xxxxxxxx>
Cc: Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>
---
Not 4.11 material, Ccing Boris and Juergen for their opinion as Linux
maintainers.
---
 tools/libxl/libxl_dom.c | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/tools/libxl/libxl_dom.c b/tools/libxl/libxl_dom.c
index f0fd5fd3a3..1ae0e8ef33 100644
--- a/tools/libxl/libxl_dom.c
+++ b/tools/libxl/libxl_dom.c
@@ -1230,16 +1230,21 @@ int libxl__build_hvm(libxl__gc *gc, uint32_t domid,
     else if (dom->mmio_size == 0 && !device_model) {
 #if defined(__i386__) || defined(__x86_64__)
         /*
+         * Set MMIO hole size to 1GB, so that the whole 3-4GB region is not
+         * populated. This prevents page shattering, since there are MMIO areas
+         * in that region that cannot be populated.
+         *
          * Make sure the local APIC page, the ACPI tables and the special pages
          * are inside the MMIO hole.
          */
-        xen_paddr_t start =
-            (X86_HVM_END_SPECIAL_REGION - X86_HVM_NR_SPECIAL_PAGES) <<
-            XC_PAGE_SHIFT;
-
-        start = min_t(xen_paddr_t, start, LAPIC_BASE_ADDRESS);
-        start = min_t(xen_paddr_t, start, ACPI_INFO_PHYSICAL_ADDRESS);
-        dom->mmio_size = GB(4) - start;
+        dom->mmio_size = GB(1);
+#define ASSERT_ADDR_MMIO(addr) assert((addr) >= (GB(4) - dom->mmio_size) && \
+                                      (addr) < GB(4))
+        ASSERT_ADDR_MMIO((X86_HVM_END_SPECIAL_REGION - 
X86_HVM_NR_SPECIAL_PAGES)
+                         << XC_PAGE_SHIFT);
+        ASSERT_ADDR_MMIO(LAPIC_BASE_ADDRESS);
+        ASSERT_ADDR_MMIO(ACPI_INFO_PHYSICAL_ADDRESS);
+#undef ASSERT_ADDR_MMIO
 #else
         assert(1);
 #endif
-- 
2.17.0


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel

 


Rackspace

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