Skip to contentSkip to conversation

vhost-vdpa: add trace functions in vhost-vdpa.c

PATCH Superseded Laurent Vivier 4 participants 8 messages Sep 20, 2020 – Sep 21, 2020

v1 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

cover vhost-vdpa: add trace functions in vhost-vdpa.c

Add trace events functions in vdpa functions.

Modify qemu_hexdump() to be able to dump the vdpa config in trace logs in hexadecimal form.

Laurent Vivier (2):
util/hexdump: introduce qemu_hexdump_line()
vhost-vdpa: add trace-events

 hw/virtio/trace-events | 29 ++++++++++++++
 hw/virtio/vhost-vdpa.c | 85 +++++++++++++++++++++++++++++++++++++++---
 include/qemu-common.h  |  8 ++++
 util/hexdump.c         | 54 +++++++++++++++++----------
 4 files changed, 151 insertions(+), 25 deletions(-)
Signature · 1 line
2.26.2
#1 lore raw

PATCH 1/2 util/hexdump: introduce qemu_hexdump_line()

Dumping one line of hexadecimal/ASCII from a buffer is often needed. Move this part from qemu_hexdump() and use it

---
 include/qemu-common.h |  8 +++++++
 util/hexdump.c        | 54 +++++++++++++++++++++++++++----------------
 2 files changed, 42 insertions(+), 20 deletions(-)
include/qemu-common.h +8 -0
index 9cfd62669bf8..cc902b690db3 100644
@@ -134,6 +134,14 @@ void os_setup_early_signal_handling(void);
 char *os_find_datadir(void);
 int os_parse_cmd_args(int index, const char *optarg);
 
+/*
+ * Hexdump a line of a byte buffer into a hexadecimal/ASCII buffer
+ */
+#define QEMU_HEXDUMP_LINE_BYTES 16 /* Number of bytes to dump */
+#define QEMU_HEXDUMP_LINE_LEN 75   /* Number of characters in line */
+void qemu_hexdump_line(char *line, unsigned int b, const void *bufptr,
+                       unsigned int len, bool ascii);
+
 /*
  * Hexdump a buffer to a file. An optional string prefix is added to every line
  */
util/hexdump.c +34 -20

70 lines not on this page · raw message

Signature · 1 line
2.26.2
#2 lore raw

PATCH 2/2 vhost-vdpa: add trace-events

In reply to Laurent Vivier

Add trace functionis in vhost-vdpa.c.

All traces from this file can be enabled with '-trace vhost_vdpa*'.

---
 hw/virtio/trace-events | 29 ++++++++++++++
 hw/virtio/vhost-vdpa.c | 85 +++++++++++++++++++++++++++++++++++++++---
 2 files changed, 109 insertions(+), 5 deletions(-)
hw/virtio/trace-events +29 -0
index 845200bf109d..700edda8fc70 100644
@@ -22,6 +22,35 @@ vhost_user_postcopy_waker(const char *rb, uint64_t rb_offset) "%s + 0x%"PRIx64
 vhost_user_postcopy_waker_found(uint64_t client_addr) "0x%"PRIx64
 vhost_user_postcopy_waker_nomatch(const char *rb, uint64_t rb_offset) "%s + 0x%"PRIx64
 
+# vhost-vdpa.c
+vhost_vdpa_listener_region_add(void *vdpa, uint64_t iova, uint64_t llend, void *vaddr, bool readonly) "vdpa: %p iova 0x%"PRIx64" llend 0x%"PRIx64" vaddr: %p read-only: %d"
+vhost_vdpa_listener_region_del(void *vdpa, uint64_t iova, uint64_t llend) "vdpa: %p iova 0x%"PRIx64" llend 0x%"PRIx64
+vhost_vdpa_add_status(void *dev, uint8_t status) "dev: %p status: 0x%"PRIx8
+vhost_vdpa_init(void *dev, void *vdpa) "dev: %p vdpa: %p"
+vhost_vdpa_cleanup(void *dev, void *vdpa) "dev: %p vdpa: %p"
+vhost_vdpa_memslots_limit(void *dev, int ret) "dev: %p = 0x%x"
+vhost_vdpa_set_mem_table(void *dev, uint32_t nregions, uint32_t padding) "dev: %p nregions: %"PRIu32" padding: %"PRIx32
+vhost_vdpa_dump_regions(void *dev, int i, uint64_t guest_phys_addr, uint64_t memory_size, uint64_t userspace_addr, uint64_t flags_padding) "dev: %p %d: guest_phys_addr: 0x%"PRIx64" memory_size: 0x%"PRIx64" userspace_addr: 0x%"PRIx64" flags_padding: 0x%"PRIx64
+vhost_vdpa_set_features(void *dev, uint64_t features) "dev: %p features: 0x%"PRIx64
+vhost_vdpa_get_device_id(void *dev, uint32_t device_id) "dev: %p device_id %"PRIu32
+vhost_vdpa_reset_device(void *dev, uint8_t status) "dev: %p status: 0x%"PRIx8
+vhost_vdpa_get_vq_index(void *dev, int idx, int vq_idx) "dev: %p idx: %d vq idx: %d"
+vhost_vdpa_set_vring_ready(void *dev) "dev: %p"
+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_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"
+vhost_vdpa_get_vring_base(void *dev, unsigned int index, unsigned int num) "dev: %p index: %u num: %u"
+vhost_vdpa_set_vring_kick(void *dev, unsigned int index, int fd) "dev: %p index: %u fd: %d"
+vhost_vdpa_set_vring_call(void *dev, unsigned int index, int fd) "dev: %p index: %u fd: %d"
+vhost_vdpa_get_features(void *dev, uint64_t features) "dev: %p features: 0x%"PRIx64
+vhost_vdpa_set_owner(void *dev) "dev: %p"
+vhost_vdpa_vq_get_addr(void *dev, void *vq, uint64_t desc_user_addr, uint64_t avail_user_addr, uint64_t used_user_addr) "dev: %p vq: %p desc_user_addr: 0x%"PRIx64" avail_user_addr: 0x%"PRIx64" used_user_addr: 0x%"PRIx64
+
 # virtio.c
 virtqueue_alloc_element(void *elem, size_t sz, unsigned in_num, unsigned out_num) "elem %p size %zd in_num %u out_num %u"
 virtqueue_fill(void *vq, const void *elem, unsigned int len, unsigned int idx) "vq %p elem %p len %u idx %u"
