qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PULL for-5.2 0/2] Tracing patches
@ 2020-11-11 15:56 Stefan Hajnoczi
  2020-11-11 15:56 ` [PULL for-5.2 1/2] trace: remove argument from trace_init_file Stefan Hajnoczi
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Stefan Hajnoczi @ 2020-11-11 15:56 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, qemu-block, Stefan Hajnoczi

The following changes since commit c6f28ed5075df79fef39c500362a3f4089256c9c:

  Update version for v5.2.0-rc1 release (2020-11-10 22:29:57 +0000)

are available in the Git repository at:

  https://gitlab.com/stefanha/qemu.git tags/tracing-pull-request

for you to fetch changes up to 35e28cb0f210cae3d9c98113d519fe5a4bef5866:

  scripts/tracetool: silence SystemTap dtrace(1) long long warnings (2020-11-11 13:10:38 +0000)

----------------------------------------------------------------
Tracing pull request

----------------------------------------------------------------

Paolo Bonzini (1):
  trace: remove argument from trace_init_file

Stefan Hajnoczi (1):
  scripts/tracetool: silence SystemTap dtrace(1) long long warnings

 trace/control.h                      | 12 +++---------
 bsd-user/main.c                      |  6 ++----
 linux-user/main.c                    |  6 ++----
 qemu-img.c                           |  6 ++----
 qemu-io.c                            |  6 ++----
 qemu-nbd.c                           |  6 ++----
 scsi/qemu-pr-helper.c                |  6 ++----
 softmmu/vl.c                         |  6 ++----
 storage-daemon/qemu-storage-daemon.c |  9 +++------
 trace/control.c                      | 10 ++++------
 scripts/tracetool/format/d.py        |  6 ++++++
 11 files changed, 30 insertions(+), 49 deletions(-)

-- 
2.28.0


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

* [PULL for-5.2 1/2] trace: remove argument from trace_init_file
  2020-11-11 15:56 [PULL for-5.2 0/2] Tracing patches Stefan Hajnoczi
@ 2020-11-11 15:56 ` Stefan Hajnoczi
  2020-11-11 15:56 ` [PULL for-5.2 2/2] scripts/tracetool: silence SystemTap dtrace(1) long long warnings Stefan Hajnoczi
  2020-11-11 21:51 ` [PULL for-5.2 0/2] Tracing patches Peter Maydell
  2 siblings, 0 replies; 6+ messages in thread
From: Stefan Hajnoczi @ 2020-11-11 15:56 UTC (permalink / raw)
  To: qemu-devel; +Cc: Peter Maydell, qemu-block, Stefan Hajnoczi, Paolo Bonzini

From: Paolo Bonzini <pbonzini@redhat.com>

It is not needed, all the callers are just saving what was
retrieved from -trace and trace_init_file can retrieve it
on its own.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Message-id: 20201102115841.4017692-1-pbonzini@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 trace/control.h                      | 12 +++---------
 bsd-user/main.c                      |  6 ++----
 linux-user/main.c                    |  6 ++----
 qemu-img.c                           |  6 ++----
 qemu-io.c                            |  6 ++----
 qemu-nbd.c                           |  6 ++----
 scsi/qemu-pr-helper.c                |  6 ++----
 softmmu/vl.c                         |  6 ++----
 storage-daemon/qemu-storage-daemon.c |  9 +++------
 trace/control.c                      | 10 ++++------
 10 files changed, 24 insertions(+), 49 deletions(-)

