* [PATCH v2] xen: fix booting ballooned down hvm guest
@ 2017-10-26 9:50 Juergen Gross
2017-10-26 14:12 ` Boris Ostrovsky
` (3 more replies)
0 siblings, 4 replies; 8+ messages in thread
From: Juergen Gross @ 2017-10-26 9:50 UTC (permalink / raw)
To: linux-kernel, xen-devel; +Cc: boris.ostrovsky, hw42, Juergen Gross, stable
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>
---
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.12.3
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH v2] xen: fix booting ballooned down hvm guest
2017-10-26 9:50 [PATCH v2] xen: fix booting ballooned down hvm guest Juergen Gross
@ 2017-10-26 14:12 ` Boris Ostrovsky
2017-10-26 22:55 ` Boris Ostrovsky
2017-10-26 22:55 ` Boris Ostrovsky
2017-10-26 14:12 ` Boris Ostrovsky
` (2 subsequent siblings)
3 siblings, 2 replies; 8+ messages in thread
From: Boris Ostrovsky @ 2017-10-26 14:12 UTC (permalink / raw)
To: Juergen Gross, linux-kernel, xen-devel; +Cc: hw42, stable
On 10/26/2017 05:50 AM, Juergen Gross wrote:
> 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>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2] xen: fix booting ballooned down hvm guest
2017-10-26 9:50 [PATCH v2] xen: fix booting ballooned down hvm guest Juergen Gross
2017-10-26 14:12 ` Boris Ostrovsky
@ 2017-10-26 14:12 ` Boris Ostrovsky
2017-10-26 15:40 ` HW42
2017-10-26 15:40 ` HW42
3 siblings, 0 replies; 8+ messages in thread
From: Boris Ostrovsky @ 2017-10-26 14:12 UTC (permalink / raw)
To: Juergen Gross, linux-kernel, xen-devel; +Cc: hw42, stable
On 10/26/2017 05:50 AM, Juergen Gross wrote:
> 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>
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2] xen: fix booting ballooned down hvm guest
2017-10-26 9:50 [PATCH v2] xen: fix booting ballooned down hvm guest Juergen Gross
2017-10-26 14:12 ` Boris Ostrovsky
2017-10-26 14:12 ` Boris Ostrovsky
@ 2017-10-26 15:40 ` HW42
2017-10-26 15:40 ` HW42
3 siblings, 0 replies; 8+ messages in thread
From: HW42 @ 2017-10-26 15:40 UTC (permalink / raw)
To: Juergen Gross, linux-kernel, xen-devel; +Cc: boris.ostrovsky, stable
[-- Attachment #1.1: Type: text/plain, Size: 889 bytes --]
Juergen Gross:
> 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>
Fixes the issues for me. Thanks.
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 854 bytes --]
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2] xen: fix booting ballooned down hvm guest
2017-10-26 9:50 [PATCH v2] xen: fix booting ballooned down hvm guest Juergen Gross
` (2 preceding siblings ...)
2017-10-26 15:40 ` HW42
@ 2017-10-26 15:40 ` HW42
3 siblings, 0 replies; 8+ messages in thread
From: HW42 @ 2017-10-26 15:40 UTC (permalink / raw)
To: Juergen Gross, linux-kernel, xen-devel; +Cc: boris.ostrovsky, stable
[-- Attachment #1.1.1: Type: text/plain, Size: 889 bytes --]
Juergen Gross:
> 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>
Fixes the issues for me. Thanks.
[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 854 bytes --]
[-- Attachment #2: Type: text/plain, Size: 127 bytes --]
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2] xen: fix booting ballooned down hvm guest
2017-10-26 14:12 ` Boris Ostrovsky
2017-10-26 22:55 ` Boris Ostrovsky
@ 2017-10-26 22:55 ` Boris Ostrovsky
1 sibling, 0 replies; 8+ messages in thread
From: Boris Ostrovsky @ 2017-10-26 22:55 UTC (permalink / raw)
To: Juergen Gross, linux-kernel, xen-devel; +Cc: hw42, stable
On 10/26/2017 10:12 AM, Boris Ostrovsky wrote:
> On 10/26/2017 05:50 AM, Juergen Gross wrote:
>> 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>
>
Applied to for-linus-4.14c.
-boris
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2] xen: fix booting ballooned down hvm guest
2017-10-26 14:12 ` Boris Ostrovsky
@ 2017-10-26 22:55 ` Boris Ostrovsky
2017-10-26 22:55 ` Boris Ostrovsky
1 sibling, 0 replies; 8+ messages in thread
From: Boris Ostrovsky @ 2017-10-26 22:55 UTC (permalink / raw)
To: Juergen Gross, linux-kernel, xen-devel; +Cc: hw42, stable
On 10/26/2017 10:12 AM, Boris Ostrovsky wrote:
> On 10/26/2017 05:50 AM, Juergen Gross wrote:
>> 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>
>
Applied to for-linus-4.14c.
-boris
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v2] xen: fix booting ballooned down hvm guest
@ 2017-10-26 9:50 Juergen Gross
0 siblings, 0 replies; 8+ messages in thread
From: Juergen Gross @ 2017-10-26 9:50 UTC (permalink / raw)
To: linux-kernel, xen-devel; +Cc: Juergen Gross, boris.ostrovsky, hw42, stable
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>
---
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.12.3
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
^ permalink raw reply related [flat|nested] 8+ messages in thread
end of thread, other threads:[~2017-10-26 22:54 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-26 9:50 [PATCH v2] xen: fix booting ballooned down hvm guest Juergen Gross
2017-10-26 14:12 ` Boris Ostrovsky
2017-10-26 22:55 ` Boris Ostrovsky
2017-10-26 22:55 ` Boris Ostrovsky
2017-10-26 14:12 ` Boris Ostrovsky
2017-10-26 15:40 ` HW42
2017-10-26 15:40 ` HW42
2017-10-26 9:50 Juergen Gross
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.