Commit 8a745f2a authored by Michael Mueller's avatar Michael Mueller Committed by Stefan Hajnoczi
Browse files

tracing: start trace processing thread in final child process



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: default avatarMichael Mueller <mimu@linux.vnet.ibm.com>
Signed-off-by: default avatarChristian Borntraeger <borntraeger@de.ibm.com>
[minor whitespace fixes]
Signed-off-by: default avatarStefan Hajnoczi <stefanha@redhat.com>
parent 0169c511
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -3879,9 +3879,11 @@ int main(int argc, char **argv, char **envp)
        qemu_set_log(mask);
    }

    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
       executable path.  */
@@ -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();