All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v3 00/11] simplify usage of tracepoints, and connect them to logging
@ 2015-10-29 20:44 Denis V. Lunev
  2015-10-29 20:44 ` [Qemu-devel] [PATCH 01/11] trace: fix documentation Denis V. Lunev
                   ` (13 more replies)
  0 siblings, 14 replies; 23+ messages in thread
From: Denis V. Lunev @ 2015-10-29 20:44 UTC (permalink / raw)
  Cc: Denis V. Lunev, qemu-devel, Paolo Bonzini

This series does three things:

1) add a "-trace [enable=]foo" option to enable one or more trace
events, and a "-trace help" option to show the list of tracepoints
(patches 4-5)

2) change the stderr tracing backend so that it prints to the
-D log file, and enable it by default.  "-trace file=..." is
now a synonym of -D if the log backend is enabled (patches 7-8)

3) add a "-d trace:foo" option that is a synonym for "-trace foo";
this makes the new functionality more discoverable to people used
to "-d", makes it available for user-mode emulation (which does
not have -trace), and is somewhat nice if you want to enable both
tracepoints and some other "-d" flag (patch 9).  When globbing
it is also less susceptible to unwanted shell expansion.

For example, you can trace block device I/O and save the result
to a file just by adding "-trace bdrv_aio_*,file=trace.txt", or
correlate it to guest PCs with "-d exec,nochain,trace:bdrv_aio_*".

Opinions?  I would like to have this in 2.5 if there is agreement.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Denis V. Lunev <den@openvz.org>

Changes from v2:
- compilation fix was extended to patch 2 and 3
- replaced Reviewed-by with Acked-by by request from Christian

Changes from v1:
- small cleanup to vl.c is added as patch (4)
- compilation is fixed in patch (2)
- moved qemu-log.c to util/log.c to fix linking of qemu-io/qemu-nbd

Denis V. Lunev (2):
  trace: no need to call trace_backend_init in different branches now
  log: move qemu-log.c into util/ directory

Paolo Bonzini (9):
  trace: fix documentation
  trace: split trace_init_events out of trace_init_backends
  trace: split trace_init_file out of trace_init_backends
  trace: add "-trace enable=..."
  trace: add "-trace help"
  log: do not unnecessarily include qom/cpu.h
  trace: convert stderr backend to log
  trace: switch default backend to "log"
  log: add "-d trace:PATTERN"

 Makefile.objs                                   |  1 -
 bsd-user/main.c                                 |  1 +
 configure                                       |  6 +-
 cpu-exec.c                                      |  1 +
 exec.c                                          |  1 +
 hw/acpi/cpu_hotplug.c                           |  1 +
 hw/timer/a9gtimer.c                             |  1 +
 include/exec/log.h                              | 60 ++++++++++++++++
 include/qemu/log.h                              | 60 +---------------
 linux-user/main.c                               |  1 +
 qemu-io.c                                       |  2 +-
 qemu-options.hx                                 | 22 ++++--
 qom/cpu.c                                       |  1 +
 scripts/tracetool/backend/{stderr.py => log.py} |  9 +--
 target-alpha/translate.c                        |  1 +
 target-arm/translate.c                          |  1 +
 target-cris/translate.c                         |  1 +
 target-i386/seg_helper.c                        |  1 +
 target-i386/smm_helper.c                        |  1 +
 target-i386/translate.c                         |  1 +
 target-lm32/helper.c                            |  1 +
 target-lm32/translate.c                         |  1 +
 target-m68k/translate.c                         |  1 +
 target-microblaze/helper.c                      |  1 +
 target-microblaze/translate.c                   |  1 +
 target-mips/helper.c                            |  1 +
 target-mips/translate.c                         |  1 +
 target-moxie/translate.c                        |  1 +
 target-openrisc/translate.c                     |  1 +
 target-ppc/mmu-hash32.c                         |  1 +
 target-ppc/mmu-hash64.c                         |  1 +
 target-ppc/mmu_helper.c                         |  1 +
 target-ppc/translate.c                          |  1 +
 target-s390x/translate.c                        |  1 +
 target-sh4/helper.c                             |  1 +
 target-sh4/translate.c                          |  1 +
 target-sparc/int32_helper.c                     |  1 +
 target-sparc/int64_helper.c                     |  1 +
 target-sparc/translate.c                        |  1 +
 target-tilegx/translate.c                       |  1 +
 target-tricore/translate.c                      |  1 +
 target-unicore32/translate.c                    |  1 +
 target-xtensa/translate.c                       |  1 +
 tcg/tcg.c                                       |  1 +
 trace/control.c                                 | 95 ++++++++++++++++++-------
 trace/control.h                                 | 42 ++++++++++-
 trace/simple.c                                  |  6 +-
 trace/simple.h                                  |  4 +-
 translate-all.c                                 |  1 +
 util/Makefile.objs                              |  1 +
 qemu-log.c => util/log.c                        | 19 ++++-
 vl.c                                            | 38 +++++-----
 52 files changed, 274 insertions(+), 129 deletions(-)
 create mode 100644 include/exec/log.h
 rename scripts/tracetool/backend/{stderr.py => log.py} (78%)
 rename qemu-log.c => util/log.c (90%)

-- 
2.1.4

^ permalink raw reply	[flat|nested] 23+ messages in thread

* [Qemu-devel] [PATCH 01/11] trace: fix documentation
  2015-10-29 20:44 [Qemu-devel] [PATCH v3 00/11] simplify usage of tracepoints, and connect them to logging Denis V. Lunev
@ 2015-10-29 20:44 ` Denis V. Lunev
  2015-10-29 20:44 ` [Qemu-devel] [PATCH 02/11] trace: split trace_init_events out of trace_init_backends Denis V. Lunev
                   ` (12 subsequent siblings)
  13 siblings, 0 replies; 23+ messages in thread
From: Denis V. Lunev @ 2015-10-29 20:44 UTC (permalink / raw)
  Cc: Paolo Bonzini, qemu-devel, Denis V. Lunev

From: Paolo Bonzini <pbonzini@redhat.com>

Mention the ftrace backend too.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Denis V. Lunev <den@openvz.org>
Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
---
 qemu-options.hx | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/qemu-options.hx b/qemu-options.hx
index 949db7f..594cddd 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -3485,13 +3485,13 @@ Specify tracing options.
 @table @option
 @item events=@var{file}
 Immediately enable events listed in @var{file}.
-The file must contain one event name (as listed in the @var{trace-events} file)
-per line.
-This option is only available if QEMU has been compiled with
-either @var{simple} or @var{stderr} tracing backend.
+The file must contain one event name (as listed in the @file{trace-events} file)
+per line; globbing patterns are accepted too.  This option is only
+available if QEMU has been compiled with the @var{simple}, @var{stderr} or
+@var{ftrace} tracing backend.
+
 @item file=@var{file}
 Log output traces to @var{file}.
-
 This option is only available if QEMU has been compiled with
 the @var{simple} tracing backend.
 @end table
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [Qemu-devel] [PATCH 02/11] trace: split trace_init_events out of trace_init_backends
  2015-10-29 20:44 [Qemu-devel] [PATCH v3 00/11] simplify usage of tracepoints, and connect them to logging Denis V. Lunev
  2015-10-29 20:44 ` [Qemu-devel] [PATCH 01/11] trace: fix documentation Denis V. Lunev
@ 2015-10-29 20:44 ` Denis V. Lunev
  2015-10-29 20:44 ` [Qemu-devel] [PATCH 03/11] trace: split trace_init_file " Denis V. Lunev
                   ` (11 subsequent siblings)
  13 siblings, 0 replies; 23+ messages in thread
From: Denis V. Lunev @ 2015-10-29 20:44 UTC (permalink / raw)
  Cc: Paolo Bonzini, qemu-devel, Denis V. Lunev

From: Paolo Bonzini <pbonzini@redhat.com>

This is cleaner and has two advantages.  First, it improves error
reporting with -daemonize.  Second, multiple "-trace events" options
now cumulate.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Denis V. Lunev <den@openvz.org>
Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
---
 qemu-io.c       |  2 +-
 trace/control.c |  5 ++---
 trace/control.h | 15 ++++++++++++---
 vl.c            |  8 ++++----
 4 files changed, 19 insertions(+), 11 deletions(-)

diff --git a/qemu-io.c b/qemu-io.c
index 269f17c..d6fa11b 100644
--- a/qemu-io.c
+++ b/qemu-io.c
@@ -440,7 +440,7 @@ int main(int argc, char **argv)
             }
             break;
         case 'T':
-            if (!trace_init_backends(optarg, NULL)) {
+            if (!trace_init_backends(optarg)) {
                 exit(1); /* error message will have been printed */
             }
             break;
diff --git a/trace/control.c b/trace/control.c
index 995beb3..ee5fbca 100644
--- a/trace/control.c
+++ b/trace/control.c
@@ -85,7 +85,7 @@ TraceEvent *trace_event_pattern(const char *pat, TraceEvent *ev)
     return NULL;
 }
 
-static void trace_init_events(const char *fname)
+void trace_init_events(const char *fname)
 {
     Location loc;
     FILE *fp;
@@ -142,7 +142,7 @@ static void trace_init_events(const char *fname)
     loc_pop(&loc);
 }
 
-bool trace_init_backends(const char *events, const char *file)
+bool trace_init_backends(const char *file)
 {
 #ifdef CONFIG_TRACE_SIMPLE
     if (!st_init(file)) {
@@ -164,6 +164,5 @@ bool trace_init_backends(const char *events, const char *file)
     }
 #endif
 
-    trace_init_events(events);
     return true;
 }
diff --git a/trace/control.h b/trace/control.h
index da9bb6b..bfbe560 100644
--- a/trace/control.h
+++ b/trace/control.h
@@ -150,8 +150,6 @@ static void trace_event_set_state_dynamic(TraceEvent *ev, bool state);
 
 /**
  * trace_init_backends:
- * @events: Name of file with events to be enabled at startup; may be NULL.
- *          Corresponds to commandline option "-trace events=...".
  * @file:   Name of trace output file; may be NULL.
  *          Corresponds to commandline option "-trace file=...".
  *
@@ -159,7 +157,18 @@ static void trace_event_set_state_dynamic(TraceEvent *ev, bool state);
  *
  * Returns: Whether the backends could be successfully initialized.
  */
-bool trace_init_backends(const char *events, const char *file);
+bool trace_init_backends(const char *file);
+
+/**
+ * trace_init_events:
+ * @events: Name of file with events to be enabled at startup; may be NULL.
+ *          Corresponds to commandline option "-trace events=...".
+ *
+ * Read the list of enabled tracing events.
+ *
+ * Returns: Whether the backends could be successfully initialized.
+ */
+void trace_init_events(const char *file);
 
 
 #include "trace/control-internal.h"
diff --git a/vl.c b/vl.c
index f5f7c3f..129177e 100644
--- a/vl.c
+++ b/vl.c
@@ -2961,7 +2961,6 @@ int main(int argc, char **argv, char **envp)
     bool userconfig = true;
     const char *log_mask = NULL;
     const char *log_file = NULL;
-    const char *trace_events = NULL;
     const char *trace_file = NULL;
     ram_addr_t maxram_size;
     uint64_t ram_slots = 0;
@@ -3886,8 +3885,9 @@ int main(int argc, char **argv, char **envp)
                 if (!opts) {
                     exit(1);
                 }
-                trace_events = qemu_opt_get(opts, "events");
+                trace_init_events(qemu_opt_get(opts, "events"));
                 trace_file = qemu_opt_get(opts, "file");
+                qemu_opts_del(opts);
                 break;
             }
             case QEMU_OPTION_readconfig:
@@ -4084,7 +4084,7 @@ int main(int argc, char **argv, char **envp)
     }
 
     if (!is_daemonized()) {
-        if (!trace_init_backends(trace_events, trace_file)) {
+        if (!trace_init_backends(trace_file)) {
             exit(1);
         }
     }
@@ -4636,7 +4636,7 @@ int main(int argc, char **argv, char **envp)
     os_setup_post();
 
     if (is_daemonized()) {
-        if (!trace_init_backends(trace_events, trace_file)) {
+        if (!trace_init_backends(trace_file)) {
             exit(1);
         }
     }
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [Qemu-devel] [PATCH 03/11] trace: split trace_init_file out of trace_init_backends
  2015-10-29 20:44 [Qemu-devel] [PATCH v3 00/11] simplify usage of tracepoints, and connect them to logging Denis V. Lunev
  2015-10-29 20:44 ` [Qemu-devel] [PATCH 01/11] trace: fix documentation Denis V. Lunev
  2015-10-29 20:44 ` [Qemu-devel] [PATCH 02/11] trace: split trace_init_events out of trace_init_backends Denis V. Lunev
@ 2015-10-29 20:44 ` Denis V. Lunev
  2015-10-29 20:44 ` [Qemu-devel] [PATCH 04/11] trace: no need to call trace_backend_init in different branches now Denis V. Lunev
                   ` (10 subsequent siblings)
  13 siblings, 0 replies; 23+ messages in thread
From: Denis V. Lunev @ 2015-10-29 20:44 UTC (permalink / raw)
  Cc: Paolo Bonzini, qemu-devel, Denis V. Lunev

From: Paolo Bonzini <pbonzini@redhat.com>

This is cleaner, and improves error reporting with -daemonize.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Denis V. Lunev <den@openvz.org>
Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
---
 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 d6fa11b..fbddf82 100644
--- a/qemu-io.c
+++ b/qemu-io.c
@@ -440,7 +440,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 ee5fbca..3e33d03 100644
--- a/trace/control.c
+++ b/trace/control.c
@@ -142,17 +142,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);
 #else
     if (file) {
         fprintf(stderr, "error: -trace file=...: "
                 "option not supported by the selected tracing backends\n");
+        exit(1);
+    }
+#endif
+}
+
+bool trace_init_backends(void)
+{
+#ifdef CONFIG_TRACE_SIMPLE
+    if (!st_init()) {
+        fprintf(stderr, "failed to initialize simple tracing backend.\n");
         return false;
     }
 #endif
diff --git a/trace/control.h b/trace/control.h
index bfbe560..d2506d4 100644
--- a/trace/control.h
+++ b/trace/control.h
@@ -157,7 +157,7 @@ static void trace_event_set_state_dynamic(TraceEvent *ev, bool state);
  *
  * Returns: Whether the backends could be successfully initialized.
  */
-bool trace_init_backends(const char *file);
+bool trace_init_backends(void);
 
 /**
  * trace_init_events:
@@ -170,6 +170,17 @@ bool trace_init_backends(const char *file);
  */
 void trace_init_events(const char *file);
 
+/**
+ * trace_init_file:
+ * @file:   Name of trace output file; may be NULL.
+ *          Corresponds to commandline option "-trace file=...".
+ *
+ * Record the name of the output file for the tracing backend.
+ * Exits if no selected backend does not support specifying the
+ * output file, and a non-NULL file was passed.
+ */
+void trace_init_file(const char *file);
+
 
 #include "trace/control-internal.h"
 
diff --git a/trace/simple.c b/trace/simple.c
index 11ad030..a4bc705 100644
--- a/trace/simple.c
+++ b/trace/simple.c
@@ -322,7 +322,7 @@ void st_set_trace_file_enabled(bool enable)
  * @file        The trace file name or NULL for the default name-<pid> set at
  *              config time
  */
-bool st_set_trace_file(const char *file)
+void st_set_trace_file(const char *file)
 {
     st_set_trace_file_enabled(false);
 
@@ -335,7 +335,6 @@ bool st_set_trace_file(const char *file)
     }
 
     st_set_trace_file_enabled(true);
-    return true;
 }
 
 void st_print_trace_file_status(FILE *stream, int (*stream_printf)(FILE *stream, const char *fmt, ...))
@@ -373,7 +372,7 @@ static GThread *trace_thread_create(GThreadFunc fn)
     return thread;
 }
 
-bool st_init(const char *file)
+bool st_init(void)
 {
     GThread *thread;
 
@@ -386,6 +385,5 @@ bool st_init(const char *file)
     }
 
     atexit(st_flush_trace_buffer);
-    st_set_trace_file(file);
     return true;
 }
diff --git a/trace/simple.h b/trace/simple.h
index 6997996..8d1a32e 100644
--- a/trace/simple.h
+++ b/trace/simple.h
@@ -20,8 +20,8 @@
 
 void st_print_trace_file_status(FILE *stream, fprintf_function stream_printf);
 void st_set_trace_file_enabled(bool enable);
