All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH 02/12] trace+libvirt: start trace processing thread in final child process
@ 2013-07-15 19:41 Christian Borntraeger
  2013-07-16  3:05 ` Stefan Hajnoczi
  0 siblings, 1 reply; 6+ messages in thread
From: Christian Borntraeger @ 2013-07-15 19:41 UTC (permalink / raw)
  To: aliguori; +Cc: Christian Borntraeger, Michael Mueller, qemu-devel, Lluís

From: Michael Mueller <mimu@linux.vnet.ibm.com>

When running with trace backend e.g. "simple" the writer thread needs to be
implemented in the same process context as the trace points that will be
processed. Under libvirtd control, qemu gets first started in daemonized
mode to privide its capabilities. Creating the writer thread in the initial
process context then leads to a dead lock because the thread gets termined
together with the initial parent. (-daemonize) This results in
stale qemu processes.
Fix this by deferring trace initialization.

Signed-off-by: Michael Mueller <mimu@linux.vnet.ibm.com>
[Christian Borntraeger: white space fixes]
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
---
 vl.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/vl.c b/vl.c
index 25b8f2f..3c24108 100644
--- a/vl.c
+++ b/vl.c
@@ -3935,8 +3935,10 @@ int main(int argc, char **argv, char **envp)
         qemu_set_log(mask);
     }
 
-    if (!trace_backend_init(trace_events, trace_file)) {
-        exit(1);
+    if (!is_daemonized()) {
+        if (!trace_backend_init(trace_events, trace_file)) {
+            exit(1);
+        }
     }
 
     /* If no data_dir is specified then try to find it relative to the
@@ -4429,6 +4431,12 @@ int main(int argc, char **argv, char **envp)
 
     os_setup_post();
 
+    if (is_daemonized()) {
+        if (!trace_backend_init(trace_events, trace_file)) {
+            exit(1);
+        }
+    }
+
     main_loop();
     bdrv_close_all();
     pause_all_vcpus();
-- 
1.8.1.4

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2013-09-23 13:09 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-15 19:41 [Qemu-devel] [PATCH 02/12] trace+libvirt: start trace processing thread in final child process Christian Borntraeger
2013-07-16  3:05 ` Stefan Hajnoczi
2013-07-16 12:17   ` Michael Mueller
2013-07-17  2:08     ` Stefan Hajnoczi
2013-09-06 14:06       ` Michael Mueller
2013-09-23 13:09         ` Stefan Hajnoczi

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.