diff --git a/trace/control.h b/trace/control.h
index 1f81c491b6..05b95ea453 100644
--- a/trace/control.h
+++ b/trace/control.h
@@ -167,8 +167,6 @@ void trace_event_set_vcpu_state_dynamic(CPUState *vcpu,
 
 /**
  * trace_init_backends:
- * @file:   Name of trace output file; may be NULL.
- *          Corresponds to commandline option "--trace file=...".
  *
  * Initialize the tracing backend.
  *
@@ -178,14 +176,12 @@ bool trace_init_backends(void);
 
 /**
  * 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.
+ * output file, and a file was specified with "-trace file=...".
  */
-void trace_init_file(const char *file);
+void trace_init_file(void);
 
 /**
  * trace_init_vcpu:
@@ -229,10 +225,8 @@ extern QemuOptsList qemu_trace_opts;
  * @optarg: A string argument of --trace command line argument
  *
  * Initialize tracing subsystem.
- *
- * Returns the filename to save trace to.  It must be freed with g_free().
  */
-char *trace_opt_parse(const char *optarg);
+void trace_opt_parse(const char *optarg);
 
 /**
  * trace_get_vcpu_event_count:
diff --git a/bsd-user/main.c b/bsd-user/main.c
index ac40d79bfa..0a918e8f74 100644
--- a/bsd-user/main.c
+++ b/bsd-user/main.c
@@ -745,7 +745,6 @@ int main(int argc, char **argv)
     const char *gdbstub = NULL;
     char **target_environ, **wrk;
     envlist_t *envlist = NULL;
-    char *trace_file = NULL;
     bsd_type = target_openbsd;
 
     if (argc <= 1)
@@ -851,8 +850,7 @@ int main(int argc, char **argv)
         } else if (!strcmp(r, "strace")) {
             do_strace = 1;
         } else if (!strcmp(r, "trace")) {
-            g_free(trace_file);
-            trace_file = trace_opt_parse(optarg);
+            trace_opt_parse(optarg);
         } else {
             usage();
         }
@@ -880,7 +878,7 @@ int main(int argc, char **argv)
     if (!trace_init_backends()) {
         exit(1);
     }
-    trace_init_file(trace_file);
+    trace_init_file();
 
     /* Zero out regs */
     memset(regs, 0, sizeof(struct target_pt_regs));
diff --git a/linux-user/main.c b/linux-user/main.c
index 75c9785157..24d1eb73ad 100644
--- a/linux-user/main.c
+++ b/linux-user/main.c
@@ -386,11 +386,9 @@ static void handle_arg_version(const char *arg)
     exit(EXIT_SUCCESS);
 }
 
-static char *trace_file;
 static void handle_arg_trace(const char *arg)
 {
-    g_free(trace_file);
-    trace_file = trace_opt_parse(arg);
+    trace_opt_parse(arg);
 }
 
 #if defined(TARGET_XTENSA)
@@ -672,7 +670,7 @@ int main(int argc, char **argv, char **envp)
     if (!trace_init_backends()) {
         exit(1);
     }
-    trace_init_file(trace_file);
+    trace_init_file();
     if (qemu_plugin_load_list(&plugins)) {
         exit(1);
     }
diff --git a/qemu-img.c b/qemu-img.c
index c2c56fc797..8bdea40b58 100644
--- a/qemu-img.c
+++ b/qemu-img.c
@@ -5466,7 +5466,6 @@ int main(int argc, char **argv)
     const img_cmd_t *cmd;
     const char *cmdname;
     Error *local_error = NULL;
-    char *trace_file = NULL;
     int c;
     static const struct option long_options[] = {
         {"help", no_argument, 0, 'h'},
@@ -5516,8 +5515,7 @@ int main(int argc, char **argv)
             printf(QEMU_IMG_VERSION);
             return 0;
         case 'T':
-            g_free(trace_file);
-            trace_file = trace_opt_parse(optarg);
+            trace_opt_parse(optarg);
             break;
         }
     }
@@ -5535,7 +5533,7 @@ int main(int argc, char **argv)
     if (!trace_init_backends()) {
         exit(1);
     }
-    trace_init_file(trace_file);
+    trace_init_file();
     qemu_set_log(LOG_TRACE);
 
     /* find the command */
diff --git a/qemu-io.c b/qemu-io.c
index 7cc832b3d6..ac88d8bd40 100644
--- a/qemu-io.c
+++ b/qemu-io.c
@@ -536,7 +536,6 @@ int main(int argc, char **argv)
     Error *local_error = NULL;
     QDict *opts = NULL;
     const char *format = NULL;
-    char *trace_file = NULL;
     bool force_share = false;
 
 #ifdef CONFIG_POSIX
@@ -601,8 +600,7 @@ int main(int argc, char **argv)
             }
             break;
         case 'T':
