Home Home > GIT Browse > SLE12-SP3-AZURE
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuergen Gross <jgross@suse.com>2019-02-18 09:24:52 +0100
committerJuergen Gross <jgross@suse.com>2019-02-18 09:25:40 +0100
commitcfbcea74765d32e1a626094b41d87ac9e88680e0 (patch)
tree779ccd2078652dbebfb568f0790f3498e3a8e88a
parent8da491ba457b27b186020cd6c2525fb10cc73bcd (diff)
x86/xen: dont add memory above max allowed allocation
(bsc#1117645).
-rw-r--r--patches.fixes/0002-x86-xen-dont-add-memory-above-max-allowed-allocat.patch135
-rw-r--r--series.conf1
2 files changed, 136 insertions, 0 deletions
diff --git a/patches.fixes/0002-x86-xen-dont-add-memory-above-max-allowed-allocat.patch b/patches.fixes/0002-x86-xen-dont-add-memory-above-max-allowed-allocat.patch
new file mode 100644
index 0000000000..3b59629c53
--- /dev/null
+++ b/patches.fixes/0002-x86-xen-dont-add-memory-above-max-allowed-allocat.patch
@@ -0,0 +1,135 @@
+From: Juergen Gross <jgross@suse.com>
+Date: Mon, 21 Jan 2019 16:08:39 +0100
+Patch-mainline: Queued in subsystem maintainer repository
+Git-repo: git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip.git
+Git-commit: 1d988ed46543ca36c010634c97ac32114362ddb1
+References: bsc#1117645
+Subject: x86/xen: dont add memory above max allowed allocation
+
+Don't allow memory to be added above the allowed maximum allocation
+limit set by Xen.
+
+Trying to do so would result in cases like the following:
+
+[ 584.559652] ------------[ cut here ]------------
+[ 584.564897] WARNING: CPU: 2 PID: 1 at ../arch/x86/xen/multicalls.c:129 xen_alloc_pte+0x1c7/0x390()
+[ 584.575151] Modules linked in:
+[ 584.578643] Supported: Yes
+[ 584.581750] CPU: 2 PID: 1 Comm: swapper/0 Not tainted 4.4.120-92.70-default #1
+[ 584.590000] Hardware name: Cisco Systems Inc UCSC-C460-M4/UCSC-C460-M4, BIOS C460M4.4.0.1b.0.0629181419 06/29/2018
+[ 584.601862] 0000000000000000 ffffffff813175a0 0000000000000000 ffffffff8184777c
+[ 584.610200] ffffffff8107f4e1 ffff880487eb7000 ffff8801862b79c0 ffff88048608d290
+[ 584.618537] 0000000000487eb7 ffffea0000000201 ffffffff81009de7 ffffffff81068561
+[ 584.626876] Call Trace:
+[ 584.629699] [<ffffffff81019ad9>] dump_trace+0x59/0x340
+[ 584.635645] [<ffffffff81019eaa>] show_stack_log_lvl+0xea/0x170
+[ 584.642391] [<ffffffff8101ac51>] show_stack+0x21/0x40
+[ 584.648238] [<ffffffff813175a0>] dump_stack+0x5c/0x7c
+[ 584.654085] [<ffffffff8107f4e1>] warn_slowpath_common+0x81/0xb0
+[ 584.660932] [<ffffffff81009de7>] xen_alloc_pte+0x1c7/0x390
+[ 584.667289] [<ffffffff810647f0>] pmd_populate_kernel.constprop.6+0x40/0x80
+[ 584.675241] [<ffffffff815ecfe8>] phys_pmd_init+0x210/0x255
+[ 584.681587] [<ffffffff815ed207>] phys_pud_init+0x1da/0x247
+[ 584.687931] [<ffffffff815edb3b>] kernel_physical_mapping_init+0xf5/0x1d4
+[ 584.695682] [<ffffffff815e9bdd>] init_memory_mapping+0x18d/0x380
+[ 584.702631] [<ffffffff81064699>] arch_add_memory+0x59/0xf0
+
+Signed-off-by: Juergen Gross <jgross@suse.com>
+Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
+Signed-off-by: Juergen Gross <jgross@suse.com>
+---
+ arch/x86/xen/setup.c | 13 +++++++++++++
+ drivers/xen/xen-balloon.c | 11 +++++++++++
+ include/xen/xen.h | 4 ++++
+ 3 files changed, 28 insertions(+)
+
+diff --git a/arch/x86/xen/setup.c b/arch/x86/xen/setup.c
+index d5f303c0e656..0e770f5e5e8c 100644
+--- a/arch/x86/xen/setup.c
++++ b/arch/x86/xen/setup.c
+@@ -11,6 +11,7 @@
+ #include <linux/memblock.h>
+ #include <linux/cpuidle.h>
+ #include <linux/cpufreq.h>
++#include <linux/memory_hotplug.h>
+
+ #include <asm/elf.h>
+ #include <asm/vdso.h>
+@@ -594,6 +595,14 @@ static void __init xen_align_and_add_e820_region(phys_addr_t start,
+ if (type == E820_RAM) {
+ start = PAGE_ALIGN(start);
+ end &= ~((phys_addr_t)PAGE_SIZE - 1);
++#ifdef CONFIG_MEMORY_HOTPLUG
++ /*
++ * Don't allow adding memory not in E820 map while booting the
++ * system. Once the balloon driver is up it will remove that
++ * restriction again.
++ */
++ max_mem_size = end;
++#endif
+ }
+
+ e820_add_region(start, end - start, type);
+@@ -753,6 +762,10 @@ char * __init xen_memory_setup(void)
+ memmap.nr_entries = E820MAX;
+ set_xen_guest_handle(memmap.buffer, xen_e820_map);
+
++#if defined(CONFIG_MEMORY_HOTPLUG) && defined(CONFIG_XEN_BALLOON)
++ xen_saved_max_mem_size = max_mem_size;
++#endif
++
+ op = xen_initial_domain() ?
+ XENMEM_machine_memory_map :
+ XENMEM_memory_map;
+diff --git a/drivers/xen/xen-balloon.c b/drivers/xen/xen-balloon.c
+index 2acbfe104e46..a67236b02452 100644
+--- a/drivers/xen/xen-balloon.c
++++ b/drivers/xen/xen-balloon.c
+@@ -37,6 +37,7 @@
+ #include <linux/kernel.h>
+ #include <linux/module.h>
+ #include <linux/capability.h>
++#include <linux/memory_hotplug.h>
+
+ #include <xen/xen.h>
+ #include <xen/interface/xen.h>
+@@ -50,6 +51,10 @@
+
+ #define BALLOON_CLASS_NAME "xen_memory"
+
++#ifdef CONFIG_MEMORY_HOTPLUG
++u64 xen_saved_max_mem_size = 0;
++#endif
++
+ static struct device balloon_dev;
+
+ static int register_balloon(struct device *dev);
+@@ -63,6 +68,12 @@ static void watch_target(struct xenbus_watch *watch,
+ static bool watch_fired;
+ static long target_diff;
+
++#ifdef CONFIG_MEMORY_HOTPLUG
++ /* The balloon driver will take care of adding memory now. */
++ if (xen_saved_max_mem_size)
++ max_mem_size = xen_saved_max_mem_size;
++#endif
++
+ err = xenbus_scanf(XBT_NIL, "memory", "target", "%llu", &new_target);
+ if (err != 1) {
+ /* This is ok (for domain0 at least) - so just return */
+diff --git a/include/xen/xen.h b/include/xen/xen.h
+index 0e2156786ad2..d8f1ab43ab56 100644
+--- a/include/xen/xen.h
++++ b/include/xen/xen.h
+@@ -43,4 +43,8 @@ struct bio_vec;
+ #else
+ #define xen_pvh_domain() (0)
+ #endif
++
++#if defined(CONFIG_MEMORY_HOTPLUG) && defined(CONFIG_XEN_BALLOON)
++extern u64 xen_saved_max_mem_size;
++#endif
+ #endif /* _XEN_XEN_H */
+--
+2.16.4
+
diff --git a/series.conf b/series.conf
index f666dfc4cb..94a12893fe 100644
--- a/series.conf
+++ b/series.conf
@@ -24679,6 +24679,7 @@
patches.fixes/xen-hold-lock_device_hotplug-throughout-vcpu-hotplug.patch
patches.fixes/xen-netback-dont-overflow-meta-array.patch
patches.fixes/0001-x86-respect-memory-size-limiting-via-mem-paramete.patch
+ patches.fixes/0002-x86-xen-dont-add-memory-above-max-allowed-allocat.patch
# bsc#1025461 - Slow throughput on SLES 12 SP2 compared to SLES 11 SP3
patches.fixes/0001-smartpqi-limit-transfer-length-to-1MB.patch