
On 09/13/2017 03:54 PM, Stefan Hajnoczi wrote:
Hi Michal, You asked how NVDIMM hotplug should work if the domain was launched without -M nvdimm=on. I'm not very familiar with ACPI so this may be incorrect.
Hotplug relies on the presence of ACPI tables (SSDT Device=NVDR _HID=ACPI0012) added by -M nvdimm=on. The ACPI tables contain the interface needed to handle hotplug events.
The device_add command fails with the following message if -M nvdimm=on is missing:
nvdimm is not enabled: missing 'nvdimm' in '-M'
Right.
I'm not sure if ACPI allows SSDT tables to be dynamically added but in any case the current QEMU code doesn't support that.
Options for libvirt:
1. Rely on QEMU's device_add error. Pro: If QEMU behavior ever changes then libvirt will also start working without code changes.
Well, this sounds scary :-)
Cons: Does libvirt interpret QMP error strings?
No.
2. Only allow NVDIMM hotplug if the domain was started with -M nvdimm=on.
I think QEMU will not add -M nvdimm=on to the "pc" machine type by default since it adds the NVDIMM DSM hardware interface that increases the security attack surface.
So this is the downside. Well, I think all that we are left with is option 2 then. Or, we can expose nvdimm=on the domain XML (and enable it by default for any domain that already has a nvdimm device configured). BTW: I ran a migration from no nvdimm qemu to one that had -M nvdimm=on and guest migrated happily. So looks like guest ABI is stable (or at least stable enough not to crash). But since ACPI table is changed I doubt that. Also, I found that hotunplug is not implemented yet? error: internal error: unable to execute QEMU command 'device_del': nvdimm device hot unplug is not supported yet. Michal