linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] xen/balloon: Support xend-based toolstack take two
@ 2020-01-16 17:00 Juergen Gross
  2020-01-16 19:32 ` Boris Ostrovsky
  2020-01-17 11:01 ` Jan Beulich
  0 siblings, 2 replies; 6+ messages in thread
From: Juergen Gross @ 2020-01-16 17:00 UTC (permalink / raw)
  To: xen-devel, linux-kernel
  Cc: Juergen Gross, Boris Ostrovsky, Stefano Stabellini, stable

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")
Signed-off-by: Juergen Gross <jgross@suse.com>
Cc: <stable@vger.kernel.org> # 4.13
---
 drivers/xen/xen-balloon.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/xen/xen-balloon.c b/drivers/xen/xen-balloon.c
index 6d12fc368210..a8d24433c8e9 100644
--- a/drivers/xen/xen-balloon.c
+++ b/drivers/xen/xen-balloon.c
@@ -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;
-- 
2.16.4


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] xen/balloon: Support xend-based toolstack take two
  2020-01-16 17:00 [PATCH] xen/balloon: Support xend-based toolstack take two Juergen Gross
@ 2020-01-16 19:32 ` Boris Ostrovsky
  2020-01-17 11:01 ` Jan Beulich
  1 sibling, 0 replies; 6+ messages in thread
From: Boris Ostrovsky @ 2020-01-16 19:32 UTC (permalink / raw)
  To: Juergen Gross, xen-devel, linux-kernel; +Cc: Stefano Stabellini, stable



On 1/16/20 12:00 PM, Juergen Gross wrote:
> 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")
> Signed-off-by: Juergen Gross <jgross@suse.com>
> Cc: <stable@vger.kernel.org> # 4.13

Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] xen/balloon: Support xend-based toolstack take two
  2020-01-16 17:00 [PATCH] xen/balloon: Support xend-based toolstack take two Juergen Gross
  2020-01-16 19:32 ` Boris Ostrovsky
@ 2020-01-17 11:01 ` Jan Beulich
  2020-01-17 11:31   ` Jürgen Groß
  1 sibling, 1 reply; 6+ messages in thread
From: Jan Beulich @ 2020-01-17 11:01 UTC (permalink / raw)
  To: Juergen Gross
  Cc: xen-devel, linux-kernel, Stefano Stabellini, Boris Ostrovsky, stable

On 16.01.2020 18:00, Juergen Gross wrote:
> 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, ...

> --- a/drivers/xen/xen-balloon.c
> +++ b/drivers/xen/xen-balloon.c
> @@ -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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] xen/balloon: Support xend-based toolstack take two
  2020-01-17 11:01 ` Jan Beulich
@ 2020-01-17 11:31   ` Jürgen Groß
  2020-01-17 11:36     ` Jan Beulich
  0 siblings, 1 reply; 6+ messages in thread
From: Jürgen Groß @ 2020-01-17 11:31 UTC (permalink / raw)
  To: Jan Beulich
  Cc: xen-devel, linux-kernel, Stefano Stabellini, Boris Ostrovsky, stable

On 17.01.20 12:01, Jan Beulich wrote:
> On 16.01.2020 18:00, Juergen Gross wrote:
>> 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, ...
> 
>> --- a/drivers/xen/xen-balloon.c
>> +++ b/drivers/xen/xen-balloon.c
>> @@ -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.

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] xen/balloon: Support xend-based toolstack take two
  2020-01-17 11:31   ` Jürgen Groß
@ 2020-01-17 11:36     ` Jan Beulich
  2020-01-17 11:45       ` Jürgen Groß
  0 siblings, 1 reply; 6+ messages in thread
From: Jan Beulich @ 2020-01-17 11:36 UTC (permalink / raw)
  To: Jürgen Groß
  Cc: xen-devel, linux-kernel, Stefano Stabellini, Boris Ostrovsky, stable

On 17.01.2020 12:31, Jürgen Groß wrote:
> On 17.01.20 12:01, Jan Beulich wrote:
>> On 16.01.2020 18:00, Juergen Gross wrote:
>>> 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, ...
>>
>>> --- a/drivers/xen/xen-balloon.c
>>> +++ b/drivers/xen/xen-balloon.c
>>> @@ -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.
> 
> 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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] xen/balloon: Support xend-based toolstack take two
  2020-01-17 11:36     ` Jan Beulich
@ 2020-01-17 11:45       ` Jürgen Groß
  0 siblings, 0 replies; 6+ messages in thread
From: Jürgen Groß @ 2020-01-17 11:45 UTC (permalink / raw)
  To: Jan Beulich
  Cc: xen-devel, linux-kernel, Stefano Stabellini, Boris Ostrovsky, stable

On 17.01.20 12:36, Jan Beulich wrote:
> On 17.01.2020 12:31, Jürgen Groß wrote:
>> On 17.01.20 12:01, Jan Beulich wrote:
>>> On 16.01.2020 18:00, Juergen Gross wrote:
>>>> 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, ...
>>>
>>>> --- a/drivers/xen/xen-balloon.c
>>>> +++ b/drivers/xen/xen-balloon.c
>>>> @@ -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.
>>
>> 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.

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


Juergen

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-01-17 11:45 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-01-16 17:00 [PATCH] xen/balloon: Support xend-based toolstack take two Juergen Gross
2020-01-16 19:32 ` Boris Ostrovsky
2020-01-17 11:01 ` Jan Beulich
2020-01-17 11:31   ` Jürgen Groß
2020-01-17 11:36     ` Jan Beulich
2020-01-17 11:45       ` Jürgen Groß

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).