All of lore.kernel.org
 help / color / mirror / Atom feed
* initial ballooning amount on HVM+PoD
@ 2014-01-17 14:33 Jan Beulich
  2014-01-17 15:54 ` Boris Ostrovsky
  2014-01-17 17:13 ` Ian Campbell
  0 siblings, 2 replies; 18+ messages in thread
From: Jan Beulich @ 2014-01-17 14:33 UTC (permalink / raw)
  To: xen-devel; +Cc: George Dunlap, Boris Ostrovsky, Keir Fraser

While looking into Jürgen's issue with PoD setup causing soft lockups
in Dom0 I realized that what I did in linux-2.6.18-xen.hg's c/s
989:a7781c0a3b9a ("xen/balloon: fix balloon driver accounting for
HVM-with-PoD case") just doesn't work - the BUG_ON() added there
triggers as soon as there's a reasonable amount of excess memory.
And that is despite me knowing that I spent significant amounts of
in testing that change - I must have tested something else than
finally got checked in, or must have screwed up in some other way.
Extremely embarrassing...

In the course of finding a proper solution I soon stumbled across
upstream's c275a57f5e ("xen/balloon: Set balloon's initial state to
number of existing RAM pages"), and hence went ahead and
compared three different calculations for initial bs.current_pages:

(a) upstream's (open coding get_num_physpages(), as I did this on
    an older kernel)
(b) plain old num_physpages (equaling the maximum RAM PFN)
(c) XENMEM_get_pod_target output (with the hypervisor altered
    to not refuse this for a domain doing it on itself)

The fourth (original) method, using totalram_pages, was already
known to result in the driver not ballooning down enough, and
hence setting up the domain for an eventual crash when the PoD
cache runs empty.

Interestingly, (a) too results in the driver not ballooning down
enough - there's a gap of exactly as many pages as are marked
reserved below the 1Mb boundary. Therefore aforementioned
upstream commit is presumably broken.

Short of a reliable (and ideally architecture independent) way of
knowing the necessary adjustment value, the next best solution
(not ballooning down too little, but also not ballooning down much
more than necessary) turns out to be using the minimum of (b)
and (c): When the domain only has memory below 4Gb, (b) is
more precise, whereas in the other cases (c) gets closest.

Question now is: Considering that (a) is broken (and hard to fix)
and (b) is in presumably a large part of practical cases leading to
too much ballooning down, shouldn't we open up
XENMEM_get_pod_target for domains to query on themselves?
Alternatively, can anyone see another way to calculate a
reasonably precise value?

Jan

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel

^ permalink raw reply	[flat|nested] 18+ messages in thread
* Re: initial ballooning amount on HVM+PoD
@ 2014-01-20 15:19 Boris Ostrovsky
  2014-01-20 15:23 ` Ian Campbell
  0 siblings, 1 reply; 18+ messages in thread
From: Boris Ostrovsky @ 2014-01-20 15:19 UTC (permalink / raw)
  To: Ian.Campbell; +Cc: George.Dunlap, xen-devel, keir, JBeulich


----- Ian.Campbell@citrix.com wrote:

> > > 
> > > I previously had a patch to use memblock_phys_mem_size(), but when
> I saw
> > > Boris switch to get_num_physpages() I thought that would be OK,
> but I
> > > didn't look into it very hard. Without checking I suspect they
> return
> > > pretty much the same think and so memblock_phys_mem_size will have
> the
> > > same issue you observed (which I confess I haven't yet gone back
> and
> > > understood).
> > 
> > If there's no reserved memory in that range, I guess ARM might
> > be fine as is.
> 
> Hrm I'm not sure what a DTB /memreserve/ statement turns into wrt the
> memblock stuff and whether it is included in phys_mem_size -- I think
> that stuff is still WIP upstream (i.e. the kernel currently ignores
> such
> things, IIRC there was a fix but it was broken and reverted to try
> again
> and then I've lost track).


FWIW, when I was looking at this code I also first thought of using memblock but IIRC I wasn't convinced that we always have CONFIG_HAVE_MEMBLOCK set so I ended up with physmem_size().

-boris

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

end of thread, other threads:[~2014-01-20 15:54 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-01-17 14:33 initial ballooning amount on HVM+PoD Jan Beulich
2014-01-17 15:54 ` Boris Ostrovsky
2014-01-17 16:03   ` Jan Beulich
2014-01-17 16:08     ` Ian Campbell
2014-01-17 16:26       ` Jan Beulich
2014-01-17 16:54         ` Ian Campbell
2014-01-20  8:01           ` Jan Beulich
2014-01-20 10:42             ` Ian Campbell
2014-01-17 16:13     ` Boris Ostrovsky
2014-01-17 16:23       ` Jan Beulich
2014-01-20 15:31         ` Konrad Rzeszutek Wilk
2014-01-20 15:54           ` Jan Beulich
2014-01-17 17:13 ` Ian Campbell
2014-01-20  8:08   ` Jan Beulich
2014-01-20 10:50     ` Ian Campbell
2014-01-20 11:35       ` Jan Beulich
  -- strict thread matches above, loose matches on Subject: below --
2014-01-20 15:19 Boris Ostrovsky
2014-01-20 15:23 ` Ian Campbell

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.