qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [RFC][PATCH 0/6] trace-state: make the behaviour of "disable" consistent across all backends
@ 2011-04-04 21:49 Lluís
  2011-04-04 21:49 ` [Qemu-devel] [PATCH 1/6] trace: [ust] fix generation of 'trace.c' on events without args Lluís
                   ` (6 more replies)
  0 siblings, 7 replies; 17+ messages in thread
From: Lluís @ 2011-04-04 21:49 UTC (permalink / raw)
  To: qemu-devel; +Cc: stefanha

This patch defines the "disable" trace event state to always use the "nop"
backend.

As a side-effect, all events are now enabled (without "disable") by default, as
all backends (except "stderr") have programmatic support for dynamically
(de)activating each trace event.

In order to make this true, the "simple" backend now has a "-trace
events=<file>" argument to let the user select which events must be enabled from
the very beginning.

Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
---

Lluís Vilanova (6):
      trace: [ust] fix generation of 'trace.c' on events without args
      trace: generalize the "property" concept in the trace-events file
      trace-state: always use the "nop" backend on events with the "disable" keyword
      trace-state: [simple] disable all trace points by default
      trace-state: [simple] add "-trace events" argument to control initial state
      trace: enable all events


 docs/tracing.txt  |   12 +-
 qemu-config.c     |    5 +
 qemu-options.hx   |   18 ++
 scripts/tracetool |   88 +++++-------
 trace-events      |  385 ++++++++++++++++++++++++++---------------------------
 vl.c              |   94 ++++++++-----
 6 files changed, 313 insertions(+), 289 deletions(-)

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

* [Qemu-devel] [PATCH 1/6] trace: [ust] fix generation of 'trace.c' on events without args
  2011-04-04 21:49 [Qemu-devel] [RFC][PATCH 0/6] trace-state: make the behaviour of "disable" consistent across all backends Lluís
@ 2011-04-04 21:49 ` Lluís
  2011-04-04 21:49 ` [Qemu-devel] [PATCH 2/6] trace: generalize the "property" concept in the trace-events file Lluís
                   ` (5 subsequent siblings)
  6 siblings, 0 replies; 17+ messages in thread
From: Lluís @ 2011-04-04 21:49 UTC (permalink / raw)
  To: qemu-devel; +Cc: stefanha

Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
---
 scripts/tracetool |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/scripts/tracetool b/scripts/tracetool
index 412f695..d88cb43 100755
--- a/scripts/tracetool
+++ b/scripts/tracetool
@@ -338,6 +338,7 @@ linetoc_ust()
     name=$(get_name "$1")
     args=$(get_args "$1")
     argnames=$(get_argnames "$1", ",")
+    [ -z "$argnames" ] || argnames=", $argnames"
     fmt=$(get_fmt "$1")
 
     cat <<EOF
@@ -345,7 +346,7 @@ DEFINE_TRACE(ust_$name);
 
 static void ust_${name}_probe($args)
 {
-    trace_mark(ust, $name, "$fmt", $argnames);
+    trace_mark(ust, $name, "$fmt"$argnames);
 }
 EOF
 
@@ -488,7 +489,7 @@ EOF
         cat <<EOF
   $arg = \$arg$i;
 EOF
-	i="$((i+1))"
+        i="$((i+1))"
     done
 
     cat <<EOF
@@ -585,7 +586,7 @@ tracetostap()
        exit 1
     fi
     if [ -z "$probeprefix" ]; then
-	probeprefix="qemu.$targettype.$targetarch";
+        probeprefix="qemu.$targettype.$targetarch";
     fi
     echo "/* This file is autogenerated by tracetool, do not edit. */"
     convert stap

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

* [Qemu-devel] [PATCH 2/6] trace: generalize the "property" concept in the trace-events file
  2011-04-04 21:49 [Qemu-devel] [RFC][PATCH 0/6] trace-state: make the behaviour of "disable" consistent across all backends Lluís
  2011-04-04 21:49 ` [Qemu-devel] [PATCH 1/6] trace: [ust] fix generation of 'trace.c' on events without args Lluís
@ 2011-04-04 21:49 ` Lluís
  2011-04-06 10:53   ` [Qemu-devel] " Stefan Hajnoczi
  2011-04-04 21:49 ` [Qemu-devel] [PATCH 3/6] trace-state: always use the "nop" backend on events with the "disable" keyword Lluís
                   ` (4 subsequent siblings)
  6 siblings, 1 reply; 17+ messages in thread
From: Lluís @ 2011-04-04 21:49 UTC (permalink / raw)
  To: qemu-devel; +Cc: stefanha

This adds/modifies the following functions:

* get_name: Get _only_ the event name
* has_property: Return whether an event has a property (keyword before the event
  name)

Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
---
 docs/tracing.txt  |    4 +--
 scripts/tracetool |   73 ++++++++++++++++++++++++-----------------------------
 2 files changed, 35 insertions(+), 42 deletions(-)

diff --git a/docs/tracing.txt b/docs/tracing.txt
index f15069c..5dbd3c0 100644
--- a/docs/tracing.txt
+++ b/docs/tracing.txt
@@ -98,7 +98,7 @@ portability macros, ensure they are preceded and followed by double quotes:
 4. Name trace events after their function.  If there are multiple trace events
    in one function, append a unique distinguisher at the end of the name.
 
-5. Declare trace events with the "disable" keyword.  Some trace events can
+5. Declare trace events with the "disable" property.  Some trace events can
    produce a lot of output and users are typically only interested in a subset
    of trace events.  Marking trace events disabled by default saves the user
    from having to manually disable noisy trace events.
@@ -168,7 +168,7 @@ The st_change_trace_event_state() function can be used to enable or disable trac
 events at runtime inside QEMU:
 
     #include "trace.h"
-    
+
     st_change_trace_event_state("virtio_irq", true); /* enable */
     [...]
     st_change_trace_event_state("virtio_irq", false); /* disable */
