Skip to content

Commit

Permalink
tracing: start trace processing thread in final child process
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Christian Borntraeger <[email protected]>
[minor whitespace fixes]
Signed-off-by: Stefan Hajnoczi <[email protected]>
  • Loading branch information
mimu001 authored and stefanhaRH committed Jan 27, 2014
1 parent 0169c51 commit 8a745f2
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions vl.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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();
Expand Down

0 comments on commit 8a745f2

Please sign in to comment.