hw/virtio/vhost-vdpa.c +80 -5

256 lines not on this page · raw message

Signature · 1 line
2.26.2
#3 lore raw
In reply to Laurent Vivier
Patchew URL: https://patchew.org/QEMU/[email protected]/

Patchew URL: https://patchew.org/QEMU/[email protected]/

Hi,

This series seems to have some coding style problems. See output below for more information:

Type: series
Message-id: [email protected]
Subject: [PATCH 0/2] vhost-vdpa: add trace functions in vhost-vdpa.c

=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram
./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384 From https://github.com/patchew-project/qemu
* [new tag] patchew/[email protected] -> patchew/[email protected]
* [new tag] patchew/[email protected] -> patchew/[email protected]
Switched to a new branch 'test'
08d1002 vhost-vdpa: add trace-events 7ac6b11 util/hexdump: introduce qemu_hexdump_line()

=== OUTPUT BEGIN ===
1/2 Checking commit 7ac6b1191959 (util/hexdump: introduce qemu_hexdump_line())
2/2 Checking commit 08d100254c8b (vhost-vdpa: add trace-events)
ERROR: Hex numbers must be prefixed with '0x'
#29: FILE: hw/virtio/trace-events:32:
+vhost_vdpa_set_mem_table(void *dev, uint32_t nregions, uint32_t padding) "dev: %p nregions: %"PRIu32" padding: %"PRIx32