-            g_free(trace_file);
-            trace_file = trace_opt_parse(optarg);
+            trace_opt_parse(optarg);
             break;
         case 'V':
             printf("%s version " QEMU_FULL_VERSION "\n"
@@ -653,7 +651,7 @@ int main(int argc, char **argv)
     if (!trace_init_backends()) {
         exit(1);
     }
-    trace_init_file(trace_file);
+    trace_init_file();
     qemu_set_log(LOG_TRACE);
 
     /* initialize commands */
diff --git a/qemu-nbd.c b/qemu-nbd.c
index 75ced65030..a7075c5419 100644
--- a/qemu-nbd.c
+++ b/qemu-nbd.c
@@ -581,7 +581,6 @@ int main(int argc, char **argv)
     const char *tlscredsid = NULL;
     bool imageOpts = false;
     bool writethrough = true;
-    char *trace_file = NULL;
     bool fork_process = false;
     bool list = false;
     int old_stderr = -1;
@@ -768,8 +767,7 @@ int main(int argc, char **argv)
             imageOpts = true;
             break;
         case 'T':
-            g_free(trace_file);
-            trace_file = trace_opt_parse(optarg);
+            trace_opt_parse(optarg);
             break;
         case QEMU_NBD_OPT_TLSAUTHZ:
             tlsauthz = optarg;
@@ -816,7 +814,7 @@ int main(int argc, char **argv)
     if (!trace_init_backends()) {
         exit(1);
     }
-    trace_init_file(trace_file);
+    trace_init_file();
     qemu_set_log(LOG_TRACE);
 
     socket_activation = check_socket_activation();
diff --git a/scsi/qemu-pr-helper.c b/scsi/qemu-pr-helper.c
index d26faaf91e..2733d92f2d 100644
--- a/scsi/qemu-pr-helper.c
+++ b/scsi/qemu-pr-helper.c
@@ -884,7 +884,6 @@ int main(int argc, char **argv)
     int quiet = 0;
     int ch;
     Error *local_err = NULL;
-    char *trace_file = NULL;
     bool daemonize = false;
     bool pidfile_specified = false;
     bool socket_path_specified = false;
@@ -968,8 +967,7 @@ int main(int argc, char **argv)
             ++loglevel;
             break;
         case 'T':
-            g_free(trace_file);
-            trace_file = trace_opt_parse(optarg);
+            trace_opt_parse(optarg);
             break;
         case 'V':
             version(argv[0]);
@@ -992,7 +990,7 @@ int main(int argc, char **argv)
     if (!trace_init_backends()) {
         exit(EXIT_FAILURE);
     }
-    trace_init_file(trace_file);
+    trace_init_file();
     qemu_set_log(LOG_TRACE);
 
 #ifdef CONFIG_MPATH
diff --git a/softmmu/vl.c b/softmmu/vl.c
index a71164494e..42e6d1057b 100644
--- a/softmmu/vl.c
+++ b/softmmu/vl.c
@@ -2886,7 +2886,6 @@ void qemu_init(int argc, char **argv, char **envp)
     int display_remote = 0;
     const char *log_mask = NULL;
     const char *log_file = NULL;
-    char *trace_file = NULL;
     ram_addr_t maxram_size;
     uint64_t ram_slots = 0;
     FILE *vmstate_dump_file = NULL;
@@ -3688,8 +3687,7 @@ void qemu_init(int argc, char **argv, char **envp)
                 xen_domid_restrict = true;
                 break;
             case QEMU_OPTION_trace:
-                g_free(trace_file);
-                trace_file = trace_opt_parse(optarg);
+                trace_opt_parse(optarg);
                 break;
             case QEMU_OPTION_plugin:
                 qemu_plugin_opt_parse(optarg, &plugin_list);
@@ -3939,7 +3937,7 @@ void qemu_init(int argc, char **argv, char **envp)
     if (!trace_init_backends()) {
         exit(1);
     }
-    trace_init_file(trace_file);
+    trace_init_file();
 
     /* Open the logfile at this point and set the log mask if necessary.
      */
diff --git a/storage-daemon/qemu-storage-daemon.c b/storage-daemon/qemu-storage-daemon.c
index e419ba9f19..7c914b0dc1 100644
--- a/storage-daemon/qemu-storage-daemon.c
+++ b/storage-daemon/qemu-storage-daemon.c
@@ -180,12 +180,9 @@ static void process_options(int argc, char *argv[])
             help();
             exit(EXIT_SUCCESS);
         case 'T':
-            {
-                char *trace_file = trace_opt_parse(optarg);
-                trace_init_file(trace_file);
-                g_free(trace_file);
-                break;
-            }
+            trace_opt_parse(optarg);
+            trace_init_file();
+            break;
         case 'V':
             printf("qemu-storage-daemon version "
                    QEMU_FULL_VERSION "\n" QEMU_COPYRIGHT "\n");
diff --git a/trace/control.c b/trace/control.c
index 5669db7eea..b82fb87316 100644
--- a/trace/control.c
+++ b/trace/control.c
@@ -222,8 +222,10 @@ static void trace_init_events(const char *fname)
     loc_pop(&loc);
 }
 
