Noticed when breaking on 'fork()' in qemuxml2argvtest (output slihtly
trimmed, of unimportant file locations:

  #0  0x00007ffff75abf18 in fork () at /lib64/libc.so.6
  #1  0x00007ffff7b88387 in virFork () at 
../../../libvirt/src/util/vircommand.c:282
  #2  0x00007ffff7b8a7d2 in virExec (cmd=0x55555740d440) at 
../../../libvirt/src/util/vircommand.c:741
  #3  virCommandRunAsync (cmd=cmd@entry=0x55555740d440, pid=pid@entry=0x0) at 
../../../libvirt/src/util/vircommand.c:2658
  #4  0x00007ffff7b8c04f in virCommandRun (cmd=cmd@entry=0x55555740d440, 
exitstatus=exitstatus@entry=0x0)
  #5  0x00007ffff79f6daa in qemuVhostUserFillDomainGPU 
(driver=driver@entry=0x555555586120 <driver>, video=0x5555573e8d80)
  #6  0x00007ffff79f73f5 in qemuExtVhostUserGPUPrepareDomain 
(driver=driver@entry=0x555555586120 <driver>, video=<optimized out>)
  #7  0x00007ffff797c569 in qemuExtDevicesPrepareDomain 
(driver=driver@entry=0x555555586120 <driver>, vm=vm@entry=0x5555573dfef0)
  #8  0x00007ffff79d69ef in qemuProcessPrepareDomain
  #9  0x00007ffff79dda36 in qemuProcessCreatePretendCmdPrepare
  #10 0x000055555556fa28 in testCompareXMLToArgvCreateArgs
  #11 testCompareXMLToArgv (data=0x5555573440f0) at 
../../../libvirt/tests/qemuxml2argvtest.c:733
  #12 0x0000555555570f7a in virTestRun
  #13 0x0000555555571201 in virTestRunLog
      (ret=0x7fffffffdb4c, title=0x55555697c360 "QEMU XML-2-ARGV 
virtio-options.x86_64-latest", body=0x55555556f820 <testCompareXMLToArgv>, 
data=0x5555573440f0) at ../../../libvirt/tests/testutils.c:198
  #14 0x000055555555c1b9 in testRun

Code paths in 'qemuProcessPrepareDomain' should not invoke external
helpers. Note this in a comment and mock the function for now. It will
need a more complex refactor.

Signed-off-by: Peter Krempa <pkre...@redhat.com>
---
 src/qemu/qemu_vhost_user_gpu.c | 4 ++++
 src/qemu/qemu_vhost_user_gpu.h | 2 +-
 tests/qemuxml2argvmock.c       | 9 +++++++++
 3 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/src/qemu/qemu_vhost_user_gpu.c b/src/qemu/qemu_vhost_user_gpu.c
index 933adfe8de..cca76526d1 100644
--- a/src/qemu/qemu_vhost_user_gpu.c
+++ b/src/qemu/qemu_vhost_user_gpu.c
@@ -78,6 +78,10 @@ qemuVhostUserGPUGetPid(const char *stateDir,
 }


+/** TODO: this is called from qemuProcessPrepareDomain which is NOT supposed to
+ * query the host in any way. This function is mocked in qemuxml2argvmock.so
+ * to prevent probing the host vgpu process capabilities.
+ */
 int qemuExtVhostUserGPUPrepareDomain(virQEMUDriver *driver,
                                      virDomainVideoDef *video)
 {
diff --git a/src/qemu/qemu_vhost_user_gpu.h b/src/qemu/qemu_vhost_user_gpu.h
index 2b86982cb8..d19798d781 100644
--- a/src/qemu/qemu_vhost_user_gpu.h
+++ b/src/qemu/qemu_vhost_user_gpu.h
@@ -26,7 +26,7 @@
 int qemuExtVhostUserGPUPrepareDomain(virQEMUDriver *driver,
                                      virDomainVideoDef *video)
     ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2)
-    G_GNUC_WARN_UNUSED_RESULT;
+    G_GNUC_WARN_UNUSED_RESULT G_NO_INLINE;

 int qemuExtVhostUserGPUStart(virQEMUDriver *driver,
                              virDomainObj *vm,
diff --git a/tests/qemuxml2argvmock.c b/tests/qemuxml2argvmock.c
index 52c44b2ed0..2deccd79c4 100644
--- a/tests/qemuxml2argvmock.c
+++ b/tests/qemuxml2argvmock.c
@@ -37,6 +37,7 @@
 #include "qemu/qemu_command.h"
 #include <unistd.h>
 #include <fcntl.h>
+#include "qemu/qemu_vhost_user_gpu.h"

 #define VIR_FROM_THIS VIR_FROM_NONE

@@ -267,3 +268,11 @@ virIdentityEnsureSystemToken(void)
 {
     return g_strdup("3de80bcbf22d4833897f1638e01be9b2");
 }
+
+
+int
+qemuExtVhostUserGPUPrepareDomain(virQEMUDriver *driver G_GNUC_UNUSED,
+                                 virDomainVideoDef *video G_GNUC_UNUSED)
+{
+    return 0;
+}
-- 
2.43.0
_______________________________________________
Devel mailing list -- devel@lists.libvirt.org
To unsubscribe send an email to devel-le...@lists.libvirt.org

Reply via email to