Received: from eggs.gnu.org ([2001:4830:134:3::10]:45822) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VO7Fp-0004nl-SZ for qemu-devel@nongnu.org; Mon, 23 Sep 2013 10:36:58 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VO7Fg-00006J-KL for qemu-devel@nongnu.org; Mon, 23 Sep 2013 10:36:49 -0400 Received: from e06smtp15.uk.ibm.com ([195.75.94.111]:53154) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VO7Fg-000066-AA for qemu-devel@nongnu.org; Mon, 23 Sep 2013 10:36:40 -0400 Received: from /spool/local by e06smtp15.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 23 Sep 2013 15:36:37 +0100 Received: from b06cxnps4076.portsmouth.uk.ibm.com (d06relay13.portsmouth.uk.ibm.com [9.149.109.198]) by d06dlp03.portsmouth.uk.ibm.com (Postfix) with ESMTP id 348A21B08061 for ; Mon, 23 Sep 2013 15:36:36 +0100 (BST) Received: from d06av12.portsmouth.uk.ibm.com (d06av12.portsmouth.uk.ibm.com [9.149.37.247]) by b06cxnps4076.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id r8NEaMt152887654 for ; Mon, 23 Sep 2013 14:36:22 GMT Received: from d06av12.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av12.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id r8NEaWBl024751 for ; Mon, 23 Sep 2013 08:36:34 -0600 From: Christian Borntraeger Date: Mon, 23 Sep 2013 16:36:54 +0200 Message-Id: <1379947014-14216-1-git-send-email-borntraeger@de.ibm.com> Subject: [Qemu-devel] [PATCH] tracing: start trace processing thread in final child process List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Stefan Hajnoczi Cc: Christian Borntraeger , =?UTF-8?q?Llu=C3=ADs?= , Michael Mueller , qemu-devel@nongnu.org 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] --- vl.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/vl.c b/vl.c index 4e709d5..93670c8 100644 --- a/vl.c +++ b/vl.c @@ -3863,8 +3863,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 @@ -4358,6 +4360,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.3.1