Skip to contentSkip to conversation

xen/balloon: Support xend-based toolstack take two

PATCH Superseded Juergen Gross 3 participants 6 messages Jan 16, 2020 – Jan 17, 2020

Subsystems (2)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

Juergen Gross

author maintainer
#0 lore raw

PATCH 1/1 xen/balloon: Support xend-based toolstack take two

Commit 3aa6c19d2f38be ("xen/balloon: Support xend-based toolstack") tried to fix a regression with running on rather ancient Xen versions. Unfortunately the fix was based on the assumption that xend would just use another Xenstore node, but in reality only some downstream versions of xend are doing that. The upstream xend does not write that Xenstore node at all, so the problem must be fixed in another way.

The easiest way to achieve that is to fall back to the behavior before commit 5266b8e4445c ("xen: fix booting ballooned down hvm guest") in case the static memory maximum can't be read.

Fixes 3aa6c19d2f38be ("xen/balloon: Support xend-based toolstack")
Cc <[email protected]> # 4.13
---
 drivers/xen/xen-balloon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/xen/xen-balloon.c +1 -1
index 6d12fc368210..a8d24433c8e9 100644
@@ -94,7 +94,7 @@ static void watch_target(struct xenbus_watch *watch,
 				  "%llu", &static_max) == 1))
 			static_max >>= PAGE_SHIFT - 10;
 		else
-			static_max = new_target;
+			static_max = balloon_stats.current_pages;
 
 		target_diff = (xen_pv_domain() || xen_initial_domain()) ? 0
 				: static_max - balloon_stats.target_pages;
Signature · 7 lines
2.16.4


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Reviewed-by on v1 1/1
#1 lore raw
Quoted 8 lines · Juergen Gross

Commit 3aa6c19d2f38be ("xen/balloon: Support xend-based toolstack") tried to fix a regression with running on rather ancient Xen versions. Unfortunately the fix was based on the assumption that xend would just use another Xenstore node, but in reality only some downstream versions of xend are doing that. The upstream xend does not write that Xenstore node at all, so the problem must be fixed in another way.

Quoted 7 lines

The easiest way to achieve that is to fall back to the behavior before commit 5266b8e4445c ("xen: fix booting ballooned down hvm guest") in case the static memory maximum can't be read.

Fixes 3aa6c19d2f38be ("xen/balloon: Support xend-based toolstack")
Cc <[email protected]> # 4.13

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#2 lore raw
In reply to Juergen Gross
Quoted 11 lines · Juergen Gross

Commit 3aa6c19d2f38be ("xen/balloon: Support xend-based toolstack") tried to fix a regression with running on rather ancient Xen versions. Unfortunately the fix was based on the assumption that xend would just use another Xenstore node, but in reality only some downstream versions of xend are doing that. The upstream xend does not write that Xenstore node at all, so the problem must be fixed in another way.

The easiest way to achieve that is to fall back to the behavior before commit 5266b8e4445c ("xen: fix booting ballooned down hvm guest") in case the static memory maximum can't be read.

I could use some help here: Prior to said commit there was

	target_diff = new_target - balloon_stats.target_pages;

Which is, afaict, ...

drivers/xen/xen-balloon.c static void watch_target(struct xenbus_watch *watch, · line 100

Quoted 11 lines
drivers/xen/xen-balloon.c +1 -1
@@ -94,7 +94,7 @@ static void watch_target(struct xenbus_watch *watch,
 				  "%llu", &static_max) == 1))
 			static_max >>= PAGE_SHIFT - 10;
 		else
-			static_max = new_target;
+			static_max = balloon_stats.current_pages;
 
 		target_diff = (xen_pv_domain() || xen_initial_domain()) ? 0
 				: static_max - balloon_stats.target_pages;

... what the code does before your change. Afaict there was never a use of balloon_stats.current_pages in this function.

Jan

author maintainer
#3 lore raw
Quoted 29 lines · Jan Beulich
Quoted 11 lines · Juergen Gross

Commit 3aa6c19d2f38be ("xen/balloon: Support xend-based toolstack") tried to fix a regression with running on rather ancient Xen versions. Unfortunately the fix was based on the assumption that xend would just use another Xenstore node, but in reality only some downstream versions of xend are doing that. The upstream xend does not write that Xenstore node at all, so the problem must be fixed in another way.

The easiest way to achieve that is to fall back to the behavior before commit 5266b8e4445c ("xen: fix booting ballooned down hvm guest") in case the static memory maximum can't be read.

I could use some help here: Prior to said commit there was

	target_diff = new_target - balloon_stats.target_pages;

Which is, afaict, ...

Quoted 9 lines
drivers/xen/xen-balloon.c +1 -1
@@ -94,7 +94,7 @@ static void watch_target(struct xenbus_watch *watch,
  				  "%llu", &static_max) == 1))
  			static_max >>= PAGE_SHIFT - 10;
  		else
-			static_max = new_target;
+			static_max = balloon_stats.current_pages;
 