-bool st_set_trace_file(const char *file);
-bool st_init(const char *file);
+void st_set_trace_file(const char *file);
+bool st_init(void);
 void st_flush_trace_buffer(void);
 
 typedef struct {
diff --git a/vl.c b/vl.c
index 129177e..0424ce5 100644
--- a/vl.c
+++ b/vl.c
@@ -2961,7 +2961,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;
@@ -3886,7 +3886,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;
             }
@@ -4067,6 +4070,8 @@ int main(int argc, char **argv, char **envp)
         exit(0);
     }
 
+    trace_init_file(trace_file);
+
     /* Open the logfile at this point and set the log mask if necessary.
      */
     if (log_file) {
@@ -4084,7 +4089,7 @@ int main(int argc, char **argv, char **envp)
     }
 
     if (!is_daemonized()) {
-        if (!trace_init_backends(trace_file)) {
+        if (!trace_init_backends()) {
             exit(1);
         }
     }
@@ -4636,7 +4641,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()) {
             exit(1);
         }
     }
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [Qemu-devel] [PATCH 04/11] trace: no need to call trace_backend_init in different branches now
  2015-10-29 20:44 [Qemu-devel] [PATCH v3 00/11] simplify usage of tracepoints, and connect them to logging Denis V. Lunev
                   ` (2 preceding siblings ...)
  2015-10-29 20:44 ` [Qemu-devel] [PATCH 03/11] trace: split trace_init_file " Denis V. Lunev
@ 2015-10-29 20:44 ` Denis V. Lunev
  2015-10-29 20:44 ` [Qemu-devel] [PATCH 05/11] trace: add "-trace enable=..." Denis V. Lunev
                   ` (9 subsequent siblings)
  13 siblings, 0 replies; 23+ messages in thread
From: Denis V. Lunev @ 2015-10-29 20:44 UTC (permalink / raw)
  Cc: Denis V. Lunev, qemu-devel

original idea to split calling locations was to spawn tracing thread
in the final child process according to

    commit 8a745f2a9296ad2cf6bda33534ed298f2625a4ad
    Author: Michael Mueller
    Date:   Mon Sep 23 16:36:54 2013 +0200

os_daemonize is now on top of both locations. Drop unneeded ifs.

Signed-off-by: Denis V. Lunev <den@openvz.org>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
---
 vl.c | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

diff --git a/vl.c b/vl.c
index 0424ce5..4261662 100644
--- a/vl.c
+++ b/vl.c
@@ -4088,10 +4088,8 @@ int main(int argc, char **argv, char **envp)
         qemu_set_log(mask);
     }
 
-    if (!is_daemonized()) {
-        if (!trace_init_backends()) {
-            exit(1);
-        }
+    if (!trace_init_backends()) {
+        exit(1);
     }
 
     /* If no data_dir is specified then try to find it relative to the
@@ -4640,12 +4638,6 @@ int main(int argc, char **argv, char **envp)
 
     os_setup_post();
 
-    if (is_daemonized()) {
-        if (!trace_init_backends()) {
-            exit(1);
-        }
-    }
-
     main_loop();
     bdrv_close_all();
     pause_all_vcpus();
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [Qemu-devel] [PATCH 05/11] trace: add "-trace enable=..."
  2015-10-29 20:44 [Qemu-devel] [PATCH v3 00/11] simplify usage of tracepoints, and connect them to logging Denis V. Lunev
                   ` (3 preceding siblings ...)
  2015-10-29 20:44 ` [Qemu-devel] [PATCH 04/11] trace: no need to call trace_backend_init in different branches now Denis V. Lunev
@ 2015-10-29 20:44 ` Denis V. Lunev
  2015-10-29 20:44 ` [Qemu-devel] [PATCH 06/11] trace: add "-trace help" Denis V. Lunev
                   ` (8 subsequent siblings)
  13 siblings, 0 replies; 23+ messages in thread
From: Denis V. Lunev @ 2015-10-29 20:44 UTC (permalink / raw)
  Cc: Paolo Bonzini, qemu-devel, Denis V. Lunev

From: Paolo Bonzini <pbonzini@redhat.com>

Allow enabling events without going through a file, for example:

   qemu-system-x86_64 -trace bdrv_aio_writev -trace bdrv_aio_readv

or with globbing too:

   qemu-system-x86_64 -trace 'bdrv_aio_*'

if an appropriate backend is enabled (simple, stderr, ftrace).

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Denis V. Lunev <den@openvz.org>
Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
---
 qemu-options.hx | 10 +++++++++-
 trace/control.c | 48 +++++++++++++++++++++++++++---------------------
 trace/control.h |  9 +++++++++
 vl.c            | 11 +++++++++--
 4 files changed, 54 insertions(+), 24 deletions(-)

diff --git a/qemu-options.hx b/qemu-options.hx
index 594cddd..6e8cc0c 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -3471,7 +3471,7 @@ config files on @var{sysconfdir}, but won't make it skip the QEMU-provided confi
 files from @var{datadir}.
 ETEXI
 DEF("trace", HAS_ARG, QEMU_OPTION_trace,
-    "-trace [events=<file>][,file=<file>]\n"
+    "-trace [[enable=]<pattern>][,events=<file>][,file=<file>]\n"
     "                specify tracing options\n",
     QEMU_ARCH_ALL)
 STEXI
@@ -3483,6 +3483,14 @@ HXCOMM HX does not support conditional compilation of text.
 Specify tracing options.
 
 @table @option
+@item [enable=]@var{pattern}
+Immediately enable events matching @var{pattern}.
+The file must contain one event name (as listed in the @file{trace-events} file)
+per line; globbing patterns are accepted too.  This option is only
+available if QEMU has been compiled with the @var{simple}, @var{stderr}
+or @var{ftrace} tracing backend.  To specify multiple events or patterns,
+specify the @option{-trace} option multiple times.
+
 @item events=@var{file}
 Immediately enable events listed in @var{file}.
 The file must contain one event name (as listed in the @file{trace-events} file)
diff --git a/trace/control.c b/trace/control.c
index 3e33d03..715b5b7 100644
--- a/trace/control.c
+++ b/trace/control.c
@@ -85,6 +85,32 @@ TraceEvent *trace_event_pattern(const char *pat, TraceEvent *ev)
     return NULL;
 }
 
