From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:44438) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W7nZ4-0006qe-HP for qemu-devel@nongnu.org; Mon, 27 Jan 2014 09:53:40 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W7nYy-0008DD-HY for qemu-devel@nongnu.org; Mon, 27 Jan 2014 09:53:30 -0500 Received: from mx1.redhat.com ([209.132.183.28]:7451) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W7nYy-0008D8-A8 for qemu-devel@nongnu.org; Mon, 27 Jan 2014 09:53:24 -0500 From: Stefan Hajnoczi Date: Mon, 27 Jan 2014 15:53:03 +0100 Message-Id: <1390834386-23139-2-git-send-email-stefanha@redhat.com> In-Reply-To: <1390834386-23139-1-git-send-email-stefanha@redhat.com> References: <1390834386-23139-1-git-send-email-stefanha@redhat.com> Subject: [Qemu-devel] [PULL 1/4] tracing: start trace processing thread in final child process List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Peter Maydell , Anthony Liguori From: Michael Mueller 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 Signed-off-by: Christian Borntraeger [minor whitespace fixes] Signed-off-by: Stefan Hajnoczi --- 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