[libvirt] [RFC] Memory hotplug for qemu guests and the relevant XML parts

Daniel P. Berrange berrange at redhat.com
Wed Jul 30 11:45:13 UTC 2014


On Wed, Jul 30, 2014 at 01:37:36PM +0200, Peter Krempa wrote:
> On 07/30/14 12:08, Daniel P. Berrange wrote:
> > On Tue, Jul 29, 2014 at 05:05:23PM +0100, Daniel P. Berrange wrote:
> >> Looking at the big picture, we've got a bunch of memory related
> >> configuration sets
> >>
> >>  - Guest NUMA topology setup, assigning vCPUs and RAM to guest nodes
> >>
> >>     <cpu>
> >>       <numa>
> >>         <cell id='0' cpus='0' memory='512000'/>
> >>         <cell id='1' cpus='1' memory='512000'/>
> >>         <cell id='2' cpus='2-3' memory='1024000'/>
> 
> Alternatively, we can allow the user to omit the memory attribute if
> memory modules are specified and re-calculate it as in the hotplug case.

Yes, omitting 'memory' would be ok if there are slot devices
listed in the XML.

> 
> >>       </numa>
> >>     </cpu>
> >>
> >>  - Request the use of huge pages, optionally different size
> >>    per guest NUMA node
> >>
> >>     <memoryBacking>
> >>       <hugepages/>
> >>     </memoryBacking>
> >>
> >>     <memoryBacking>
> >>       <hugepages>
> >>         <page size='2048' unit='KiB' nodeset='0,1'/>
> >>         <page size='1' unit='GiB' nodeset='2'/>
> >>       </hugepages>
> >>     </memoryBacking>
> >>
> >>  - Mapping of guest NUMA nodes to host NUMA nodes
> >>
> >>     <numatune>
> >>       <memory mode="strict" nodeset="1-4,^3"/>
> >>       <memnode cellid="0" mode="strict" nodeset="1"/>
> >>       <memnode cellid="1" mode="strict"  nodeset="2"/>
> >>     </numatune>
> >>
> >>
> >> At the QEMU level, aside from the size of the DIMM, the memory slot
> >> device lets you 
> >>
> >>   1. Specify guest NUMA node to attach to
> >>   2. Specify host NUMA node to assign to
> >>   3. Request use of huge pages, optionally with size
> > 
> > [snip]
> > 
> >> So I think it is valid for libvirt to expose the memory slot feature
> >> just specifying the RAM size and the guest NUMA node and infer huge
> >> page usage, huge page size and host NUMA node from existing data that
> >> libvirt has in its domain XML document elsewhere.
> > 
> > I meant to outline how I thought hotplug/unplug would interact with
> > the existing data.
> > 
> > When first booting the guest
> > 
> >  - If the XML does not include any memory slot info, we should
> >    add minimum possible memory slots to match the per-guest
> >    NUMA node config.
> > 
> >  - If XML does include slots, then we must validate that the
> >    sum of the memory for slots listed against each guest NUMA
> >    node matches the memory set in /cpu/numa/cell/@memory
> 
> My idea was that the user would be also able to not specify
> <memoryBacking> and other of those existing info and then provide just
> the memory module configuration. On the other hand, making the other
> information above mandatory when using memory hotplug will just make the
> code simpler and allow to re-use that data.

Yep, I think it is important to use the memoryBacking here, since
if we list hugepages against the memory slot we get into the
situation where you can have different slots in the same
NUMA node specifying different configs which is not a sensible
setup.

Regards,
Daniel
-- 
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|




More information about the libvir-list mailing list