qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Stefan Hajnoczi <stefanha@redhat.com>
To: qemu-devel@nongnu.org
Cc: Peter Maydell <peter.maydell@linaro.org>,
	Anthony Liguori <aliguori@amazon.com>
Subject: [Qemu-devel] [PULL 1/4] tracing: start trace processing thread in final child process
Date: Mon, 27 Jan 2014 15:53:03 +0100	[thread overview]
Message-ID: <1390834386-23139-2-git-send-email-stefanha@redhat.com> (raw)
In-Reply-To: <1390834386-23139-1-git-send-email-stefanha@redhat.com>

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)

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

diff --git a/vl.c b/vl.c
index 7f4fe0d..63f4d55 100644
--- a/vl.c
+++ b/vl.c
@@ -3879,8 +3879,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
@@ -4379,6 +4381,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.4.2

  reply	other threads:[~2014-01-27 14:53 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-27 14:53 [Qemu-devel] [PULL 0/4] Tracing patches Stefan Hajnoczi
2014-01-27 14:53 ` Stefan Hajnoczi [this message]
2014-01-27 19:25   ` [Qemu-devel] [PULL 1/4] tracing: start trace processing thread in final child process Eric Blake
2014-01-27 14:53 ` [Qemu-devel] [PULL 2/4] trace: [simple] Do not include "trace/simple.h" in generated tracer headers Stefan Hajnoczi
2014-01-27 14:53 ` [Qemu-devel] [PULL 3/4] trace: add glib 2.32+ static GMutex support Stefan Hajnoczi
2014-01-27 15:15   ` Daniel P. Berrange
2014-01-28 12:01     ` Stefan Hajnoczi
2014-01-27 14:53 ` [Qemu-devel] [PULL 4/4] trace: fix simple trace "disable" keyword Stefan Hajnoczi
2014-01-31 11:22 ` [Qemu-devel] [PULL 0/4] Tracing patches Peter Maydell

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1390834386-23139-2-git-send-email-stefanha@redhat.com \
    --to=stefanha@redhat.com \
    --cc=aliguori@amazon.com \
    --cc=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).