[PATCH 3/5] virDomainMemoryDefCheckConflict: Check dimm & nvdimm models too

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



So far we check whether virtio-mem and/or virtio-pmem memory
devices do not overlap with each other. But we allow specifying
address where dimm and nvdimm memory devices are mapped too. And
there are left out from this collision check. Not anymore.

This leaves just sgx model out, but that's expected since it
can't have any address (see virDomainMemoryDefValidate()).

Resolves: https://issues.redhat.com/browse/RHEL-4452
Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
 src/conf/domain_validate.c                           | 12 ++++++++++--
 ...plug-virtio-mem-overlap-address.x86_64-latest.err |  2 +-
 2 files changed, 11 insertions(+), 3 deletions(-)

diff --git a/src/conf/domain_validate.c b/src/conf/domain_validate.c
index b4ffef919a..5d9602666e 100644
--- a/src/conf/domain_validate.c
+++ b/src/conf/domain_validate.c
@@ -2234,6 +2234,10 @@ virDomainMemoryDefCheckConflict(const virDomainMemoryDef *mem,
         break;
     case VIR_DOMAIN_MEMORY_MODEL_DIMM:
     case VIR_DOMAIN_MEMORY_MODEL_NVDIMM:
+        if (mem->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DIMM) {
+            thisStart = mem->info.addr.dimm.base;
+        }
+        break;
     case VIR_DOMAIN_MEMORY_MODEL_SGX_EPC:
     case VIR_DOMAIN_MEMORY_MODEL_NONE:
     case VIR_DOMAIN_MEMORY_MODEL_LAST:
@@ -2271,13 +2275,17 @@ virDomainMemoryDefCheckConflict(const virDomainMemoryDef *mem,
 
         switch (other->model) {
         case VIR_DOMAIN_MEMORY_MODEL_NONE:
-        case VIR_DOMAIN_MEMORY_MODEL_DIMM:
-        case VIR_DOMAIN_MEMORY_MODEL_NVDIMM:
         case VIR_DOMAIN_MEMORY_MODEL_SGX_EPC:
         case VIR_DOMAIN_MEMORY_MODEL_LAST:
             continue;
             break;
 
+        case VIR_DOMAIN_MEMORY_MODEL_DIMM:
+        case VIR_DOMAIN_MEMORY_MODEL_NVDIMM:
+            if (other->info.type == VIR_DOMAIN_DEVICE_ADDRESS_TYPE_DIMM) {
+                otherStart = other->info.addr.dimm.base;
+            }
+            break;
         case VIR_DOMAIN_MEMORY_MODEL_VIRTIO_PMEM:
             otherStart = other->target.virtio_pmem.address;
             break;
diff --git a/tests/qemuxml2argvdata/memory-hotplug-virtio-mem-overlap-address.x86_64-latest.err b/tests/qemuxml2argvdata/memory-hotplug-virtio-mem-overlap-address.x86_64-latest.err
index 36d5b8a6e6..6a1ad4556d 100644
--- a/tests/qemuxml2argvdata/memory-hotplug-virtio-mem-overlap-address.x86_64-latest.err
+++ b/tests/qemuxml2argvdata/memory-hotplug-virtio-mem-overlap-address.x86_64-latest.err
@@ -1 +1 @@
-unsupported configuration: memory device address [0x140000000:0x180000000] overlaps with other memory device (0x170000000)
+unsupported configuration: memory device address [0x170000000:0x178000000] overlaps with other memory device (0x170000000)
-- 
2.41.0

_______________________________________________
Devel mailing list -- devel@xxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxx




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux