[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [PULL 05/13] trace: split trace_init_file out of trace_
From: |
Alex Bennée |
Subject: |
Re: [Qemu-devel] [PULL 05/13] trace: split trace_init_file out of trace_init_backends |
Date: |
Mon, 08 Feb 2016 18:43:55 +0000 |
User-agent: |
mu4e 0.9.17; emacs 25.0.90.4 |
Stefan Hajnoczi <address@hidden> writes:
> From: Paolo Bonzini <address@hidden>
>
> This is cleaner, and improves error reporting with -daemonize.
>
> Signed-off-by: Paolo Bonzini <address@hidden>
> Signed-off-by: Denis V. Lunev <address@hidden>
> Acked-by: Christian Borntraeger <address@hidden>
> Message-id: address@hidden
> Signed-off-by: Stefan Hajnoczi <address@hidden>
> ---
> qemu-io.c | 2 +-
> trace/control.c | 17 ++++++++++++-----
> trace/control.h | 13 ++++++++++++-
> trace/simple.c | 6 ++----
> trace/simple.h | 4 ++--
> vl.c | 13 +++++++++----
> 6 files changed, 38 insertions(+), 17 deletions(-)
>
> diff --git a/qemu-io.c b/qemu-io.c
> index 1c11d57..83c48f4 100644
> --- a/qemu-io.c
> +++ b/qemu-io.c
> @@ -435,7 +435,7 @@ int main(int argc, char **argv)
> }
> break;
> case 'T':
> - if (!trace_init_backends(optarg)) {
> + if (!trace_init_backends()) {
> exit(1); /* error message will have been printed */
> }
> break;
> diff --git a/trace/control.c b/trace/control.c
> index 931d64c..f5a497a 100644
> --- a/trace/control.c
> +++ b/trace/control.c
> @@ -145,17 +145,24 @@ void trace_init_events(const char *fname)
> loc_pop(&loc);
> }
>
> -bool trace_init_backends(const char *file)
> +void trace_init_file(const char *file)
> {
> #ifdef CONFIG_TRACE_SIMPLE
> - if (!st_init(file)) {
> - fprintf(stderr, "failed to initialize simple tracing backend.\n");
> - return false;
> - }
> + st_set_trace_file(file);
This breaks "make check" as st_set_trace_file will attempt to flush the
file:
/* Halt trace writeout */
flush_trace_file(true);
trace_writeout_enabled = false;
flush_trace_file(true);
And this deadlocks waiting for trace_empty_cond to get tickled which
will never happen because:
<snip>
> diff --git a/vl.c b/vl.c
> index ff2a7d5..955f364 100644
> --- a/vl.c
> +++ b/vl.c
> @@ -2988,7 +2988,7 @@ int main(int argc, char **argv, char **envp)
> bool userconfig = true;
> const char *log_mask = NULL;
> const char *log_file = NULL;
> - const char *trace_file = NULL;
> + char *trace_file = NULL;
> ram_addr_t maxram_size;
> uint64_t ram_slots = 0;
> FILE *vmstate_dump_file = NULL;
> @@ -3905,7 +3905,10 @@ int main(int argc, char **argv, char **envp)
> exit(1);
> }
> trace_init_events(qemu_opt_get(opts, "events"));
> - trace_file = qemu_opt_get(opts, "file");
> + if (trace_file) {
> + g_free(trace_file);
> + }
> + trace_file = g_strdup(qemu_opt_get(opts, "file"));
> qemu_opts_del(opts);
> break;
> }
> @@ -4089,6 +4092,8 @@ int main(int argc, char **argv, char **envp)
> exit(0);
> }
>
> + trace_init_file(trace_file);
> +
This happens before:
> */
> if (log_file) {
> @@ -4106,7 +4111,7 @@ int main(int argc, char **argv, char **envp)
> }
>
> if (!is_daemonized()) {
> - if (!trace_init_backends(trace_file)) {
> + if (!trace_init_backends()) {
> exit(1);
> }
> }
> @@ -4653,7 +4658,7 @@ int main(int argc, char **argv, char **envp)
> os_setup_post();
>
> if (is_daemonized()) {
> - if (!trace_init_backends(trace_file)) {
> + if (!trace_init_backends()) {
This which creates the thread.
> exit(1);
> }
> }
--
Alex Bennée
- [Qemu-devel] [PULL 00/13] Tracing patches, Stefan Hajnoczi, 2016/02/03
- [Qemu-devel] [PULL 01/13] trace: count number of enabled events, Stefan Hajnoczi, 2016/02/03
- [Qemu-devel] [PULL 03/13] trace: fix documentation, Stefan Hajnoczi, 2016/02/03
- [Qemu-devel] [PULL 02/13] trace: track enabled events in a separate array, Stefan Hajnoczi, 2016/02/03
- [Qemu-devel] [PULL 04/13] trace: split trace_init_events out of trace_init_backends, Stefan Hajnoczi, 2016/02/03
- [Qemu-devel] [PULL 06/13] trace: no need to call trace_backend_init in different branches now, Stefan Hajnoczi, 2016/02/03
- [Qemu-devel] [PULL 05/13] trace: split trace_init_file out of trace_init_backends, Stefan Hajnoczi, 2016/02/03
- Re: [Qemu-devel] [PULL 05/13] trace: split trace_init_file out of trace_init_backends,
Alex Bennée <=
[Qemu-devel] [PULL 07/13] trace: add "-trace enable=...", Stefan Hajnoczi, 2016/02/03
[Qemu-devel] [PULL 08/13] trace: add "-trace help", Stefan Hajnoczi, 2016/02/03
[Qemu-devel] [PULL 09/13] log: do not unnecessarily include qom/cpu.h, Stefan Hajnoczi, 2016/02/03
[Qemu-devel] [PULL 10/13] log: move qemu-log.c into util/ directory, Stefan Hajnoczi, 2016/02/03