diff mbox series

qemu: Taint cpu host-passthrough only after migration

Message ID 5ef467661a99fe73df1008e41ef75bba43705387.1601838652.git.crobinso@redhat.com
State New
Headers show
Series qemu: Taint cpu host-passthrough only after migration | expand

Commit Message

Cole Robinson Oct. 4, 2020, 7:10 p.m. UTC
>From a discussion last year[1], Dan recommended libvirt drop the tain

flag for cpu host-passthrough, unless the VM has been migrated.

This repurposes the existing host-cpu taint flag to do just that.

[1]: https://www.redhat.com/archives/virt-tools-list/2019-February/msg00041.html

https://bugzilla.redhat.com/show_bug.cgi?id=1673098

Signed-off-by: Cole Robinson <crobinso@redhat.com>

---
 src/conf/domain_conf.h  | 2 +-
 src/qemu/qemu_domain.c  | 7 +++++--
 src/qemu/qemu_domain.h  | 3 ++-
 src/qemu/qemu_process.c | 2 +-
 4 files changed, 9 insertions(+), 5 deletions(-)

-- 
2.28.0

Comments

Daniel P. Berrangé Oct. 5, 2020, 8:07 a.m. UTC | #1
On Sun, Oct 04, 2020 at 03:10:52PM -0400, Cole Robinson wrote:
> From a discussion last year[1], Dan recommended libvirt drop the tain

> flag for cpu host-passthrough, unless the VM has been migrated.

> 

> This repurposes the existing host-cpu taint flag to do just that.

> 

> [1]: https://www.redhat.com/archives/virt-tools-list/2019-February/msg00041.html

> 

> https://bugzilla.redhat.com/show_bug.cgi?id=1673098

> 

> Signed-off-by: Cole Robinson <crobinso@redhat.com>

> ---

>  src/conf/domain_conf.h  | 2 +-

>  src/qemu/qemu_domain.c  | 7 +++++--

>  src/qemu/qemu_domain.h  | 3 ++-

>  src/qemu/qemu_process.c | 2 +-

>  4 files changed, 9 insertions(+), 5 deletions(-)


Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>



Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|
diff mbox series

Patch

diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index 9a44315519..450686dfb5 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -2736,7 +2736,7 @@  typedef enum {
     VIR_DOMAIN_TAINT_SHELL_SCRIPTS,    /* Network configuration using opaque shell scripts */
     VIR_DOMAIN_TAINT_DISK_PROBING,     /* Relying on potentially unsafe disk format probing */
     VIR_DOMAIN_TAINT_EXTERNAL_LAUNCH,  /* Externally launched guest domain */
-    VIR_DOMAIN_TAINT_HOST_CPU,         /* Host CPU passthrough in use */
+    VIR_DOMAIN_TAINT_HOST_CPU,         /* Host CPU passthrough in use after migration */
     VIR_DOMAIN_TAINT_HOOK,             /* Domain (possibly) changed via hook script */
     VIR_DOMAIN_TAINT_CDROM_PASSTHROUGH,/* CDROM passthrough */
     VIR_DOMAIN_TAINT_CUSTOM_DTB,       /* Custom device tree blob was specified */
diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c
index 0331fd55e0..ed4bdbd7fb 100644
--- a/src/qemu/qemu_domain.c
+++ b/src/qemu/qemu_domain.c
@@ -6115,7 +6115,8 @@  void qemuDomainObjTaint(virQEMUDriverPtr driver,
 
 void qemuDomainObjCheckTaint(virQEMUDriverPtr driver,
                              virDomainObjPtr obj,
-                             qemuDomainLogContextPtr logCtxt)
+                             qemuDomainLogContextPtr logCtxt,
+                             bool incomingMigration)
 {
     size_t i;
     g_autoptr(virQEMUDriverConfig) cfg = virQEMUDriverGetConfig(driver);
@@ -6144,7 +6145,9 @@  void qemuDomainObjCheckTaint(virQEMUDriverPtr driver,
                            VIR_DOMAIN_TAINT_CUSTOM_HYPERVISOR_FEATURE, logCtxt);
     }
 
-    if (obj->def->cpu && obj->def->cpu->mode == VIR_CPU_MODE_HOST_PASSTHROUGH)
+    if (obj->def->cpu &&
+        obj->def->cpu->mode == VIR_CPU_MODE_HOST_PASSTHROUGH &&
+        incomingMigration)
         qemuDomainObjTaint(driver, obj, VIR_DOMAIN_TAINT_HOST_CPU, logCtxt);
 
     for (i = 0; i < obj->def->ndisks; i++)
diff --git a/src/qemu/qemu_domain.h b/src/qemu/qemu_domain.h
index ec776ced72..9bf32e16c9 100644
--- a/src/qemu/qemu_domain.h
+++ b/src/qemu/qemu_domain.h
@@ -567,7 +567,8 @@  void qemuDomainObjTaint(virQEMUDriverPtr driver,
 
 void qemuDomainObjCheckTaint(virQEMUDriverPtr driver,
                              virDomainObjPtr obj,
-                             qemuDomainLogContextPtr logCtxt);
+                             qemuDomainLogContextPtr logCtxt,
+                             bool incomingMigration);
 void qemuDomainObjCheckDiskTaint(virQEMUDriverPtr driver,
                                  virDomainObjPtr obj,
                                  virDomainDiskDefPtr disk,
diff --git a/src/qemu/qemu_process.c b/src/qemu/qemu_process.c
index 9122069cc9..57d764014a 100644
--- a/src/qemu/qemu_process.c
+++ b/src/qemu/qemu_process.c
@@ -6856,7 +6856,7 @@  qemuProcessLaunch(virConnectPtr conn,
 
     qemuLogOperation(vm, "starting up", cmd, logCtxt);
 
-    qemuDomainObjCheckTaint(driver, vm, logCtxt);
+    qemuDomainObjCheckTaint(driver, vm, logCtxt, incoming != NULL);
 
     qemuDomainLogContextMarkPosition(logCtxt);