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

[PATCH 2/2] Revert "xen: fix p2m size in dom0 for disabled memory hotplug case"


  • To: <linux-kernel@xxxxxxxxxxxxxxx>
  • From: Roger Pau Monne <roger.pau@xxxxxxxxxx>
  • Date: Wed, 17 Mar 2021 12:04:01 +0100
  • Arc-authentication-results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=citrix.com; dmarc=pass action=none header.from=citrix.com; dkim=pass header.d=citrix.com; arc=none
  • Arc-message-signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=a9NK4I28nJimLBCaFSNjZA+gzCPe3+u58agzQpiG2Co=; b=HNwwlyJMswgsdp+et6bRVWZRPehcc0WPIF2MU3tbdrifhdyBxr782ud0coUsr++6NDehK/eY4JOw4gXHkiig3PESP7+u60/7n47/aXd8wqt5O1gx56l9vl5SGCh9GlPP44Tk4VMn7fmBPlM1G0hvnjduxbhtQke5/Loh1VNT/CTlXvD74s+bnPFdqCuwJxjSrhvPPqgwTKlLUbbG3LPUW867KdWvXAPugY1kV/VsWGEAWd4pNE71p3ce2CmNyHEpG8SnEzRo2Nr3pJg/GukX6fI9W0wNt/gwkps+AIn0cg0jKMCVx/goVhyDKH5wxgS1NFknS5gdKgzxC6NVZhMpLQ==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Gv+Uo4KTSQTAit3Y/Ara4j2Zln5sX5NvhPHSBe0a3rPi1bAeOusVgIeD5dn8JaZs0f2r6QKj64Y8IgRzg/bJ2IqVVURS6ik2RyMUssyN9G9MkCSZfwneQmWpROIdj41YZZ5bI1dF4Jkd7+GVXOYMk9kLK5w39GfjeQM5Bke3Lc3EplV9eZSvxqKP5yz1lyPhqJoNqEFj2FSwDWokqWJqkBcLg/gsergIpBKdCaWMqSpnHZUv2zgdiEIcy5Q1vF7Oe5Q3kg89OOMX/oLmEGTrEW8Z/lQwswBJUJqU/sWIqVCPnrQxkbJxbYvN7atyHjp+rQzMwCYb47mgbx1ar3gvyw==
  • Authentication-results: esa5.hc3370-68.iphmx.com; dkim=pass (signature verified) header.i=@citrix.onmicrosoft.com
  • Cc: Roger Pau Monne <roger.pau@xxxxxxxxxx>, Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>, "Stefano Stabellini" <sstabellini@xxxxxxxxxx>, Jan Beulich <jbeulich@xxxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Wed, 17 Mar 2021 11:05:55 +0000
  • Ironport-hdrordr: A9a23:4qp65K7UEVhalkalSQPXwU+EI+orLtY04lQ7vn1ZYSd+NuSFis Gjm+ka3xfoiDAXHEotg8yEJbPoex3h3LZPy800Ma25VAfr/FGpIoZr8Jf4z1TbdBHW3tV2kZ 1te60WMrHNJHBnkMf35xS5Gd48wN+BtJuln/va0m0Fd2FXQotLhj0JbTqzOEtwWQVAGN4FD5 Ka/MVKvH6Nfn4QY8S9CBA+Lpf+jvfMk4/rZgNDOg4/5GC1/E+VwZPZMzzd5BcRVDtT3awvmF KlryXV7riu2svLsyP0+HTU6/1t6b7c4/tFQPeBk80Ebgjr4zzYHrhJf52nkHQLrPq06FAs+e O80CsIG8ho8XveciWUjHLWqnHd+Q0j4XPj1lOU6EGLyaeSKUNYeqgx8L5xSRfX51Etu9txys twrh+knqFaEA/am2DF78XIPisa5nacm2YokuIYkhVkIO0jQYJWxLZvmH99IdMrGSL3750fC+ 9+DM3Qz+Y+SyLqU1np+kZo29CiRXI1A1OvRVUDoNWc13xskGl+1FZw/r1Rol4wsLYGD7VU7e XNNapl0JlIU88tdKp4QMMMW9G+BGDhSQ/FWVjib2jPJeUiATbgupT36LI66KWBY5oT1qY/n5 zHTRdxqXMyU1iGM7zM4LR7tjT2BEmtVzXkzc9To7JjvKfnebbtOSqfDHgzj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ZFj1fxDkGr0BA0ao6J mnaxyS1QbndzfnP30xIun/Jlkd9g+FJ/aVO1HPmKthnB3LWt3FnizXGBS9I8ovFTJNrMCGLB5s 4oM6DAyi18AHztOuTQLWNl6bEn4Fx2wPN7usb0S1JjxZTFyAGuDFe7RTHfE8Hbomz5a+Ukeaka 3zdzWPFlZvsHxIy0jaiLstbO67nbPLhhadFQjZJortff5qeRq9fNZE1GqrT9RYaIthDdhf55RT ieM=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

This partially reverts commit 882213990d32fd224340a4533f6318dd152be4b2.

There's no need to special case XEN_UNPOPULATED_ALLOC anymore in order
to correctly size the p2m. The generic memory hotplug option has
already been tied together with the Xen hotplug limit, so enabling
memory hotplug should already trigger a properly sized p2m on Xen PV.

Leave the check added to __set_phys_to_machine.

Signed-off-by: Roger Pau Monné <roger.pau@xxxxxxxxxx>
---
Cc: Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>
Cc: Juergen Gross <jgross@xxxxxxxx>
Cc: Stefano Stabellini <sstabellini@xxxxxxxxxx>
Cc: Jan Beulich <jbeulich@xxxxxxxx>
Cc: xen-devel@xxxxxxxxxxxxxxxxxxxx
---
 arch/x86/include/asm/xen/page.h | 12 ------------
 arch/x86/xen/p2m.c              |  3 ---
 arch/x86/xen/setup.c            | 25 ++++++++++++++++++++++---
 3 files changed, 22 insertions(+), 18 deletions(-)

diff --git a/arch/x86/include/asm/xen/page.h b/arch/x86/include/asm/xen/page.h
index 7068e4bb057d..1a162e559753 100644
--- a/arch/x86/include/asm/xen/page.h
+++ b/arch/x86/include/asm/xen/page.h
@@ -86,18 +86,6 @@ clear_foreign_p2m_mapping(struct gnttab_unmap_grant_ref 
*unmap_ops,
 }
 #endif
 
-/*
- * The maximum amount of extra memory compared to the base size.  The
- * main scaling factor is the size of struct page.  At extreme ratios
- * of base:extra, all the base memory can be filled with page
- * structures for the extra memory, leaving no space for anything
- * else.
- *
- * 10x seems like a reasonable balance between scaling flexibility and
- * leaving a practically usable system.
- */
-#define XEN_EXTRA_MEM_RATIO    (10)
-
 /*
  * Helper functions to write or read unsigned long values to/from
  * memory, when the access may fault.
diff --git a/arch/x86/xen/p2m.c b/arch/x86/xen/p2m.c
index a33902d05e45..ac06ca32e9ef 100644
--- a/arch/x86/xen/p2m.c
+++ b/arch/x86/xen/p2m.c
@@ -416,9 +416,6 @@ void __init xen_vmalloc_p2m_tree(void)
        xen_p2m_last_pfn = xen_max_p2m_pfn;
 
        p2m_limit = (phys_addr_t)P2M_LIMIT * 1024 * 1024 * 1024 / PAGE_SIZE;
-       if (!p2m_limit && IS_ENABLED(CONFIG_XEN_UNPOPULATED_ALLOC))
-               p2m_limit = xen_start_info->nr_pages * XEN_EXTRA_MEM_RATIO;
-
        vm.flags = VM_ALLOC;
        vm.size = ALIGN(sizeof(unsigned long) * max(xen_max_p2m_pfn, p2m_limit),
                        PMD_SIZE * PMDS_PER_MID_PAGE);
diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c
index 1a3b75652fa4..7eab14d56369 100644
--- a/arch/x86/xen/setup.c
+++ b/arch/x86/xen/setup.c
@@ -59,6 +59,18 @@ static struct {
 } xen_remap_buf __initdata __aligned(PAGE_SIZE);
 static unsigned long xen_remap_mfn __initdata = INVALID_P2M_ENTRY;
 
+/* 
+ * The maximum amount of extra memory compared to the base size.  The
+ * main scaling factor is the size of struct page.  At extreme ratios
+ * of base:extra, all the base memory can be filled with page
+ * structures for the extra memory, leaving no space for anything
+ * else.
+ * 
+ * 10x seems like a reasonable balance between scaling flexibility and
+ * leaving a practically usable system.
+ */
+#define EXTRA_MEM_RATIO                (10)
+
 static bool xen_512gb_limit __initdata = IS_ENABLED(CONFIG_XEN_512GB);
 
 static void __init xen_parse_512gb(void)
@@ -778,13 +790,20 @@ char * __init xen_memory_setup(void)
                extra_pages += max_pages - max_pfn;
 
        /*
-        * Clamp the amount of extra memory to a XEN_EXTRA_MEM_RATIO
-        * factor the base size.
+        * Clamp the amount of extra memory to a EXTRA_MEM_RATIO
+        * factor the base size.  On non-highmem systems, the base
+        * size is the full initial memory allocation; on highmem it
+        * is limited to the max size of lowmem, so that it doesn't
+        * get completely filled.
         *
         * Make sure we have no memory above max_pages, as this area
         * isn't handled by the p2m management.
+        *
+        * In principle there could be a problem in lowmem systems if
+        * the initial memory is also very large with respect to
+        * lowmem, but we won't try to deal with that here.
         */
-       extra_pages = min3(XEN_EXTRA_MEM_RATIO * min(max_pfn, PFN_DOWN(MAXMEM)),
+       extra_pages = min3(EXTRA_MEM_RATIO * min(max_pfn, PFN_DOWN(MAXMEM)),
                           extra_pages, max_pages - max_pfn);
        i = 0;
        addr = xen_e820_table.entries[0].addr;
-- 
2.30.1




 


Rackspace

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