-void trace_init_file(const char *file)
+void trace_init_file(void)
 {
+    QemuOpts *opts = qemu_find_opts_singleton("trace");
+    const char *file = qemu_opt_get(opts, "file");
 #ifdef CONFIG_TRACE_SIMPLE
     st_set_trace_file(file);
     if (init_trace_on_startup) {
@@ -289,9 +291,8 @@ bool trace_init_backends(void)
     return true;
 }
 
-char *trace_opt_parse(const char *optarg)
+void trace_opt_parse(const char *optarg)
 {
-    char *trace_file;
     QemuOpts *opts = qemu_opts_parse_noisily(qemu_find_opts("trace"),
                                              optarg, true);
     if (!opts) {
@@ -301,11 +302,8 @@ char *trace_opt_parse(const char *optarg)
         trace_enable_events(qemu_opt_get(opts, "enable"));
     }
     trace_init_events(qemu_opt_get(opts, "events"));
-    trace_file = g_strdup(qemu_opt_get(opts, "file"));
     init_trace_on_startup = true;
     qemu_opts_del(opts);
-
-    return trace_file;
 }
 
 uint32_t trace_get_vcpu_event_count(void)
-- 
2.28.0


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

* [PULL for-5.2 2/2] scripts/tracetool: silence SystemTap dtrace(1) long long warnings
  2020-11-11 15:56 [PULL for-5.2 0/2] Tracing patches Stefan Hajnoczi
  2020-11-11 15:56 ` [PULL for-5.2 1/2] trace: remove argument from trace_init_file Stefan Hajnoczi
@ 2020-11-11 15:56 ` Stefan Hajnoczi
  2021-01-04 20:31   ` Laurent Vivier
  2020-11-11 21:51 ` [PULL for-5.2 0/2] Tracing patches Peter Maydell
  2 siblings, 1 reply; 6+ messages in thread
From: Stefan Hajnoczi @ 2020-11-11 15:56 UTC (permalink / raw)
  To: qemu-devel
  Cc: Peter Maydell, Daniel P . Berrangé,
	qemu-block, Markus Armbruster, Stefan Hajnoczi,
	Philippe Mathieu-Daudé

SystemTap's dtrace(1) prints the following warning when it encounters
long long arguments:

  Warning: /usr/bin/dtrace:trace/trace-dtrace-hw_virtio.dtrace:76: syntax error near:
  probe vhost_vdpa_dev_start

  Warning: Proceeding as if --no-pyparsing was given.

Use the uint64_t and int64_t types, respectively. This works with all
host CPU 32- and 64-bit data models (ILP32, LP64, and LLP64) that QEMU
supports.

Reported-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
Message-id: 20201020094043.159935-1-stefanha@redhat.com
Suggested-by: Daniel P. Berrangé <berrange@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
 scripts/tracetool/format/d.py | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/scripts/tracetool/format/d.py b/scripts/tracetool/format/d.py
index 353722f89c..ebfb714200 100644
--- a/scripts/tracetool/format/d.py
+++ b/scripts/tracetool/format/d.py
@@ -57,6 +57,12 @@ def generate(events, backend, group):
                 # Avoid it by changing probe type to signed char * beforehand.
                 if type_ == 'int8_t *':
                     type_ = 'signed char *'
+
+            # SystemTap dtrace(1) emits a warning when long long is used
+            type_ = type_.replace('unsigned long long', 'uint64_t')
+            type_ = type_.replace('signed long long', 'int64_t')
+            type_ = type_.replace('long long', 'int64_t')
+
             if name in RESERVED_WORDS:
                 name += '_'
             args.append(type_ + ' ' + name)
-- 
2.28.0


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

* Re: [PULL for-5.2 0/2] Tracing patches
  2020-11-11 15:56 [PULL for-5.2 0/2] Tracing patches Stefan Hajnoczi
  2020-11-11 15:56 ` [PULL for-5.2 1/2] trace: remove argument from trace_init_file Stefan Hajnoczi
  2020-11-11 15:56 ` [PULL for-5.2 2/2] scripts/tracetool: silence SystemTap dtrace(1) long long warnings Stefan Hajnoczi
@ 2020-11-11 21:51 ` Peter Maydell
  2 siblings, 0 replies; 6+ messages in thread
From: Peter Maydell @ 2020-11-11 21:51 UTC (permalink / raw)
  To: Stefan Hajnoczi; +Cc: QEMU Developers, Qemu-block

On Wed, 11 Nov 2020 at 15:57, Stefan Hajnoczi <stefanha@redhat.com> wrote:
>
> The following changes since commit c6f28ed5075df79fef39c500362a3f4089256c9c:
>
>   Update version for v5.2.0-rc1 release (2020-11-10 22:29:57 +0000)
>
> are available in the Git repository at:
>
>   https://gitlab.com/stefanha/qemu.git tags/tracing-pull-request
>
> for you to fetch changes up to 35e28cb0f210cae3d9c98113d519fe5a4bef5866:
>
>   scripts/tracetool: silence SystemTap dtrace(1) long long warnings (2020-11-11 13:10:38 +0000)
>
> ----------------------------------------------------------------
> Tracing pull request
>


Applied, thanks.

Please update the changelog at https://wiki.qemu.org/ChangeLog/5.2
for any user-visible changes.

-- PMM


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

* Re: [PULL for-5.2 2/2] scripts/tracetool: silence SystemTap dtrace(1) long long warnings
  2020-11-11 15:56 ` [PULL for-5.2 2/2] scripts/tracetool: silence SystemTap dtrace(1) long long warnings Stefan Hajnoczi
@ 2021-01-04 20:31   ` Laurent Vivier
  2021-01-05 17:39     ` Daniel P. Berrangé
  0 siblings, 1 reply; 6+ messages in thread
From: Laurent Vivier @ 2021-01-04 20:31 UTC (permalink / raw)
  To: Stefan Hajnoczi, qemu-devel
  Cc: Peter Maydell, Daniel P . Berrangé,
	Markus Armbruster, qemu-block, Philippe Mathieu-Daudé

On 11/11/2020 16:56, Stefan Hajnoczi wrote:
> SystemTap's dtrace(1) prints the following warning when it encounters
> long long arguments:
> 
>   Warning: /usr/bin/dtrace:trace/trace-dtrace-hw_virtio.dtrace:76: syntax error near:
>   probe vhost_vdpa_dev_start
> 
>   Warning: Proceeding as if --no-pyparsing was given.
> 
> Use the uint64_t and int64_t types, respectively. This works with all
> host CPU 32- and 64-bit data models (ILP32, LP64, and LLP64) that QEMU
> supports.
> 
> Reported-by: Markus Armbruster <armbru@redhat.com>
> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
> Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
> Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> Message-id: 20201020094043.159935-1-stefanha@redhat.com
> Suggested-by: Daniel P. Berrangé <berrange@redhat.com>
> Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
> ---
>  scripts/tracetool/format/d.py | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/scripts/tracetool/format/d.py b/scripts/tracetool/format/d.py
> index 353722f89c..ebfb714200 100644
> --- a/scripts/tracetool/format/d.py
> +++ b/scripts/tracetool/format/d.py
> @@ -57,6 +57,12 @@ def generate(events, backend, group):
>                  # Avoid it by changing probe type to signed char * beforehand.
>                  if type_ == 'int8_t *':
>                      type_ = 'signed char *'
> +
> +            # SystemTap dtrace(1) emits a warning when long long is used
> +            type_ = type_.replace('unsigned long long', 'uint64_t')
> +            type_ = type_.replace('signed long long', 'int64_t')
> +            type_ = type_.replace('long long', 'int64_t')
> +
>              if name in RESERVED_WORDS:
>                  name += '_'
>              args.append(type_ + ' ' + name)
> 

This patch fixes the warning with "d" format, but we have the same kind of problem with
log-stap format:

  $ sudo stap -e 'probe begin{printf ("BEGIN")}'  -I .
  parse error: invalid or missing conversion specifier
          saw: operator ',' at ./qemu-system-x86_64-log.stp:15118:101
       source:     printf("%d@%d vhost_vdpa_set_log_base dev: %p base: 0x%x size: %llu
refcnt: %d fd: %d log: %p\n", pid(), gettimeofday_ns(), dev, base, size, refcnt, fd, log)

                       ^

  1 parse error.
  WARNING: tapset "./qemu-system-x86_64-log.stp" has errors, and will be skipped
  BEGIN

This happens because of the "%llu" in the format string.

I'm wondering if we need to fix all the stap based format or simply replace the "unsigned
long long" by "uint64_t" in hw/virtio/trace-events?

Thanks,
Laurent



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

* Re: [PULL for-5.2 2/2] scripts/tracetool: silence SystemTap dtrace(1) long long warnings
  2021-01-04 20:31   ` Laurent Vivier
@ 2021-01-05 17:39     ` Daniel P. Berrangé
  0 siblings, 0 replies; 6+ messages in thread
From: Daniel P. Berrangé @ 2021-01-05 17:39 UTC (permalink / raw)
  To: Laurent Vivier
  Cc: Peter Maydell, qemu-block, qemu-devel, Markus Armbruster,
	Stefan Hajnoczi, Philippe Mathieu-Daudé

On Mon, Jan 04, 2021 at 09:31:19PM +0100, Laurent Vivier wrote:
> On 11/11/2020 16:56, Stefan Hajnoczi wrote:
> > SystemTap's dtrace(1) prints the following warning when it encounters
> > long long arguments:
> > 
> >   Warning: /usr/bin/dtrace:trace/trace-dtrace-hw_virtio.dtrace:76: syntax error near:
> >   probe vhost_vdpa_dev_start
> > 
> >   Warning: Proceeding as if --no-pyparsing was given.
> > 
> > Use the uint64_t and int64_t types, respectively. This works with all
> > host CPU 32- and 64-bit data models (ILP32, LP64, and LLP64) that QEMU
> > supports.
> > 
> > Reported-by: Markus Armbruster <armbru@redhat.com>
> > Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
> > Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
> > Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
> > Message-id: 20201020094043.159935-1-stefanha@redhat.com
> > Suggested-by: Daniel P. Berrangé <berrange@redhat.com>
> > Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
> > ---
> >  scripts/tracetool/format/d.py | 6 ++++++
> >  1 file changed, 6 insertions(+)
> > 
> > diff --git a/scripts/tracetool/format/d.py b/scripts/tracetool/format/d.py
> > index 353722f89c..ebfb714200 100644
> > --- a/scripts/tracetool/format/d.py
> > +++ b/scripts/tracetool/format/d.py
> > @@ -57,6 +57,12 @@ def generate(events, backend, group):
> >                  # Avoid it by changing probe type to signed char * beforehand.
> >                  if type_ == 'int8_t *':
> >                      type_ = 'signed char *'
> > +
> > +            # SystemTap dtrace(1) emits a warning when long long is used
> > +            type_ = type_.replace('unsigned long long', 'uint64_t')
> > +            type_ = type_.replace('signed long long', 'int64_t')
> > +            type_ = type_.replace('long long', 'int64_t')
> > +
> >              if name in RESERVED_WORDS:
> >                  name += '_'
> >              args.append(type_ + ' ' + name)
> > 
> 
> This patch fixes the warning with "d" format, but we have the same kind of problem with
> log-stap format:
> 
>   $ sudo stap -e 'probe begin{printf ("BEGIN")}'  -I .
>   parse error: invalid or missing conversion specifier
>           saw: operator ',' at ./qemu-system-x86_64-log.stp:15118:101
>        source:     printf("%d@%d vhost_vdpa_set_log_base dev: %p base: 0x%x size: %llu
> refcnt: %d fd: %d log: %p\n", pid(), gettimeofday_ns(), dev, base, size, refcnt, fd, log)
> 
>                        ^
> 
>   1 parse error.
>   WARNING: tapset "./qemu-system-x86_64-log.stp" has errors, and will be skipped
>   BEGIN
> 
> This happens because of the "%llu" in the format string.
> 
> I'm wondering if we need to fix all the stap based format or simply replace the "unsigned
> long long" by "uint64_t" in hw/virtio/trace-events?

The problem isn't really the data type, but rather the format string.
systemtap format strings are not quite the same as C format strings.

So we need to re-write %llu into %lu I expect. We already do some
rewriting in log_stap.py but we obviously need a bit more.

Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|



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

end of thread, other threads:[~2021-01-05 17:55 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-11-11 15:56 [PULL for-5.2 0/2] Tracing patches Stefan Hajnoczi
2020-11-11 15:56 ` [PULL for-5.2 1/2] trace: remove argument from trace_init_file Stefan Hajnoczi
2020-11-11 15:56 ` [PULL for-5.2 2/2] scripts/tracetool: silence SystemTap dtrace(1) long long warnings Stefan Hajnoczi
2021-01-04 20:31   ` Laurent Vivier
2021-01-05 17:39     ` Daniel P. Berrangé
2020-11-11 21:51 ` [PULL for-5.2 0/2] Tracing patches Peter Maydell

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).