diff mbox series

[1/2] vhost-vdpa: fix "unsigned long long" error with stap

Message ID 20210105191721.120463-2-lvivier@redhat.com (mailing list archive)
State New, archived
Headers show
Series tracetool: fix log-stap format | expand

Commit Message

Laurent Vivier Jan. 5, 2021, 7:17 p.m. UTC
The "%llu" format type is not understood by stap:

$ 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

commit 35e28cb0f210 ("scripts/tracetool: silence SystemTap dtrace(1)
long long warnings") has already fixed the problem for the dtrace format
by dynamically replacing "unsigned long long" by "uint64_t", but as it
seems the problem can happen with any format and this is the only
occurrence of this type, simply replace it directly by "uint64_t" in the
trace-events file.

Fixes: 778e67de4cd8 ("vhost-vdpa: add trace-events")
Signed-off-by: Laurent Vivier <lvivier@redhat.com>
---
 hw/virtio/trace-events | 2 +-
 hw/virtio/vhost-vdpa.c | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

Comments

Laurent Vivier Jan. 6, 2021, 12:45 p.m. UTC | #1
On 05/01/2021 20:17, Laurent Vivier wrote:
> The "%llu" format type is not understood by stap:
> 
> $ 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
> 
> commit 35e28cb0f210 ("scripts/tracetool: silence SystemTap dtrace(1)
> long long warnings") has already fixed the problem for the dtrace format
> by dynamically replacing "unsigned long long" by "uint64_t", but as it
> seems the problem can happen with any format and this is the only
> occurrence of this type, simply replace it directly by "uint64_t" in the
> trace-events file.
> 
> Fixes: 778e67de4cd8 ("vhost-vdpa: add trace-events")
> Signed-off-by: Laurent Vivier <lvivier@redhat.com>
> ---
>  hw/virtio/trace-events | 2 +-
>  hw/virtio/vhost-vdpa.c | 4 ++--
>  2 files changed, 3 insertions(+), 3 deletions(-)

Ignore this patch, Daniel has proposed a better fix.

Thanks,
Laurent
diff mbox series

Patch

diff --git a/hw/virtio/trace-events b/hw/virtio/trace-events
index 2060a144a2f4..6074bafeb147 100644
--- a/hw/virtio/trace-events
+++ b/hw/virtio/trace-events
@@ -42,7 +42,7 @@  vhost_vdpa_dump_config(void *dev, const char *line) "dev: %p %s"
 vhost_vdpa_set_config(void *dev, uint32_t offset, uint32_t size, uint32_t flags) "dev: %p offset: %"PRIu32" size: %"PRIu32" flags: 0x%"PRIx32
 vhost_vdpa_get_config(void *dev, void *config, uint32_t config_len) "dev: %p config: %p config_len: %"PRIu32
 vhost_vdpa_dev_start(void *dev, bool started) "dev: %p started: %d"
-vhost_vdpa_set_log_base(void *dev, uint64_t base, unsigned long long size, int refcnt, int fd, void *log) "dev: %p base: 0x%"PRIx64" size: %llu refcnt: %d fd: %d log: %p"
+vhost_vdpa_set_log_base(void *dev, uint64_t base, uint64_t size, int refcnt, int fd, void *log) "dev: %p base: 0x%"PRIx64" size: %"PRIu64" refcnt: %d fd: %d log: %p"
 vhost_vdpa_set_vring_addr(void *dev, unsigned int index, unsigned int flags, uint64_t desc_user_addr, uint64_t used_user_addr, uint64_t avail_user_addr, uint64_t log_guest_addr) "dev: %p index: %u flags: 0x%x desc_user_addr: 0x%"PRIx64" used_user_addr: 0x%"PRIx64" avail_user_addr: 0x%"PRIx64" log_guest_addr: 0x%"PRIx64
 vhost_vdpa_set_vring_num(void *dev, unsigned int index, unsigned int num) "dev: %p index: %u num: %u"
 vhost_vdpa_set_vring_base(void *dev, unsigned int index, unsigned int num) "dev: %p index: %u num: %u"
diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c
index 01d2101d0976..436aa20d3f09 100644
--- a/hw/virtio/vhost-vdpa.c
+++ b/hw/virtio/vhost-vdpa.c
@@ -493,8 +493,8 @@  static int vhost_vdpa_dev_start(struct vhost_dev *dev, bool started)
 static int vhost_vdpa_set_log_base(struct vhost_dev *dev, uint64_t base,
                                      struct vhost_log *log)
 {
-    trace_vhost_vdpa_set_log_base(dev, base, log->size, log->refcnt, log->fd,
-                                  log->log);
+    trace_vhost_vdpa_set_log_base(dev, base, (uint64_t)log->size, log->refcnt,
+                                  log->fd, log->log);
     return vhost_vdpa_call(dev, VHOST_SET_LOG_BASE, &base);
 }