Replace workaround for the HVM/PVH ballooning bug with upstream patch
This commit is contained in:
parent
3812053b14
commit
f9e729c7af
@ -0,0 +1,71 @@
|
|||||||
|
From 5266b8e4445cc836c46689d80a9ff539fa3bfbda Mon Sep 17 00:00:00 2001
|
||||||
|
From: Juergen Gross <jgross@suse.com>
|
||||||
|
Date: Thu, 26 Oct 2017 11:50:56 +0200
|
||||||
|
Subject: [PATCH] xen: fix booting ballooned down hvm guest
|
||||||
|
|
||||||
|
Commit 96edd61dcf44362d3ef0bed1a5361e0ac7886a63 ("xen/balloon: don't
|
||||||
|
online new memory initially") introduced a regression when booting a
|
||||||
|
HVM domain with memory less than mem-max: instead of ballooning down
|
||||||
|
immediately the system would try to use the memory up to mem-max
|
||||||
|
resulting in Xen crashing the domain.
|
||||||
|
|
||||||
|
For HVM domains the current size will be reflected in Xenstore node
|
||||||
|
memory/static-max instead of memory/target.
|
||||||
|
|
||||||
|
Additionally we have to trigger the ballooning process at once.
|
||||||
|
|
||||||
|
Cc: <stable@vger.kernel.org> # 4.13
|
||||||
|
Fixes: 96edd61dcf44362d3ef0bed1a5361e0ac7886a63 ("xen/balloon: don't
|
||||||
|
online new memory initially")
|
||||||
|
|
||||||
|
Reported-by: Simon Gaiser <hw42@ipsumj.de>
|
||||||
|
Suggested-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
|
||||||
|
Signed-off-by: Juergen Gross <jgross@suse.com>
|
||||||
|
Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
|
||||||
|
Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
|
||||||
|
---
|
||||||
|
drivers/xen/xen-balloon.c | 19 +++++++++++++------
|
||||||
|
1 file changed, 13 insertions(+), 6 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/drivers/xen/xen-balloon.c b/drivers/xen/xen-balloon.c
|
||||||
|
index e89136ab851e..b437fccd4e62 100644
|
||||||
|
--- a/drivers/xen/xen-balloon.c
|
||||||
|
+++ b/drivers/xen/xen-balloon.c
|
||||||
|
@@ -57,7 +57,7 @@ static int register_balloon(struct device *dev);
|
||||||
|
static void watch_target(struct xenbus_watch *watch,
|
||||||
|
const char *path, const char *token)
|
||||||
|
{
|
||||||
|
- unsigned long long new_target;
|
||||||
|
+ unsigned long long new_target, static_max;
|
||||||
|
int err;
|
||||||
|
static bool watch_fired;
|
||||||
|
static long target_diff;
|
||||||
|
@@ -72,13 +72,20 @@ static void watch_target(struct xenbus_watch *watch,
|
||||||
|
* pages. PAGE_SHIFT converts bytes to pages, hence PAGE_SHIFT - 10.
|
||||||
|
*/
|
||||||
|
new_target >>= PAGE_SHIFT - 10;
|
||||||
|
- if (watch_fired) {
|
||||||
|
- balloon_set_new_target(new_target - target_diff);
|
||||||
|
- return;
|
||||||
|
+
|
||||||
|
+ if (!watch_fired) {
|
||||||
|
+ watch_fired = true;
|
||||||
|
+ err = xenbus_scanf(XBT_NIL, "memory", "static-max", "%llu",
|
||||||
|
+ &static_max);
|
||||||
|
+ if (err != 1)
|
||||||
|
+ static_max = new_target;
|
||||||
|
+ else
|
||||||
|
+ static_max >>= PAGE_SHIFT - 10;
|
||||||
|
+ target_diff = xen_pv_domain() ? 0
|
||||||
|
+ : static_max - balloon_stats.target_pages;
|
||||||
|
}
|
||||||
|
|
||||||
|
- watch_fired = true;
|
||||||
|
- target_diff = new_target - balloon_stats.target_pages;
|
||||||
|
+ balloon_set_new_target(new_target - target_diff);
|
||||||
|
}
|
||||||
|
static struct xenbus_watch target_watch = {
|
||||||
|
.node = "memory/target",
|
||||||
|
--
|
||||||
|
2.15.0.rc2
|
||||||
|
|
@ -1,99 +0,0 @@
|
|||||||
From ae10fc424982b3c841c77dc9b1fa3ec96d8f5851 Mon Sep 17 00:00:00 2001
|
|
||||||
From: HW42 <hw42@ipsumj.de>
|
|
||||||
Date: Fri, 29 Sep 2017 17:59:14 +0200
|
|
||||||
Subject: [PATCH] Revert "xen/balloon: don't online new memory initially"
|
|
||||||
|
|
||||||
This reverts commit 96edd61dcf44362d3ef0bed1a5361e0ac7886a63.
|
|
||||||
---
|
|
||||||
drivers/xen/balloon.c | 3 ---
|
|
||||||
drivers/xen/xen-balloon.c | 22 ++++++++++------------
|
|
||||||
include/xen/balloon.h | 8 --------
|
|
||||||
3 files changed, 10 insertions(+), 23 deletions(-)
|
|
||||||
|
|
||||||
diff --git a/drivers/xen/balloon.c b/drivers/xen/balloon.c
|
|
||||||
index ab609255a0f3..50dcb68d8070 100644
|
|
||||||
--- a/drivers/xen/balloon.c
|
|
||||||
+++ b/drivers/xen/balloon.c
|
|
||||||
@@ -780,9 +780,6 @@ static int __init balloon_init(void)
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
- /* Init the xen-balloon driver. */
|
|
||||||
- xen_balloon_init();
|
|
||||||
-
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
subsys_initcall(balloon_init);
|
|
||||||
diff --git a/drivers/xen/xen-balloon.c b/drivers/xen/xen-balloon.c
|
|
||||||
index e89136ab851e..e7715cb62eef 100644
|
|
||||||
--- a/drivers/xen/xen-balloon.c
|
|
||||||
+++ b/drivers/xen/xen-balloon.c
|
|
||||||
@@ -59,8 +59,6 @@ static void watch_target(struct xenbus_watch *watch,
|
|
||||||
{
|
|
||||||
unsigned long long new_target;
|
|
||||||
int err;
|
|
||||||
- static bool watch_fired;
|
|
||||||
- static long target_diff;
|
|
||||||
|
|
||||||
err = xenbus_scanf(XBT_NIL, "memory", "target", "%llu", &new_target);
|
|
||||||
if (err != 1) {
|
|
||||||
@@ -71,14 +69,7 @@ static void watch_target(struct xenbus_watch *watch,
|
|
||||||
/* The given memory/target value is in KiB, so it needs converting to
|
|
||||||
* pages. PAGE_SHIFT converts bytes to pages, hence PAGE_SHIFT - 10.
|
|
||||||
*/
|
|
||||||
- new_target >>= PAGE_SHIFT - 10;
|
|
||||||
- if (watch_fired) {
|
|
||||||
- balloon_set_new_target(new_target - target_diff);
|
|
||||||
- return;
|
|
||||||
- }
|
|
||||||
-
|
|
||||||
- watch_fired = true;
|
|
||||||
- target_diff = new_target - balloon_stats.target_pages;
|
|
||||||
+ balloon_set_new_target(new_target >> (PAGE_SHIFT - 10));
|
|
||||||
}
|
|
||||||
static struct xenbus_watch target_watch = {
|
|
||||||
.node = "memory/target",
|
|
||||||
@@ -103,15 +94,22 @@ static struct notifier_block xenstore_notifier = {
|
|
||||||
.notifier_call = balloon_init_watcher,
|
|
||||||
};
|
|
||||||
|
|
||||||
-void xen_balloon_init(void)
|
|
||||||
+static int __init balloon_init(void)
|
|
||||||
{
|
|
||||||
+ if (!xen_domain())
|
|
||||||
+ return -ENODEV;
|
|
||||||
+
|
|
||||||
+ pr_info("Initialising balloon driver\n");
|
|
||||||
+
|
|
||||||
register_balloon(&balloon_dev);
|
|
||||||
|
|
||||||
register_xen_selfballooning(&balloon_dev);
|
|
||||||
|
|
||||||
register_xenstore_notifier(&xenstore_notifier);
|
|
||||||
+
|
|
||||||
+ return 0;
|
|
||||||
}
|
|
||||||
-EXPORT_SYMBOL_GPL(xen_balloon_init);
|
|
||||||
+subsys_initcall(balloon_init);
|
|
||||||
|
|
||||||
#define BALLOON_SHOW(name, format, args...) \
|
|
||||||
static ssize_t show_##name(struct device *dev, \
|
|
||||||
diff --git a/include/xen/balloon.h b/include/xen/balloon.h
|
|
||||||
index 8906361bb50c..d1767dfb0d95 100644
|
|
||||||
--- a/include/xen/balloon.h
|
|
||||||
+++ b/include/xen/balloon.h
|
|
||||||
@@ -35,11 +35,3 @@ static inline int register_xen_selfballooning(struct device *dev)
|
|
||||||
return -ENOSYS;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
-
|
|
||||||
-#ifdef CONFIG_XEN_BALLOON
|
|
||||||
-void xen_balloon_init(void);
|
|
||||||
-#else
|
|
||||||
-static inline void xen_balloon_init(void)
|
|
||||||
-{
|
|
||||||
-}
|
|
||||||
-#endif
|
|
||||||
--
|
|
||||||
2.14.2
|
|
||||||
|
|
@ -22,4 +22,4 @@ patches.xen/xsa155-linux44-0013-xen-blkfront-prepare-request-locally-only-then-p
|
|||||||
# MSI-X enabled device passthrough fix (#1734)
|
# MSI-X enabled device passthrough fix (#1734)
|
||||||
patches.xen/pci_op-cleanup.patch
|
patches.xen/pci_op-cleanup.patch
|
||||||
|
|
||||||
patches.xen/Revert-xen-balloon-don-t-online-new-memory-initially.patch
|
patches.xen/5266b8e4445c-xen-fix-booting-ballooned-down-hvm-guest.patch
|
||||||
|
Loading…
Reference in New Issue
Block a user