diff --git a/scripts/tracetool b/scripts/tracetool
index d88cb43..6d8ead2 100755
--- a/scripts/tracetool
+++ b/scripts/tracetool
@@ -43,7 +43,26 @@ EOF
 # Get the name of a trace event
 get_name()
 {
-    echo ${1%%\(*}
+    local name
+    name=${1%%\(*}
+    echo "${name##* }"
+}
+
+# Get the given property of a trace event
+# 1: trace-events line
+# 2: property name
+# -> return 0 if property is present, or 1 otherwise
+has_property()
+{
+    local props prop
+    props=${1%%\(*}
+    props=${props% *}
+    for prop in $props; do
+        if [ "$prop" = "$2" ]; then
+            return 0
+        fi
+    done
+    return 1
 }
 
 # Get the argument list of a trace event, including types and names
@@ -101,20 +120,6 @@ get_fmt()
     echo "$fmt"
 }
 
-# Get the state of a trace event
-get_state()
-{
-    local str disable state
-    str=$(get_name "$1")
-    disable=${str##disable }
-    if [ "$disable" = "$str" ] ; then
-        state=1
-    else
-        state=0
-    fi
-    echo "$state"
-}
-
 linetoh_begin_nop()
 {
     return
@@ -174,14 +179,10 @@ cast_args_to_uint64_t()
 
 linetoh_simple()
 {
-    local name args argc trace_args state
+    local name args argc trace_args
     name=$(get_name "$1")
     args=$(get_args "$1")
     argc=$(get_argc "$1")
-    state=$(get_state "$1")
-    if [ "$state" = "0" ]; then
-        name=${name##disable }
-    fi
 
     trace_args="$simple_event_num"
     if [ "$argc" -gt 0 ]
@@ -222,9 +223,10 @@ linetoc_simple()
 {
     local name state
     name=$(get_name "$1")
-    state=$(get_state "$1")
-    if [ "$state" = "0" ] ; then
-        name=${name##disable }
+    if has_property "$1" "disable"; then
+        state="0"
+    else
+        state="1"
     fi
     cat <<EOF
 {.tp_name = "$name", .state=$state},
@@ -379,14 +381,10 @@ EOF
 
 linetoh_dtrace()
 {
-    local name args argnames state nameupper
+    local name args argnames nameupper
     name=$(get_name "$1")
     args=$(get_args "$1")
     argnames=$(get_argnames "$1", ",")
-    state=$(get_state "$1")
-    if [ "$state" = "0" ] ; then
-        name=${name##disable }
-    fi
 
     nameupper=`echo $name | tr '[:lower:]' '[:upper:]'`
 
@@ -430,13 +428,9 @@ EOF
 
 linetod_dtrace()
 {
-    local name args state
+    local name args
     name=$(get_name "$1")
     args=$(get_args "$1")
-    state=$(get_state "$1")
-    if [ "$state" = "0" ] ; then
-        name=${name##disable }
-    fi
 
     # DTrace provider syntax expects foo() for empty
     # params, not foo(void)
@@ -464,14 +458,10 @@ linetostap_begin_dtrace()
 
 linetostap_dtrace()
 {
-    local i arg name args arglist state
+    local i arg name args arglist
     name=$(get_name "$1")
     args=$(get_args "$1")
     arglist=$(get_argnames "$1", "")
-    state=$(get_state "$1")
-    if [ "$state" = "0" ] ; then
-        name=${name##disable }
-    fi
 
     # Define prototype for probe arguments
     cat <<EOF
@@ -517,9 +507,12 @@ convert()
         test -z "${str%%#*}" && continue
 
         # Process the line.  The nop backend handles disabled lines.
-        disable=${str%%disable *}
+        disable="0"
+        if has_property "$str" "disable"; then
+            disable="1"
+        fi
         echo
-        if test -z "$disable"; then
+        if [ "$disable" = "1" ]; then
             # Pass the disabled state as an arg for the simple
             # or DTrace backends which handle it dynamically.
             # For all other backends, call lineto$1_nop()

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

* [Qemu-devel] [PATCH 3/6] trace-state: always use the "nop" backend on events with the "disable" keyword
  2011-04-04 21:49 [Qemu-devel] [RFC][PATCH 0/6] trace-state: make the behaviour of "disable" consistent across all backends Lluís
  2011-04-04 21:49 ` [Qemu-devel] [PATCH 1/6] trace: [ust] fix generation of 'trace.c' on events without args Lluís
  2011-04-04 21:49 ` [Qemu-devel] [PATCH 2/6] trace: generalize the "property" concept in the trace-events file Lluís
@ 2011-04-04 21:49 ` Lluís
  2011-04-06 11:04   ` [Qemu-devel] " Stefan Hajnoczi
  2011-04-04 21:49 ` [Qemu-devel] [PATCH 4/6] trace-state: [simple] disable all trace points by default Lluís
                   ` (3 subsequent siblings)
  6 siblings, 1 reply; 17+ messages in thread
From: Lluís @ 2011-04-04 21:49 UTC (permalink / raw)
  To: qemu-devel; +Cc: stefanha

Any event with the keyword/property "disable" generates an empty trace event
using the "nop" backend, regardless of the current backend.

Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
---
 docs/tracing.txt  |    3 +++
 scripts/tracetool |   15 ++-------------
 2 files changed, 5 insertions(+), 13 deletions(-)

diff --git a/docs/tracing.txt b/docs/tracing.txt
index 5dbd3c0..49e030e 100644
--- a/docs/tracing.txt
+++ b/docs/tracing.txt
@@ -126,6 +126,9 @@ The "nop" backend generates empty trace event functions so that the compiler
 can optimize out trace events completely.  This is the default and imposes no
 performance penalty.
 
+Note that regardless of the selected trace backend, events with the "disable"
+property will be generated with the "nop" backend.
+
 === Stderr ===
 
 The "stderr" backend sends trace events directly to standard error.  This
diff --git a/scripts/tracetool b/scripts/tracetool
index 6d8ead2..7506776 100755
--- a/scripts/tracetool
+++ b/scripts/tracetool
@@ -506,21 +506,10 @@ convert()
         # Skip comments and empty lines
         test -z "${str%%#*}" && continue
 
+        echo
         # Process the line.  The nop backend handles disabled lines.
-        disable="0"
         if has_property "$str" "disable"; then
-            disable="1"
-        fi
-        echo
-        if [ "$disable" = "1" ]; then
-            # Pass the disabled state as an arg for the simple
-            # or DTrace backends which handle it dynamically.
-            # For all other backends, call lineto$1_nop()
-            if [ $backend = "simple" -o "$backend" = "dtrace" ]; then
-                "$process_line" "$str"
-            else
-                "lineto$1_nop" "${str##disable }"
-            fi
+            "lineto$1_nop" "$str"
         else
             "$process_line" "$str"
         fi

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

* [Qemu-devel] [PATCH 4/6] trace-state: [simple] disable all trace points by default
  2011-04-04 21:49 [Qemu-devel] [RFC][PATCH 0/6] trace-state: make the behaviour of "disable" consistent across all backends Lluís
                   ` (2 preceding siblings ...)
  2011-04-04 21:49 ` [Qemu-devel] [PATCH 3/6] trace-state: always use the "nop" backend on events with the "disable" keyword Lluís
@ 2011-04-04 21:49 ` Lluís
  2011-04-04 21:49 ` [Qemu-devel] [PATCH 5/6] trace-state: [simple] add "-trace events" argument to control initial state Lluís
                   ` (2 subsequent siblings)
  6 siblings, 0 replies; 17+ messages in thread
From: Lluís @ 2011-04-04 21:49 UTC (permalink / raw)
  To: qemu-devel; +Cc: stefanha

Note that this refers to the backend-specific state (whether the output must be
generated), not the event "disabled" property (which always uses the "nop"
backend).

Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
---
 scripts/tracetool |    9 ++-------
 trace-events      |    3 ---
 2 files changed, 2 insertions(+), 10 deletions(-)

diff --git a/scripts/tracetool b/scripts/tracetool
index 7506776..e3aec89 100755
--- a/scripts/tracetool
+++ b/scripts/tracetool
@@ -221,15 +221,10 @@ EOF
 
 linetoc_simple()
 {
-    local name state
+    local name
     name=$(get_name "$1")
-    if has_property "$1" "disable"; then
-        state="0"
-    else
-        state="1"
-    fi
     cat <<EOF
-{.tp_name = "$name", .state=$state},
+{.tp_name = "$name", .state=0},
 EOF
     simple_event_num=$((simple_event_num + 1))
 }
diff --git a/trace-events b/trace-events
index 90c9e0b..d871ffc 100644
--- a/trace-events
+++ b/trace-events
@@ -17,9 +17,6 @@
 # Example: qemu_malloc(size_t size) "size %zu"
 #
 # The "disable" keyword will build without the trace event.
-# In case of 'simple' trace backend, it will allow the trace event to be
-# compiled, but this would be turned off by default. It can be toggled on via
-# the monitor.
 #
 # The <name> must be a valid as a C function name.
 #

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

* [Qemu-devel] [PATCH 5/6] trace-state: [simple] add "-trace events" argument to control initial state
  2011-04-04 21:49 [Qemu-devel] [RFC][PATCH 0/6] trace-state: make the behaviour of "disable" consistent across all backends Lluís
                   ` (3 preceding siblings ...)
  2011-04-04 21:49 ` [Qemu-devel] [PATCH 4/6] trace-state: [simple] disable all trace points by default Lluís
@ 2011-04-04 21:49 ` Lluís
  2011-04-06 11:37   ` [Qemu-devel] " Stefan Hajnoczi
  2011-04-04 21:49 ` [Qemu-devel] [PATCH 6/6] trace: enable all events Lluís
  2011-04-05 13:30 ` [Qemu-devel] Re: [RFC][PATCH 0/6] trace-state: make the behaviour of "disable" consistent across all backends Stefan Hajnoczi
  6 siblings, 1 reply; 17+ messages in thread
From: Lluís @ 2011-04-04 21:49 UTC (permalink / raw)
  To: qemu-devel; +Cc: stefanha

When using the "simple" tracing backend, all events are in disabled state by
default.

The "-trace events" argument can be used to provide a file with a list of trace
event names that will be enabled prior to starting execution. This saves the
user from manually toggling event states through the monitor interface, as well
as enables early tracing for the selected points, much like other
more-sophisticated backends like "ust" or "dtrace".

Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
---
 docs/tracing.txt |    5 +++
 qemu-config.c    |    5 ++-
 qemu-options.hx  |   18 ++++++++--
 vl.c             |   94 +++++++++++++++++++++++++++++++++++-------------------
 4 files changed, 84 insertions(+), 38 deletions(-)

diff --git a/docs/tracing.txt b/docs/tracing.txt
index 49e030e..5f86f1a 100644
--- a/docs/tracing.txt
+++ b/docs/tracing.txt
@@ -144,6 +144,11 @@ source tree.  It may not be as powerful as platform-specific or third-party
 trace backends but it is portable.  This is the recommended trace backend
 unless you have specific needs for more advanced backends.
 
+==== Enabling trace events from the command line ====
+
+The "-trace events=<file>" command line argument can be used to enable the
+events listed in <file> from the very beginning of the program.
+
 ==== Monitor commands ====
 
 * info trace
diff --git a/qemu-config.c b/qemu-config.c
index 323d3c2..0a00081 100644
--- a/qemu-config.c
+++ b/qemu-config.c
@@ -300,12 +300,15 @@ static QemuOptsList qemu_mon_opts = {
 #ifdef CONFIG_SIMPLE_TRACE
 static QemuOptsList qemu_trace_opts = {
     .name = "trace",
-    .implied_opt_name = "trace",
+    .implied_opt_name = "file",
     .head = QTAILQ_HEAD_INITIALIZER(qemu_trace_opts.head),
     .desc = {
         {
             .name = "file",
             .type = QEMU_OPT_STRING,
+        },{
+            .name = "events",
+            .type = QEMU_OPT_STRING,
         },
         { /* end if list */ }
     },
diff --git a/qemu-options.hx b/qemu-options.hx
index ef60730..e7b93b5 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -2358,13 +2358,23 @@ option will prevent QEMU from loading these configuration files at startup.
 ETEXI
 #ifdef CONFIG_SIMPLE_TRACE
 DEF("trace", HAS_ARG, QEMU_OPTION_trace,
-    "-trace\n"
-    "                Specify a trace file to log traces to\n",
+    "-trace [file=]<file>[,events=<file>]\n"
+    "                specify tracing options\n",
     QEMU_ARCH_ALL)
 STEXI
-@item -trace
+@item -trace [file=]@var{file}[,events=@var{file}]
 @findex -trace
-Specify a trace file to log output traces to.
+
+Specify tracing options.
+
+@table @option
+@item file=@var{file}
+Log output traces to @var{file}.
+@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.
+@end table
 ETEXI
 #endif
 
diff --git a/vl.c b/vl.c
index c387f2b..5d6b03b 100644
--- a/vl.c
+++ b/vl.c
@@ -1931,7 +1931,7 @@ static int virtcon_parse(const char *devname)
 }
 
 static int debugcon_parse(const char *devname)
-{   
+{
     QemuOpts *opts;
 
     if (!qemu_chr_open("debugcon", devname, NULL)) {
@@ -2039,6 +2039,7 @@ int main(int argc, char **argv, char **envp)
 #endif
     int defconfig = 1;
     const char *trace_file = NULL;
+    const char *trace_events_file = NULL;
 
     atexit(qemu_run_exit_notifiers);
     error_set_progname(argv[0]);
@@ -2112,7 +2113,7 @@ int main(int argc, char **argv, char **envp)
         if (optind >= argc)
             break;
         if (argv[optind][0] != '-') {
-	    hda_opts = drive_add(IF_DEFAULT, 0, argv[optind++], HD_OPTS);
+            hda_opts = drive_add(IF_DEFAULT, 0, argv[optind++], HD_OPTS);
         } else {
             const QEMUOption *popt;
 
@@ -2174,15 +2175,15 @@ int main(int argc, char **argv, char **envp)
                 break;
             case QEMU_OPTION_drive:
                 drive_def(optarg);
-	        break;
+                break;
             case QEMU_OPTION_set:
                 if (qemu_set_option(optarg) != 0)
                     exit(1);
-	        break;
+                break;
             case QEMU_OPTION_global:
                 if (qemu_global_option(optarg) != 0)
                     exit(1);
-	        break;
+                break;
             case QEMU_OPTION_mtdblock:
                 drive_add(IF_MTD, -1, optarg, MTD_OPTS);
                 break;
@@ -2229,7 +2230,7 @@ int main(int argc, char **argv, char **envp)
                         fprintf(stderr, "qemu: invalid physical CHS format\n");
                         exit(1);
                     }
-		    if (hda_opts != NULL) {
+                    if (hda_opts != NULL) {
                         char num[16];
                         snprintf(num, sizeof(num), "%d", cyls);
                         qemu_opt_set(hda_opts, "cyls", num);
@@ -2431,9 +2432,9 @@ int main(int argc, char **argv, char **envp)
             case QEMU_OPTION_S:
                 autostart = 0;
                 break;
-	    case QEMU_OPTION_k:
-		keyboard_layout = optarg;
-		break;
+            case QEMU_OPTION_k:
+                keyboard_layout = optarg;
+                break;
             case QEMU_OPTION_localtime:
                 rtc_utc = 0;
                 break;
@@ -2616,9 +2617,9 @@ int main(int argc, char **argv, char **envp)
             case QEMU_OPTION_debugcon:
                 add_device_config(DEV_DEBUGCON, optarg);
                 break;
-	    case QEMU_OPTION_loadvm:
-		loadvm = optarg;
-		break;
+            case QEMU_OPTION_loadvm:
+                loadvm = optarg;
+                break;
             case QEMU_OPTION_full_screen:
                 full_screen = 1;
                 break;
@@ -2693,7 +2694,7 @@ int main(int argc, char **argv, char **envp)
                     exit(1);
                 }
                 break;
-	    case QEMU_OPTION_vnc:
+            case QEMU_OPTION_vnc:
 #ifdef CONFIG_VNC
                 display_remote++;
                 vnc_display = optarg;
@@ -2730,11 +2731,11 @@ int main(int argc, char **argv, char **envp)
                     exit(1);
                 }
                 break;
-	    case QEMU_OPTION_option_rom:
-		if (nb_option_roms >= MAX_OPTION_ROMS) {
-		    fprintf(stderr, "Too many option ROMs\n");
-		    exit(1);
-		}
+            case QEMU_OPTION_option_rom:
+                if (nb_option_roms >= MAX_OPTION_ROMS) {
+                    fprintf(stderr, "Too many option ROMs\n");
+                    exit(1);
+                }
                 opts = qemu_opts_parse(qemu_find_opts("option-rom"), optarg, 1);
                 option_rom[nb_option_roms].name = qemu_opt_get(opts, "romfile");
                 option_rom[nb_option_roms].bootindex =
@@ -2743,25 +2744,25 @@ int main(int argc, char **argv, char **envp)
                     fprintf(stderr, "Option ROM file is not specified\n");
                     exit(1);
                 }
-		nb_option_roms++;
-		break;
+                nb_option_roms++;
+                break;
             case QEMU_OPTION_semihosting:
                 semihosting_enabled = 1;
                 break;
             case QEMU_OPTION_name:
                 qemu_name = qemu_strdup(optarg);
-		 {
-		     char *p = strchr(qemu_name, ',');
-		     if (p != NULL) {
-		        *p++ = 0;
-			if (strncmp(p, "process=", 8)) {
-			    fprintf(stderr, "Unknown subargument %s to -name\n", p);
-			    exit(1);
-			}
-			p += 8;
-			os_set_proc_name(p);
-		     }	
-		 }	
+                 {
+                     char *p = strchr(qemu_name, ',');
+                     if (p != NULL) {
+                        *p++ = 0;
+                        if (strncmp(p, "process=", 8)) {
+                            fprintf(stderr, "Unknown subargument %s to -name\n", p);
+                            exit(1);
+                        }
+                        p += 8;
+                        os_set_proc_name(p);
+                     }
+                 }
                 break;
             case QEMU_OPTION_prom_env:
                 if (nb_prom_envs >= MAX_PROM_ENVS) {
@@ -2833,9 +2834,10 @@ int main(int argc, char **argv, char **envp)
                 break;
 #ifdef CONFIG_SIMPLE_TRACE
             case QEMU_OPTION_trace:
-                opts = qemu_opts_parse(qemu_find_opts("trace"), optarg, 0);
+                opts = qemu_opts_parse(qemu_find_opts("trace"), optarg, 1);
                 if (opts) {
                     trace_file = qemu_opt_get(opts, "file");
+                    trace_events_file = qemu_opt_get(opts, "events");
                 }
                 break;
 #endif
@@ -2887,6 +2889,32 @@ int main(int argc, char **argv, char **envp)
     if (!st_init(trace_file)) {
         fprintf(stderr, "warning: unable to initialize simple trace backend\n");
     }
+    if (trace_events_file) {
+        FILE *trace_events_fp = fopen(trace_events_file, "r");
+        if (!trace_events_fp) {
+            fprintf(stderr, "could not open trace events file '%s': %s\n",
+                    trace_events_file, strerror(errno));
+            exit(1);
+        }
+        char line_buf[1024];
+        char *line;
+        for (line = fgets(line_buf, 1024, trace_events_fp); line != NULL;
+             line = fgets(line_buf, 1024, trace_events_fp)) {
+            int len = strlen(line);
+            if (len > 1) {              /* skip empty lines */
+                line[len - 1] = '\0';
+                if (!st_change_trace_event_state(line, true)) {
+                    fprintf(stderr, "trace event '%s' does not exist\n", line);
+                    exit(1);
+                }
+            }
+        }
+        if (fclose(trace_events_fp) != 0) {
+            fprintf(stderr, "error closing file '%s': %s\n",
+                    trace_events_file, strerror(errno));
+            exit(1);
+        }
+    }
 
     /* If no data_dir is specified then try to find it relative to the
        executable path.  */

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

* [Qemu-devel] [PATCH 6/6] trace: enable all events
  2011-04-04 21:49 [Qemu-devel] [RFC][PATCH 0/6] trace-state: make the behaviour of "disable" consistent across all backends Lluís
                   ` (4 preceding siblings ...)
  2011-04-04 21:49 ` [Qemu-devel] [PATCH 5/6] trace-state: [simple] add "-trace events" argument to control initial state Lluís
@ 2011-04-04 21:49 ` Lluís
  2011-04-06 11:38   ` [Qemu-devel] " Stefan Hajnoczi
  2011-04-05 13:30 ` [Qemu-devel] Re: [RFC][PATCH 0/6] trace-state: make the behaviour of "disable" consistent across all backends Stefan Hajnoczi
  6 siblings, 1 reply; 17+ messages in thread
From: Lluís @ 2011-04-04 21:49 UTC (permalink / raw)
  To: qemu-devel; +Cc: stefanha

Given that all events with programmatically-controlled state are disabled by
default, we can delete the "disable" property from all events.

As of now, the only backend that will generate high ammounts of (possibly)
undesired output is "stderr", but it is considered only for debug purposes.

Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
---
 trace-events |  382 +++++++++++++++++++++++++++++-----------------------------
 1 files changed, 191 insertions(+), 191 deletions(-)

diff --git a/trace-events b/trace-events
index d871ffc..d8a27ad 100644
--- a/trace-events
+++ b/trace-events
@@ -26,260 +26,260 @@
 # The <format-string> should be a sprintf()-compatible format string.
 
 # qemu-malloc.c
-disable qemu_malloc(size_t size, void *ptr) "size %zu ptr %p"
-disable qemu_realloc(void *ptr, size_t size, void *newptr) "ptr %p size %zu newptr %p"
-disable qemu_free(void *ptr) "ptr %p"
+qemu_malloc(size_t size, void *ptr) "size %zu ptr %p"
+qemu_realloc(void *ptr, size_t size, void *newptr) "ptr %p size %zu newptr %p"
+qemu_free(void *ptr) "ptr %p"
 
 # osdep.c
-disable qemu_memalign(size_t alignment, size_t size, void *ptr) "alignment %zu size %zu ptr %p"
-disable qemu_vmalloc(size_t size, void *ptr) "size %zu ptr %p"
-disable qemu_vfree(void *ptr) "ptr %p"
+qemu_memalign(size_t alignment, size_t size, void *ptr) "alignment %zu size %zu ptr %p"
+qemu_vmalloc(size_t size, void *ptr) "size %zu ptr %p"
+qemu_vfree(void *ptr) "ptr %p"
 
 # hw/virtio.c
-disable virtqueue_fill(void *vq, const void *elem, unsigned int len, unsigned int idx) "vq %p elem %p len %u idx %u"
-disable virtqueue_flush(void *vq, unsigned int count) "vq %p count %u"
-disable virtqueue_pop(void *vq, void *elem, unsigned int in_num, unsigned int out_num) "vq %p elem %p in_num %u out_num %u"
-disable virtio_queue_notify(void *vdev, int n, void *vq) "vdev %p n %d vq %p"
-disable virtio_irq(void *vq) "vq %p"
-disable virtio_notify(void *vdev, void *vq) "vdev %p vq %p"
+virtqueue_fill(void *vq, const void *elem, unsigned int len, unsigned int idx) "vq %p elem %p len %u idx %u"
+virtqueue_flush(void *vq, unsigned int count) "vq %p count %u"
+virtqueue_pop(void *vq, void *elem, unsigned int in_num, unsigned int out_num) "vq %p elem %p in_num %u out_num %u"
+virtio_queue_notify(void *vdev, int n, void *vq) "vdev %p n %d vq %p"
+virtio_irq(void *vq) "vq %p"
+virtio_notify(void *vdev, void *vq) "vdev %p vq %p"
 
 # block.c
-disable multiwrite_cb(void *mcb, int ret) "mcb %p ret %d"
-disable bdrv_aio_multiwrite(void *mcb, int num_callbacks, int num_reqs) "mcb %p num_callbacks %d num_reqs %d"
-disable bdrv_aio_multiwrite_earlyfail(void *mcb) "mcb %p"
-disable bdrv_aio_multiwrite_latefail(void *mcb, int i) "mcb %p i %d"
-disable bdrv_aio_flush(void *bs, void *opaque) "bs %p opaque %p"
-disable bdrv_aio_readv(void *bs, int64_t sector_num, int nb_sectors, void *opaque) "bs %p sector_num %"PRId64" nb_sectors %d opaque %p"
-disable bdrv_aio_writev(void *bs, int64_t sector_num, int nb_sectors, void *opaque) "bs %p sector_num %"PRId64" nb_sectors %d opaque %p"
+multiwrite_cb(void *mcb, int ret) "mcb %p ret %d"
+bdrv_aio_multiwrite(void *mcb, int num_callbacks, int num_reqs) "mcb %p num_callbacks %d num_reqs %d"
+bdrv_aio_multiwrite_earlyfail(void *mcb) "mcb %p"
+bdrv_aio_multiwrite_latefail(void *mcb, int i) "mcb %p i %d"
+bdrv_aio_flush(void *bs, void *opaque) "bs %p opaque %p"
+bdrv_aio_readv(void *bs, int64_t sector_num, int nb_sectors, void *opaque) "bs %p sector_num %"PRId64" nb_sectors %d opaque %p"
+bdrv_aio_writev(void *bs, int64_t sector_num, int nb_sectors, void *opaque) "bs %p sector_num %"PRId64" nb_sectors %d opaque %p"
 
 # hw/virtio-blk.c
-disable virtio_blk_req_complete(void *req, int status) "req %p status %d"
-disable virtio_blk_rw_complete(void *req, int ret) "req %p ret %d"
-disable virtio_blk_handle_write(void *req, uint64_t sector, size_t nsectors) "req %p sector %"PRIu64" nsectors %zu"
+virtio_blk_req_complete(void *req, int status) "req %p status %d"
+virtio_blk_rw_complete(void *req, int ret) "req %p ret %d"
+virtio_blk_handle_write(void *req, uint64_t sector, size_t nsectors) "req %p sector %"PRIu64" nsectors %zu"
 
 # posix-aio-compat.c
-disable paio_submit(void *acb, void *opaque, int64_t sector_num, int nb_sectors, int type) "acb %p opaque %p sector_num %"PRId64" nb_sectors %d type %d"
-disable paio_complete(void *acb, void *opaque, int ret) "acb %p opaque %p ret %d"
-disable paio_cancel(void *acb, void *opaque) "acb %p opaque %p"
+paio_submit(void *acb, void *opaque, int64_t sector_num, int nb_sectors, int type) "acb %p opaque %p sector_num %"PRId64" nb_sectors %d type %d"
+paio_complete(void *acb, void *opaque, int ret) "acb %p opaque %p ret %d"
+paio_cancel(void *acb, void *opaque) "acb %p opaque %p"
 
 # ioport.c
-disable cpu_in(unsigned int addr, unsigned int val) "addr %#x value %u"
-disable cpu_out(unsigned int addr, unsigned int val) "addr %#x value %u"
+cpu_in(unsigned int addr, unsigned int val) "addr %#x value %u"
+cpu_out(unsigned int addr, unsigned int val) "addr %#x value %u"
 
 # balloon.c
 # Since requests are raised via monitor, not many tracepoints are needed.
-disable balloon_event(void *opaque, unsigned long addr) "opaque %p addr %lu"
+balloon_event(void *opaque, unsigned long addr) "opaque %p addr %lu"
 
 # hw/apic.c
-disable apic_local_deliver(int vector, uint32_t lvt) "vector %d delivery mode %d"
-disable apic_deliver_irq(uint8_t dest, uint8_t dest_mode, uint8_t delivery_mode, uint8_t vector_num, uint8_t polarity, uint8_t trigger_mode) "dest %d dest_mode %d delivery_mode %d vector %d polarity %d trigger_mode %d"
-disable cpu_set_apic_base(uint64_t val) "%016"PRIx64""
-disable cpu_get_apic_base(uint64_t val) "%016"PRIx64""
-disable apic_mem_readl(uint64_t addr, uint32_t val)  "%"PRIx64" = %08x"
-disable apic_mem_writel(uint64_t addr, uint32_t val) "%"PRIx64" = %08x"
+apic_local_deliver(int vector, uint32_t lvt) "vector %d delivery mode %d"
+apic_deliver_irq(uint8_t dest, uint8_t dest_mode, uint8_t delivery_mode, uint8_t vector_num, uint8_t polarity, uint8_t trigger_mode) "dest %d dest_mode %d delivery_mode %d vector %d polarity %d trigger_mode %d"
+cpu_set_apic_base(uint64_t val) "%016"PRIx64""
+cpu_get_apic_base(uint64_t val) "%016"PRIx64""
+apic_mem_readl(uint64_t addr, uint32_t val)  "%"PRIx64" = %08x"
+apic_mem_writel(uint64_t addr, uint32_t val) "%"PRIx64" = %08x"
 # coalescing
-disable apic_reset_irq_delivered(int apic_irq_delivered) "old coalescing %d"
-disable apic_get_irq_delivered(int apic_irq_delivered) "returning coalescing %d"
-disable apic_set_irq(int apic_irq_delivered) "coalescing %d"
+apic_reset_irq_delivered(int apic_irq_delivered) "old coalescing %d"
+apic_get_irq_delivered(int apic_irq_delivered) "returning coalescing %d"
+apic_set_irq(int apic_irq_delivered) "coalescing %d"
 
 # hw/cs4231.c
-disable cs4231_mem_readl_dreg(uint32_t reg, uint32_t ret) "read dreg %d: 0x%02x"
-disable cs4231_mem_readl_reg(uint32_t reg, uint32_t ret) "read reg %d: 0x%08x"
-disable cs4231_mem_writel_reg(uint32_t reg, uint32_t old, uint32_t val) "write reg %d: 0x%08x -> 0x%08x"
-disable cs4231_mem_writel_dreg(uint32_t reg, uint32_t old, uint32_t val) "write dreg %d: 0x%02x -> 0x%02x"
+cs4231_mem_readl_dreg(uint32_t reg, uint32_t ret) "read dreg %d: 0x%02x"
+cs4231_mem_readl_reg(uint32_t reg, uint32_t ret) "read reg %d: 0x%08x"
+cs4231_mem_writel_reg(uint32_t reg, uint32_t old, uint32_t val) "write reg %d: 0x%08x -> 0x%08x"
+cs4231_mem_writel_dreg(uint32_t reg, uint32_t old, uint32_t val) "write dreg %d: 0x%02x -> 0x%02x"
 
 # hw/eccmemctl.c
-disable ecc_mem_writel_mer(uint32_t val) "Write memory enable %08x"
-disable ecc_mem_writel_mdr(uint32_t val) "Write memory delay %08x"
-disable ecc_mem_writel_mfsr(uint32_t val) "Write memory fault status %08x"
-disable ecc_mem_writel_vcr(uint32_t val) "Write slot configuration %08x"
-disable ecc_mem_writel_dr(uint32_t val) "Write diagnostic %08x"
-disable ecc_mem_writel_ecr0(uint32_t val) "Write event count 1 %08x"
-disable ecc_mem_writel_ecr1(uint32_t val) "Write event count 2 %08x"
-disable ecc_mem_readl_mer(uint32_t ret) "Read memory enable %08x"
-disable ecc_mem_readl_mdr(uint32_t ret) "Read memory delay %08x"
-disable ecc_mem_readl_mfsr(uint32_t ret) "Read memory fault status %08x"
-disable ecc_mem_readl_vcr(uint32_t ret) "Read slot configuration %08x"
-disable ecc_mem_readl_mfar0(uint32_t ret) "Read memory fault address 0 %08x"
-disable ecc_mem_readl_mfar1(uint32_t ret) "Read memory fault address 1 %08x"
-disable ecc_mem_readl_dr(uint32_t ret) "Read diagnostic %08x"
-disable ecc_mem_readl_ecr0(uint32_t ret) "Read event count 1 %08x"
-disable ecc_mem_readl_ecr1(uint32_t ret) "Read event count 2 %08x"
-disable ecc_diag_mem_writeb(uint64_t addr, uint32_t val) "Write diagnostic %"PRId64" = %02x"
-disable ecc_diag_mem_readb(uint64_t addr, uint32_t ret) "Read diagnostic %"PRId64"= %02x"
+ecc_mem_writel_mer(uint32_t val) "Write memory enable %08x"
+ecc_mem_writel_mdr(uint32_t val) "Write memory delay %08x"
+ecc_mem_writel_mfsr(uint32_t val) "Write memory fault status %08x"
+ecc_mem_writel_vcr(uint32_t val) "Write slot configuration %08x"
+ecc_mem_writel_dr(uint32_t val) "Write diagnostic %08x"
+ecc_mem_writel_ecr0(uint32_t val) "Write event count 1 %08x"
+ecc_mem_writel_ecr1(uint32_t val) "Write event count 2 %08x"
+ecc_mem_readl_mer(uint32_t ret) "Read memory enable %08x"
+ecc_mem_readl_mdr(uint32_t ret) "Read memory delay %08x"
+ecc_mem_readl_mfsr(uint32_t ret) "Read memory fault status %08x"
+ecc_mem_readl_vcr(uint32_t ret) "Read slot configuration %08x"
+ecc_mem_readl_mfar0(uint32_t ret) "Read memory fault address 0 %08x"
+ecc_mem_readl_mfar1(uint32_t ret) "Read memory fault address 1 %08x"
+ecc_mem_readl_dr(uint32_t ret) "Read diagnostic %08x"
+ecc_mem_readl_ecr0(uint32_t ret) "Read event count 1 %08x"
+ecc_mem_readl_ecr1(uint32_t ret) "Read event count 2 %08x"
+ecc_diag_mem_writeb(uint64_t addr, uint32_t val) "Write diagnostic %"PRId64" = %02x"
+ecc_diag_mem_readb(uint64_t addr, uint32_t ret) "Read diagnostic %"PRId64"= %02x"
 
 # hw/lance.c
-disable lance_mem_readw(uint64_t addr, uint32_t ret) "addr=%"PRIx64"val=0x%04x"
-disable lance_mem_writew(uint64_t addr, uint32_t val) "addr=%"PRIx64"val=0x%04x"
+lance_mem_readw(uint64_t addr, uint32_t ret) "addr=%"PRIx64"val=0x%04x"
+lance_mem_writew(uint64_t addr, uint32_t val) "addr=%"PRIx64"val=0x%04x"
 
 # hw/slavio_intctl.c
-disable slavio_intctl_mem_readl(uint32_t cpu, uint64_t addr, uint32_t ret) "read cpu %d reg 0x%"PRIx64" = %x"
-disable slavio_intctl_mem_writel(uint32_t cpu, uint64_t addr, uint32_t val) "write cpu %d reg 0x%"PRIx64" = %x"
-disable slavio_intctl_mem_writel_clear(uint32_t cpu, uint32_t val, uint32_t intreg_pending) "Cleared cpu %d irq mask %x, curmask %x"
-disable slavio_intctl_mem_writel_set(uint32_t cpu, uint32_t val, uint32_t intreg_pending) "Set cpu %d irq mask %x, curmask %x"
-disable slavio_intctlm_mem_readl(uint64_t addr, uint32_t ret) "read system reg 0x%"PRIx64" = %x"
-disable slavio_intctlm_mem_writel(uint64_t addr, uint32_t val) "write system reg 0x%"PRIx64" = %x"
-disable slavio_intctlm_mem_writel_enable(uint32_t val, uint32_t intregm_disabled) "Enabled master irq mask %x, curmask %x"
-disable slavio_intctlm_mem_writel_disable(uint32_t val, uint32_t intregm_disabled) "Disabled master irq mask %x, curmask %x"
-disable slavio_intctlm_mem_writel_target(uint32_t cpu) "Set master irq cpu %d"
-disable slavio_check_interrupts(uint32_t pending, uint32_t intregm_disabled) "pending %x disabled %x"
-disable slavio_set_irq(uint32_t target_cpu, int irq, uint32_t pil, int level) "Set cpu %d irq %d -> pil %d level %d"
-disable slavio_set_timer_irq_cpu(int cpu, int level) "Set cpu %d local timer level %d"
+slavio_intctl_mem_readl(uint32_t cpu, uint64_t addr, uint32_t ret) "read cpu %d reg 0x%"PRIx64" = %x"
+slavio_intctl_mem_writel(uint32_t cpu, uint64_t addr, uint32_t val) "write cpu %d reg 0x%"PRIx64" = %x"
+slavio_intctl_mem_writel_clear(uint32_t cpu, uint32_t val, uint32_t intreg_pending) "Cleared cpu %d irq mask %x, curmask %x"
+slavio_intctl_mem_writel_set(uint32_t cpu, uint32_t val, uint32_t intreg_pending) "Set cpu %d irq mask %x, curmask %x"
+slavio_intctlm_mem_readl(uint64_t addr, uint32_t ret) "read system reg 0x%"PRIx64" = %x"
+slavio_intctlm_mem_writel(uint64_t addr, uint32_t val) "write system reg 0x%"PRIx64" = %x"
+slavio_intctlm_mem_writel_enable(uint32_t val, uint32_t intregm_disabled) "Enabled master irq mask %x, curmask %x"
+slavio_intctlm_mem_writel_disable(uint32_t val, uint32_t intregm_disabled) "Disabled master irq mask %x, curmask %x"
+slavio_intctlm_mem_writel_target(uint32_t cpu) "Set master irq cpu %d"
+slavio_check_interrupts(uint32_t pending, uint32_t intregm_disabled) "pending %x disabled %x"
+slavio_set_irq(uint32_t target_cpu, int irq, uint32_t pil, int level) "Set cpu %d irq %d -> pil %d level %d"
+slavio_set_timer_irq_cpu(int cpu, int level) "Set cpu %d local timer level %d"
 
 # hw/slavio_misc.c
-disable slavio_misc_update_irq_raise(void) "Raise IRQ"
-disable slavio_misc_update_irq_lower(void) "Lower IRQ"
-disable slavio_set_power_fail(int power_failing, uint8_t config) "Power fail: %d, config: %d"
-disable slavio_cfg_mem_writeb(uint32_t val) "Write config %02x"
-disable slavio_cfg_mem_readb(uint32_t ret) "Read config %02x"
-disable slavio_diag_mem_writeb(uint32_t val) "Write diag %02x"
-disable slavio_diag_mem_readb(uint32_t ret) "Read diag %02x"
-disable slavio_mdm_mem_writeb(uint32_t val) "Write modem control %02x"
-disable slavio_mdm_mem_readb(uint32_t ret) "Read modem control %02x"
-disable slavio_aux1_mem_writeb(uint32_t val) "Write aux1 %02x"
-disable slavio_aux1_mem_readb(uint32_t ret) "Read aux1 %02x"
-disable slavio_aux2_mem_writeb(uint32_t val) "Write aux2 %02x"
-disable slavio_aux2_mem_readb(uint32_t ret) "Read aux2 %02x"
-disable apc_mem_writeb(uint32_t val) "Write power management %02x"
-disable apc_mem_readb(uint32_t ret) "Read power management %02x"
-disable slavio_sysctrl_mem_writel(uint32_t val) "Write system control %08x"
-disable slavio_sysctrl_mem_readl(uint32_t ret) "Read system control %08x"
-disable slavio_led_mem_writew(uint32_t val) "Write diagnostic LED %04x"
-disable slavio_led_mem_readw(uint32_t ret) "Read diagnostic LED %04x"
+slavio_misc_update_irq_raise(void) "Raise IRQ"
+slavio_misc_update_irq_lower(void) "Lower IRQ"
+slavio_set_power_fail(int power_failing, uint8_t config) "Power fail: %d, config: %d"
+slavio_cfg_mem_writeb(uint32_t val) "Write config %02x"
+slavio_cfg_mem_readb(uint32_t ret) "Read config %02x"
+slavio_diag_mem_writeb(uint32_t val) "Write diag %02x"
+slavio_diag_mem_readb(uint32_t ret) "Read diag %02x"
+slavio_mdm_mem_writeb(uint32_t val) "Write modem control %02x"
+slavio_mdm_mem_readb(uint32_t ret) "Read modem control %02x"
+slavio_aux1_mem_writeb(uint32_t val) "Write aux1 %02x"
+slavio_aux1_mem_readb(uint32_t ret) "Read aux1 %02x"
+slavio_aux2_mem_writeb(uint32_t val) "Write aux2 %02x"
+slavio_aux2_mem_readb(uint32_t ret) "Read aux2 %02x"
+apc_mem_writeb(uint32_t val) "Write power management %02x"
+apc_mem_readb(uint32_t ret) "Read power management %02x"
+slavio_sysctrl_mem_writel(uint32_t val) "Write system control %08x"
+slavio_sysctrl_mem_readl(uint32_t ret) "Read system control %08x"
+slavio_led_mem_writew(uint32_t val) "Write diagnostic LED %04x"
+slavio_led_mem_readw(uint32_t ret) "Read diagnostic LED %04x"
 
 # hw/slavio_timer.c
-disable slavio_timer_get_out(uint64_t limit, uint32_t counthigh, uint32_t count) "limit %"PRIx64" count %x%08x"
-disable slavio_timer_irq(uint32_t counthigh, uint32_t count) "callback: count %x%08x"
-disable slavio_timer_mem_readl_invalid(uint64_t addr) "invalid read address %"PRIx64""
-disable slavio_timer_mem_readl(uint64_t addr, uint32_t ret) "read %"PRIx64" = %08x"
-disable slavio_timer_mem_writel(uint64_t addr, uint32_t val) "write %"PRIx64" = %08x"
-disable slavio_timer_mem_writel_limit(unsigned int timer_index, uint64_t count) "processor %d user timer set to %016"PRIx64""
-disable slavio_timer_mem_writel_counter_invalid(void) "not user timer"
-disable slavio_timer_mem_writel_status_start(unsigned int timer_index) "processor %d user timer started"
-disable slavio_timer_mem_writel_status_stop(unsigned int timer_index) "processor %d user timer stopped"
-disable slavio_timer_mem_writel_mode_user(unsigned int timer_index) "processor %d changed from counter to user timer"
-disable slavio_timer_mem_writel_mode_counter(unsigned int timer_index) "processor %d changed from user timer to counter"
-disable slavio_timer_mem_writel_mode_invalid(void) "not system timer"
-disable slavio_timer_mem_writel_invalid(uint64_t addr) "invalid write address %"PRIx64""
+slavio_timer_get_out(uint64_t limit, uint32_t counthigh, uint32_t count) "limit %"PRIx64" count %x%08x"
+slavio_timer_irq(uint32_t counthigh, uint32_t count) "callback: count %x%08x"
+slavio_timer_mem_readl_invalid(uint64_t addr) "invalid read address %"PRIx64""
+slavio_timer_mem_readl(uint64_t addr, uint32_t ret) "read %"PRIx64" = %08x"
+slavio_timer_mem_writel(uint64_t addr, uint32_t val) "write %"PRIx64" = %08x"
+slavio_timer_mem_writel_limit(unsigned int timer_index, uint64_t count) "processor %d user timer set to %016"PRIx64""
+slavio_timer_mem_writel_counter_invalid(void) "not user timer"
+slavio_timer_mem_writel_status_start(unsigned int timer_index) "processor %d user timer started"
+slavio_timer_mem_writel_status_stop(unsigned int timer_index) "processor %d user timer stopped"
+slavio_timer_mem_writel_mode_user(unsigned int timer_index) "processor %d changed from counter to user timer"
+slavio_timer_mem_writel_mode_counter(unsigned int timer_index) "processor %d changed from user timer to counter"
+slavio_timer_mem_writel_mode_invalid(void) "not system timer"
+slavio_timer_mem_writel_invalid(uint64_t addr) "invalid write address %"PRIx64""
 
 # hw/sparc32_dma.c
-disable ledma_memory_read(uint64_t addr) "DMA read addr 0x%"PRIx64""
-disable ledma_memory_write(uint64_t addr) "DMA write addr 0x%"PRIx64""
-disable sparc32_dma_set_irq_raise(void) "Raise IRQ"
-disable sparc32_dma_set_irq_lower(void) "Lower IRQ"
-disable espdma_memory_read(uint32_t addr) "DMA read addr 0x%08x"
-disable espdma_memory_write(uint32_t addr) "DMA write addr 0x%08x"
-disable sparc32_dma_mem_readl(uint64_t addr, uint32_t ret) "read dmareg %"PRIx64": 0x%08x"
-disable sparc32_dma_mem_writel(uint64_t addr, uint32_t old, uint32_t val) "write dmareg %"PRIx64": 0x%08x -> 0x%08x"
-disable sparc32_dma_enable_raise(void) "Raise DMA enable"
-disable sparc32_dma_enable_lower(void) "Lower DMA enable"
+ledma_memory_read(uint64_t addr) "DMA read addr 0x%"PRIx64""
+ledma_memory_write(uint64_t addr) "DMA write addr 0x%"PRIx64""
+sparc32_dma_set_irq_raise(void) "Raise IRQ"
+sparc32_dma_set_irq_lower(void) "Lower IRQ"
+espdma_memory_read(uint32_t addr) "DMA read addr 0x%08x"
+espdma_memory_write(uint32_t addr) "DMA write addr 0x%08x"
+sparc32_dma_mem_readl(uint64_t addr, uint32_t ret) "read dmareg %"PRIx64": 0x%08x"
+sparc32_dma_mem_writel(uint64_t addr, uint32_t old, uint32_t val) "write dmareg %"PRIx64": 0x%08x -> 0x%08x"
+sparc32_dma_enable_raise(void) "Raise DMA enable"
+sparc32_dma_enable_lower(void) "Lower DMA enable"
 
 # hw/sun4m.c
-disable sun4m_cpu_interrupt(unsigned int level) "Set CPU IRQ %d"
-disable sun4m_cpu_reset_interrupt(unsigned int level) "Reset CPU IRQ %d"
-disable sun4m_cpu_set_irq_raise(int level) "Raise CPU IRQ %d"
-disable sun4m_cpu_set_irq_lower(int level) "Lower CPU IRQ %d"
+sun4m_cpu_interrupt(unsigned int level) "Set CPU IRQ %d"
+sun4m_cpu_reset_interrupt(unsigned int level) "Reset CPU IRQ %d"
+sun4m_cpu_set_irq_raise(int level) "Raise CPU IRQ %d"
+sun4m_cpu_set_irq_lower(int level) "Lower CPU IRQ %d"
 
 # hw/sun4m_iommu.c
-disable sun4m_iommu_mem_readl(uint64_t addr, uint32_t ret) "read reg[%"PRIx64"] = %x"
-disable sun4m_iommu_mem_writel(uint64_t addr, uint32_t val) "write reg[%"PRIx64"] = %x"
-disable sun4m_iommu_mem_writel_ctrl(uint64_t iostart) "iostart = %"PRIx64""
-disable sun4m_iommu_mem_writel_tlbflush(uint32_t val) "tlb flush %x"
-disable sun4m_iommu_mem_writel_pgflush(uint32_t val) "page flush %x"
-disable sun4m_iommu_page_get_flags(uint64_t pa, uint64_t iopte, uint32_t ret) "get flags addr %"PRIx64" => pte %"PRIx64", *pte = %x"
-disable sun4m_iommu_translate_pa(uint64_t addr, uint64_t pa, uint32_t iopte) "xlate dva %"PRIx64" => pa %"PRIx64" iopte = %x"
-disable sun4m_iommu_bad_addr(uint64_t addr) "bad addr %"PRIx64""
+sun4m_iommu_mem_readl(uint64_t addr, uint32_t ret) "read reg[%"PRIx64"] = %x"
+sun4m_iommu_mem_writel(uint64_t addr, uint32_t val) "write reg[%"PRIx64"] = %x"
+sun4m_iommu_mem_writel_ctrl(uint64_t iostart) "iostart = %"PRIx64""
+sun4m_iommu_mem_writel_tlbflush(uint32_t val) "tlb flush %x"
+sun4m_iommu_mem_writel_pgflush(uint32_t val) "page flush %x"
+sun4m_iommu_page_get_flags(uint64_t pa, uint64_t iopte, uint32_t ret) "get flags addr %"PRIx64" => pte %"PRIx64", *pte = %x"
+sun4m_iommu_translate_pa(uint64_t addr, uint64_t pa, uint32_t iopte) "xlate dva %"PRIx64" => pa %"PRIx64" iopte = %x"
+sun4m_iommu_bad_addr(uint64_t addr) "bad addr %"PRIx64""
 
 # hw/usb-desc.c
-disable usb_desc_device(int addr, int len, int ret) "dev %d query device, len %d, ret %d"
-disable usb_desc_device_qualifier(int addr, int len, int ret) "dev %d query device qualifier, len %d, ret %d"
-disable usb_desc_config(int addr, int index, int len, int ret) "dev %d query config %d, len %d, ret %d"
-disable usb_desc_other_speed_config(int addr, int index, int len, int ret) "dev %d query config %d, len %d, ret %d"
-disable usb_desc_string(int addr, int index, int len, int ret) "dev %d query string %d, len %d, ret %d"
-disable usb_set_addr(int addr) "dev %d"
-disable usb_set_config(int addr, int config, int ret) "dev %d, config %d, ret %d"
-disable usb_clear_device_feature(int addr, int feature, int ret) "dev %d, feature %d, ret %d"
-disable usb_set_device_feature(int addr, int feature, int ret) "dev %d, feature %d, ret %d"
+usb_desc_device(int addr, int len, int ret) "dev %d query device, len %d, ret %d"
+usb_desc_device_qualifier(int addr, int len, int ret) "dev %d query device qualifier, len %d, ret %d"
+usb_desc_config(int addr, int index, int len, int ret) "dev %d query config %d, len %d, ret %d"
+usb_desc_other_speed_config(int addr, int index, int len, int ret) "dev %d query config %d, len %d, ret %d"
+usb_desc_string(int addr, int index, int len, int ret) "dev %d query string %d, len %d, ret %d"
+usb_set_addr(int addr) "dev %d"
+usb_set_config(int addr, int config, int ret) "dev %d, config %d, ret %d"
+usb_clear_device_feature(int addr, int feature, int ret) "dev %d, feature %d, ret %d"
+usb_set_device_feature(int addr, int feature, int ret) "dev %d, feature %d, ret %d"
 
 # vl.c
-disable vm_state_notify(int running, int reason) "running %d reason %d"
+vm_state_notify(int running, int reason) "running %d reason %d"
 
 # block/qed-l2-cache.c
-disable qed_alloc_l2_cache_entry(void *l2_cache, void *entry) "l2_cache %p entry %p"
-disable qed_unref_l2_cache_entry(void *entry, int ref) "entry %p ref %d"
-disable qed_find_l2_cache_entry(void *l2_cache, void *entry, uint64_t offset, int ref) "l2_cache %p entry %p offset %"PRIu64" ref %d"
+qed_alloc_l2_cache_entry(void *l2_cache, void *entry) "l2_cache %p entry %p"
+qed_unref_l2_cache_entry(void *entry, int ref) "entry %p ref %d"
+qed_find_l2_cache_entry(void *l2_cache, void *entry, uint64_t offset, int ref) "l2_cache %p entry %p offset %"PRIu64" ref %d"
 
 # block/qed-table.c
-disable qed_read_table(void *s, uint64_t offset, void *table) "s %p offset %"PRIu64" table %p"
-disable qed_read_table_cb(void *s, void *table, int ret) "s %p table %p ret %d"
-disable qed_write_table(void *s, uint64_t offset, void *table, unsigned int index, unsigned int n) "s %p offset %"PRIu64" table %p index %u n %u"
-disable qed_write_table_cb(void *s, void *table, int flush, int ret) "s %p table %p flush %d ret %d"
+qed_read_table(void *s, uint64_t offset, void *table) "s %p offset %"PRIu64" table %p"
+qed_read_table_cb(void *s, void *table, int ret) "s %p table %p ret %d"
+qed_write_table(void *s, uint64_t offset, void *table, unsigned int index, unsigned int n) "s %p offset %"PRIu64" table %p index %u n %u"
+qed_write_table_cb(void *s, void *table, int flush, int ret) "s %p table %p flush %d ret %d"
 
 # block/qed.c
-disable qed_aio_complete(void *s, void *acb, int ret) "s %p acb %p ret %d"
-disable qed_aio_setup(void *s, void *acb, int64_t sector_num, int nb_sectors, void *opaque, int is_write) "s %p acb %p sector_num %"PRId64" nb_sectors %d opaque %p is_write %d"
-disable qed_aio_next_io(void *s, void *acb, int ret, uint64_t cur_pos) "s %p acb %p ret %d cur_pos %"PRIu64""
-disable qed_aio_read_data(void *s, void *acb, int ret, uint64_t offset, size_t len) "s %p acb %p ret %d offset %"PRIu64" len %zu"
-disable qed_aio_write_data(void *s, void *acb, int ret, uint64_t offset, size_t len) "s %p acb %p ret %d offset %"PRIu64" len %zu"
-disable qed_aio_write_prefill(void *s, void *acb, uint64_t start, size_t len, uint64_t offset) "s %p acb %p start %"PRIu64" len %zu offset %"PRIu64""
-disable qed_aio_write_postfill(void *s, void *acb, uint64_t start, size_t len, uint64_t offset) "s %p acb %p start %"PRIu64" len %zu offset %"PRIu64""
-disable qed_aio_write_main(void *s, void *acb, int ret, uint64_t offset, size_t len) "s %p acb %p ret %d offset %"PRIu64" len %zu"
+qed_aio_complete(void *s, void *acb, int ret) "s %p acb %p ret %d"
+qed_aio_setup(void *s, void *acb, int64_t sector_num, int nb_sectors, void *opaque, int is_write) "s %p acb %p sector_num %"PRId64" nb_sectors %d opaque %p is_write %d"
+qed_aio_next_io(void *s, void *acb, int ret, uint64_t cur_pos) "s %p acb %p ret %d cur_pos %"PRIu64""
+qed_aio_read_data(void *s, void *acb, int ret, uint64_t offset, size_t len) "s %p acb %p ret %d offset %"PRIu64" len %zu"
+qed_aio_write_data(void *s, void *acb, int ret, uint64_t offset, size_t len) "s %p acb %p ret %d offset %"PRIu64" len %zu"
+qed_aio_write_prefill(void *s, void *acb, uint64_t start, size_t len, uint64_t offset) "s %p acb %p start %"PRIu64" len %zu offset %"PRIu64""
+qed_aio_write_postfill(void *s, void *acb, uint64_t start, size_t len, uint64_t offset) "s %p acb %p start %"PRIu64" len %zu offset %"PRIu64""
+qed_aio_write_main(void *s, void *acb, int ret, uint64_t offset, size_t len) "s %p acb %p ret %d offset %"PRIu64" len %zu"
 
 # hw/grlib_gptimer.c
-disable grlib_gptimer_enable(int id, uint32_t count) "timer:%d set count 0x%x and run"
-disable grlib_gptimer_disabled(int id, uint32_t config) "timer:%d Timer disable config 0x%x"
-disable grlib_gptimer_restart(int id, uint32_t reload) "timer:%d reload val: 0x%x"
-disable grlib_gptimer_set_scaler(uint32_t scaler, uint32_t freq) "scaler:0x%x freq: 0x%x"
-disable grlib_gptimer_hit(int id) "timer:%d HIT"
-disable grlib_gptimer_readl(int id, const char *s, uint32_t val) "timer:%d %s 0x%x"
-disable grlib_gptimer_writel(int id, const char *s, uint32_t val) "timer:%d %s 0x%x"
-disable grlib_gptimer_unknown_register(const char *op, uint64_t val) "%s unknown register 0x%"PRIx64""
+grlib_gptimer_enable(int id, uint32_t count) "timer:%d set count 0x%x and run"
+grlib_gptimer_disabled(int id, uint32_t config) "timer:%d Timer disable config 0x%x"
+grlib_gptimer_restart(int id, uint32_t reload) "timer:%d reload val: 0x%x"
+grlib_gptimer_set_scaler(uint32_t scaler, uint32_t freq) "scaler:0x%x freq: 0x%x"
+grlib_gptimer_hit(int id) "timer:%d HIT"
+grlib_gptimer_readl(int id, const char *s, uint32_t val) "timer:%d %s 0x%x"
+grlib_gptimer_writel(int id, const char *s, uint32_t val) "timer:%d %s 0x%x"
+grlib_gptimer_unknown_register(const char *op, uint64_t val) "%s unknown register 0x%"PRIx64""
 
 # hw/grlib_irqmp.c
-disable grlib_irqmp_check_irqs(uint32_t pend, uint32_t force, uint32_t mask, uint32_t lvl1, uint32_t lvl2) "pend:0x%04x force:0x%04x mask:0x%04x lvl1:0x%04x lvl0:0x%04x\n"
-disable grlib_irqmp_ack(int intno) "interrupt:%d"
-disable grlib_irqmp_set_irq(int irq) "Raise CPU IRQ %d"
-disable grlib_irqmp_unknown_register(const char *op, uint64_t val) "%s unknown register 0x%"PRIx64""
+grlib_irqmp_check_irqs(uint32_t pend, uint32_t force, uint32_t mask, uint32_t lvl1, uint32_t lvl2) "pend:0x%04x force:0x%04x mask:0x%04x lvl1:0x%04x lvl0:0x%04x\n"
+grlib_irqmp_ack(int intno) "interrupt:%d"
+grlib_irqmp_set_irq(int irq) "Raise CPU IRQ %d"
+grlib_irqmp_unknown_register(const char *op, uint64_t val) "%s unknown register 0x%"PRIx64""
 
 # hw/grlib_apbuart.c
-disable grlib_apbuart_event(int event) "event:%d"
-disable grlib_apbuart_unknown_register(const char *op, uint64_t val) "%s unknown register 0x%"PRIx64""
+grlib_apbuart_event(int event) "event:%d"
+grlib_apbuart_unknown_register(const char *op, uint64_t val) "%s unknown register 0x%"PRIx64""
 
 # hw/leon3.c
-disable leon3_set_irq(int intno) "Set CPU IRQ %d"
-disable leon3_reset_irq(int intno) "Reset CPU IRQ %d"
+leon3_set_irq(int intno) "Set CPU IRQ %d"
+leon3_reset_irq(int intno) "Reset CPU IRQ %d"
 
 # spice-qemu-char.c
-disable spice_vmc_write(ssize_t out, int len) "spice wrottn %lu of requested %zd"
-disable spice_vmc_read(int bytes, int len) "spice read %lu of requested %zd"
-disable spice_vmc_register_interface(void *scd) "spice vmc registered interface %p"
-disable spice_vmc_unregister_interface(void *scd) "spice vmc unregistered interface %p"
+spice_vmc_write(ssize_t out, int len) "spice wrottn %lu of requested %zd"
+spice_vmc_read(int bytes, int len) "spice read %lu of requested %zd"
+spice_vmc_register_interface(void *scd) "spice vmc registered interface %p"
+spice_vmc_unregister_interface(void *scd) "spice vmc unregistered interface %p"
 
 # hw/lm32_pic.c
-disable lm32_pic_raise_irq(void) "Raise CPU interrupt"
-disable lm32_pic_lower_irq(void) "Lower CPU interrupt"
-disable lm32_pic_interrupt(int irq, int level) "Set IRQ%d %d"
-disable lm32_pic_set_im(uint32_t im) "im 0x%08x"
-disable lm32_pic_set_ip(uint32_t ip) "ip 0x%08x"
-disable lm32_pic_get_im(uint32_t im) "im 0x%08x"
-disable lm32_pic_get_ip(uint32_t ip) "ip 0x%08x"
+lm32_pic_raise_irq(void) "Raise CPU interrupt"
+lm32_pic_lower_irq(void) "Lower CPU interrupt"
+lm32_pic_interrupt(int irq, int level) "Set IRQ%d %d"
+lm32_pic_set_im(uint32_t im) "im 0x%08x"
+lm32_pic_set_ip(uint32_t ip) "ip 0x%08x"
+lm32_pic_get_im(uint32_t im) "im 0x%08x"
+lm32_pic_get_ip(uint32_t ip) "ip 0x%08x"
 
 # hw/lm32_juart.c
-disable lm32_juart_get_jtx(uint32_t value) "jtx 0x%08x"
-disable lm32_juart_set_jtx(uint32_t value) "jtx 0x%08x"
-disable lm32_juart_get_jrx(uint32_t value) "jrx 0x%08x"
-disable lm32_juart_set_jrx(uint32_t value) "jrx 0x%08x"
+lm32_juart_get_jtx(uint32_t value) "jtx 0x%08x"
+lm32_juart_set_jtx(uint32_t value) "jtx 0x%08x"
+lm32_juart_get_jrx(uint32_t value) "jrx 0x%08x"
+lm32_juart_set_jrx(uint32_t value) "jrx 0x%08x"
 
 # hw/lm32_timer.c
-disable lm32_timer_memory_write(uint32_t addr, uint32_t value) "addr 0x%08x value 0x%08x"
-disable lm32_timer_memory_read(uint32_t addr, uint32_t value) "addr 0x%08x value 0x%08x"
-disable lm32_timer_hit(void) "timer hit"
-disable lm32_timer_irq_state(int level) "irq state %d"
+lm32_timer_memory_write(uint32_t addr, uint32_t value) "addr 0x%08x value 0x%08x"
+lm32_timer_memory_read(uint32_t addr, uint32_t value) "addr 0x%08x value 0x%08x"
+lm32_timer_hit(void) "timer hit"
+lm32_timer_irq_state(int level) "irq state %d"
 
 # hw/lm32_uart.c
-disable lm32_uart_memory_write(uint32_t addr, uint32_t value) "addr 0x%08x value 0x%08x"
-disable lm32_uart_memory_read(uint32_t addr, uint32_t value) "addr 0x%08x value 0x%08x"
-disable lm32_uart_irq_state(int level) "irq state %d"
+lm32_uart_memory_write(uint32_t addr, uint32_t value) "addr 0x%08x value 0x%08x"
+lm32_uart_memory_read(uint32_t addr, uint32_t value) "addr 0x%08x value 0x%08x"
+lm32_uart_irq_state(int level) "irq state %d"
 
 # hw/lm32_sys.c
-disable lm32_sys_memory_write(uint32_t addr, uint32_t value) "addr 0x%08x value 0x%08x"
+lm32_sys_memory_write(uint32_t addr, uint32_t value) "addr 0x%08x value 0x%08x"

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

* [Qemu-devel] Re: [RFC][PATCH 0/6] trace-state: make the behaviour of "disable" consistent across all backends
  2011-04-04 21:49 [Qemu-devel] [RFC][PATCH 0/6] trace-state: make the behaviour of "disable" consistent across all backends Lluís
                   ` (5 preceding siblings ...)
  2011-04-04 21:49 ` [Qemu-devel] [PATCH 6/6] trace: enable all events Lluís
@ 2011-04-05 13:30 ` Stefan Hajnoczi
  2011-04-06 11:42   ` Stefan Hajnoczi
  6 siblings, 1 reply; 17+ messages in thread
From: Stefan Hajnoczi @ 2011-04-05 13:30 UTC (permalink / raw)
  To: Lluís; +Cc: qemu-devel

On Mon, Apr 4, 2011 at 10:49 PM, Lluís <xscript@gmx.net> wrote:
> This patch defines the "disable" trace event state to always use the "nop"
> backend.
>
> As a side-effect, all events are now enabled (without "disable") by default, as
> all backends (except "stderr") have programmatic support for dynamically
> (de)activating each trace event.
>
> In order to make this true, the "simple" backend now has a "-trace
> events=<file>" argument to let the user select which events must be enabled from
> the very beginning.
>
> Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
> ---
>
> Lluís Vilanova (6):
>      trace: [ust] fix generation of 'trace.c' on events without args
>      trace: generalize the "property" concept in the trace-events file
>      trace-state: always use the "nop" backend on events with the "disable" keyword
>      trace-state: [simple] disable all trace points by default
>      trace-state: [simple] add "-trace events" argument to control initial state
>      trace: enable all events
>
>
>  docs/tracing.txt  |   12 +-
>  qemu-config.c     |    5 +
>  qemu-options.hx   |   18 ++
>  scripts/tracetool |   88 +++++-------
>  trace-events      |  385 ++++++++++++++++++++++++++---------------------------
>  vl.c              |   94 ++++++++-----
>  6 files changed, 313 insertions(+), 289 deletions(-)

Excellent, thanks for implementing this.  I'll review the patches in
detail shortly.

Stefan

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

* [Qemu-devel] Re: [PATCH 2/6] trace: generalize the "property" concept in the trace-events file
  2011-04-04 21:49 ` [Qemu-devel] [PATCH 2/6] trace: generalize the "property" concept in the trace-events file Lluís
@ 2011-04-06 10:53   ` Stefan Hajnoczi
  0 siblings, 0 replies; 17+ messages in thread
From: Stefan Hajnoczi @ 2011-04-06 10:53 UTC (permalink / raw)
  To: Lluís; +Cc: qemu-devel

On Mon, Apr 4, 2011 at 10:49 PM, Lluís <xscript@gmx.net> wrote:
> @@ -168,7 +168,7 @@ The st_change_trace_event_state() function can be used to enable or disable trac
>  events at runtime inside QEMU:
>
>     #include "trace.h"
> -
> +

Please leave the trailing whitespace, it's a workaround for wiki
syntax/formatting.

> @@ -222,9 +223,10 @@ linetoc_simple()
>  {
>     local name state
>     name=$(get_name "$1")
> -    state=$(get_state "$1")
> -    if [ "$state" = "0" ] ; then
> -        name=${name##disable }
> +    if has_property "$1" "disable"; then
> +        state="0"
> +    else
> +        state="1"

Or put another way (style decision, I won't complain if you leave it):
has_property "$1" "disable"
state=$?

Stefan

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

* [Qemu-devel] Re: [PATCH 3/6] trace-state: always use the "nop" backend on events with the "disable" keyword
  2011-04-04 21:49 ` [Qemu-devel] [PATCH 3/6] trace-state: always use the "nop" backend on events with the "disable" keyword Lluís
@ 2011-04-06 11:04   ` Stefan Hajnoczi
  0 siblings, 0 replies; 17+ messages in thread
From: Stefan Hajnoczi @ 2011-04-06 11:04 UTC (permalink / raw)
  To: Lluís; +Cc: qemu-devel

On Mon, Apr 4, 2011 at 10:49 PM, Lluís <xscript@gmx.net> wrote:
> Any event with the keyword/property "disable" generates an empty trace event
> using the "nop" backend, regardless of the current backend.
>
> Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
> ---
>  docs/tracing.txt  |    3 +++
>  scripts/tracetool |   15 ++-------------
>  2 files changed, 5 insertions(+), 13 deletions(-)
>
> diff --git a/docs/tracing.txt b/docs/tracing.txt
> index 5dbd3c0..49e030e 100644
> --- a/docs/tracing.txt
> +++ b/docs/tracing.txt
> @@ -126,6 +126,9 @@ The "nop" backend generates empty trace event functions so that the compiler
>  can optimize out trace events completely.  This is the default and imposes no
>  performance penalty.
>
> +Note that regardless of the selected trace backend, events with the "disable"
> +property will be generated with the "nop" backend.
> +
>  === Stderr ===
>
>  The "stderr" backend sends trace events directly to standard error.  This

Please also fix up docs/tracing.txt:
2. Enable trace events you are interested in:

    $EDITOR trace-events  # remove "disable" from events you want

The comment is now obsolete.

Stefan

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

* [Qemu-devel] Re: [PATCH 5/6] trace-state: [simple] add "-trace events" argument to control initial state
  2011-04-04 21:49 ` [Qemu-devel] [PATCH 5/6] trace-state: [simple] add "-trace events" argument to control initial state Lluís
@ 2011-04-06 11:37   ` Stefan Hajnoczi
  2011-04-06 14:15     ` Lluís
  0 siblings, 1 reply; 17+ messages in thread
From: Stefan Hajnoczi @ 2011-04-06 11:37 UTC (permalink / raw)
  To: Lluís; +Cc: qemu-devel

On Mon, Apr 4, 2011 at 10:49 PM, Lluís <xscript@gmx.net> wrote:
> When using the "simple" tracing backend, all events are in disabled state by
> default.
>
> The "-trace events" argument can be used to provide a file with a list of trace
> event names that will be enabled prior to starting execution. This saves the
> user from manually toggling event states through the monitor interface, as well
> as enables early tracing for the selected points, much like other
> more-sophisticated backends like "ust" or "dtrace".
>
> Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
> ---
>  docs/tracing.txt |    5 +++
>  qemu-config.c    |    5 ++-
>  qemu-options.hx  |   18 ++++++++--
>  vl.c             |   94 +++++++++++++++++++++++++++++++++++-------------------
>  4 files changed, 84 insertions(+), 38 deletions(-)

Too many whitespace/indentation changes here.  If you want to fix
whitespace then please do it in a separate patch that is not part of
this series.

> @@ -2833,9 +2834,10 @@ int main(int argc, char **argv, char **envp)
>                 break;
>  #ifdef CONFIG_SIMPLE_TRACE
>             case QEMU_OPTION_trace:
> -                opts = qemu_opts_parse(qemu_find_opts("trace"), optarg, 0);
> +                opts = qemu_opts_parse(qemu_find_opts("trace"), optarg, 1);

Previously "qemu -trace asdf" failed:
qemu: -trace asdf: Invalid parameter 'asdf'

Please don't add an implied file= since there are no legacy users whom
this would help.  Let's strictly accept file= and events=.

> @@ -2887,6 +2889,32 @@ int main(int argc, char **argv, char **envp)
>     if (!st_init(trace_file)) {
>         fprintf(stderr, "warning: unable to initialize simple trace backend\n");
>     }
> +    if (trace_events_file) {
> +        FILE *trace_events_fp = fopen(trace_events_file, "r");
> +        if (!trace_events_fp) {
> +            fprintf(stderr, "could not open trace events file '%s': %s\n",
> +                    trace_events_file, strerror(errno));
> +            exit(1);
> +        }
> +        char line_buf[1024];
> +        char *line;
> +        for (line = fgets(line_buf, 1024, trace_events_fp); line != NULL;
> +             line = fgets(line_buf, 1024, trace_events_fp)) {

Without the line variable, hardcoded 1024, and duplicated fgets() call:
while (fgets(line_buf, sizeof(line_buf), trace_events_fp)) {

> +            int len = strlen(line);

There's no reason to cast the size_t return value to int here.

> +            if (len > 1) {              /* skip empty lines */
> +                line[len - 1] = '\0';
> +                if (!st_change_trace_event_state(line, true)) {

The build breaks when --enable-trace-backend != simple because this
code is outside an #ifdef CONFIG_SIMPLE_TRACE.  Please add this:

diff --git a/simpletrace.h b/simpletrace.h
index 8d893bd..5d9d2ec 100644
--- a/simpletrace.h
+++ b/simpletrace.h
@@ -43,6 +43,11 @@ static inline bool st_init(const char *file)
 {
     return true;
 }
+
+static bool st_change_trace_event_state(const char *tname, bool tstate)
+{
+    return true;
+}
 #endif /* !CONFIG_SIMPLE_TRACE */

 #endif /* SIMPLETRACE_H */

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

* [Qemu-devel] Re: [PATCH 6/6] trace: enable all events
  2011-04-04 21:49 ` [Qemu-devel] [PATCH 6/6] trace: enable all events Lluís
@ 2011-04-06 11:38   ` Stefan Hajnoczi
  0 siblings, 0 replies; 17+ messages in thread
From: Stefan Hajnoczi @ 2011-04-06 11:38 UTC (permalink / raw)
  To: Lluís; +Cc: qemu-devel

On Mon, Apr 4, 2011 at 10:49 PM, Lluís <xscript@gmx.net> wrote:
> Given that all events with programmatically-controlled state are disabled by
> default, we can delete the "disable" property from all events.
>
> As of now, the only backend that will generate high ammounts of (possibly)
> undesired output is "stderr", but it is considered only for debug purposes.
>
> Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
> ---
>  trace-events |  382 +++++++++++++++++++++++++++++-----------------------------
>  1 files changed, 191 insertions(+), 191 deletions(-)

Please rebase on qemu.git/master before sending v2.  New trace events
have been added and need to have the disabled property removed.

Stefan

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

* [Qemu-devel] Re: [RFC][PATCH 0/6] trace-state: make the behaviour of "disable" consistent across all backends
  2011-04-05 13:30 ` [Qemu-devel] Re: [RFC][PATCH 0/6] trace-state: make the behaviour of "disable" consistent across all backends Stefan Hajnoczi
@ 2011-04-06 11:42   ` Stefan Hajnoczi
  2011-04-06 14:30     ` Fabien Chouteau
  0 siblings, 1 reply; 17+ messages in thread
From: Stefan Hajnoczi @ 2011-04-06 11:42 UTC (permalink / raw)
  To: Lluís; +Cc: qemu-devel, Fabien Chouteau, Prerna Saxena

On Tue, Apr 5, 2011 at 2:30 PM, Stefan Hajnoczi <stefanha@gmail.com> wrote:
> On Mon, Apr 4, 2011 at 10:49 PM, Lluís <xscript@gmx.net> wrote:
>> This patch defines the "disable" trace event state to always use the "nop"
>> backend.
>>
>> As a side-effect, all events are now enabled (without "disable") by default, as
>> all backends (except "stderr") have programmatic support for dynamically
>> (de)activating each trace event.
>>
>> In order to make this true, the "simple" backend now has a "-trace
>> events=<file>" argument to let the user select which events must be enabled from
>> the very beginning.
>>
>> Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
>> ---
>>
>> Lluís Vilanova (6):
>>      trace: [ust] fix generation of 'trace.c' on events without args
>>      trace: generalize the "property" concept in the trace-events file
>>      trace-state: always use the "nop" backend on events with the "disable" keyword
>>      trace-state: [simple] disable all trace points by default
>>      trace-state: [simple] add "-trace events" argument to control initial state
>>      trace: enable all events
>>
>>
>>  docs/tracing.txt  |   12 +-
>>  qemu-config.c     |    5 +
>>  qemu-options.hx   |   18 ++
>>  scripts/tracetool |   88 +++++-------
>>  trace-events      |  385 ++++++++++++++++++++++++++---------------------------
>>  vl.c              |   94 ++++++++-----
>>  6 files changed, 313 insertions(+), 289 deletions(-)
>
> Excellent, thanks for implementing this.  I'll review the patches in
> detail shortly.

I've left feedback on the individual patches.  This is a nice cleanup,
thanks for doing this work!

The stderr backend is impacted - but not severely.  You now need to
disable all trace events that should not generate output.  Previously
it was the opposite; you needed to enable all trace events that should
generate output.

Adding Prerna (simpletrace) and Fabien (stderr) on CC so they can take a look.

I'd like to merge v2 into my tracing tree and send the qemu.git
maintainer a pull request soon.

Stefan

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

* Re: [Qemu-devel] Re: [PATCH 5/6] trace-state: [simple] add "-trace events" argument to control initial state
  2011-04-06 11:37   ` [Qemu-devel] " Stefan Hajnoczi
@ 2011-04-06 14:15     ` Lluís
  2011-04-06 20:30       ` Stefan Hajnoczi
  0 siblings, 1 reply; 17+ messages in thread
From: Lluís @ 2011-04-06 14:15 UTC (permalink / raw)
  To: Stefan Hajnoczi; +Cc: qemu-devel

Stefan Hajnoczi writes:

>> +            if (len > 1) {              /* skip empty lines */
>> +                line[len - 1] = '\0';
>> +                if (!st_change_trace_event_state(line, true)) {

> The build breaks when --enable-trace-backend != simple because this
> code is outside an #ifdef CONFIG_SIMPLE_TRACE.  Please add this:

> diff --git a/simpletrace.h b/simpletrace.h
> index 8d893bd..5d9d2ec 100644
> --- a/simpletrace.h
> +++ b/simpletrace.h
> @@ -43,6 +43,11 @@ static inline bool st_init(const char *file)
>  {
>      return true;
>  }
> +
> +static bool st_change_trace_event_state(const char *tname, bool tstate)
> +{
> +    return true;
> +}
>  #endif /* !CONFIG_SIMPLE_TRACE */

>  #endif /* SIMPLETRACE_H */

Hmmm... why don't simply conditionally call st_init (put it into an
#ifdef) and remove the "#else" in simpletrace.h.

I've looked at it and it's not called from anywhere else.

This also reminds me that I didn't see any "-trace" option parsing in
the OS-specific frontends (at least in linux-user).


Lluis

--
 "And it's much the same thing with knowledge, for whenever you learn
 something new, the whole world becomes that much richer."
 -- The Princess of Pure Reason, as told by Norton Juster in The Phantom
 Tollbooth

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

* [Qemu-devel] Re: [RFC][PATCH 0/6] trace-state: make the behaviour of "disable" consistent across all backends
  2011-04-06 11:42   ` Stefan Hajnoczi
@ 2011-04-06 14:30     ` Fabien Chouteau
  0 siblings, 0 replies; 17+ messages in thread
From: Fabien Chouteau @ 2011-04-06 14:30 UTC (permalink / raw)
  To: Stefan Hajnoczi; +Cc: Prerna Saxena, Lluís, qemu-devel

On 04/06/2011 01:42 PM, Stefan Hajnoczi wrote:
> On Tue, Apr 5, 2011 at 2:30 PM, Stefan Hajnoczi <stefanha@gmail.com> wrote:
>> On Mon, Apr 4, 2011 at 10:49 PM, Lluís <xscript@gmx.net> wrote:
>>> This patch defines the "disable" trace event state to always use the "nop"
>>> backend.
>>>
>>> As a side-effect, all events are now enabled (without "disable") by default, as
>>> all backends (except "stderr") have programmatic support for dynamically
>>> (de)activating each trace event.
>>>
>>> In order to make this true, the "simple" backend now has a "-trace
>>> events=<file>" argument to let the user select which events must be enabled from
>>> the very beginning.
>>>
>>> Signed-off-by: Lluís Vilanova <vilanova@ac.upc.edu>
>>> ---
>>>
>>> Lluís Vilanova (6):
>>>      trace: [ust] fix generation of 'trace.c' on events without args
>>>      trace: generalize the "property" concept in the trace-events file
>>>      trace-state: always use the "nop" backend on events with the "disable" keyword
>>>      trace-state: [simple] disable all trace points by default
>>>      trace-state: [simple] add "-trace events" argument to control initial state
>>>      trace: enable all events
>>>
>>>
>>>  docs/tracing.txt  |   12 +-
>>>  qemu-config.c     |    5 +
>>>  qemu-options.hx   |   18 ++
>>>  scripts/tracetool |   88 +++++-------
>>>  trace-events      |  385 ++++++++++++++++++++++++++---------------------------
>>>  vl.c              |   94 ++++++++-----
>>>  6 files changed, 313 insertions(+), 289 deletions(-)
>>
>> Excellent, thanks for implementing this.  I'll review the patches in
>> detail shortly.
> 
> I've left feedback on the individual patches.  This is a nice cleanup,
> thanks for doing this work!
> 
> The stderr backend is impacted - but not severely.  You now need to
> disable all trace events that should not generate output.  Previously
> it was the opposite; you needed to enable all trace events that should
> generate output.
> 
> Adding Prerna (simpletrace) and Fabien (stderr) on CC so they can take a look.

Patches look good to me, it will be very useful to change event selections
without recompiling (I didn't know that trace-events could be enabled/disabled
in the monitor...).

I attach a patch that adds event selection to stderr based on what is done for
the simple backend.

Lluís can you please add it in your patch set?

>From 71fd4ae792aea78691415241be5cec5f2e9afbca Mon Sep 17 00:00:00 2001
From: Fabien Chouteau <chouteau@adacore.com>
Date: Wed, 6 Apr 2011 16:15:53 +0200
Subject: [PATCH 1/1] Add trace-event selection from monitor in the stderr backend


Signed-off-by: Fabien Chouteau <chouteau@adacore.com>
---
 Makefile.objs     |    5 +++++
 configure         |    3 +++
 monitor.c         |    6 ++++--
 qemu-config.c     |    2 +-
 qemu-options.hx   |    2 +-
 scripts/tracetool |   33 ++++++++++++++++++++++++++++-----
 stderrtrace.c     |   14 ++++++++++++++
 stderrtrace.h     |   13 +++++++++++++
 vl.c              |   10 ++++++++--
 9 files changed, 77 insertions(+), 11 deletions(-)
 create mode 100644 stderrtrace.c
 create mode 100644 stderrtrace.h

diff --git a/Makefile.objs b/Makefile.objs
index c05f5e5..d58565a 100644
--- a/Makefile.objs
+++ b/Makefile.objs
@@ -342,6 +342,7 @@ trace-dtrace.o: trace-dtrace.dtrace $(GENERATED_HEADERS)
 	$(call quiet-command,dtrace -o $@ -G -s $<, "  GEN trace-dtrace.o")
 
 simpletrace.o: simpletrace.c $(GENERATED_HEADERS)
+stderrtrace.o: stderrtrace.c $(GENERATED_HEADERS)
 
 ifeq ($(TRACE_BACKEND),dtrace)
 trace-obj-y = trace-dtrace.o
@@ -351,6 +352,10 @@ ifeq ($(TRACE_BACKEND),simple)
 trace-obj-y += simpletrace.o
 user-obj-y += qemu-timer-common.o
 endif
+
+ifeq ($(TRACE_BACKEND),stderr)
+trace-obj-y += stderrtrace.o
+endif
 endif
 
 ######################################################################
diff --git a/configure b/configure
index faaed60..d80bb38 100755
--- a/configure
+++ b/configure
@@ -2933,6 +2933,9 @@ echo "TRACE_BACKEND=$trace_backend" >> $config_host_mak
 if test "$trace_backend" = "simple"; then
   echo "CONFIG_SIMPLE_TRACE=y" >> $config_host_mak
 fi
+if test "$trace_backend" = "stderr"; then
+  echo "CONFIG_STDERR_TRACE=y" >> $config_host_mak
+fi
 # Set the appropriate trace file.
 if test "$trace_backend" = "simple"; then
   trace_file="\"$trace_file-%u\""
diff --git a/monitor.c b/monitor.c
index f1a08dc..cb695c6 100644
--- a/monitor.c
+++ b/monitor.c
@@ -57,7 +57,7 @@
 #include "json-parser.h"
 #include "osdep.h"
 #include "exec-all.h"
-#ifdef CONFIG_SIMPLE_TRACE
+#if defined(CONFIG_SIMPLE_TRACE) || defined(CONFIG_STDERR_TRACE)
 #include "trace.h"
 #endif
 #include "ui/qemu-spice.h"
@@ -592,7 +592,7 @@ static void do_help_cmd(Monitor *mon, const QDict *qdict)
     help_cmd(mon, qdict_get_try_str(qdict, "name"));
 }
 
-#ifdef CONFIG_SIMPLE_TRACE
+#if defined(CONFIG_SIMPLE_TRACE) || defined(CONFIG_STDERR_TRACE)
 static void do_change_trace_event_state(Monitor *mon, const QDict *qdict)
 {
     const char *tp_name = qdict_get_str(qdict, "name");
@@ -603,7 +603,9 @@ static void do_change_trace_event_state(Monitor *mon, const QDict *qdict)
         monitor_printf(mon, "unknown event name \"%s\"\n", tp_name);
     }
 }
+#endif
 
+#ifdef CONFIG_SIMPLE_TRACE
 static void do_trace_file(Monitor *mon, const QDict *qdict)
 {
     const char *op = qdict_get_try_str(qdict, "op");
diff --git a/qemu-config.c b/qemu-config.c
index 0a00081..a524680 100644
--- a/qemu-config.c
+++ b/qemu-config.c
@@ -297,7 +297,7 @@ static QemuOptsList qemu_mon_opts = {
     },
 };
 
-#ifdef CONFIG_SIMPLE_TRACE
+#if defined(CONFIG_SIMPLE_TRACE) || defined(CONFIG_STDERR_TRACE)
 static QemuOptsList qemu_trace_opts = {
     .name = "trace",
     .implied_opt_name = "file",
diff --git a/qemu-options.hx b/qemu-options.hx
index e7b93b5..13e3d71 100644
--- a/qemu-options.hx
+++ b/qemu-options.hx
@@ -2356,7 +2356,7 @@ Normally QEMU loads a configuration file from @var{sysconfdir}/qemu.conf and
 @var{sysconfdir}/target-@var{ARCH}.conf on startup.  The @code{-nodefconfig}
 option will prevent QEMU from loading these configuration files at startup.
 ETEXI
-#ifdef CONFIG_SIMPLE_TRACE
+#if defined(CONFIG_SIMPLE_TRACE) || defined(CONFIG_STDERR_TRACE)
 DEF("trace", HAS_ARG, QEMU_OPTION_trace,
     "-trace [file=]<file>[,events=<file>]\n"
     "                specify tracing options\n",
diff --git a/scripts/tracetool b/scripts/tracetool
index e3aec89..d43fbf0 100755
--- a/scripts/tracetool
+++ b/scripts/tracetool
@@ -241,7 +241,12 @@ linetoh_begin_stderr()
 {
     cat <<EOF
 #include <stdio.h>
+#include "stderrtrace.h"
+
+extern TraceEvent trace_list[];
 EOF
+
+    simple_event_num=0
 }
 
 linetoh_stderr()
@@ -260,29 +265,47 @@ linetoh_stderr()
     cat <<EOF
 static inline void trace_$name($args)
 {
-    fprintf(stderr, "$name $fmt\n" $argnames);
+    if (trace_list[$simple_event_num].state != 0) {
+        fprintf(stderr, "$name $fmt\n" $argnames);
+    }
 }
 EOF
+    simple_event_num=$((simple_event_num + 1))
+
 }
 
 linetoh_end_stderr()
 {
-return
+    cat <<EOF
+#define NR_TRACE_EVENTS $simple_event_num
+EOF
 }
 
 linetoc_begin_stderr()
 {
-return
+    cat <<EOF
+#include "trace.h"
+
+TraceEvent trace_list[] = {
+EOF
+    simple_event_num=0
 }
 
 linetoc_stderr()
 {
-return
+    local name
+    name=$(get_name "$1")
+    cat <<EOF
+{.tp_name = "$name", .state=0},
+EOF
+    simple_event_num=$(($simple_event_num + 1))
 }
 
 linetoc_end_stderr()
 {
-return
+    cat <<EOF
+};
+EOF
 }
 #END OF STDERR
 
diff --git a/stderrtrace.c b/stderrtrace.c
new file mode 100644
index 0000000..7c27203
--- /dev/null
+++ b/stderrtrace.c
@@ -0,0 +1,14 @@
+#include "trace.h"
+
+bool st_change_trace_event_state(const char *name, bool enabled)
+{
+    int i;
+
+    for (i = 0; i < NR_TRACE_EVENTS; i++) {
+        if (!strcmp(trace_list[i].tp_name, name)) {
+            trace_list[i].state = enabled;
+            return true;
+        }
+    }
+    return false;
+}
diff --git a/stderrtrace.h b/stderrtrace.h
new file mode 100644
index 0000000..c2b148c
--- /dev/null
+++ b/stderrtrace.h
@@ -0,0 +1,13 @@
+#ifndef _STDERRTRACE_H_
+#define _STDERRTRACE_H_
+
+typedef uint64_t TraceEventID;
+
+typedef struct {
+    const char *tp_name;
+    bool state;
+} TraceEvent;
+
+bool st_change_trace_event_state(const char *name, bool enabled);
+
+#endif /* ! _STDERRTRACE_H_ */
diff --git a/vl.c b/vl.c
index 9fb6a41..d9160bf 100644
--- a/vl.c
+++ b/vl.c
@@ -155,8 +155,9 @@ int main(int argc, char **argv)
 
 #include "slirp/libslirp.h"
 
+#if defined(CONFIG_SIMPLE_TRACE) || defined(CONFIG_STDERR_TRACE)
 #include "trace.h"
-#include "simpletrace.h"
+#endif
 #include "qemu-queue.h"
 #include "cpus.h"
 #include "arch_init.h"
@@ -2761,7 +2762,7 @@ int main(int argc, char **argv, char **envp)
                 }
                 xen_mode = XEN_ATTACH;
                 break;
-#ifdef CONFIG_SIMPLE_TRACE
+#if defined(CONFIG_SIMPLE_TRACE) || defined(CONFIG_STDERR_TRACE)
             case QEMU_OPTION_trace:
                 opts = qemu_opts_parse(qemu_find_opts("trace"), optarg, 1);
                 if (opts) {
@@ -2815,9 +2816,13 @@ int main(int argc, char **argv, char **envp)
     }
     loc_set_none();
 
+#if defined(CONFIG_SIMPLE_TRACE) || defined(CONFIG_STDERR_TRACE)
+
+# if defined(CONFIG_SIMPLE_TRACE)
     if (!st_init(trace_file)) {
         fprintf(stderr, "warning: unable to initialize simple trace backend\n");
     }
+# endif
     if (trace_events_file) {
         FILE *trace_events_fp = fopen(trace_events_file, "r");
         if (!trace_events_fp) {
@@ -2844,6 +2849,7 @@ int main(int argc, char **argv, char **envp)
             exit(1);
         }
     }
+#endif
 
     /* If no data_dir is specified then try to find it relative to the
        executable path.  */
-- 
1.7.1


-- 
Fabien Chouteau

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

* Re: [Qemu-devel] Re: [PATCH 5/6] trace-state: [simple] add "-trace events" argument to control initial state
  2011-04-06 14:15     ` Lluís
@ 2011-04-06 20:30       ` Stefan Hajnoczi
  2011-04-06 21:45         ` Lluís
  0 siblings, 1 reply; 17+ messages in thread
From: Stefan Hajnoczi @ 2011-04-06 20:30 UTC (permalink / raw)
  To: Lluís; +Cc: Stefan Hajnoczi, qemu-devel

On Wed, Apr 6, 2011 at 3:15 PM, Lluís <xscript@gmx.net> wrote:
> Stefan Hajnoczi writes:
>
>>> +            if (len > 1) {              /* skip empty lines */
>>> +                line[len - 1] = '\0';
>>> +                if (!st_change_trace_event_state(line, true)) {
>
>> The build breaks when --enable-trace-backend != simple because this
>> code is outside an #ifdef CONFIG_SIMPLE_TRACE.  Please add this:
>
>> diff --git a/simpletrace.h b/simpletrace.h
>> index 8d893bd..5d9d2ec 100644
>> --- a/simpletrace.h
>> +++ b/simpletrace.h
>> @@ -43,6 +43,11 @@ static inline bool st_init(const char *file)
>>  {
>>      return true;
>>  }
>> +
>> +static bool st_change_trace_event_state(const char *tname, bool tstate)
>> +{
>> +    return true;
>> +}
>>  #endif /* !CONFIG_SIMPLE_TRACE */
>
>>  #endif /* SIMPLETRACE_H */
>
> Hmmm... why don't simply conditionally call st_init (put it into an
> #ifdef) and remove the "#else" in simpletrace.h.
>
> I've looked at it and it's not called from anywhere else.

The benefit to stubbing out these functions is that callers don't have
#ifdefs.  And caller code is always built (i.e. syntax checked by the
parser) so it helps avoid bitrot.  vl.c:main() is already a long and
ugly function so it would be nice to avoid #ifdefs there.

> This also reminds me that I didn't see any "-trace" option parsing in
> the OS-specific frontends (at least in linux-user).

User emulation does not have any way to control simpletrace today.

Stefan

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

* Re: [Qemu-devel] Re: [PATCH 5/6] trace-state: [simple] add "-trace events" argument to control initial state
  2011-04-06 20:30       ` Stefan Hajnoczi
@ 2011-04-06 21:45         ` Lluís
  0 siblings, 0 replies; 17+ messages in thread
From: Lluís @ 2011-04-06 21:45 UTC (permalink / raw)
  To: Stefan Hajnoczi; +Cc: qemu-devel

Stefan Hajnoczi writes:

>> Hmmm... why don't simply conditionally call st_init (put it into an
>> #ifdef) and remove the "#else" in simpletrace.h.
>>
>> I've looked at it and it's not called from anywhere else.

> The benefit to stubbing out these functions is that callers don't have
> #ifdefs.  And caller code is always built (i.e. syntax checked by the
> parser) so it helps avoid bitrot.  vl.c:main() is already a long and
> ugly function so it would be nice to avoid #ifdefs there.

Aaah... well, I simply moved everything into ifdefs in v2, as the stderr
additions also made use of the same function names but deleted the
'#include "simpletrace.h"' in vl.c (as it's already in trace.h when such
backend is enabled).

Do you want it back?


>> This also reminds me that I didn't see any "-trace" option parsing in
>> the OS-specific frontends (at least in linux-user).

> User emulation does not have any way to control simpletrace today.

Well I was referring more to the lack of a common option parsing loop on
all frontends, as I expected all of them to use hxtool.


Lluis

--
 "And it's much the same thing with knowledge, for whenever you learn
 something new, the whole world becomes that much richer."
 -- The Princess of Pure Reason, as told by Norton Juster in The Phantom
 Tollbooth

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

end of thread, other threads:[~2011-04-06 21:46 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-04 21:49 [Qemu-devel] [RFC][PATCH 0/6] trace-state: make the behaviour of "disable" consistent across all backends Lluís
2011-04-04 21:49 ` [Qemu-devel] [PATCH 1/6] trace: [ust] fix generation of 'trace.c' on events without args Lluís
2011-04-04 21:49 ` [Qemu-devel] [PATCH 2/6] trace: generalize the "property" concept in the trace-events file Lluís
2011-04-06 10:53   ` [Qemu-devel] " Stefan Hajnoczi
2011-04-04 21:49 ` [Qemu-devel] [PATCH 3/6] trace-state: always use the "nop" backend on events with the "disable" keyword Lluís
2011-04-06 11:04   ` [Qemu-devel] " Stefan Hajnoczi
2011-04-04 21:49 ` [Qemu-devel] [PATCH 4/6] trace-state: [simple] disable all trace points by default Lluís
2011-04-04 21:49 ` [Qemu-devel] [PATCH 5/6] trace-state: [simple] add "-trace events" argument to control initial state Lluís
2011-04-06 11:37   ` [Qemu-devel] " Stefan Hajnoczi
2011-04-06 14:15     ` Lluís
2011-04-06 20:30       ` Stefan Hajnoczi
2011-04-06 21:45         ` Lluís
2011-04-04 21:49 ` [Qemu-devel] [PATCH 6/6] trace: enable all events Lluís
2011-04-06 11:38   ` [Qemu-devel] " Stefan Hajnoczi
2011-04-05 13:30 ` [Qemu-devel] Re: [RFC][PATCH 0/6] trace-state: make the behaviour of "disable" consistent across all backends Stefan Hajnoczi
2011-04-06 11:42   ` Stefan Hajnoczi
2011-04-06 14:30     ` Fabien Chouteau

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).