xen: fix booting ballooned down hvm guest
Subsystems (2)
Juergen Gross
maintainerPATCH v2 1/1 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.
online new memory initially")
--- drivers/xen/xen-balloon.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-)
drivers/xen/xen-balloon.c +13 -6
@@ -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" ,
Signature · 1 line
2.12.3
Quoted 11 lines · 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.
Quoted 7 lines
Cc <[email protected]> # 4.13Fixes 96edd61dcf44362d3ef0bed1a5361e0ac7886a63 ("xen/balloon: don'tonline new memory initially")
Reported-by Simon Gaiser <[email protected]>Suggested-by Boris Ostrovsky <[email protected]>Signed-off-by Juergen Gross <[email protected]>
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Quoted 11 lines · 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.
Quoted 7 lines
Cc <[email protected]> # 4.13Fixes 96edd61dcf44362d3ef0bed1a5361e0ac7886a63 ("xen/balloon: don'tonline new memory initially")
Reported-by Simon Gaiser <[email protected]>Suggested-by Boris Ostrovsky <[email protected]>Signed-off-by Juergen Gross <[email protected]>
Boris Ostrovsky
AppliedQuoted 12 lines · Boris Ostrovsky
Quoted 11 lines · 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.
Quoted 9 lines
Quoted 7 lines
Cc <[email protected]> # 4.13Fixes 96edd61dcf44362d3ef0bed1a5361e0ac7886a63 ("xen/balloon: don'tonline new memory initially")
Reported-by Simon Gaiser <[email protected]>Suggested-by Boris Ostrovsky <[email protected]>Signed-off-by Juergen Gross <[email protected]>Reviewed-by Boris Ostrovsky <[email protected]>
Applied to for-linus-4.14c.
-boris
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Boris Ostrovsky
AppliedQuoted 12 lines · Boris Ostrovsky
Quoted 11 lines · 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.
Quoted 9 lines
Quoted 7 lines
Cc <[email protected]> # 4.13Fixes 96edd61dcf44362d3ef0bed1a5361e0ac7886a63 ("xen/balloon: don'tonline new memory initially")
Reported-by Simon Gaiser <[email protected]>Suggested-by Boris Ostrovsky <[email protected]>Signed-off-by Juergen Gross <[email protected]>Reviewed-by Boris Ostrovsky <[email protected]>
Applied to for-linus-4.14c.
-boris
Juergen Gross:
Quoted 11 lines
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.
Quoted 7 lines
Cc <[email protected]> # 4.13Fixes 96edd61dcf44362d3ef0bed1a5361e0ac7886a63 ("xen/balloon: don'tonline new memory initially")
Reported-by Simon Gaiser <[email protected]>Suggested-by Boris Ostrovsky <[email protected]>Signed-off-by Juergen Gross <[email protected]>
Fixes the issues for me. Thanks.
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel
Juergen Gross:
Quoted 11 lines
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.
Quoted 7 lines
Cc <[email protected]> # 4.13Fixes 96edd61dcf44362d3ef0bed1a5361e0ac7886a63 ("xen/balloon: don'tonline new memory initially")
Reported-by Simon Gaiser <[email protected]>Suggested-by Boris Ostrovsky <[email protected]>Signed-off-by Juergen Gross <[email protected]>
Fixes the issues for me. Thanks.