+void trace_enable_events(const char *line_buf)
+{
+    const bool enable = ('-' != line_buf[0]);
+    const char *line_ptr = enable ? line_buf : line_buf + 1;
+
+    if (trace_event_is_pattern(line_ptr)) {
+        TraceEvent *ev = NULL;
+        while ((ev = trace_event_pattern(line_ptr, ev)) != NULL) {
+            if (trace_event_get_state_static(ev)) {
+                trace_event_set_state_dynamic(ev, enable);
+            }
+        }
+    } else {
+        TraceEvent *ev = trace_event_name(line_ptr);
+        if (ev == NULL) {
+            error_report("WARNING: trace event '%s' does not exist",
+                         line_ptr);
+        } else if (!trace_event_get_state_static(ev)) {
+            error_report("WARNING: trace event '%s' is not traceable",
+                         line_ptr);
+        } else {
+            trace_event_set_state_dynamic(ev, enable);
+        }
+    }
+}
+
 void trace_init_events(const char *fname)
 {
     Location loc;
@@ -111,27 +137,7 @@ void trace_init_events(const char *fname)
             if ('#' == line_buf[0]) { /* skip commented lines */
                 continue;
             }
-            const bool enable = ('-' != line_buf[0]);
-            char *line_ptr = enable ? line_buf : line_buf + 1;
-            if (trace_event_is_pattern(line_ptr)) {
-                TraceEvent *ev = NULL;
-                while ((ev = trace_event_pattern(line_ptr, ev)) != NULL) {
-                    if (trace_event_get_state_static(ev)) {
-                        trace_event_set_state_dynamic(ev, enable);
-                    }
-                }
-            } else {
-                TraceEvent *ev = trace_event_name(line_ptr);
-                if (ev == NULL) {
-                    error_report("WARNING: trace event '%s' does not exist",
-                                 line_ptr);
-                } else if (!trace_event_get_state_static(ev)) {
-                    error_report("WARNING: trace event '%s' is not traceable",
-                                 line_ptr);
-                } else {
-                    trace_event_set_state_dynamic(ev, enable);
-                }
-            }
+            trace_enable_events(line_buf);
         }
     }
     if (fclose(fp) != 0) {
diff --git a/trace/control.h b/trace/control.h
index d2506d4..32a66ce 100644
--- a/trace/control.h
+++ b/trace/control.h
@@ -181,6 +181,15 @@ void trace_init_events(const char *file);
  */
 void trace_init_file(const char *file);
 
+/**
+ * trace_enable_events:
+ * @line_buf: A string with a glob pattern of events to be enabled or,
+ *            if the string starts with '-', disabled.
+ *
+ * Enable or disable matching events.
+ */
+void trace_enable_events(const char *line_buf);
+
 
 #include "trace/control-internal.h"
 
diff --git a/vl.c b/vl.c
index 4261662..83ffd92 100644
--- a/vl.c
+++ b/vl.c
@@ -269,10 +269,14 @@ static QemuOptsList qemu_sandbox_opts = {
 
 static QemuOptsList qemu_trace_opts = {
     .name = "trace",
-    .implied_opt_name = "trace",
+    .implied_opt_name = "enable",
     .head = QTAILQ_HEAD_INITIALIZER(qemu_trace_opts.head),
     .desc = {
         {
+            .name = "enable",
+            .type = QEMU_OPT_STRING,
+        },
+        {
             .name = "events",
             .type = QEMU_OPT_STRING,
         },{
@@ -3881,10 +3885,13 @@ int main(int argc, char **argv, char **envp)
             case QEMU_OPTION_trace:
             {
                 opts = qemu_opts_parse_noisily(qemu_find_opts("trace"),
-                                               optarg, false);
+                                               optarg, true);
                 if (!opts) {
                     exit(1);
                 }
+                if (qemu_opt_get(opts, "enable")) {
+                    trace_enable_events(qemu_opt_get(opts, "enable"));
+                }
                 trace_init_events(qemu_opt_get(opts, "events"));
                 if (trace_file) {
                     g_free(trace_file);
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [Qemu-devel] [PATCH 06/11] trace: add "-trace help"
  2015-10-29 20:44 [Qemu-devel] [PATCH v3 00/11] simplify usage of tracepoints, and connect them to logging Denis V. Lunev
                   ` (4 preceding siblings ...)
  2015-10-29 20:44 ` [Qemu-devel] [PATCH 05/11] trace: add "-trace enable=..." Denis V. Lunev
@ 2015-10-29 20:44 ` Denis V. Lunev
  2015-10-29 20:44 ` [Qemu-devel] [PATCH 07/11] log: do not unnecessarily include qom/cpu.h Denis V. Lunev
                   ` (7 subsequent siblings)
  13 siblings, 0 replies; 23+ messages in thread
From: Denis V. Lunev @ 2015-10-29 20:44 UTC (permalink / raw)
  Cc: Paolo Bonzini, qemu-devel, Denis V. Lunev

From: Paolo Bonzini <pbonzini@redhat.com>

Print a list of trace points

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Denis V. Lunev <den@openvz.org>
Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
---
 qemu-options.hx |  2 ++
 trace/control.c | 21 ++++++++++++++++++++-
 trace/control.h |  7 +++++++
 3 files changed, 29 insertions(+), 1 deletion(-)

diff --git a/qemu-options.hx b/qemu-options.hx
index 6e8cc0c..b36d8b9 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -3491,6 +3491,8 @@ available if QEMU has been compiled with the @var{simple}, @var{stderr}
 or @var{ftrace} tracing backend.  To specify multiple events or patterns,
 specify the @option{-trace} option multiple times.
 
+Use @code{-trace help} to print a list of names of trace points.
+
 @item events=@var{file}
 Immediately enable events listed in @var{file}.
 The file must contain one event name (as listed in the @file{trace-events} file)
diff --git a/trace/control.c b/trace/control.c
index 715b5b7..7c84795 100644
--- a/trace/control.c
+++ b/trace/control.c
@@ -85,7 +85,16 @@ TraceEvent *trace_event_pattern(const char *pat, TraceEvent *ev)
     return NULL;
 }
 
-void trace_enable_events(const char *line_buf)
+void trace_list_events(void)
+{
+    int i;
+    for (i = 0; i < trace_event_count(); i++) {
+        TraceEvent *res = trace_event_id(i);
+        fprintf(stderr, "%s\n", trace_event_get_name(res));
+    }
+}
+
+static void do_trace_enable_events(const char *line_buf)
 {
     const bool enable = ('-' != line_buf[0]);
     const char *line_ptr = enable ? line_buf : line_buf + 1;
@@ -111,6 +120,16 @@ void trace_enable_events(const char *line_buf)
     }
 }
 
+void trace_enable_events(const char *line_buf)
+{
+    if (is_help_option(line_buf)) {
+        trace_list_events();
+        exit(0);
+    } else {
+        do_trace_enable_events(line_buf);
+    }
+}
+
 void trace_init_events(const char *fname)
 {
     Location loc;
diff --git a/trace/control.h b/trace/control.h
index 32a66ce..3707b3b 100644
--- a/trace/control.h
+++ b/trace/control.h
@@ -182,6 +182,13 @@ void trace_init_events(const char *file);
 void trace_init_file(const char *file);
 
 /**
+ * trace_list_events:
+ *
+ * List all available events.
+ */
+void trace_list_events(void);
+
+/**
  * trace_enable_events:
  * @line_buf: A string with a glob pattern of events to be enabled or,
  *            if the string starts with '-', disabled.
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [Qemu-devel] [PATCH 07/11] log: do not unnecessarily include qom/cpu.h
  2015-10-29 20:44 [Qemu-devel] [PATCH v3 00/11] simplify usage of tracepoints, and connect them to logging Denis V. Lunev
                   ` (5 preceding siblings ...)
  2015-10-29 20:44 ` [Qemu-devel] [PATCH 06/11] trace: add "-trace help" Denis V. Lunev
@ 2015-10-29 20:44 ` Denis V. Lunev
  2015-10-29 20:44 ` [Qemu-devel] [PATCH 08/11] log: move qemu-log.c into util/ directory Denis V. Lunev
                   ` (6 subsequent siblings)
  13 siblings, 0 replies; 23+ messages in thread
From: Denis V. Lunev @ 2015-10-29 20:44 UTC (permalink / raw)
  Cc: Paolo Bonzini, qemu-devel, Denis V. Lunev

From: Paolo Bonzini <pbonzini@redhat.com>

Split the bits that require it to exec/log.h.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Denis V. Lunev <den@openvz.org>
Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
---
 bsd-user/main.c               |  1 +
 cpu-exec.c                    |  1 +
 exec.c                        |  1 +
 hw/acpi/cpu_hotplug.c         |  1 +
 hw/timer/a9gtimer.c           |  1 +
 include/exec/log.h            | 60 +++++++++++++++++++++++++++++++++++++++++++
 include/qemu/log.h            | 59 ------------------------------------------
 linux-user/main.c             |  1 +
 qom/cpu.c                     |  1 +
 target-alpha/translate.c      |  1 +
 target-arm/translate.c        |  1 +
 target-cris/translate.c       |  1 +
 target-i386/seg_helper.c      |  1 +
 target-i386/smm_helper.c      |  1 +
 target-i386/translate.c       |  1 +
 target-lm32/helper.c          |  1 +
 target-lm32/translate.c       |  1 +
 target-m68k/translate.c       |  1 +
 target-microblaze/helper.c    |  1 +
 target-microblaze/translate.c |  1 +
 target-mips/helper.c          |  1 +
 target-mips/translate.c       |  1 +
 target-moxie/translate.c      |  1 +
 target-openrisc/translate.c   |  1 +
 target-ppc/mmu-hash32.c       |  1 +
 target-ppc/mmu-hash64.c       |  1 +
 target-ppc/mmu_helper.c       |  1 +
 target-ppc/translate.c        |  1 +
 target-s390x/translate.c      |  1 +
 target-sh4/helper.c           |  1 +
 target-sh4/translate.c        |  1 +
 target-sparc/int32_helper.c   |  1 +
 target-sparc/int64_helper.c   |  1 +
 target-sparc/translate.c      |  1 +
 target-tilegx/translate.c     |  1 +
 target-tricore/translate.c    |  1 +
 target-unicore32/translate.c  |  1 +
 target-xtensa/translate.c     |  1 +
 tcg/tcg.c                     |  1 +
 translate-all.c               |  1 +
 40 files changed, 98 insertions(+), 59 deletions(-)
 create mode 100644 include/exec/log.h

diff --git a/bsd-user/main.c b/bsd-user/main.c
index adf2de0..520ce99 100644
--- a/bsd-user/main.c
+++ b/bsd-user/main.c
@@ -33,6 +33,7 @@
 #include "tcg.h"
 #include "qemu/timer.h"
 #include "qemu/envlist.h"
+#include "exec/log.h"
 
 int singlestep;
 unsigned long mmap_min_addr;
diff --git a/cpu-exec.c b/cpu-exec.c
index 7eef083..564a21d 100644
--- a/cpu-exec.c
+++ b/cpu-exec.c
@@ -27,6 +27,7 @@
 #include "exec/address-spaces.h"
 #include "qemu/rcu.h"
 #include "exec/tb-hash.h"
+#include "exec/log.h"
 #if defined(TARGET_I386) && !defined(CONFIG_USER_ONLY)
 #include "hw/i386/apic.h"
 #endif
diff --git a/exec.c b/exec.c
index 8af2570..87636a6 100644
--- a/exec.c
+++ b/exec.c
@@ -53,6 +53,7 @@
 
 #include "exec/memory-internal.h"
 #include "exec/ram_addr.h"
+#include "exec/log.h"
 
 #include "qemu/range.h"
 #ifndef _WIN32
diff --git a/hw/acpi/cpu_hotplug.c b/hw/acpi/cpu_hotplug.c
index f5b9972..16bacfc 100644
--- a/hw/acpi/cpu_hotplug.c
+++ b/hw/acpi/cpu_hotplug.c
@@ -11,6 +11,7 @@
  */
 #include "hw/hw.h"
 #include "hw/acpi/cpu_hotplug.h"
+#include "qom/cpu.h"
 
 static uint64_t cpu_status_read(void *opaque, hwaddr addr, unsigned int size)
 {
diff --git a/hw/timer/a9gtimer.c b/hw/timer/a9gtimer.c
index dd4aae8..b38c76a 100644
--- a/hw/timer/a9gtimer.c
+++ b/hw/timer/a9gtimer.c
@@ -24,6 +24,7 @@
 #include "qemu/timer.h"
 #include "qemu/bitops.h"
 #include "qemu/log.h"
+#include "qom/cpu.h"
 
 #ifndef A9_GTIMER_ERR_DEBUG
 #define A9_GTIMER_ERR_DEBUG 0
diff --git a/include/exec/log.h b/include/exec/log.h
new file mode 100644
index 0000000..ba1c9b5
--- /dev/null
+++ b/include/exec/log.h
@@ -0,0 +1,60 @@
+#ifndef QEMU_EXEC_LOG_H
+#define QEMU_EXEC_LOG_H
+
+#include "qemu/log.h"
+#include "qom/cpu.h"
+#include "disas/disas.h"
+
+/* cpu_dump_state() logging functions: */
+/**
+ * log_cpu_state:
+ * @cpu: The CPU whose state is to be logged.
+ * @flags: Flags what to log.
+ *
+ * Logs the output of cpu_dump_state().
+ */
+static inline void log_cpu_state(CPUState *cpu, int flags)
+{
+    if (qemu_log_enabled()) {
+        cpu_dump_state(cpu, qemu_logfile, fprintf, flags);
+    }
+}
+
+/**
+ * log_cpu_state_mask:
+ * @mask: Mask when to log.
+ * @cpu: The CPU whose state is to be logged.
+ * @flags: Flags what to log.
+ *
+ * Logs the output of cpu_dump_state() if loglevel includes @mask.
+ */
+static inline void log_cpu_state_mask(int mask, CPUState *cpu, int flags)
+{
+    if (qemu_loglevel & mask) {
+        log_cpu_state(cpu, flags);
+    }
+}
+
+#ifdef NEED_CPU_H
+/* disas() and target_disas() to qemu_logfile: */
+static inline void log_target_disas(CPUState *cpu, target_ulong start,
+                                    target_ulong len, int flags)
+{
+    target_disas(qemu_logfile, cpu, start, len, flags);
+}
+
+static inline void log_disas(void *code, unsigned long size)
+{
+    disas(qemu_logfile, code, size);
+}
+
+#if defined(CONFIG_USER_ONLY)
+/* page_dump() output to the log file: */
+static inline void log_page_dump(void)
+{
+    page_dump(qemu_logfile);
+}
+#endif
+#endif
+
+#endif
diff --git a/include/qemu/log.h b/include/qemu/log.h
index 7de4500..ed57a3d 100644
--- a/include/qemu/log.h
+++ b/include/qemu/log.h
@@ -5,10 +5,6 @@
 #include <stdbool.h>
 #include <stdio.h>
 #include "qemu/compiler.h"
-#include "qom/cpu.h"
-#ifdef NEED_CPU_H
-#include "disas/disas.h"
-#endif
 
 /* Private global variables, don't use */
 extern FILE *qemu_logfile;
@@ -71,61 +67,6 @@ qemu_log_vprintf(const char *fmt, va_list va)
 void GCC_FMT_ATTR(2, 3) qemu_log_mask(int mask, const char *fmt, ...);
 
 
-/* Special cases: */
-
-/* cpu_dump_state() logging functions: */
-/**
- * log_cpu_state:
- * @cpu: The CPU whose state is to be logged.
- * @flags: Flags what to log.
- *
- * Logs the output of cpu_dump_state().
- */
-static inline void log_cpu_state(CPUState *cpu, int flags)
-{
-    if (qemu_log_enabled()) {
-        cpu_dump_state(cpu, qemu_logfile, fprintf, flags);
-    }
-}
-
-/**
- * log_cpu_state_mask:
- * @mask: Mask when to log.
- * @cpu: The CPU whose state is to be logged.
- * @flags: Flags what to log.
- *
- * Logs the output of cpu_dump_state() if loglevel includes @mask.
- */
-static inline void log_cpu_state_mask(int mask, CPUState *cpu, int flags)
-{
-    if (qemu_loglevel & mask) {
-        log_cpu_state(cpu, flags);
-    }
-}
-
-#ifdef NEED_CPU_H
-/* disas() and target_disas() to qemu_logfile: */
-static inline void log_target_disas(CPUState *cpu, target_ulong start,
-                                    target_ulong len, int flags)
-{
-    target_disas(qemu_logfile, cpu, start, len, flags);
-}
-
-static inline void log_disas(void *code, unsigned long size)
-{
-    disas(qemu_logfile, code, size);
-}
-
-#if defined(CONFIG_USER_ONLY)
-/* page_dump() output to the log file: */
-static inline void log_page_dump(void)
-{
-    page_dump(qemu_logfile);
-}
-#endif
-#endif
-
-
 /* Maintenance: */
 
 /* fflush() the log file */
diff --git a/linux-user/main.c b/linux-user/main.c
index 8acfe0f..8430fb8 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -33,6 +33,7 @@
 #include "qemu/timer.h"
 #include "qemu/envlist.h"
 #include "elf.h"
+#include "exec/log.h"
 
 char *exec_path;
 
diff --git a/qom/cpu.c b/qom/cpu.c
index fb80d13..ce7dfa2 100644
--- a/qom/cpu.c
+++ b/qom/cpu.c
@@ -23,6 +23,7 @@
 #include "sysemu/kvm.h"
 #include "qemu/notify.h"
 #include "qemu/log.h"
+#include "exec/log.h"
 #include "qemu/error-report.h"
 #include "sysemu/sysemu.h"
 
diff --git a/target-alpha/translate.c b/target-alpha/translate.c
index 87950c6..711a67c 100644
--- a/target-alpha/translate.c
+++ b/target-alpha/translate.c
@@ -27,6 +27,7 @@
 #include "exec/helper-gen.h"
 
 #include "trace-tcg.h"
+#include "exec/log.h"
 
 
 #undef ALPHA_DEBUG_DISAS
diff --git a/target-arm/translate.c b/target-arm/translate.c
index b10a455..c7b50f8 100644
--- a/target-arm/translate.c
+++ b/target-arm/translate.c
@@ -36,6 +36,7 @@
 #include "exec/helper-gen.h"
 
 #include "trace-tcg.h"
+#include "exec/log.h"
 
 
 #define ENABLE_ARCH_4T    arm_dc_feature(s, ARM_FEATURE_V4T)
diff --git a/target-cris/translate.c b/target-cris/translate.c
index 2d710cc..954a6f5 100644
--- a/target-cris/translate.c
+++ b/target-cris/translate.c
@@ -34,6 +34,7 @@
 #include "exec/helper-gen.h"
 
 #include "trace-tcg.h"
+#include "exec/log.h"
 
 
 #define DISAS_CRIS 0
diff --git a/target-i386/seg_helper.c b/target-i386/seg_helper.c
index 20ee892..e55694f 100644
--- a/target-i386/seg_helper.c
+++ b/target-i386/seg_helper.c
@@ -22,6 +22,7 @@
 #include "qemu/log.h"
 #include "exec/helper-proto.h"
 #include "exec/cpu_ldst.h"
+#include "exec/log.h"
 
 //#define DEBUG_PCALL
 
diff --git a/target-i386/smm_helper.c b/target-i386/smm_helper.c
index c272a98..1ab6637 100644
--- a/target-i386/smm_helper.c
+++ b/target-i386/smm_helper.c
@@ -19,6 +19,7 @@
 
 #include "cpu.h"
 #include "exec/helper-proto.h"
+#include "exec/log.h"
 
 /* SMM support */
 
diff --git a/target-i386/translate.c b/target-i386/translate.c
index b400d24..58e1d7d 100644
--- a/target-i386/translate.c
+++ b/target-i386/translate.c
@@ -32,6 +32,7 @@
 #include "exec/helper-gen.h"
 
 #include "trace-tcg.h"
+#include "exec/log.h"
 
 
 #define PREFIX_REPZ   0x01
diff --git a/target-lm32/helper.c b/target-lm32/helper.c
index e26c133..978b99f 100644
--- a/target-lm32/helper.c
+++ b/target-lm32/helper.c
@@ -21,6 +21,7 @@
 #include "qemu/host-utils.h"
 #include "sysemu/sysemu.h"
 #include "exec/semihost.h"
+#include "exec/log.h"
 
 int lm32_cpu_handle_mmu_fault(CPUState *cs, vaddr address, int rw,
                               int mmu_idx)
diff --git a/target-lm32/translate.c b/target-lm32/translate.c
index fa5b0b9..ad6bd20 100644
--- a/target-lm32/translate.c
+++ b/target-lm32/translate.c
@@ -28,6 +28,7 @@
 #include "exec/helper-gen.h"
 
 #include "trace-tcg.h"
+#include "exec/log.h"
 
 
 #define DISAS_LM32 1
diff --git a/target-m68k/translate.c b/target-m68k/translate.c
index 41ae2c6..03772cf 100644
--- a/target-m68k/translate.c
+++ b/target-m68k/translate.c
@@ -28,6 +28,7 @@
 #include "exec/helper-gen.h"
 
 #include "trace-tcg.h"
+#include "exec/log.h"
 
 
 //#define DEBUG_DISPATCH 1
diff --git a/target-microblaze/helper.c b/target-microblaze/helper.c
index 8257b0e..ee65245 100644
--- a/target-microblaze/helper.c
+++ b/target-microblaze/helper.c
@@ -20,6 +20,7 @@
 
 #include "cpu.h"
 #include "qemu/host-utils.h"
+#include "exec/log.h"
 
 #define D(x)
 
diff --git a/target-microblaze/translate.c b/target-microblaze/translate.c
index 154b9d6..dfd6e32 100644
--- a/target-microblaze/translate.c
+++ b/target-microblaze/translate.c
@@ -27,6 +27,7 @@
 #include "exec/helper-gen.h"
 
 #include "trace-tcg.h"
+#include "exec/log.h"
 
 
 #define SIM_COMPAT 0
diff --git a/target-mips/helper.c b/target-mips/helper.c
index 01c4461..bab8e17 100644
--- a/target-mips/helper.c
+++ b/target-mips/helper.c
@@ -25,6 +25,7 @@
 #include "cpu.h"
 #include "sysemu/kvm.h"
 #include "exec/cpu_ldst.h"
+#include "exec/log.h"
 
 enum {
     TLBRET_XI = -6,
diff --git a/target-mips/translate.c b/target-mips/translate.c
index a10bfa3..3b9315c 100644
--- a/target-mips/translate.c
+++ b/target-mips/translate.c
@@ -32,6 +32,7 @@
 #include "exec/semihost.h"
 
 #include "trace-tcg.h"
+#include "exec/log.h"
 
 #define MIPS_DEBUG_DISAS 0
 
diff --git a/target-moxie/translate.c b/target-moxie/translate.c
index 6dedcb7..9e2ac47 100644
--- a/target-moxie/translate.c
+++ b/target-moxie/translate.c
@@ -35,6 +35,7 @@
 
 #include "exec/helper-proto.h"
 #include "exec/helper-gen.h"
+#include "exec/log.h"
 
 /* This is the state at translation time.  */
 typedef struct DisasContext {
diff --git a/target-openrisc/translate.c b/target-openrisc/translate.c
index 606490a..b572eee 100644
--- a/target-openrisc/translate.c
+++ b/target-openrisc/translate.c
@@ -32,6 +32,7 @@
 #include "exec/helper-gen.h"
 
 #include "trace-tcg.h"
+#include "exec/log.h"
 
 
 #define OPENRISC_DISAS
diff --git a/target-ppc/mmu-hash32.c b/target-ppc/mmu-hash32.c
index dfee358..6453856 100644
--- a/target-ppc/mmu-hash32.c
+++ b/target-ppc/mmu-hash32.c
@@ -23,6 +23,7 @@
 #include "sysemu/kvm.h"
 #include "kvm_ppc.h"
 #include "mmu-hash32.h"
+#include "exec/log.h"
 
 //#define DEBUG_MMU
 //#define DEBUG_BAT
diff --git a/target-ppc/mmu-hash64.c b/target-ppc/mmu-hash64.c
index 7df6ede..73edde6 100644
--- a/target-ppc/mmu-hash64.c
+++ b/target-ppc/mmu-hash64.c
@@ -22,6 +22,7 @@
 #include "sysemu/kvm.h"
 #include "kvm_ppc.h"
 #include "mmu-hash64.h"
+#include "exec/log.h"
 
 //#define DEBUG_MMU
 //#define DEBUG_SLB
diff --git a/target-ppc/mmu_helper.c b/target-ppc/mmu_helper.c
index e52d0e5..b4fea22 100644
--- a/target-ppc/mmu_helper.c
+++ b/target-ppc/mmu_helper.c
@@ -23,6 +23,7 @@
 #include "mmu-hash64.h"
 #include "mmu-hash32.h"
 #include "exec/cpu_ldst.h"
+#include "exec/log.h"
 
 //#define DEBUG_MMU
 //#define DEBUG_BATS
diff --git a/target-ppc/translate.c b/target-ppc/translate.c
index 308ad68..3078f88 100644
--- a/target-ppc/translate.c
+++ b/target-ppc/translate.c
@@ -28,6 +28,7 @@
 #include "exec/helper-gen.h"
 
 #include "trace-tcg.h"
+#include "exec/log.h"
 
 
 #define CPU_SINGLE_STEP 0x1
diff --git a/target-s390x/translate.c b/target-s390x/translate.c
index c79a2cb..4c69ee3 100644
--- a/target-s390x/translate.c
+++ b/target-s390x/translate.c
@@ -43,6 +43,7 @@ static TCGv_ptr cpu_env;
 #include "exec/helper-gen.h"
 
 #include "trace-tcg.h"
+#include "exec/log.h"
 
 
 /* Information that (most) every instruction needs to manipulate.  */
diff --git a/target-sh4/helper.c b/target-sh4/helper.c
index eaececd..90b4405 100644
--- a/target-sh4/helper.c
+++ b/target-sh4/helper.c
@@ -23,6 +23,7 @@
 #include <inttypes.h>
 
 #include "cpu.h"
+#include "exec/log.h"
 
 #if !defined(CONFIG_USER_ONLY)
 #include "hw/sh4/sh_intc.h"
diff --git a/target-sh4/translate.c b/target-sh4/translate.c
index 7bc6216..b07904d 100644
--- a/target-sh4/translate.c
+++ b/target-sh4/translate.c
@@ -28,6 +28,7 @@
 #include "exec/helper-gen.h"
 
 #include "trace-tcg.h"
+#include "exec/log.h"
 
 
 typedef struct DisasContext {
diff --git a/target-sparc/int32_helper.c b/target-sparc/int32_helper.c
index 7c380ba..ac5e599 100644
--- a/target-sparc/int32_helper.c
+++ b/target-sparc/int32_helper.c
@@ -20,6 +20,7 @@
 #include "cpu.h"
 #include "trace.h"
 #include "sysemu/sysemu.h"
+#include "exec/log.h"
 
 #define DEBUG_PCALL
 
diff --git a/target-sparc/int64_helper.c b/target-sparc/int64_helper.c
index b02d22b..a753151 100644
--- a/target-sparc/int64_helper.c
+++ b/target-sparc/int64_helper.c
@@ -19,6 +19,7 @@
 
 #include "cpu.h"
 #include "exec/helper-proto.h"
+#include "exec/log.h"
 #include "trace.h"
 
 #define DEBUG_PCALL
diff --git a/target-sparc/translate.c b/target-sparc/translate.c
index 41a3319..d484f1e 100644
--- a/target-sparc/translate.c
+++ b/target-sparc/translate.c
@@ -33,6 +33,7 @@
 #include "exec/helper-gen.h"
 
 #include "trace-tcg.h"
+#include "exec/log.h"
 
 
 #define DEBUG_DISAS
diff --git a/target-tilegx/translate.c b/target-tilegx/translate.c
index 34d45f8..efd0fd3 100644
--- a/target-tilegx/translate.c
+++ b/target-tilegx/translate.c
@@ -20,6 +20,7 @@
 
 #include "cpu.h"
 #include "qemu/log.h"
+#include "exec/log.h"
 #include "disas/disas.h"
 #include "tcg-op.h"
 #include "exec/cpu_ldst.h"
diff --git a/target-tricore/translate.c b/target-tricore/translate.c
index 135c583..1d29ea1 100644
--- a/target-tricore/translate.c
+++ b/target-tricore/translate.c
@@ -27,6 +27,7 @@
 #include "exec/helper-gen.h"
 
 #include "tricore-opcodes.h"
+#include "exec/log.h"
 
 /*
  * TCG registers
diff --git a/target-unicore32/translate.c b/target-unicore32/translate.c
index d2f92f0..8e9e434 100644
--- a/target-unicore32/translate.c
+++ b/target-unicore32/translate.c
@@ -24,6 +24,7 @@
 #include "exec/helper-gen.h"
 
 #include "trace-tcg.h"
+#include "exec/log.h"
 
 
 /* internal defines */
diff --git a/target-xtensa/translate.c b/target-xtensa/translate.c
index 06b0163..f7ce238 100644
--- a/target-xtensa/translate.c
+++ b/target-xtensa/translate.c
@@ -43,6 +43,7 @@
 #include "exec/helper-gen.h"
 
 #include "trace-tcg.h"
+#include "exec/log.h"
 
 
 typedef struct DisasContext {
diff --git a/tcg/tcg.c b/tcg/tcg.c
index 682af8a..d614751 100644
--- a/tcg/tcg.c
+++ b/tcg/tcg.c
@@ -60,6 +60,7 @@
 #endif
 
 #include "elf.h"
+#include "exec/log.h"
 
 /* Forward declarations for functions declared in tcg-target.c and used here. */
 static void tcg_target_init(TCGContext *s);
diff --git a/translate-all.c b/translate-all.c
index 20ce40e..e9e928e 100644
--- a/translate-all.c
+++ b/translate-all.c
@@ -62,6 +62,7 @@
 #include "translate-all.h"
 #include "qemu/bitmap.h"
 #include "qemu/timer.h"
+#include "exec/log.h"
 
 //#define DEBUG_TB_INVALIDATE
 //#define DEBUG_FLUSH
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [Qemu-devel] [PATCH 08/11] log: move qemu-log.c into util/ directory
  2015-10-29 20:44 [Qemu-devel] [PATCH v3 00/11] simplify usage of tracepoints, and connect them to logging Denis V. Lunev
                   ` (6 preceding siblings ...)
  2015-10-29 20:44 ` [Qemu-devel] [PATCH 07/11] log: do not unnecessarily include qom/cpu.h Denis V. Lunev
@ 2015-10-29 20:44 ` Denis V. Lunev
  2015-10-29 20:44 ` [Qemu-devel] [PATCH 09/11] trace: convert stderr backend to log Denis V. Lunev
                   ` (5 subsequent siblings)
  13 siblings, 0 replies; 23+ messages in thread
From: Denis V. Lunev @ 2015-10-29 20:44 UTC (permalink / raw)
  Cc: Denis V. Lunev, qemu-devel

log will become common facility with tracepoints support in next step.

Signed-off-by: Denis V. Lunev <den@openvz.org>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
---
 Makefile.objs            | 1 -
 util/Makefile.objs       | 1 +
 qemu-log.c => util/log.c | 0
 3 files changed, 1 insertion(+), 1 deletion(-)
 rename qemu-log.c => util/log.c (100%)

diff --git a/Makefile.objs b/Makefile.objs
index fe02ee2..cdd7f83 100644
--- a/Makefile.objs
+++ b/Makefile.objs
@@ -81,7 +81,6 @@ endif
 
 #######################################################################
 # Target-independent parts used in system and user emulation
-common-obj-y += qemu-log.o
 common-obj-y += tcg-runtime.o
 common-obj-y += hw/
 common-obj-y += qom/
diff --git a/util/Makefile.objs b/util/Makefile.objs
index d7cc399..a11915c 100644
--- a/util/Makefile.objs
+++ b/util/Makefile.objs
@@ -29,3 +29,4 @@ util-obj-y += qemu-coroutine.o qemu-coroutine-lock.o qemu-coroutine-io.o
 util-obj-y += qemu-coroutine-sleep.o
 util-obj-y += coroutine-$(CONFIG_COROUTINE_BACKEND).o
 util-obj-y += buffer.o
+util-obj-y += log.o
diff --git a/qemu-log.c b/util/log.c
similarity index 100%
rename from qemu-log.c
rename to util/log.c
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [Qemu-devel] [PATCH 09/11] trace: convert stderr backend to log
  2015-10-29 20:44 [Qemu-devel] [PATCH v3 00/11] simplify usage of tracepoints, and connect them to logging Denis V. Lunev
                   ` (7 preceding siblings ...)
  2015-10-29 20:44 ` [Qemu-devel] [PATCH 08/11] log: move qemu-log.c into util/ directory Denis V. Lunev
@ 2015-10-29 20:44 ` Denis V. Lunev
  2015-10-29 20:44 ` [Qemu-devel] [PATCH 10/11] trace: switch default backend to "log" Denis V. Lunev
                   ` (4 subsequent siblings)
  13 siblings, 0 replies; 23+ messages in thread
From: Denis V. Lunev @ 2015-10-29 20:44 UTC (permalink / raw)
  Cc: Paolo Bonzini, qemu-devel, Denis V. Lunev

From: Paolo Bonzini <pbonzini@redhat.com>

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Denis V. Lunev <den@openvz.org>
Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
---
 configure                                       |  4 ++--
 include/qemu/log.h                              |  1 +
 scripts/tracetool/backend/{stderr.py => log.py} |  9 +++++----
 trace/control.c                                 | 10 ++++++++++
 util/log.c                                      |  3 +++
 vl.c                                            |  2 ++
 6 files changed, 23 insertions(+), 6 deletions(-)
 rename scripts/tracetool/backend/{stderr.py => log.py} (78%)

diff --git a/configure b/configure
index 7a1d08d..5e65dd5 100755
--- a/configure
+++ b/configure
@@ -5300,8 +5300,8 @@ if have_backend "simple"; then
   # Set the appropriate trace file.
   trace_file="\"$trace_file-\" FMT_pid"
 fi
-if have_backend "stderr"; then
-  echo "CONFIG_TRACE_STDERR=y" >> $config_host_mak
+if have_backend "log"; then
+  echo "CONFIG_TRACE_LOG=y" >> $config_host_mak
 fi
 if have_backend "ust"; then
   echo "CONFIG_TRACE_UST=y" >> $config_host_mak
diff --git a/include/qemu/log.h b/include/qemu/log.h
index ed57a3d..5a0fbe3 100644
--- a/include/qemu/log.h
+++ b/include/qemu/log.h
@@ -38,6 +38,7 @@ static inline bool qemu_log_enabled(void)
 #define LOG_GUEST_ERROR    (1 << 11)
 #define CPU_LOG_MMU        (1 << 12)
 #define CPU_LOG_TB_NOCHAIN (1 << 13)
+#define LOG_TRACE          (1 << 14)
 
 /* Returns true if a bit is set in the current loglevel mask
  */
diff --git a/scripts/tracetool/backend/stderr.py b/scripts/tracetool/backend/log.py
similarity index 78%
rename from scripts/tracetool/backend/stderr.py
rename to scripts/tracetool/backend/log.py
index ca58054..a62c310 100644
--- a/scripts/tracetool/backend/stderr.py
+++ b/scripts/tracetool/backend/log.py
@@ -25,6 +25,7 @@ def generate_h_begin(events):
         '#include <sys/types.h>',
         '#include <unistd.h>',
         '#include "trace/control.h"',
+        '#include "qemu/log.h"',
         '')
 
 
@@ -36,10 +37,10 @@ def generate_h(event):
     out('    if (trace_event_get_state(%(event_id)s)) {',
         '        struct timeval _now;',
         '        gettimeofday(&_now, NULL);',
-        '        fprintf(stderr, "%%d@%%zd.%%06zd:%(name)s " %(fmt)s "\\n",',
-        '                        getpid(),',
-        '                        (size_t)_now.tv_sec, (size_t)_now.tv_usec',
-        '                        %(argnames)s);',
+        '        qemu_log_mask(LOG_TRACE, "%%d@%%zd.%%06zd:%(name)s " %(fmt)s "\\n",',
+        '                      getpid(),',
+        '                      (size_t)_now.tv_sec, (size_t)_now.tv_usec',
+        '                      %(argnames)s);',
         '    }',
         event_id="TRACE_" + event.name.upper(),
         name=event.name,
diff --git a/trace/control.c b/trace/control.c
index 7c84795..9a1e381 100644
--- a/trace/control.c
+++ b/trace/control.c
@@ -14,6 +14,9 @@
 #ifdef CONFIG_TRACE_FTRACE
 #include "trace/ftrace.h"
 #endif
+#ifdef CONFIG_TRACE_LOG
+#include "qemu/log.h"
+#endif
 #include "qemu/error-report.h"
 
 TraceEvent *trace_event_name(const char *name)
@@ -171,6 +174,13 @@ void trace_init_file(const char *file)
 {
 #ifdef CONFIG_TRACE_SIMPLE
     st_set_trace_file(file);
+#elif defined CONFIG_TRACE_LOG
+    /* If both the simple and the log backends are enabled, "-trace file"
+     * only applies to the simple backend; use "-D" for the log backend.
+     */
+    if (file) {
+        qemu_set_log_filename(file);
+    }
 #else
     if (file) {
         fprintf(stderr, "error: -trace file=...: "
diff --git a/util/log.c b/util/log.c
index efd07c8..5c641a0 100644
--- a/util/log.c
+++ b/util/log.c
@@ -51,6 +51,9 @@ void qemu_log_mask(int mask, const char *fmt, ...)
 void do_qemu_set_log(int log_flags, bool use_own_buffers)
 {
     qemu_loglevel = log_flags;
+#ifdef CONFIG_TRACE_LOG
+    qemu_loglevel |= LOG_TRACE;
+#endif
     if (qemu_loglevel && !qemu_logfile) {
         if (logfilename) {
             qemu_logfile = fopen(logfilename, log_append ? "a" : "w");
diff --git a/vl.c b/vl.c
index 83ffd92..ca4f7a0 100644
--- a/vl.c
+++ b/vl.c
@@ -4093,6 +4093,8 @@ int main(int argc, char **argv, char **envp)
             exit(1);
         }
         qemu_set_log(mask);
+    } else {
+        qemu_set_log(0);
     }
 
     if (!trace_init_backends()) {
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [Qemu-devel] [PATCH 10/11] trace: switch default backend to "log"
  2015-10-29 20:44 [Qemu-devel] [PATCH v3 00/11] simplify usage of tracepoints, and connect them to logging Denis V. Lunev
                   ` (8 preceding siblings ...)
  2015-10-29 20:44 ` [Qemu-devel] [PATCH 09/11] trace: convert stderr backend to log Denis V. Lunev
@ 2015-10-29 20:44 ` Denis V. Lunev
  2015-10-29 20:44 ` [Qemu-devel] [PATCH 11/11] log: add "-d trace:PATTERN" Denis V. Lunev
                   ` (3 subsequent siblings)
  13 siblings, 0 replies; 23+ messages in thread
From: Denis V. Lunev @ 2015-10-29 20:44 UTC (permalink / raw)
  Cc: Paolo Bonzini, qemu-devel, Denis V. Lunev

From: Paolo Bonzini <pbonzini@redhat.com>

This enables integration with other QEMU logging facilities.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Denis V. Lunev <den@openvz.org>
Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
---
 configure | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configure b/configure
index 5e65dd5..248c4ec 100755
--- a/configure
+++ b/configure
@@ -298,7 +298,7 @@ pkgversion=""
 pie=""
 zero_malloc=""
 qom_cast_debug="yes"
-trace_backends="nop"
+trace_backends="log"
 trace_file="trace"
 spice=""
 rbd=""
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* [Qemu-devel] [PATCH 11/11] log: add "-d trace:PATTERN"
  2015-10-29 20:44 [Qemu-devel] [PATCH v3 00/11] simplify usage of tracepoints, and connect them to logging Denis V. Lunev
                   ` (9 preceding siblings ...)
  2015-10-29 20:44 ` [Qemu-devel] [PATCH 10/11] trace: switch default backend to "log" Denis V. Lunev
@ 2015-10-29 20:44 ` Denis V. Lunev
  2015-11-03 11:39 ` [Qemu-devel] [PATCH v3 00/11] simplify usage of tracepoints, and connect them to logging Denis V. Lunev
                   ` (2 subsequent siblings)
  13 siblings, 0 replies; 23+ messages in thread
From: Denis V. Lunev @ 2015-10-29 20:44 UTC (permalink / raw)
  Cc: Paolo Bonzini, qemu-devel, Denis V. Lunev

From: Paolo Bonzini <pbonzini@redhat.com>

This is a bit easier to use than "-trace" if you are also enabling
other kinds of logging.  It is also more discoverable for experienced
QEMU users, and accessible from user-mode emulators.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Denis V. Lunev <den@openvz.org>
Acked-by: Christian Borntraeger <borntraeger@de.ibm.com>
---
 util/log.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/util/log.c b/util/log.c
index 5c641a0..2bcef95 100644
--- a/util/log.c
+++ b/util/log.c
@@ -19,6 +19,7 @@
 
 #include "qemu-common.h"
 #include "qemu/log.h"
+#include "trace/control.h"
 
 static char *logfilename;
 FILE *qemu_logfile;
@@ -154,6 +155,11 @@ int qemu_str_to_log_mask(const char *str)
             for (item = qemu_log_items; item->mask != 0; item++) {
                 mask |= item->mask;
             }
+#ifdef CONFIG_TRACE_LOG
+        } else if (strncmp(p, "trace:", 6) == 0 && p + 6 != p1) {
+            trace_enable_events(p + 6);
+            mask |= LOG_TRACE;
+#endif
         } else {
             for (item = qemu_log_items; item->mask != 0; item++) {
                 if (cmp1(p, p1 - p, item->name)) {
@@ -161,9 +167,9 @@ int qemu_str_to_log_mask(const char *str)
                 }
             }
             return 0;
+        found:
+            mask |= item->mask;
         }
-    found:
-        mask |= item->mask;
         if (*p1 != ',') {
             break;
         }
@@ -177,6 +183,10 @@ void qemu_print_log_usage(FILE *f)
     const QEMULogItem *item;
     fprintf(f, "Log items (comma separated):\n");
     for (item = qemu_log_items; item->mask != 0; item++) {
-        fprintf(f, "%-10s %s\n", item->name, item->help);
+        fprintf(f, "%-15s %s\n", item->name, item->help);
     }
+#ifdef CONFIG_TRACE_LOG
+    fprintf(f, "trace:PATTERN   enable trace events\n");
+    fprintf(f, "\nUse \"-d trace:help\" to get a list of trace events.\n\n");
+#endif
 }
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* Re: [Qemu-devel] [PATCH v3 00/11] simplify usage of tracepoints, and connect them to logging
  2015-10-29 20:44 [Qemu-devel] [PATCH v3 00/11] simplify usage of tracepoints, and connect them to logging Denis V. Lunev
                   ` (10 preceding siblings ...)
  2015-10-29 20:44 ` [Qemu-devel] [PATCH 11/11] log: add "-d trace:PATTERN" Denis V. Lunev
@ 2015-11-03 11:39 ` Denis V. Lunev
  2015-11-03 15:33   ` Stefan Hajnoczi
  2015-11-03 17:10 ` Stefan Hajnoczi
  2016-01-07  9:58 ` Stefan Hajnoczi
  13 siblings, 1 reply; 23+ messages in thread
From: Denis V. Lunev @ 2015-11-03 11:39 UTC (permalink / raw)
  To: Stefan Hajnoczi, Stefan Hajnoczi; +Cc: Paolo Bonzini, qemu-devel

On 10/29/2015 11:44 PM, Denis V. Lunev wrote:
> This series does three things:
>
> 1) add a "-trace [enable=]foo" option to enable one or more trace
> events, and a "-trace help" option to show the list of tracepoints
> (patches 4-5)
>
> 2) change the stderr tracing backend so that it prints to the
> -D log file, and enable it by default.  "-trace file=..." is
> now a synonym of -D if the log backend is enabled (patches 7-8)
>
> 3) add a "-d trace:foo" option that is a synonym for "-trace foo";
> this makes the new functionality more discoverable to people used
> to "-d", makes it available for user-mode emulation (which does
> not have -trace), and is somewhat nice if you want to enable both
> tracepoints and some other "-d" flag (patch 9).  When globbing
> it is also less susceptible to unwanted shell expansion.
>
> For example, you can trace block device I/O and save the result
> to a file just by adding "-trace bdrv_aio_*,file=trace.txt", or
> correlate it to guest PCs with "-d exec,nochain,trace:bdrv_aio_*".
>
> Opinions?  I would like to have this in 2.5 if there is agreement.
>
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> Signed-off-by: Denis V. Lunev <den@openvz.org>
>
> Changes from v2:
> - compilation fix was extended to patch 2 and 3
> - replaced Reviewed-by with Acked-by by request from Christian
>
> Changes from v1:
> - small cleanup to vl.c is added as patch (4)
> - compilation is fixed in patch (2)
> - moved qemu-log.c to util/log.c to fix linking of qemu-io/qemu-nbd
>
> Denis V. Lunev (2):
>    trace: no need to call trace_backend_init in different branches now
>    log: move qemu-log.c into util/ directory
>
> Paolo Bonzini (9):
>    trace: fix documentation
>    trace: split trace_init_events out of trace_init_backends
>    trace: split trace_init_file out of trace_init_backends
>    trace: add "-trace enable=..."
>    trace: add "-trace help"
>    log: do not unnecessarily include qom/cpu.h
>    trace: convert stderr backend to log
>    trace: switch default backend to "log"
>    log: add "-d trace:PATTERN"
>
>   Makefile.objs                                   |  1 -
>   bsd-user/main.c                                 |  1 +
>   configure                                       |  6 +-
>   cpu-exec.c                                      |  1 +
>   exec.c                                          |  1 +
>   hw/acpi/cpu_hotplug.c                           |  1 +
>   hw/timer/a9gtimer.c                             |  1 +
>   include/exec/log.h                              | 60 ++++++++++++++++
>   include/qemu/log.h                              | 60 +---------------
>   linux-user/main.c                               |  1 +
>   qemu-io.c                                       |  2 +-
>   qemu-options.hx                                 | 22 ++++--
>   qom/cpu.c                                       |  1 +
>   scripts/tracetool/backend/{stderr.py => log.py} |  9 +--
>   target-alpha/translate.c                        |  1 +
>   target-arm/translate.c                          |  1 +
>   target-cris/translate.c                         |  1 +
>   target-i386/seg_helper.c                        |  1 +
>   target-i386/smm_helper.c                        |  1 +
>   target-i386/translate.c                         |  1 +
>   target-lm32/helper.c                            |  1 +
>   target-lm32/translate.c                         |  1 +
>   target-m68k/translate.c                         |  1 +
>   target-microblaze/helper.c                      |  1 +
>   target-microblaze/translate.c                   |  1 +
>   target-mips/helper.c                            |  1 +
>   target-mips/translate.c                         |  1 +
>   target-moxie/translate.c                        |  1 +
>   target-openrisc/translate.c                     |  1 +
>   target-ppc/mmu-hash32.c                         |  1 +
>   target-ppc/mmu-hash64.c                         |  1 +
>   target-ppc/mmu_helper.c                         |  1 +
>   target-ppc/translate.c                          |  1 +
>   target-s390x/translate.c                        |  1 +
>   target-sh4/helper.c                             |  1 +
>   target-sh4/translate.c                          |  1 +
>   target-sparc/int32_helper.c                     |  1 +
>   target-sparc/int64_helper.c                     |  1 +
>   target-sparc/translate.c                        |  1 +
>   target-tilegx/translate.c                       |  1 +
>   target-tricore/translate.c                      |  1 +
>   target-unicore32/translate.c                    |  1 +
>   target-xtensa/translate.c                       |  1 +
>   tcg/tcg.c                                       |  1 +
>   trace/control.c                                 | 95 ++++++++++++++++++-------
>   trace/control.h                                 | 42 ++++++++++-
>   trace/simple.c                                  |  6 +-
>   trace/simple.h                                  |  4 +-
>   translate-all.c                                 |  1 +
>   util/Makefile.objs                              |  1 +
>   qemu-log.c => util/log.c                        | 19 ++++-
>   vl.c                                            | 38 +++++-----
>   52 files changed, 274 insertions(+), 129 deletions(-)
>   create mode 100644 include/exec/log.h
>   rename scripts/tracetool/backend/{stderr.py => log.py} (78%)
>   rename qemu-log.c => util/log.c (90%)
>
Stefan,

It seems that I have missed you and other people except
Paolo in v3 submission :( The difference is only compilation
fix in patches 2/3.

My fault :(

Should I re-submit or you can take this and push them as
negotiated before?

Den

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [Qemu-devel] [PATCH v3 00/11] simplify usage of tracepoints, and connect them to logging
  2015-11-03 11:39 ` [Qemu-devel] [PATCH v3 00/11] simplify usage of tracepoints, and connect them to logging Denis V. Lunev
@ 2015-11-03 15:33   ` Stefan Hajnoczi
  0 siblings, 0 replies; 23+ messages in thread
From: Stefan Hajnoczi @ 2015-11-03 15:33 UTC (permalink / raw)
  To: Denis V. Lunev; +Cc: Stefan Hajnoczi, qemu-devel, Paolo Bonzini

[-- Attachment #1: Type: text/plain, Size: 6052 bytes --]

On Tue, Nov 03, 2015 at 02:39:05PM +0300, Denis V. Lunev wrote:
> On 10/29/2015 11:44 PM, Denis V. Lunev wrote:
> >This series does three things:
> >
> >1) add a "-trace [enable=]foo" option to enable one or more trace
> >events, and a "-trace help" option to show the list of tracepoints
> >(patches 4-5)
> >
> >2) change the stderr tracing backend so that it prints to the
> >-D log file, and enable it by default.  "-trace file=..." is
> >now a synonym of -D if the log backend is enabled (patches 7-8)
> >
> >3) add a "-d trace:foo" option that is a synonym for "-trace foo";
> >this makes the new functionality more discoverable to people used
> >to "-d", makes it available for user-mode emulation (which does
> >not have -trace), and is somewhat nice if you want to enable both
> >tracepoints and some other "-d" flag (patch 9).  When globbing
> >it is also less susceptible to unwanted shell expansion.
> >
> >For example, you can trace block device I/O and save the result
> >to a file just by adding "-trace bdrv_aio_*,file=trace.txt", or
> >correlate it to guest PCs with "-d exec,nochain,trace:bdrv_aio_*".
> >
> >Opinions?  I would like to have this in 2.5 if there is agreement.
> >
> >Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> >Signed-off-by: Denis V. Lunev <den@openvz.org>
> >
> >Changes from v2:
> >- compilation fix was extended to patch 2 and 3
> >- replaced Reviewed-by with Acked-by by request from Christian
> >
> >Changes from v1:
> >- small cleanup to vl.c is added as patch (4)
> >- compilation is fixed in patch (2)
> >- moved qemu-log.c to util/log.c to fix linking of qemu-io/qemu-nbd
> >
> >Denis V. Lunev (2):
> >   trace: no need to call trace_backend_init in different branches now
> >   log: move qemu-log.c into util/ directory
> >
> >Paolo Bonzini (9):
> >   trace: fix documentation
> >   trace: split trace_init_events out of trace_init_backends
> >   trace: split trace_init_file out of trace_init_backends
> >   trace: add "-trace enable=..."
> >   trace: add "-trace help"
> >   log: do not unnecessarily include qom/cpu.h
> >   trace: convert stderr backend to log
> >   trace: switch default backend to "log"
> >   log: add "-d trace:PATTERN"
> >
> >  Makefile.objs                                   |  1 -
> >  bsd-user/main.c                                 |  1 +
> >  configure                                       |  6 +-
> >  cpu-exec.c                                      |  1 +
> >  exec.c                                          |  1 +
> >  hw/acpi/cpu_hotplug.c                           |  1 +
> >  hw/timer/a9gtimer.c                             |  1 +
> >  include/exec/log.h                              | 60 ++++++++++++++++
> >  include/qemu/log.h                              | 60 +---------------
> >  linux-user/main.c                               |  1 +
> >  qemu-io.c                                       |  2 +-
> >  qemu-options.hx                                 | 22 ++++--
> >  qom/cpu.c                                       |  1 +
> >  scripts/tracetool/backend/{stderr.py => log.py} |  9 +--
> >  target-alpha/translate.c                        |  1 +
> >  target-arm/translate.c                          |  1 +
> >  target-cris/translate.c                         |  1 +
> >  target-i386/seg_helper.c                        |  1 +
> >  target-i386/smm_helper.c                        |  1 +
> >  target-i386/translate.c                         |  1 +
> >  target-lm32/helper.c                            |  1 +
> >  target-lm32/translate.c                         |  1 +
> >  target-m68k/translate.c                         |  1 +
> >  target-microblaze/helper.c                      |  1 +
> >  target-microblaze/translate.c                   |  1 +
> >  target-mips/helper.c                            |  1 +
> >  target-mips/translate.c                         |  1 +
> >  target-moxie/translate.c                        |  1 +
> >  target-openrisc/translate.c                     |  1 +
> >  target-ppc/mmu-hash32.c                         |  1 +
> >  target-ppc/mmu-hash64.c                         |  1 +
> >  target-ppc/mmu_helper.c                         |  1 +
> >  target-ppc/translate.c                          |  1 +
> >  target-s390x/translate.c                        |  1 +
> >  target-sh4/helper.c                             |  1 +
> >  target-sh4/translate.c                          |  1 +
> >  target-sparc/int32_helper.c                     |  1 +
> >  target-sparc/int64_helper.c                     |  1 +
> >  target-sparc/translate.c                        |  1 +
> >  target-tilegx/translate.c                       |  1 +
> >  target-tricore/translate.c                      |  1 +
> >  target-unicore32/translate.c                    |  1 +
> >  target-xtensa/translate.c                       |  1 +
> >  tcg/tcg.c                                       |  1 +
> >  trace/control.c                                 | 95 ++++++++++++++++++-------
> >  trace/control.h                                 | 42 ++++++++++-
> >  trace/simple.c                                  |  6 +-
> >  trace/simple.h                                  |  4 +-
> >  translate-all.c                                 |  1 +
> >  util/Makefile.objs                              |  1 +
> >  qemu-log.c => util/log.c                        | 19 ++++-
> >  vl.c                                            | 38 +++++-----
> >  52 files changed, 274 insertions(+), 129 deletions(-)
> >  create mode 100644 include/exec/log.h
> >  rename scripts/tracetool/backend/{stderr.py => log.py} (78%)
> >  rename qemu-log.c => util/log.c (90%)
> >
> Stefan,
> 
> It seems that I have missed you and other people except
> Paolo in v3 submission :( The difference is only compilation
> fix in patches 2/3.
> 
> My fault :(
> 
> Should I re-submit or you can take this and push them as
> negotiated before?

No need to re-submit, I will review v3.

Stefan

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [Qemu-devel] [PATCH v3 00/11] simplify usage of tracepoints, and connect them to logging
  2015-10-29 20:44 [Qemu-devel] [PATCH v3 00/11] simplify usage of tracepoints, and connect them to logging Denis V. Lunev
                   ` (11 preceding siblings ...)
  2015-11-03 11:39 ` [Qemu-devel] [PATCH v3 00/11] simplify usage of tracepoints, and connect them to logging Denis V. Lunev
@ 2015-11-03 17:10 ` Stefan Hajnoczi
  2015-11-03 17:33   ` Paolo Bonzini
  2016-01-07  9:58 ` Stefan Hajnoczi
  13 siblings, 1 reply; 23+ messages in thread
From: Stefan Hajnoczi @ 2015-11-03 17:10 UTC (permalink / raw)
  To: Denis V. Lunev; +Cc: Paolo Bonzini, qemu-devel

[-- Attachment #1: Type: text/plain, Size: 5633 bytes --]

On Thu, Oct 29, 2015 at 11:44:06PM +0300, Denis V. Lunev wrote:
> This series does three things:
> 
> 1) add a "-trace [enable=]foo" option to enable one or more trace
> events, and a "-trace help" option to show the list of tracepoints
> (patches 4-5)
> 
> 2) change the stderr tracing backend so that it prints to the
> -D log file, and enable it by default.  "-trace file=..." is
> now a synonym of -D if the log backend is enabled (patches 7-8)
> 
> 3) add a "-d trace:foo" option that is a synonym for "-trace foo";
> this makes the new functionality more discoverable to people used
> to "-d", makes it available for user-mode emulation (which does
> not have -trace), and is somewhat nice if you want to enable both
> tracepoints and some other "-d" flag (patch 9).  When globbing
> it is also less susceptible to unwanted shell expansion.
> 
> For example, you can trace block device I/O and save the result
> to a file just by adding "-trace bdrv_aio_*,file=trace.txt", or
> correlate it to guest PCs with "-d exec,nochain,trace:bdrv_aio_*".
> 
> Opinions?  I would like to have this in 2.5 if there is agreement.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> Signed-off-by: Denis V. Lunev <den@openvz.org>
> 
> Changes from v2:
> - compilation fix was extended to patch 2 and 3
> - replaced Reviewed-by with Acked-by by request from Christian
> 
> Changes from v1:
> - small cleanup to vl.c is added as patch (4)
> - compilation is fixed in patch (2)
> - moved qemu-log.c to util/log.c to fix linking of qemu-io/qemu-nbd
> 
> Denis V. Lunev (2):
>   trace: no need to call trace_backend_init in different branches now
>   log: move qemu-log.c into util/ directory
> 
> Paolo Bonzini (9):
>   trace: fix documentation
>   trace: split trace_init_events out of trace_init_backends
>   trace: split trace_init_file out of trace_init_backends
>   trace: add "-trace enable=..."
>   trace: add "-trace help"
>   log: do not unnecessarily include qom/cpu.h
>   trace: convert stderr backend to log
>   trace: switch default backend to "log"
>   log: add "-d trace:PATTERN"
> 
>  Makefile.objs                                   |  1 -
>  bsd-user/main.c                                 |  1 +
>  configure                                       |  6 +-
>  cpu-exec.c                                      |  1 +
>  exec.c                                          |  1 +
>  hw/acpi/cpu_hotplug.c                           |  1 +
>  hw/timer/a9gtimer.c                             |  1 +
>  include/exec/log.h                              | 60 ++++++++++++++++
>  include/qemu/log.h                              | 60 +---------------
>  linux-user/main.c                               |  1 +
>  qemu-io.c                                       |  2 +-
>  qemu-options.hx                                 | 22 ++++--
>  qom/cpu.c                                       |  1 +
>  scripts/tracetool/backend/{stderr.py => log.py} |  9 +--
>  target-alpha/translate.c                        |  1 +
>  target-arm/translate.c                          |  1 +
>  target-cris/translate.c                         |  1 +
>  target-i386/seg_helper.c                        |  1 +
>  target-i386/smm_helper.c                        |  1 +
>  target-i386/translate.c                         |  1 +
>  target-lm32/helper.c                            |  1 +
>  target-lm32/translate.c                         |  1 +
>  target-m68k/translate.c                         |  1 +
>  target-microblaze/helper.c                      |  1 +
>  target-microblaze/translate.c                   |  1 +
>  target-mips/helper.c                            |  1 +
>  target-mips/translate.c                         |  1 +
>  target-moxie/translate.c                        |  1 +
>  target-openrisc/translate.c                     |  1 +
>  target-ppc/mmu-hash32.c                         |  1 +
>  target-ppc/mmu-hash64.c                         |  1 +
>  target-ppc/mmu_helper.c                         |  1 +
>  target-ppc/translate.c                          |  1 +
>  target-s390x/translate.c                        |  1 +
>  target-sh4/helper.c                             |  1 +
>  target-sh4/translate.c                          |  1 +
>  target-sparc/int32_helper.c                     |  1 +
>  target-sparc/int64_helper.c                     |  1 +
>  target-sparc/translate.c                        |  1 +
>  target-tilegx/translate.c                       |  1 +
>  target-tricore/translate.c                      |  1 +
>  target-unicore32/translate.c                    |  1 +
>  target-xtensa/translate.c                       |  1 +
>  tcg/tcg.c                                       |  1 +
>  trace/control.c                                 | 95 ++++++++++++++++++-------
>  trace/control.h                                 | 42 ++++++++++-
>  trace/simple.c                                  |  6 +-
>  trace/simple.h                                  |  4 +-
>  translate-all.c                                 |  1 +
>  util/Makefile.objs                              |  1 +
>  qemu-log.c => util/log.c                        | 19 ++++-
>  vl.c                                            | 38 +++++-----
>  52 files changed, 274 insertions(+), 129 deletions(-)
>  create mode 100644 include/exec/log.h
>  rename scripts/tracetool/backend/{stderr.py => log.py} (78%)
>  rename qemu-log.c => util/log.c (90%)
> 
> -- 
> 2.1.4
> 
> 

Thanks, applied to my tracing tree:
https://github.com/stefanha/qemu/commits/tracing

Stefan

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [Qemu-devel] [PATCH v3 00/11] simplify usage of tracepoints, and connect them to logging
  2015-11-03 17:10 ` Stefan Hajnoczi
@ 2015-11-03 17:33   ` Paolo Bonzini
  2015-11-03 17:42     ` Denis V. Lunev
  0 siblings, 1 reply; 23+ messages in thread
From: Paolo Bonzini @ 2015-11-03 17:33 UTC (permalink / raw)
  To: Stefan Hajnoczi, Denis V. Lunev; +Cc: qemu-devel



On 03/11/2015 18:10, Stefan Hajnoczi wrote:
> On Thu, Oct 29, 2015 at 11:44:06PM +0300, Denis V. Lunev wrote:
>> This series does three things:
>> 
>> 1) add a "-trace [enable=]foo" option to enable one or more
>> trace events, and a "-trace help" option to show the list of
>> tracepoints (patches 4-5)
>> 
>> 2) change the stderr tracing backend so that it prints to the -D
>> log file, and enable it by default.  "-trace file=..." is now a
>> synonym of -D if the log backend is enabled (patches 7-8)
>> 
>> 3) add a "-d trace:foo" option that is a synonym for "-trace
>> foo"; this makes the new functionality more discoverable to
>> people used to "-d", makes it available for user-mode emulation
>> (which does not have -trace), and is somewhat nice if you want to
>> enable both tracepoints and some other "-d" flag (patch 9).  When
>> globbing it is also less susceptible to unwanted shell
>> expansion.
>> 
>> For example, you can trace block device I/O and save the result 
>> to a file just by adding "-trace bdrv_aio_*,file=trace.txt", or 
>> correlate it to guest PCs with "-d
>> exec,nochain,trace:bdrv_aio_*".
>> 
>> Opinions?  I would like to have this in 2.5 if there is
>> agreement.
>> 
>> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by:
>> Denis V. Lunev <den@openvz.org>
>> 
>> Changes from v2: - compilation fix was extended to patch 2 and 3 
>> - replaced Reviewed-by with Acked-by by request from Christian
>> 
>> Changes from v1: - small cleanup to vl.c is added as patch (4) -
>> compilation is fixed in patch (2) - moved qemu-log.c to
>> util/log.c to fix linking of qemu-io/qemu-nbd
>> 
>> Denis V. Lunev (2): trace: no need to call trace_backend_init in
>> different branches now log: move qemu-log.c into util/ directory
>> 
>> Paolo Bonzini (9): trace: fix documentation trace: split
>> trace_init_events out of trace_init_backends trace: split
>> trace_init_file out of trace_init_backends trace: add "-trace
>> enable=..." trace: add "-trace help" log: do not unnecessarily
>> include qom/cpu.h trace: convert stderr backend to log trace:
>> switch default backend to "log" log: add "-d trace:PATTERN"
>> 
>> Makefile.objs                                   |  1 - 
>> bsd-user/main.c                                 |  1 + configure
>> |  6 +- cpu-exec.c                                      |  1 + 
>> exec.c                                          |  1 + 
>> hw/acpi/cpu_hotplug.c                           |  1 + 
>> hw/timer/a9gtimer.c                             |  1 + 
>> include/exec/log.h                              | 60
>> ++++++++++++++++ include/qemu/log.h
>> | 60 +--------------- linux-user/main.c
>> |  1 + qemu-io.c                                       |  2 +- 
>> qemu-options.hx                                 | 22 ++++-- 
>> qom/cpu.c                                       |  1 + 
>> scripts/tracetool/backend/{stderr.py => log.py} |  9 +-- 
>> target-alpha/translate.c                        |  1 + 
>> target-arm/translate.c                          |  1 + 
>> target-cris/translate.c                         |  1 + 
>> target-i386/seg_helper.c                        |  1 + 
>> target-i386/smm_helper.c                        |  1 + 
>> target-i386/translate.c                         |  1 + 
>> target-lm32/helper.c                            |  1 + 
>> target-lm32/translate.c                         |  1 + 
>> target-m68k/translate.c                         |  1 + 
>> target-microblaze/helper.c                      |  1 + 
>> target-microblaze/translate.c                   |  1 + 
>> target-mips/helper.c                            |  1 + 
>> target-mips/translate.c                         |  1 + 
>> target-moxie/translate.c                        |  1 + 
>> target-openrisc/translate.c                     |  1 + 
>> target-ppc/mmu-hash32.c                         |  1 + 
>> target-ppc/mmu-hash64.c                         |  1 + 
>> target-ppc/mmu_helper.c                         |  1 + 
>> target-ppc/translate.c                          |  1 + 
>> target-s390x/translate.c                        |  1 + 
>> target-sh4/helper.c                             |  1 + 
>> target-sh4/translate.c                          |  1 + 
>> target-sparc/int32_helper.c                     |  1 + 
>> target-sparc/int64_helper.c                     |  1 + 
>> target-sparc/translate.c                        |  1 + 
>> target-tilegx/translate.c                       |  1 + 
>> target-tricore/translate.c                      |  1 + 
>> target-unicore32/translate.c                    |  1 + 
>> target-xtensa/translate.c                       |  1 + tcg/tcg.c
>> |  1 + trace/control.c                                 | 95
>> ++++++++++++++++++------- trace/control.h
>> | 42 ++++++++++- trace/simple.c
>> |  6 +- trace/simple.h                                  |  4 +- 
>> translate-all.c                                 |  1 + 
>> util/Makefile.objs                              |  1 + qemu-log.c
>> => util/log.c                        | 19 ++++- vl.c
>> | 38 +++++----- 52 files changed, 274 insertions(+), 129
>> deletions(-) create mode 100644 include/exec/log.h rename
>> scripts/tracetool/backend/{stderr.py => log.py} (78%) rename
>> qemu-log.c => util/log.c (90%)
>> 
>> -- 2.1.4
>> 
>> 
> 
> Thanks, applied to my tracing tree: 
> https://github.com/stefanha/qemu/commits/tracing

Thanks Denis and Stefan!  I hope this will make it simpler to track
user problems, and will also encourage people to use tracepoints more.

Paolo

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [Qemu-devel] [PATCH v3 00/11] simplify usage of tracepoints, and connect them to logging
  2015-11-03 17:33   ` Paolo Bonzini
@ 2015-11-03 17:42     ` Denis V. Lunev
  2015-11-03 17:50       ` Paolo Bonzini
  0 siblings, 1 reply; 23+ messages in thread
From: Denis V. Lunev @ 2015-11-03 17:42 UTC (permalink / raw)
  To: Paolo Bonzini, Stefan Hajnoczi; +Cc: qemu-devel

On 11/03/2015 08:33 PM, Paolo Bonzini wrote:
>
> On 03/11/2015 18:10, Stefan Hajnoczi wrote:
>> On Thu, Oct 29, 2015 at 11:44:06PM +0300, Denis V. Lunev wrote:
>>> This series does three things:
>>>
>>> 1) add a "-trace [enable=]foo" option to enable one or more
>>> trace events, and a "-trace help" option to show the list of
>>> tracepoints (patches 4-5)
>>>
>>> 2) change the stderr tracing backend so that it prints to the -D
>>> log file, and enable it by default.  "-trace file=..." is now a
>>> synonym of -D if the log backend is enabled (patches 7-8)
>>>
>>> 3) add a "-d trace:foo" option that is a synonym for "-trace
>>> foo"; this makes the new functionality more discoverable to
>>> people used to "-d", makes it available for user-mode emulation
>>> (which does not have -trace), and is somewhat nice if you want to
>>> enable both tracepoints and some other "-d" flag (patch 9).  When
>>> globbing it is also less susceptible to unwanted shell
>>> expansion.
>>>
>>> For example, you can trace block device I/O and save the result
>>> to a file just by adding "-trace bdrv_aio_*,file=trace.txt", or
>>> correlate it to guest PCs with "-d
>>> exec,nochain,trace:bdrv_aio_*".
>>>
>>> Opinions?  I would like to have this in 2.5 if there is
>>> agreement.
>>>
>>> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by:
>>> Denis V. Lunev <den@openvz.org>
>>>
>>> Changes from v2: - compilation fix was extended to patch 2 and 3
>>> - replaced Reviewed-by with Acked-by by request from Christian
>>>
>>> Changes from v1: - small cleanup to vl.c is added as patch (4) -
>>> compilation is fixed in patch (2) - moved qemu-log.c to
>>> util/log.c to fix linking of qemu-io/qemu-nbd
>>>
>>> Denis V. Lunev (2): trace: no need to call trace_backend_init in
>>> different branches now log: move qemu-log.c into util/ directory
>>>
>>> Paolo Bonzini (9): trace: fix documentation trace: split
>>> trace_init_events out of trace_init_backends trace: split
>>> trace_init_file out of trace_init_backends trace: add "-trace
>>> enable=..." trace: add "-trace help" log: do not unnecessarily
>>> include qom/cpu.h trace: convert stderr backend to log trace:
>>> switch default backend to "log" log: add "-d trace:PATTERN"
>>>
>>> Makefile.objs                                   |  1 -
>>> bsd-user/main.c                                 |  1 + configure
>>> |  6 +- cpu-exec.c                                      |  1 +
>>> exec.c                                          |  1 +
>>> hw/acpi/cpu_hotplug.c                           |  1 +
>>> hw/timer/a9gtimer.c                             |  1 +
>>> include/exec/log.h                              | 60
>>> ++++++++++++++++ include/qemu/log.h
>>> | 60 +--------------- linux-user/main.c
>>> |  1 + qemu-io.c                                       |  2 +-
>>> qemu-options.hx                                 | 22 ++++--
>>> qom/cpu.c                                       |  1 +
>>> scripts/tracetool/backend/{stderr.py => log.py} |  9 +--
>>> target-alpha/translate.c                        |  1 +
>>> target-arm/translate.c                          |  1 +
>>> target-cris/translate.c                         |  1 +
>>> target-i386/seg_helper.c                        |  1 +
>>> target-i386/smm_helper.c                        |  1 +
>>> target-i386/translate.c                         |  1 +
>>> target-lm32/helper.c                            |  1 +
>>> target-lm32/translate.c                         |  1 +
>>> target-m68k/translate.c                         |  1 +
>>> target-microblaze/helper.c                      |  1 +
>>> target-microblaze/translate.c                   |  1 +
>>> target-mips/helper.c                            |  1 +
>>> target-mips/translate.c                         |  1 +
>>> target-moxie/translate.c                        |  1 +
>>> target-openrisc/translate.c                     |  1 +
>>> target-ppc/mmu-hash32.c                         |  1 +
>>> target-ppc/mmu-hash64.c                         |  1 +
>>> target-ppc/mmu_helper.c                         |  1 +
>>> target-ppc/translate.c                          |  1 +
>>> target-s390x/translate.c                        |  1 +
>>> target-sh4/helper.c                             |  1 +
>>> target-sh4/translate.c                          |  1 +
>>> target-sparc/int32_helper.c                     |  1 +
>>> target-sparc/int64_helper.c                     |  1 +
>>> target-sparc/translate.c                        |  1 +
>>> target-tilegx/translate.c                       |  1 +
>>> target-tricore/translate.c                      |  1 +
>>> target-unicore32/translate.c                    |  1 +
>>> target-xtensa/translate.c                       |  1 + tcg/tcg.c
>>> |  1 + trace/control.c                                 | 95
>>> ++++++++++++++++++------- trace/control.h
>>> | 42 ++++++++++- trace/simple.c
>>> |  6 +- trace/simple.h                                  |  4 +-
>>> translate-all.c                                 |  1 +
>>> util/Makefile.objs                              |  1 + qemu-log.c
>>> => util/log.c                        | 19 ++++- vl.c
>>> | 38 +++++----- 52 files changed, 274 insertions(+), 129
>>> deletions(-) create mode 100644 include/exec/log.h rename
>>> scripts/tracetool/backend/{stderr.py => log.py} (78%) rename
>>> qemu-log.c => util/log.c (90%)
>>>
>>> -- 2.1.4
>>>
>>>
>> Thanks, applied to my tracing tree:
>> https://github.com/stefanha/qemu/commits/tracing
> Thanks Denis and Stefan!  I hope this will make it simpler to track
> user problems, and will also encourage people to use tracepoints more.
>
> Paolo

There 2 small notes here:
- there is small patch with 'all' alias for all tracepoints which
   could also be useful in the scope of this work:
   [PATCH v2 1/1] allow to enable all tracepoints via alias all

- it would be great if patches from my log patchset will be merged.
   I'll port them tomorrow on top of this set (if will not work on
   findings in locking patchset)
   Switch from inline call to #define and QMP/QAPI logging seems
   really necessary. timestamp could be enabled or not but it is
   better to use unified approach for logging timestamps and
   tracing timestamps.

Den

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [Qemu-devel] [PATCH v3 00/11] simplify usage of tracepoints, and connect them to logging
  2015-11-03 17:42     ` Denis V. Lunev
@ 2015-11-03 17:50       ` Paolo Bonzini
  2015-11-03 18:03         ` Denis V. Lunev
  0 siblings, 1 reply; 23+ messages in thread
From: Paolo Bonzini @ 2015-11-03 17:50 UTC (permalink / raw)
  To: Denis V. Lunev, Stefan Hajnoczi; +Cc: qemu-devel



On 03/11/2015 18:42, Denis V. Lunev wrote:
> 
> There 2 small notes here:
> - there is small patch with 'all' alias for all tracepoints which
>   could also be useful in the scope of this work:
>   [PATCH v2 1/1] allow to enable all tracepoints via alias all
> 
> - it would be great if patches from my log patchset will be merged.
>   I'll port them tomorrow on top of this set (if will not work on
>   findings in locking patchset)
>   Switch from inline call to #define and QMP/QAPI logging seems
>   really necessary. timestamp could be enabled or not but it is
>   better to use unified approach for logging timestamps and
>   tracing timestamps.

I think the "right" way would be to add tracepoints to the qmp_*
functions, or to make your logging a tracepoint.  BTW, why are you not
logging QMP commands from the Virtuozzo management tool?  That's what
libvirt is doing, you can find the JSON in qemu.log IIRC.

Paolo

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [Qemu-devel] [PATCH v3 00/11] simplify usage of tracepoints, and connect them to logging
  2015-11-03 17:50       ` Paolo Bonzini
@ 2015-11-03 18:03         ` Denis V. Lunev
  0 siblings, 0 replies; 23+ messages in thread
From: Denis V. Lunev @ 2015-11-03 18:03 UTC (permalink / raw)
  To: Paolo Bonzini, Stefan Hajnoczi; +Cc: qemu-devel

On 11/03/2015 08:50 PM, Paolo Bonzini wrote:
>
> On 03/11/2015 18:42, Denis V. Lunev wrote:
>> There 2 small notes here:
>> - there is small patch with 'all' alias for all tracepoints which
>>    could also be useful in the scope of this work:
>>    [PATCH v2 1/1] allow to enable all tracepoints via alias all
>>
>> - it would be great if patches from my log patchset will be merged.
>>    I'll port them tomorrow on top of this set (if will not work on
>>    findings in locking patchset)
>>    Switch from inline call to #define and QMP/QAPI logging seems
>>    really necessary. timestamp could be enabled or not but it is
>>    better to use unified approach for logging timestamps and
>>    tracing timestamps.
> I think the "right" way would be to add tracepoints to the qmp_*
> functions, or to make your logging a tracepoint.  BTW, why are you not
> logging QMP commands from the Virtuozzo management tool?  That's what
> libvirt is doing, you can find the JSON in qemu.log IIRC.
>
> Paolo
because libvirt is maintained by the different team and
I have to find a way to prove the side of the problem ;)

OK. using tracepoint for this (after this patchset) could
be fine. Thank you for an idea, I'll elaborate this tomorrow.

Den

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [Qemu-devel] [PATCH v3 00/11] simplify usage of tracepoints, and connect them to logging
  2015-10-29 20:44 [Qemu-devel] [PATCH v3 00/11] simplify usage of tracepoints, and connect them to logging Denis V. Lunev
                   ` (12 preceding siblings ...)
  2015-11-03 17:10 ` Stefan Hajnoczi
@ 2016-01-07  9:58 ` Stefan Hajnoczi
  2016-01-07 10:35   ` Denis V. Lunev
  2016-01-07 12:40   ` Denis V. Lunev
  13 siblings, 2 replies; 23+ messages in thread
From: Stefan Hajnoczi @ 2016-01-07  9:58 UTC (permalink / raw)
  To: Denis V. Lunev; +Cc: Paolo Bonzini, qemu-devel

[-- Attachment #1: Type: text/plain, Size: 11495 bytes --]

On Thu, Oct 29, 2015 at 11:44:06PM +0300, Denis V. Lunev wrote:
> This series does three things:
> 
> 1) add a "-trace [enable=]foo" option to enable one or more trace
> events, and a "-trace help" option to show the list of tracepoints
> (patches 4-5)
> 
> 2) change the stderr tracing backend so that it prints to the
> -D log file, and enable it by default.  "-trace file=..." is
> now a synonym of -D if the log backend is enabled (patches 7-8)
> 
> 3) add a "-d trace:foo" option that is a synonym for "-trace foo";
> this makes the new functionality more discoverable to people used
> to "-d", makes it available for user-mode emulation (which does
> not have -trace), and is somewhat nice if you want to enable both
> tracepoints and some other "-d" flag (patch 9).  When globbing
> it is also less susceptible to unwanted shell expansion.
> 
> For example, you can trace block device I/O and save the result
> to a file just by adding "-trace bdrv_aio_*,file=trace.txt", or
> correlate it to guest PCs with "-d exec,nochain,trace:bdrv_aio_*".
> 
> Opinions?  I would like to have this in 2.5 if there is agreement.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> Signed-off-by: Denis V. Lunev <den@openvz.org>
> 
> Changes from v2:
> - compilation fix was extended to patch 2 and 3
> - replaced Reviewed-by with Acked-by by request from Christian
> 
> Changes from v1:
> - small cleanup to vl.c is added as patch (4)
> - compilation is fixed in patch (2)
> - moved qemu-log.c to util/log.c to fix linking of qemu-io/qemu-nbd
> 
> Denis V. Lunev (2):
>   trace: no need to call trace_backend_init in different branches now
>   log: move qemu-log.c into util/ directory
> 
> Paolo Bonzini (9):
>   trace: fix documentation
>   trace: split trace_init_events out of trace_init_backends
>   trace: split trace_init_file out of trace_init_backends
>   trace: add "-trace enable=..."
>   trace: add "-trace help"
>   log: do not unnecessarily include qom/cpu.h
>   trace: convert stderr backend to log
>   trace: switch default backend to "log"
>   log: add "-d trace:PATTERN"
> 
>  Makefile.objs                                   |  1 -
>  bsd-user/main.c                                 |  1 +
>  configure                                       |  6 +-
>  cpu-exec.c                                      |  1 +
>  exec.c                                          |  1 +
>  hw/acpi/cpu_hotplug.c                           |  1 +
>  hw/timer/a9gtimer.c                             |  1 +
>  include/exec/log.h                              | 60 ++++++++++++++++
>  include/qemu/log.h                              | 60 +---------------
>  linux-user/main.c                               |  1 +
>  qemu-io.c                                       |  2 +-
>  qemu-options.hx                                 | 22 ++++--
>  qom/cpu.c                                       |  1 +
>  scripts/tracetool/backend/{stderr.py => log.py} |  9 +--
>  target-alpha/translate.c                        |  1 +
>  target-arm/translate.c                          |  1 +
>  target-cris/translate.c                         |  1 +
>  target-i386/seg_helper.c                        |  1 +
>  target-i386/smm_helper.c                        |  1 +
>  target-i386/translate.c                         |  1 +
>  target-lm32/helper.c                            |  1 +
>  target-lm32/translate.c                         |  1 +
>  target-m68k/translate.c                         |  1 +
>  target-microblaze/helper.c                      |  1 +
>  target-microblaze/translate.c                   |  1 +
>  target-mips/helper.c                            |  1 +
>  target-mips/translate.c                         |  1 +
>  target-moxie/translate.c                        |  1 +
>  target-openrisc/translate.c                     |  1 +
>  target-ppc/mmu-hash32.c                         |  1 +
>  target-ppc/mmu-hash64.c                         |  1 +
>  target-ppc/mmu_helper.c                         |  1 +
>  target-ppc/translate.c                          |  1 +
>  target-s390x/translate.c                        |  1 +
>  target-sh4/helper.c                             |  1 +
>  target-sh4/translate.c                          |  1 +
>  target-sparc/int32_helper.c                     |  1 +
>  target-sparc/int64_helper.c                     |  1 +
>  target-sparc/translate.c                        |  1 +
>  target-tilegx/translate.c                       |  1 +
>  target-tricore/translate.c                      |  1 +
>  target-unicore32/translate.c                    |  1 +
>  target-xtensa/translate.c                       |  1 +
>  tcg/tcg.c                                       |  1 +
>  trace/control.c                                 | 95 ++++++++++++++++++-------
>  trace/control.h                                 | 42 ++++++++++-
>  trace/simple.c                                  |  6 +-
>  trace/simple.h                                  |  4 +-
>  translate-all.c                                 |  1 +
>  util/Makefile.objs                              |  1 +
>  qemu-log.c => util/log.c                        | 19 ++++-
>  vl.c                                            | 38 +++++-----
>  52 files changed, 274 insertions(+), 129 deletions(-)
>  create mode 100644 include/exec/log.h
>  rename scripts/tracetool/backend/{stderr.py => log.py} (78%)
>  rename qemu-log.c => util/log.c (90%)

Hi Denis,
I have pasted the issues that Peter Maydell hit during QEMU 2.5 below.
Please rebase this series onto
https://github.com/stefanha/qemu/commits/tracing-pull-request
(cef517ca4bf890ef5405aac1b95f75dcda043d6a)

I'll rerun the Windows build on the next revision to make sure the
warnings have been fixed.

Thanks,
Stefan
---

1.
Fails to build on all platforms :-(

/home/petmay01/linaro/qemu-for-merges/target-arm/translate-a64.c: In
function ‘gen_intermediate_code_a64’:
/home/petmay01/linaro/qemu-for-merges/target-arm/translate-a64.c:11229:9:
error: implicit declaration of function ‘lookup_symbol’
[-Werror=implicit-function-declaration]
         qemu_log("IN: %s\n", lookup_symbol(pc_start));
         ^
/home/petmay01/linaro/qemu-for-merges/target-arm/translate-a64.c:11229:9:
error: nested extern declaration of ‘lookup_symbol’
[-Werror=nested-externs]
/home/petmay01/linaro/qemu-for-merges/target-arm/translate-a64.c:11229:9:
error: format ‘%s’ expects argument of type ‘char *’, but argument 2
has type ‘int’ [-Werror=format=]
/home/petmay01/linaro/qemu-for-merges/target-arm/translate-a64.c:11230:9:
error: implicit declaration of function ‘log_target_disas’
[-Werror=implicit-function-declaration]
         log_target_disas(cs, pc_start, dc->pc - pc_start,
         ^
/home/petmay01/linaro/qemu-for-merges/target-arm/translate-a64.c:11230:9:
error: nested extern declaration of ‘log_target_disas’
[-Werror=nested-externs]
cc1: all warnings being treated as errors

2.
w32 fails to build with the same 'ssize_t vs signed size_t for %zd'
thing that hit somebody else's changes earlier this week:

In file included from /home/petmay01/linaro/qemu-for-merges/include/trace.h:4,
                 from
/home/petmay01/linaro/qemu-for-merges/util/oslib-win32.c:38:
./trace/generated-tracers.h: In function ‘trace_virtio_console_flush_buf’:
./trace/generated-tracers.h:240: warning: format ‘%zd’ expects type
‘signed size_t’, but argument 8 has type ‘ssize_t’
  CC    util/bitops.o
./trace/generated-tracers.h: In function ‘trace_usb_ohci_iso_td_so’:
./trace/generated-tracers.h:2784: warning: format ‘%zu’ expects type
‘size_t’, but argument 11 has type ‘ssize_t’
./trace/generated-tracers.h: In function ‘trace_usb_ohci_iso_td_data_overrun’:
./trace/generated-tracers.h:2796: warning: format ‘%zu’ expects type
‘size_t’, but argument 7 has type ‘ssize_t’
  CC    util/hbitmap.o
  CC    util/fifo8.o
./trace/generated-tracers.h: In function ‘trace_spice_vmc_write’:
./trace/generated-tracers.h:6492: warning: format ‘%zd’ expects type
‘signed size_t’, but argument 6 has type ‘ssize_t’
  CC    util/acl.o
  CC    util/error.o
./trace/generated-tracers.h: In function ‘trace_v9fs_read_return’:
./trace/generated-tracers.h:10344: warning: format ‘%zd’ expects type
‘signed size_t’, but argument 9 has type ‘ssize_t’
./trace/generated-tracers.h: In function ‘trace_v9fs_readdir_return’:
./trace/generated-tracers.h:10368: warning: format ‘%zd’ expects type
‘signed size_t’, but argument 9 has type ‘ssize_t’
./trace/generated-tracers.h: In function ‘trace_v9fs_write_return’:
./trace/generated-tracers.h:10392: warning: format ‘%zd’ expects type
‘signed size_t’, but argument 9 has type ‘ssize_t’
  CC    util/qemu-error.o
  CC    util/id.o
  CC    util/iov.o
cc1: warnings being treated as errors
In file included from /home/petmay01/linaro/qemu-for-merges/include/trace.h:4,
                 from /home/petmay01/linaro/qemu-for-merges/util/hbitmap.c:18:
./trace/generated-tracers.h: In function ‘trace_virtio_console_flush_buf’:
./trace/generated-tracers.h:240: warning: format ‘%zd’ expects type
‘signed size_t’, but argument 8 has type ‘ssize_t’
  CC    util/qemu-config.o
./trace/generated-tracers.h: In function ‘trace_usb_ohci_iso_td_so’:
./trace/generated-tracers.h:2784: warning: format ‘%zu’ expects type
‘size_t’, but argument 11 has type ‘ssize_t’
./trace/generated-tracers.h: In function ‘trace_usb_ohci_iso_td_data_overrun’:
./trace/generated-tracers.h:2796: warning: format ‘%zu’ expects type
‘size_t’, but argument 7 has type ‘ssize_t’
make: *** [util/oslib-win32.o] Error 1
make: *** Waiting for unfinished jobs....
./trace/generated-tracers.h: In function ‘trace_spice_vmc_write’:
./trace/generated-tracers.h:6492: warning: format ‘%zd’ expects type
‘signed size_t’, but argument 6 has type ‘ssize_t’
./trace/generated-tracers.h: In function ‘trace_v9fs_read_return’:
./trace/generated-tracers.h:10344: warning: format ‘%zd’ expects type
‘signed size_t’, but argument 9 has type ‘ssize_t’
./trace/generated-tracers.h: In function ‘trace_v9fs_readdir_return’:
./trace/generated-tracers.h:10368: warning: format ‘%zd’ expects type
‘signed size_t’, but argument 9 has type ‘ssize_t’
./trace/generated-tracers.h: In function ‘trace_v9fs_write_return’:
./trace/generated-tracers.h:10392: warning: format ‘%zd’ expects type
‘signed size_t’, but argument 9 has type ‘ssize_t’
make: *** [util/hbitmap.o] Error 1
make: Leaving directory `/home/petmay01/linaro/qemu-for-merges/build/w32'

3.
I also now get a handful of extra warnings in the 'make check' output:

  /aarch64/qom/xilinx-zynq-a9:                                         OK
  /aarch64/qom/xlnx-ep108:
WARNING: RAM size 8000000 is small for EP108OK
  /aarch64/qom/vexpress-a9:                                            OK

(note the missing newline...)

TEST: tests/qom-test... (pid=19738)
  /microblaze/qom/none:                                                OK
  /microblaze/qom/petalogix-s3adsp1800:
Invalid MicroBlaze version number: (null)
OK
  /microblaze/qom/petalogix-ml605:
Invalid MicroBlaze version number: (null)
OK

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [Qemu-devel] [PATCH v3 00/11] simplify usage of tracepoints, and connect them to logging
  2016-01-07  9:58 ` Stefan Hajnoczi
@ 2016-01-07 10:35   ` Denis V. Lunev
  2016-01-07 12:40   ` Denis V. Lunev
  1 sibling, 0 replies; 23+ messages in thread
From: Denis V. Lunev @ 2016-01-07 10:35 UTC (permalink / raw)
  To: Stefan Hajnoczi; +Cc: Paolo Bonzini, qemu-devel

On 01/07/2016 12:58 PM, Stefan Hajnoczi wrote:
> On Thu, Oct 29, 2015 at 11:44:06PM +0300, Denis V. Lunev wrote:
>> This series does three things:
>>
>> 1) add a "-trace [enable=]foo" option to enable one or more trace
>> events, and a "-trace help" option to show the list of tracepoints
>> (patches 4-5)
>>
>> 2) change the stderr tracing backend so that it prints to the
>> -D log file, and enable it by default.  "-trace file=..." is
>> now a synonym of -D if the log backend is enabled (patches 7-8)
>>
>> 3) add a "-d trace:foo" option that is a synonym for "-trace foo";
>> this makes the new functionality more discoverable to people used
>> to "-d", makes it available for user-mode emulation (which does
>> not have -trace), and is somewhat nice if you want to enable both
>> tracepoints and some other "-d" flag (patch 9).  When globbing
>> it is also less susceptible to unwanted shell expansion.
>>
>> For example, you can trace block device I/O and save the result
>> to a file just by adding "-trace bdrv_aio_*,file=trace.txt", or
>> correlate it to guest PCs with "-d exec,nochain,trace:bdrv_aio_*".
>>
>> Opinions?  I would like to have this in 2.5 if there is agreement.
>>
>> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
>> Signed-off-by: Denis V. Lunev <den@openvz.org>
>>
>> Changes from v2:
>> - compilation fix was extended to patch 2 and 3
>> - replaced Reviewed-by with Acked-by by request from Christian
>>
>> Changes from v1:
>> - small cleanup to vl.c is added as patch (4)
>> - compilation is fixed in patch (2)
>> - moved qemu-log.c to util/log.c to fix linking of qemu-io/qemu-nbd
>>
>> Denis V. Lunev (2):
>>    trace: no need to call trace_backend_init in different branches now
>>    log: move qemu-log.c into util/ directory
>>
>> Paolo Bonzini (9):
>>    trace: fix documentation
>>    trace: split trace_init_events out of trace_init_backends
>>    trace: split trace_init_file out of trace_init_backends
>>    trace: add "-trace enable=..."
>>    trace: add "-trace help"
>>    log: do not unnecessarily include qom/cpu.h
>>    trace: convert stderr backend to log
>>    trace: switch default backend to "log"
>>    log: add "-d trace:PATTERN"
>>
>>   Makefile.objs                                   |  1 -
>>   bsd-user/main.c                                 |  1 +
>>   configure                                       |  6 +-
>>   cpu-exec.c                                      |  1 +
>>   exec.c                                          |  1 +
>>   hw/acpi/cpu_hotplug.c                           |  1 +
>>   hw/timer/a9gtimer.c                             |  1 +
>>   include/exec/log.h                              | 60 ++++++++++++++++
>>   include/qemu/log.h                              | 60 +---------------
>>   linux-user/main.c                               |  1 +
>>   qemu-io.c                                       |  2 +-
>>   qemu-options.hx                                 | 22 ++++--
>>   qom/cpu.c                                       |  1 +
>>   scripts/tracetool/backend/{stderr.py => log.py} |  9 +--
>>   target-alpha/translate.c                        |  1 +
>>   target-arm/translate.c                          |  1 +
>>   target-cris/translate.c                         |  1 +
>>   target-i386/seg_helper.c                        |  1 +
>>   target-i386/smm_helper.c                        |  1 +
>>   target-i386/translate.c                         |  1 +
>>   target-lm32/helper.c                            |  1 +
>>   target-lm32/translate.c                         |  1 +
>>   target-m68k/translate.c                         |  1 +
>>   target-microblaze/helper.c                      |  1 +
>>   target-microblaze/translate.c                   |  1 +
>>   target-mips/helper.c                            |  1 +
>>   target-mips/translate.c                         |  1 +
>>   target-moxie/translate.c                        |  1 +
>>   target-openrisc/translate.c                     |  1 +
>>   target-ppc/mmu-hash32.c                         |  1 +
>>   target-ppc/mmu-hash64.c                         |  1 +
>>   target-ppc/mmu_helper.c                         |  1 +
>>   target-ppc/translate.c                          |  1 +
>>   target-s390x/translate.c                        |  1 +
>>   target-sh4/helper.c                             |  1 +
>>   target-sh4/translate.c                          |  1 +
>>   target-sparc/int32_helper.c                     |  1 +
>>   target-sparc/int64_helper.c                     |  1 +
>>   target-sparc/translate.c                        |  1 +
>>   target-tilegx/translate.c                       |  1 +
>>   target-tricore/translate.c                      |  1 +
>>   target-unicore32/translate.c                    |  1 +
>>   target-xtensa/translate.c                       |  1 +
>>   tcg/tcg.c                                       |  1 +
>>   trace/control.c                                 | 95 ++++++++++++++++++-------
>>   trace/control.h                                 | 42 ++++++++++-
>>   trace/simple.c                                  |  6 +-
>>   trace/simple.h                                  |  4 +-
>>   translate-all.c                                 |  1 +
>>   util/Makefile.objs                              |  1 +
>>   qemu-log.c => util/log.c                        | 19 ++++-
>>   vl.c                                            | 38 +++++-----
>>   52 files changed, 274 insertions(+), 129 deletions(-)
>>   create mode 100644 include/exec/log.h
>>   rename scripts/tracetool/backend/{stderr.py => log.py} (78%)
>>   rename qemu-log.c => util/log.c (90%)
> Hi Denis,
> I have pasted the issues that Peter Maydell hit during QEMU 2.5 below.
> Please rebase this series onto
> https://github.com/stefanha/qemu/commits/tracing-pull-request
> (cef517ca4bf890ef5405aac1b95f75dcda043d6a)
>
> I'll rerun the Windows build on the next revision to make sure the
> warnings have been fixed.
>
> Thanks,
> Stefan
> ---
>
> 1.
> Fails to build on all platforms :-(
>
> /home/petmay01/linaro/qemu-for-merges/target-arm/translate-a64.c: In
> function ‘gen_intermediate_code_a64’:
> /home/petmay01/linaro/qemu-for-merges/target-arm/translate-a64.c:11229:9:
> error: implicit declaration of function ‘lookup_symbol’
> [-Werror=implicit-function-declaration]
>           qemu_log("IN: %s\n", lookup_symbol(pc_start));
>           ^
> /home/petmay01/linaro/qemu-for-merges/target-arm/translate-a64.c:11229:9:
> error: nested extern declaration of ‘lookup_symbol’
> [-Werror=nested-externs]
> /home/petmay01/linaro/qemu-for-merges/target-arm/translate-a64.c:11229:9:
> error: format ‘%s’ expects argument of type ‘char *’, but argument 2
> has type ‘int’ [-Werror=format=]
> /home/petmay01/linaro/qemu-for-merges/target-arm/translate-a64.c:11230:9:
> error: implicit declaration of function ‘log_target_disas’
> [-Werror=implicit-function-declaration]
>           log_target_disas(cs, pc_start, dc->pc - pc_start,
>           ^
> /home/petmay01/linaro/qemu-for-merges/target-arm/translate-a64.c:11230:9:
> error: nested extern declaration of ‘log_target_disas’
> [-Werror=nested-externs]
> cc1: all warnings being treated as errors
>
> 2.
> w32 fails to build with the same 'ssize_t vs signed size_t for %zd'
> thing that hit somebody else's changes earlier this week:
>
> In file included from /home/petmay01/linaro/qemu-for-merges/include/trace.h:4,
>                   from
> /home/petmay01/linaro/qemu-for-merges/util/oslib-win32.c:38:
> ./trace/generated-tracers.h: In function ‘trace_virtio_console_flush_buf’:
> ./trace/generated-tracers.h:240: warning: format ‘%zd’ expects type
> ‘signed size_t’, but argument 8 has type ‘ssize_t’
>    CC    util/bitops.o
> ./trace/generated-tracers.h: In function ‘trace_usb_ohci_iso_td_so’:
> ./trace/generated-tracers.h:2784: warning: format ‘%zu’ expects type
> ‘size_t’, but argument 11 has type ‘ssize_t’
> ./trace/generated-tracers.h: In function ‘trace_usb_ohci_iso_td_data_overrun’:
> ./trace/generated-tracers.h:2796: warning: format ‘%zu’ expects type
> ‘size_t’, but argument 7 has type ‘ssize_t’
>    CC    util/hbitmap.o
>    CC    util/fifo8.o
> ./trace/generated-tracers.h: In function ‘trace_spice_vmc_write’:
> ./trace/generated-tracers.h:6492: warning: format ‘%zd’ expects type
> ‘signed size_t’, but argument 6 has type ‘ssize_t’
>    CC    util/acl.o
>    CC    util/error.o
> ./trace/generated-tracers.h: In function ‘trace_v9fs_read_return’:
> ./trace/generated-tracers.h:10344: warning: format ‘%zd’ expects type
> ‘signed size_t’, but argument 9 has type ‘ssize_t’
> ./trace/generated-tracers.h: In function ‘trace_v9fs_readdir_return’:
> ./trace/generated-tracers.h:10368: warning: format ‘%zd’ expects type
> ‘signed size_t’, but argument 9 has type ‘ssize_t’
> ./trace/generated-tracers.h: In function ‘trace_v9fs_write_return’:
> ./trace/generated-tracers.h:10392: warning: format ‘%zd’ expects type
> ‘signed size_t’, but argument 9 has type ‘ssize_t’
>    CC    util/qemu-error.o
>    CC    util/id.o
>    CC    util/iov.o
> cc1: warnings being treated as errors
> In file included from /home/petmay01/linaro/qemu-for-merges/include/trace.h:4,
>                   from /home/petmay01/linaro/qemu-for-merges/util/hbitmap.c:18:
> ./trace/generated-tracers.h: In function ‘trace_virtio_console_flush_buf’:
> ./trace/generated-tracers.h:240: warning: format ‘%zd’ expects type
> ‘signed size_t’, but argument 8 has type ‘ssize_t’
>    CC    util/qemu-config.o
> ./trace/generated-tracers.h: In function ‘trace_usb_ohci_iso_td_so’:
> ./trace/generated-tracers.h:2784: warning: format ‘%zu’ expects type
> ‘size_t’, but argument 11 has type ‘ssize_t’
> ./trace/generated-tracers.h: In function ‘trace_usb_ohci_iso_td_data_overrun’:
> ./trace/generated-tracers.h:2796: warning: format ‘%zu’ expects type
> ‘size_t’, but argument 7 has type ‘ssize_t’
> make: *** [util/oslib-win32.o] Error 1
> make: *** Waiting for unfinished jobs....
> ./trace/generated-tracers.h: In function ‘trace_spice_vmc_write’:
> ./trace/generated-tracers.h:6492: warning: format ‘%zd’ expects type
> ‘signed size_t’, but argument 6 has type ‘ssize_t’
> ./trace/generated-tracers.h: In function ‘trace_v9fs_read_return’:
> ./trace/generated-tracers.h:10344: warning: format ‘%zd’ expects type
> ‘signed size_t’, but argument 9 has type ‘ssize_t’
> ./trace/generated-tracers.h: In function ‘trace_v9fs_readdir_return’:
> ./trace/generated-tracers.h:10368: warning: format ‘%zd’ expects type
> ‘signed size_t’, but argument 9 has type ‘ssize_t’
> ./trace/generated-tracers.h: In function ‘trace_v9fs_write_return’:
> ./trace/generated-tracers.h:10392: warning: format ‘%zd’ expects type
> ‘signed size_t’, but argument 9 has type ‘ssize_t’
> make: *** [util/hbitmap.o] Error 1
> make: Leaving directory `/home/petmay01/linaro/qemu-for-merges/build/w32'
>
> 3.
> I also now get a handful of extra warnings in the 'make check' output:
>
>    /aarch64/qom/xilinx-zynq-a9:                                         OK
>    /aarch64/qom/xlnx-ep108:
> WARNING: RAM size 8000000 is small for EP108OK
>    /aarch64/qom/vexpress-a9:                                            OK
>
> (note the missing newline...)
>
> TEST: tests/qom-test... (pid=19738)
>    /microblaze/qom/none:                                                OK
>    /microblaze/qom/petalogix-s3adsp1800:
> Invalid MicroBlaze version number: (null)
> OK
>    /microblaze/qom/petalogix-ml605:
> Invalid MicroBlaze version number: (null)
> OK
got this

^ permalink raw reply	[flat|nested] 23+ messages in thread

* Re: [Qemu-devel] [PATCH v3 00/11] simplify usage of tracepoints, and connect them to logging
  2016-01-07  9:58 ` Stefan Hajnoczi
  2016-01-07 10:35   ` Denis V. Lunev
@ 2016-01-07 12:40   ` Denis V. Lunev
  2016-01-07 14:08     ` Edgar E. Iglesias
  1 sibling, 1 reply; 23+ messages in thread
From: Denis V. Lunev @ 2016-01-07 12:40 UTC (permalink / raw)
  To: Stefan Hajnoczi, Edgar E. Iglesias; +Cc: Paolo Bonzini, qemu-devel

On 01/07/2016 12:58 PM, Stefan Hajnoczi wrote:

[skipped]

> 3.
> I also now get a handful of extra warnings in the 'make check' output:
>
>    /aarch64/qom/xilinx-zynq-a9:                                         OK
>    /aarch64/qom/xlnx-ep108:
> WARNING: RAM size 8000000 is small for EP108OK
I do not observe this problem.

>    /aarch64/qom/vexpress-a9:                                            OK
>
> (note the missing newline...)
>
> TEST: tests/qom-test... (pid=19738)
>    /microblaze/qom/none:                                                OK
>    /microblaze/qom/petalogix-s3adsp1800:
> Invalid MicroBlaze version number: (null)
> OK
>    /microblaze/qom/petalogix-ml605:
> Invalid MicroBlaze version number: (null)
> OK
This problem exists in the original code.
The patchset just reveals something hidden.

This patch aborts() on unmodified sources.
Edgar, do you have any opinion?

Den

diff --git a/target-microblaze/cpu.c b/target-microblaze/cpu.c
index 52959e1..fae8ef6 100644
--- a/target-microblaze/cpu.c
+++ b/target-microblaze/cpu.c
@@ -167,6 +167,7 @@ static void mb_cpu_realizefn(DeviceState *dev, Error 
**errp)

      if (!version_code) {
          qemu_log("Invalid MicroBlaze version number: %s\n", 
cpu->cfg.version);
+        abort();
      }

      env->pvr.regs[0] |= (cpu->cfg.stackprot ? PVR0_SPROT_MASK : 0) |

^ permalink raw reply related	[flat|nested] 23+ messages in thread

* Re: [Qemu-devel] [PATCH v3 00/11] simplify usage of tracepoints, and connect them to logging
  2016-01-07 12:40   ` Denis V. Lunev
@ 2016-01-07 14:08     ` Edgar E. Iglesias
  0 siblings, 0 replies; 23+ messages in thread
From: Edgar E. Iglesias @ 2016-01-07 14:08 UTC (permalink / raw)
  To: Denis V. Lunev; +Cc: Stefan Hajnoczi, qemu-devel, Paolo Bonzini

On Thu, Jan 07, 2016 at 03:40:01PM +0300, Denis V. Lunev wrote:
> On 01/07/2016 12:58 PM, Stefan Hajnoczi wrote:
> 
> [skipped]
> 
> >3.
> >I also now get a handful of extra warnings in the 'make check' output:
> >
> >   /aarch64/qom/xilinx-zynq-a9:                                         OK
> >   /aarch64/qom/xlnx-ep108:
> >WARNING: RAM size 8000000 is small for EP108OK
> I do not observe this problem.
> 
> >   /aarch64/qom/vexpress-a9:                                            OK
> >
> >(note the missing newline...)
> >
> >TEST: tests/qom-test... (pid=19738)
> >   /microblaze/qom/none:                                                OK
> >   /microblaze/qom/petalogix-s3adsp1800:
> >Invalid MicroBlaze version number: (null)
> >OK
> >   /microblaze/qom/petalogix-ml605:
> >Invalid MicroBlaze version number: (null)
> >OK
> This problem exists in the original code.
> The patchset just reveals something hidden.
> 
> This patch aborts() on unmodified sources.
> Edgar, do you have any opinion?

Hi,

Yes, there was a fix for the Microblaze issues on the list. I've just merged it.

The ZynqMP EP108 issue had another fix posted on list IIRC.

Cheers,
Edgar


> 
> Den
> 
> diff --git a/target-microblaze/cpu.c b/target-microblaze/cpu.c
> index 52959e1..fae8ef6 100644
> --- a/target-microblaze/cpu.c
> +++ b/target-microblaze/cpu.c
> @@ -167,6 +167,7 @@ static void mb_cpu_realizefn(DeviceState *dev,
> Error **errp)
> 
>      if (!version_code) {
>          qemu_log("Invalid MicroBlaze version number: %s\n",
> cpu->cfg.version);
> +        abort();
>      }
> 
>      env->pvr.regs[0] |= (cpu->cfg.stackprot ? PVR0_SPROT_MASK : 0) |

^ permalink raw reply	[flat|nested] 23+ messages in thread

end of thread, other threads:[~2016-01-07 14:09 UTC | newest]

Thread overview: 23+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-10-29 20:44 [Qemu-devel] [PATCH v3 00/11] simplify usage of tracepoints, and connect them to logging Denis V. Lunev
2015-10-29 20:44 ` [Qemu-devel] [PATCH 01/11] trace: fix documentation Denis V. Lunev
2015-10-29 20:44 ` [Qemu-devel] [PATCH 02/11] trace: split trace_init_events out of trace_init_backends Denis V. Lunev
2015-10-29 20:44 ` [Qemu-devel] [PATCH 03/11] trace: split trace_init_file " Denis V. Lunev
2015-10-29 20:44 ` [Qemu-devel] [PATCH 04/11] trace: no need to call trace_backend_init in different branches now Denis V. Lunev
2015-10-29 20:44 ` [Qemu-devel] [PATCH 05/11] trace: add "-trace enable=..." Denis V. Lunev
2015-10-29 20:44 ` [Qemu-devel] [PATCH 06/11] trace: add "-trace help" Denis V. Lunev
2015-10-29 20:44 ` [Qemu-devel] [PATCH 07/11] log: do not unnecessarily include qom/cpu.h Denis V. Lunev
2015-10-29 20:44 ` [Qemu-devel] [PATCH 08/11] log: move qemu-log.c into util/ directory Denis V. Lunev
2015-10-29 20:44 ` [Qemu-devel] [PATCH 09/11] trace: convert stderr backend to log Denis V. Lunev
2015-10-29 20:44 ` [Qemu-devel] [PATCH 10/11] trace: switch default backend to "log" Denis V. Lunev
2015-10-29 20:44 ` [Qemu-devel] [PATCH 11/11] log: add "-d trace:PATTERN" Denis V. Lunev
2015-11-03 11:39 ` [Qemu-devel] [PATCH v3 00/11] simplify usage of tracepoints, and connect them to logging Denis V. Lunev
2015-11-03 15:33   ` Stefan Hajnoczi
2015-11-03 17:10 ` Stefan Hajnoczi
2015-11-03 17:33   ` Paolo Bonzini
2015-11-03 17:42     ` Denis V. Lunev
2015-11-03 17:50       ` Paolo Bonzini
2015-11-03 18:03         ` Denis V. Lunev
2016-01-07  9:58 ` Stefan Hajnoczi
2016-01-07 10:35   ` Denis V. Lunev
2016-01-07 12:40   ` Denis V. Lunev
2016-01-07 14:08     ` Edgar E. Iglesias

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.