[libvirt] [PATCH v2 03/14] qemu: Introduce QEMU_CAPS_DEVICE_NVDIMM

Michal Privoznik posted 14 patches 8 years, 11 months ago
There is a newer version of this series
[libvirt] [PATCH v2 03/14] qemu: Introduce QEMU_CAPS_DEVICE_NVDIMM
Posted by Michal Privoznik 8 years, 11 months ago
Introduce a qemu capability for -device nvdimm.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
 src/qemu/qemu_capabilities.c | 9 +++++++++
 src/qemu/qemu_capabilities.h | 1 +
 2 files changed, 10 insertions(+)

diff --git a/src/qemu/qemu_capabilities.c b/src/qemu/qemu_capabilities.c
index 6f60a00ef..a9a2705a6 100644
--- a/src/qemu/qemu_capabilities.c
+++ b/src/qemu/qemu_capabilities.c
@@ -358,6 +358,7 @@ VIR_ENUM_IMPL(virQEMUCaps, QEMU_CAPS_LAST,
               "query-cpu-model-expansion", /* 245 */
               "virtio-net.host_mtu",
               "spice-rendernode",
+              "nvdimm",
     );
 
 
@@ -1625,6 +1626,7 @@ struct virQEMUCapsStringFlags virQEMUCapsObjectTypes[] = {
     { "ivshmem-plain", QEMU_CAPS_DEVICE_IVSHMEM_PLAIN },
     { "ivshmem-doorbell", QEMU_CAPS_DEVICE_IVSHMEM_DOORBELL },
     { "vhost-scsi", QEMU_CAPS_DEVICE_VHOST_SCSI },
+    { "nvdimm", QEMU_CAPS_DEVICE_NVDIMM },
 };
 
 static struct virQEMUCapsStringFlags virQEMUCapsObjectPropsVirtioBalloon[] = {
@@ -4358,6 +4360,13 @@ virQEMUCapsInitQMPMonitor(virQEMUCapsPtr qemuCaps,
         virQEMUCapsProbeQMPGICCapabilities(qemuCaps, mon) < 0)
         goto cleanup;
 
+    /* Prealloc on NVDIMMs is broken on older QEMUs leading to
+     * user data corruption. If we are dealing with such version
+     * of QEMU pretend we don't know how to NVDIMM. */
+    if (qemuCaps->version < 2009000 &&
+        virQEMUCapsGet(qemuCaps, QEMU_CAPS_DEVICE_NVDIMM))
+        virQEMUCapsClear(qemuCaps, QEMU_CAPS_DEVICE_NVDIMM);
+
     ret = 0;
  cleanup:
     return ret;
diff --git a/src/qemu/qemu_capabilities.h b/src/qemu/qemu_capabilities.h
index 0f998c473..01c4a80e6 100644
--- a/src/qemu/qemu_capabilities.h
+++ b/src/qemu/qemu_capabilities.h
@@ -394,6 +394,7 @@ typedef enum {
     QEMU_CAPS_QUERY_CPU_MODEL_EXPANSION, /* qmp query-cpu-model-expansion */
     QEMU_CAPS_VIRTIO_NET_HOST_MTU, /* virtio-net-*.host_mtu */
     QEMU_CAPS_SPICE_RENDERNODE, /* -spice rendernode */
+    QEMU_CAPS_DEVICE_NVDIMM, /* -device nvdimm */
 
     QEMU_CAPS_LAST /* this must always be the last item */
 } virQEMUCapsFlags;
-- 
2.11.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v2 03/14] qemu: Introduce QEMU_CAPS_DEVICE_NVDIMM
Posted by John Ferlan 8 years, 11 months ago

On 02/27/2017 08:19 AM, Michal Privoznik wrote:
> Introduce a qemu capability for -device nvdimm.
> 
> Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
> ---
>  src/qemu/qemu_capabilities.c | 9 +++++++++
>  src/qemu/qemu_capabilities.h | 1 +
>  2 files changed, 10 insertions(+)
> 

So this doesn't require tests/qemu*/caps_2.*.xml changes to add a:

<flag name='nvdimm'/> ?


ACK in general though... ugly for the version check, but not much that
can be done I suppose.

John

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v2 03/14] qemu: Introduce QEMU_CAPS_DEVICE_NVDIMM
Posted by Michal Privoznik 8 years, 11 months ago
On 03/07/2017 05:01 PM, John Ferlan wrote:
> 
> 
> On 02/27/2017 08:19 AM, Michal Privoznik wrote:
>> Introduce a qemu capability for -device nvdimm.
>>
>> Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
>> ---
>>  src/qemu/qemu_capabilities.c | 9 +++++++++
>>  src/qemu/qemu_capabilities.h | 1 +
>>  2 files changed, 10 insertions(+)
>>
> 
> So this doesn't require tests/qemu*/caps_2.*.xml changes to add a:
> 
> <flag name='nvdimm'/> ?

No. It doesn't. Basically, we need the version check because we are
waiting for Dan's patch to get in:

http://lists.nongnu.org/archive/html/qemu-devel/2017-03/msg00636.html

There will be no way for us to detect that. I mean, other than version
check. It sucks still, I agree on that. Therefore, even though some
older qemus do support nvdims, libvirt claims no support because they
are lacking the Dan's fix. It was discussed somewhere on the list, but I
don't remember where from the top of my head - perhaps in review of v1?

Michal

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list