Quoted 5 lines

drivers/xen/xen-balloon.c static void watch_target(struct xenbus_watch *watch, · line 100

Quoted 2 lines
drivers/xen/xen-balloon.c +0 -0
  		target_diff = (xen_pv_domain() || xen_initial_domain()) ? 0
  				: static_max - balloon_stats.target_pages;

... what the code does before your change. Afaict there was never a use of balloon_stats.current_pages in this function.

That is a little bit indirect, yes. In the end I want static_max to be either the maximum reported by Xen, or if not available, the current assumed memory size, which can be found in balloon_stats.current_pages.

The main idea is to avoid a negative target_diff which would result in not ballooning down.

Juergen

#4 lore raw
Quoted 36 lines · Jürgen Groß
Quoted 29 lines · Jan Beulich
Quoted 11 lines · Juergen Gross

Commit 3aa6c19d2f38be ("xen/balloon: Support xend-based toolstack") tried to fix a regression with running on rather ancient Xen versions. Unfortunately the fix was based on the assumption that xend would just use another Xenstore node, but in reality only some downstream versions of xend are doing that. The upstream xend does not write that Xenstore node at all, so the problem must be fixed in another way.

The easiest way to achieve that is to fall back to the behavior before commit 5266b8e4445c ("xen: fix booting ballooned down hvm guest") in case the static memory maximum can't be read.

I could use some help here: Prior to said commit there was

	target_diff = new_target - balloon_stats.target_pages;

Which is, afaict, ...

Quoted 9 lines
drivers/xen/xen-balloon.c +1 -1
@@ -94,7 +94,7 @@ static void watch_target(struct xenbus_watch *watch,
  				  "%llu", &static_max) == 1))
  			static_max >>= PAGE_SHIFT - 10;
  		else
-			static_max = new_target;
+			static_max = balloon_stats.current_pages;
 
Quoted 5 lines

drivers/xen/xen-balloon.c static void watch_target(struct xenbus_watch *watch, · line 100

Quoted 2 lines
drivers/xen/xen-balloon.c +0 -0
  		target_diff = (xen_pv_domain() || xen_initial_domain()) ? 0
  				: static_max - balloon_stats.target_pages;

... what the code does before your change. Afaict there was never a use of balloon_stats.current_pages in this function.

Quoted 6 lines

That is a little bit indirect, yes. In the end I want static_max to be either the maximum reported by Xen, or if not available, the current assumed memory size, which can be found in balloon_stats.current_pages.

The main idea is to avoid a negative target_diff which would result in not ballooning down.

All understood. Yet the change is then not a restore of prior behavior (just in a limited case), but a change to behavior that we never there before. I.e. it was indeed my assumption that the code was right, but the description was misleading.

Jan

author maintainer
#5 lore raw
Quoted 41 lines · Jan Beulich
Quoted 40 lines · Jürgen Groß
Quoted 29 lines · Jan Beulich
Quoted 11 lines · Juergen Gross

Commit 3aa6c19d2f38be ("xen/balloon: Support xend-based toolstack") tried to fix a regression with running on rather ancient Xen versions. Unfortunately the fix was based on the assumption that xend would just use another Xenstore node, but in reality only some downstream versions of xend are doing that. The upstream xend does not write that Xenstore node at all, so the problem must be fixed in another way.

The easiest way to achieve that is to fall back to the behavior before commit 5266b8e4445c ("xen: fix booting ballooned down hvm guest") in case the static memory maximum can't be read.

I could use some help here: Prior to said commit there was

	target_diff = new_target - balloon_stats.target_pages;

Which is, afaict, ...

Quoted 9 lines
drivers/xen/xen-balloon.c +1 -1
@@ -94,7 +94,7 @@ static void watch_target(struct xenbus_watch *watch,
   				  "%llu", &static_max) == 1))
   			static_max >>= PAGE_SHIFT - 10;
   		else
-			static_max = new_target;
+			static_max = balloon_stats.current_pages;
 
Quoted 5 lines

drivers/xen/xen-balloon.c static void watch_target(struct xenbus_watch *watch, · line 100

Quoted 2 lines
drivers/xen/xen-balloon.c +0 -0
   		target_diff = (xen_pv_domain() || xen_initial_domain()) ? 0
   				: static_max - balloon_stats.target_pages;

... what the code does before your change. Afaict there was never a use of balloon_stats.current_pages in this function.

That is a little bit indirect, yes. In the end I want static_max to be either the maximum reported by Xen, or if not available, the current assumed memory size, which can be found in balloon_stats.current_pages.

Quoted 7 lines
Quoted 2 lines

The main idea is to avoid a negative target_diff which would result in not ballooning down.

All understood. Yet the change is then not a restore of prior behavior (just in a limited case), but a change to behavior that we never there before. I.e. it was indeed my assumption that the code was right, but the description was misleading.

The description is misleading as it fails to mention commit 96edd61dcf44362d3e, which introduced target_diff. I'll add that to the commit message.

Juergen