[PATCH] qemu: add support for max-ram-below-4g option

Peter Krempa pkrempa at redhat.com
Mon Apr 26 08:56:18 UTC 2021


On Mon, Apr 26, 2021 at 09:20:53 +0100, Daniel P. Berrangé wrote:
> On Mon, Apr 26, 2021 at 09:55:05AM +0200, Peter Krempa wrote:
> > On Sun, Apr 25, 2021 at 17:33:31 +0800, Zhiyong Ye wrote:
> > > Limit the amount of ram below 4G. This can increase the address space
> > > used by PCI devices below 4G and it can be used by adding attributes in
> > > XML like this:
> > > <domain>
> > >   ...
> > >   <memory unit="MiB" below4g="2048">4096</memory>
> > 
> > This illustrates that sharing the 'unit' argument between 'below4g' and
> > the actual memory size is wrong (pointed out also below). In case the
> > user modifies the unit but doesn't change below4g value it may be
> > misrepresented and since below4g is new some tools might not actually
> > know how to handle that.
> > 
> > below4g must either be by default in kiB, or have an own unit (which
> > will probably be ugly).
> 
> Why would we want to pick different units for the two values. Feels
> like it is overkill, and the same units value just applies to everything
> on this element.

It could create problems in an unlikely scenario such as a management
app modifying the XML it got from libvirt, where it changes the unit but
doesn't know about 'below4g'.

Similarly it's unfriendly to users. Libvirt always formats back the
value in kiB. If you want to change the memory size using user-friendly
values but don't want to change 'below4g' you'd have to modify it as
well.

Both are minor, but annoying once you have to deal with it.




More information about the libvir-list mailing list