mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] xen/balloon: fix balloon initialization for PVH Dom0
@ 2018-08-08 11:46 Roger Pau Monne
  2018-08-08 11:51 ` Juergen Gross
  2018-08-08 17:01 ` Boris Ostrovsky
  0 siblings, 2 replies; 3+ messages in thread
From: Roger Pau Monne @ 2018-08-08 11:46 UTC (permalink / raw)
  To: linux-kernel
  Cc: Roger Pau Monne, Gabriel Ercarug, Boris Ostrovsky, Juergen Gross,
	xen-devel

The current balloon code tries to calculate a delta factor for the
balloon target when running in HVM mode in order to account for memory
used by the firmware.

This workaround for memory accounting doesn't work properly on a PVH
Dom0, that has a static-max value different from the target value even
at startup. Note that this is not a problem for DomUs because guests are
started with a static-max value that matches the amount of RAM in the
memory map.

Fix this by forcefully setting target_diff for Dom0, regardless of
it's mode.

Reported-by: Gabriel Bercarug <bercarug@amazon.com>
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
---
Cc: Gabriel Ercarug <bercarug@amazon.com>
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Cc: Juergen Gross <jgross@suse.com>
Cc: xen-devel@lists.xenproject.org
---
 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 b437fccd4e62..294f35ce9e46 100644
--- a/drivers/xen/xen-balloon.c
+++ b/drivers/xen/xen-balloon.c
@@ -81,7 +81,7 @@ static void watch_target(struct xenbus_watch *watch,
 			static_max = new_target;
 		else
 			static_max >>= PAGE_SHIFT - 10;
-		target_diff = xen_pv_domain() ? 0
+		target_diff = (xen_pv_domain() || xen_initial_domain()) ? 0
 				: static_max - balloon_stats.target_pages;
 	}
 
-- 
2.18.0


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

* Re: [PATCH] xen/balloon: fix balloon initialization for PVH Dom0
  2018-08-08 11:46 [PATCH] xen/balloon: fix balloon initialization for PVH Dom0 Roger Pau Monne
@ 2018-08-08 11:51 ` Juergen Gross
  2018-08-08 17:01 ` Boris Ostrovsky
  1 sibling, 0 replies; 3+ messages in thread
From: Juergen Gross @ 2018-08-08 11:51 UTC (permalink / raw)
  To: Roger Pau Monne, linux-kernel; +Cc: Gabriel Ercarug, Boris Ostrovsky, xen-devel

On 08/08/18 13:46, Roger Pau Monne wrote:
> The current balloon code tries to calculate a delta factor for the
> balloon target when running in HVM mode in order to account for memory
> used by the firmware.
> 
> This workaround for memory accounting doesn't work properly on a PVH
> Dom0, that has a static-max value different from the target value even
> at startup. Note that this is not a problem for DomUs because guests are
> started with a static-max value that matches the amount of RAM in the
> memory map.
> 
> Fix this by forcefully setting target_diff for Dom0, regardless of
> it's mode.
> 
> Reported-by: Gabriel Bercarug <bercarug@amazon.com>
> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>

Reviewed-by: Juergen Gross <jgross@suse.com>


Juergen

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

* Re: [PATCH] xen/balloon: fix balloon initialization for PVH Dom0
  2018-08-08 11:46 [PATCH] xen/balloon: fix balloon initialization for PVH Dom0 Roger Pau Monne
  2018-08-08 11:51 ` Juergen Gross
@ 2018-08-08 17:01 ` Boris Ostrovsky
  1 sibling, 0 replies; 3+ messages in thread
From: Boris Ostrovsky @ 2018-08-08 17:01 UTC (permalink / raw)
  To: Roger Pau Monne, linux-kernel; +Cc: Gabriel Ercarug, Juergen Gross, xen-devel

On 08/08/2018 07:46 AM, Roger Pau Monne wrote:
> The current balloon code tries to calculate a delta factor for the
> balloon target when running in HVM mode in order to account for memory
> used by the firmware.
>
> This workaround for memory accounting doesn't work properly on a PVH
> Dom0, that has a static-max value different from the target value even
> at startup. Note that this is not a problem for DomUs because guests are
> started with a static-max value that matches the amount of RAM in the
> memory map.
>
> Fix this by forcefully setting target_diff for Dom0, regardless of
> it's mode.
>
> Reported-by: Gabriel Bercarug <bercarug@amazon.com>
> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
>


Applied to for-linus-4.19

-boris

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

end of thread, other threads:[~2018-08-08 17:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-08-08 11:46 [PATCH] xen/balloon: fix balloon initialization for PVH Dom0 Roger Pau Monne
2018-08-08 11:51 ` Juergen Gross
2018-08-08 17:01 ` Boris Ostrovsky

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome