On Thu, Sep 08, 2016 at 03:50:40PM +0200, Michal Privoznik wrote:
> After going through patch 3, I'm beginning to think it
wouldn't be such
> a good idea to keep nvdimm's and dimm's in the same nmems list. I think
> they might just be too different. I also recall some algorithm
> somewhere which made sure addresses and sizes used fit "properly"...
> Searching on DIMM in cscope brings up a few more references and questions.
So, I've just discussed this with Peter who implemented the DIMM (aka
mem hotplug) feature. In this case, libvirt tries to not duplicate code
that already lives in qemu. So how this works is: on domain startup
libvirt just puts the dimms (and after my patches nvdimms as well) onto
the qemu cmd line just in the order as in the XML. Then, when qemu is
started its magic algorithm assigns addresses to all the modules (so
that they don't overlap) and libvirt just queries this information on
the monitor. And it is only in case of migration when we explicitly put
the addresses onto qemu's cmd line (to preserve ABI stability).
On the next run of domain (I mean hard stop & start => new qemu
process), the process repeats itself again. So addresses can be possibly
different, but I'd say this is okay. For two reasons: even in real
hardware if you switch two devices (e.g. DIMM modules, disks, ...)
you'll boot into different environment (e.g. disks gets renamed, what
used to be sda is now sdb). Secondly, this NVDIMM is meant to be used as
a sync mechanism between host & guest.
This is very different to how we deal with addressing for all other
types of device in libvirt, where we always assign addresses
immediately at time the guest is defined. By only assigning addresses
transiently when QEMU starts up, then you're liable to get different
addressing even if the DIMM config isn't isn't changed. eg addition
of other unrelated devices may alter the address QEMU ends up assigning
to the DIMMS. Your arguments in favour of not having persistent addresses
aren't really in any way specific to DIMMs, so if we wanted to take that
approach, then it would apply to all types of device. So I think we need
to fix DIMM address assignment so that it works exactly the same way as
we do for all other device addressing needs and assign it up front.
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 :|