ERROR: code indent should never use tabs
#126: FILE: hw/virtio/vhost-vdpa.c:275:
+^Ifor (i = 0; i < mem->nregions; i++) {$

ERROR: code indent should never use tabs #194: FILE: hw/virtio/vhost-vdpa.c:355:
+^Iqemu_hexdump_line(line, b, config, len, false);$

ERROR: code indent should never use tabs
#195: FILE: hw/virtio/vhost-vdpa.c:356:
+^Itrace_vhost_vdpa_dump_config(dev, line);$

ERROR: code indent should never use tabs
#216: FILE: hw/virtio/vhost-vdpa.c:377:
+^Ivhost_vdpa_dump_config(dev, data, size);$

ERROR: code indent should never use tabs #235: FILE: hw/virtio/vhost-vdpa.c:403:
+^Ivhost_vdpa_dump_config(dev, config, config_len);$

WARNING: line over 80 characters
#251: FILE: hw/virtio/vhost-vdpa.c:433:
+ trace_vhost_vdpa_set_log_base(dev, base, log->size, log->refcnt, log->fd, log->log);

total: 6 errors, 1 warnings, 291 lines checked

Patch 2/2 has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.

=== OUTPUT END ===

Test command exited with code: 1

The full log is available at
http://patchew.org/logs/[email protected]/testing.checkpatch/?type=message.
---
Email generated automatically by Patchew [https://patchew.org/].
Please send your feedback to [email protected]

#4 lore raw
Quoted 61 lines · On 20/09/2020 20:03, [email protected] wrote:

Patchew URL: https://patchew.org/QEMU/[email protected]/

Hi,

This series seems to have some coding style problems. See output below for more information:

Type: series
Message-id: [email protected]
Subject: [PATCH 0/2] vhost-vdpa: add trace functions in vhost-vdpa.c

=== TEST SCRIPT BEGIN ===
#!/bin/bash
git rev-parse base > /dev/null || exit 0
git config --local diff.renamelimit 0
git config --local diff.renames True
git config --local diff.algorithm histogram
./scripts/checkpatch.pl --mailback base..
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384 From https://github.com/patchew-project/qemu
* [new tag] patchew/[email protected] -> patchew/[email protected]
* [new tag] patchew/[email protected] -> patchew/[email protected]
Switched to a new branch 'test'
08d1002 vhost-vdpa: add trace-events 7ac6b11 util/hexdump: introduce qemu_hexdump_line()

=== OUTPUT BEGIN ===
1/2 Checking commit 7ac6b1191959 (util/hexdump: introduce qemu_hexdump_line())
2/2 Checking commit 08d100254c8b (vhost-vdpa: add trace-events)
ERROR: Hex numbers must be prefixed with '0x'
#29: FILE: hw/virtio/trace-events:32:
+vhost_vdpa_set_mem_table(void *dev, uint32_t nregions, uint32_t padding) "dev: %p nregions: %"PRIu32" padding: %"PRIx32

ERROR: code indent should never use tabs
#126: FILE: hw/virtio/vhost-vdpa.c:275:
+^Ifor (i = 0; i < mem->nregions; i++) {$

ERROR: code indent should never use tabs #194: FILE: hw/virtio/vhost-vdpa.c:355:
+^Iqemu_hexdump_line(line, b, config, len, false);$

ERROR: code indent should never use tabs
#195: FILE: hw/virtio/vhost-vdpa.c:356:
+^Itrace_vhost_vdpa_dump_config(dev, line);$

ERROR: code indent should never use tabs
#216: FILE: hw/virtio/vhost-vdpa.c:377:
+^Ivhost_vdpa_dump_config(dev, data, size);$

ERROR: code indent should never use tabs #235: FILE: hw/virtio/vhost-vdpa.c:403:
+^Ivhost_vdpa_dump_config(dev, config, config_len);$

WARNING: line over 80 characters
#251: FILE: hw/virtio/vhost-vdpa.c:433:
+ trace_vhost_vdpa_set_log_base(dev, base, log->size, log->refcnt, log->fd, log->log);

Quoted 9 lines

total: 6 errors, 1 warnings, 291 lines checked

Patch 2/2 has style problems, please review. If any of these errors are false positives report them to the maintainer, see CHECKPATCH in MAINTAINERS.

=== OUTPUT END ===

I'm going to resend the series with the problems reported by checkpatch fixed.

Thanks,
Laurent

Acked-by on the v1 series
#5 lore raw
In reply to Laurent Vivier
Quoted 9 lines · Laurent Vivier

Add trace events functions in vdpa functions.

Modify qemu_hexdump() to be able to dump the vdpa config in trace logs in hexadecimal form.

Laurent Vivier (2):
util/hexdump: introduce qemu_hexdump_line()
vhost-vdpa: add trace-events

Quoted 5 lines
 hw/virtio/trace-events | 29 ++++++++++++++
 hw/virtio/vhost-vdpa.c | 85 +++++++++++++++++++++++++++++++++++++++---
 include/qemu-common.h  |  8 ++++
 util/hexdump.c         | 54 +++++++++++++++++----------
 4 files changed, 151 insertions(+), 25 deletions(-)

Please take this through the VIRTIO/vhost/vDPA tree:

#6 lore raw
Quoted 16 lines · Stefan Hajnoczi
Quoted 9 lines · Laurent Vivier

Add trace events functions in vdpa functions.

Modify qemu_hexdump() to be able to dump the vdpa config in trace logs in hexadecimal form.

Laurent Vivier (2):
util/hexdump: introduce qemu_hexdump_line()
vhost-vdpa: add trace-events

Quoted 5 lines
 hw/virtio/trace-events | 29 ++++++++++++++
 hw/virtio/vhost-vdpa.c | 85 +++++++++++++++++++++++++++++++++++++++---
 include/qemu-common.h  |  8 ++++
 util/hexdump.c         | 54 +++++++++++++++++----------
 4 files changed, 151 insertions(+), 25 deletions(-)
Quoted 3 lines

Please take this through the VIRTIO/vhost/vDPA tree:

Will do, tagged.

#7 lore raw
Quoted 17 lines · Michael S. Tsirkin
Quoted 16 lines · Stefan Hajnoczi
Quoted 14 lines · Laurent Vivier

Add trace events functions in vdpa functions.

Modify qemu_hexdump() to be able to dump the vdpa config in trace logs in hexadecimal form.

Laurent Vivier (2):
util/hexdump: introduce qemu_hexdump_line()
vhost-vdpa: add trace-events

 hw/virtio/trace-events | 29 ++++++++++++++
 hw/virtio/vhost-vdpa.c | 85 +++++++++++++++++++++++++++++++++++++++---
 include/qemu-common.h  |  8 ++++
 util/hexdump.c         | 54 +++++++++++++++++----------
 4 files changed, 151 insertions(+), 25 deletions(-)
Quoted 7 lines
Quoted 3 lines

Please take this through the VIRTIO/vhost/vDPA tree:

Will do, tagged.

Not yet, please; There are some tabs remaining.

Wait the v2.

Thanks,
Laurent