Skip to contentSkip to conversation

Modular build of trace event files

PATCH In review Daniel P. Berrange 8 participants 113 messages Aug 9, 2016 – Sep 14, 2016

Subsystems (5)
lore
Share & tools
lore
#2 lore raw

PATCH 2/60 trace: move util/qemu-coroutine*.c trace points into correct file

In reply to Daniel P. Berrange

The trace points for util/qemu-coroutine*.c were mistakenly put in the top level trace-events file, instead of util/trace-events.

---
 trace-events      | 13 -------------
 util/trace-events | 13 +++++++++++++
 2 files changed, 13 insertions(+), 13 deletions(-)
trace-events +0 -13
index 52c6a6c..ae8f0ad 100644
@@ -82,19 +82,6 @@ xen_map_cache(uint64_t phys_addr) "want %#"PRIx64
 xen_remap_bucket(uint64_t index) "index %#"PRIx64
 xen_map_cache_return(void* ptr) "%p"
 
-# qemu-coroutine.c
-qemu_coroutine_enter(void *from, void *to, void *opaque) "from %p to %p opaque %p"
-qemu_coroutine_yield(void *from, void *to) "from %p to %p"
-qemu_coroutine_terminate(void *co) "self %p"
-
-# qemu-coroutine-lock.c
-qemu_co_queue_run_restart(void *co) "co %p"
-qemu_co_queue_next(void *nxt) "next %p"
-qemu_co_mutex_lock_entry(void *mutex, void *self) "mutex %p self %p"
-qemu_co_mutex_lock_return(void *mutex, void *self) "mutex %p self %p"
-qemu_co_mutex_unlock_entry(void *mutex, void *self) "mutex %p self %p"
-qemu_co_mutex_unlock_return(void *mutex, void *self) "mutex %p self %p"
-
 # monitor.c
 handle_qmp_command(void *mon, const char *cmd_name) "mon %p cmd_name \"%s\""
 monitor_protocol_emitter(void *mon) "mon %p"
util/trace-events +13 -0
index da63e58..111e1de 100644
@@ -6,6 +6,19 @@ buffer_move_empty(const char *buf, size_t len, const char *from) "%s: %zd bytes
 buffer_move(const char *buf, size_t len, const char *from) "%s: %zd bytes from %s"
 buffer_free(const char *buf, size_t len) "%s: capacity %zd"
 
+# util/qemu-coroutine.c
+qemu_coroutine_enter(void *from, void *to, void *opaque) "from %p to %p opaque %p"
+qemu_coroutine_yield(void *from, void *to) "from %p to %p"
+qemu_coroutine_terminate(void *co) "self %p"
+
+# util/qemu-coroutine-lock.c
+qemu_co_queue_run_restart(void *co) "co %p"
+qemu_co_queue_next(void *nxt) "next %p"
+qemu_co_mutex_lock_entry(void *mutex, void *self) "mutex %p self %p"
+qemu_co_mutex_lock_return(void *mutex, void *self) "mutex %p self %p"
+qemu_co_mutex_unlock_entry(void *mutex, void *self) "mutex %p self %p"
+qemu_co_mutex_unlock_return(void *mutex, void *self) "mutex %p self %p"
+
 # util/oslib-win32.c
 # util/oslib-posix.c
 qemu_memalign(size_t alignment, size_t size, void *ptr) "alignment %zu size %zu ptr %p"
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/60 trace: move util/buffer.c trace points into correct file

In reply to Daniel P. Berrange

The trace points for util/buffer.c were mistakenly put in the io/trace-events file, instead of util/trace-events.

---
 io/trace-events   | 6 ------
 util/trace-events | 6 ++++++
 2 files changed, 6 insertions(+), 6 deletions(-)
io/trace-events +0 -6
index 1108c16..8d84eda 100644
@@ -1,11 +1,5 @@
 # See docs/trace-events.txt for syntax documentation.
 
-# io/buffer.c
-buffer_resize(const char *buf, size_t olen, size_t len) "%s: old %zd, new %zd"
-buffer_move_empty(const char *buf, size_t len, const char *from) "%s: %zd bytes from %s"
-buffer_move(const char *buf, size_t len, const char *from) "%s: %zd bytes from %s"
-buffer_free(const char *buf, size_t len) "%s: capacity %zd"
-
 # io/task.c
 qio_task_new(void *task, void *source, void *func, void *opaque) "Task new task=%p source=%p func=%p opaque=%p"
 qio_task_complete(void *task) "Task complete task=%p"
util/trace-events +6 -0
index 3ce5f1e..da63e58 100644
@@ -1,5 +1,11 @@
 # See docs/trace-events.txt for syntax documentation.
 
+# util/buffer.c
+buffer_resize(const char *buf, size_t olen, size_t len) "%s: old %zd, new %zd"
+buffer_move_empty(const char *buf, size_t len, const char *from) "%s: %zd bytes from %s"
+buffer_move(const char *buf, size_t len, const char *from) "%s: %zd bytes from %s"
+buffer_free(const char *buf, size_t len) "%s: capacity %zd"
+
 # util/oslib-win32.c
 # util/oslib-posix.c
 qemu_memalign(size_t alignment, size_t size, void *ptr) "alignment %zu size %zu ptr %p"
Signature · 1 line
2.7.4
#4 lore raw

PATCH 4/60 trace: move hw/virtio/virtio-balloon.c trace points into correct file

In reply to Daniel P. Berrange

The trace points for hw/virtio/virtio-balloon.c were mistakenly put in the top level trace-events file, instead of util/trace-events.

---
 hw/virtio/trace-events | 5 +++++
 trace-events           | 4 ----
 2 files changed, 5 insertions(+), 4 deletions(-)
hw/virtio/trace-events +5 -0
index 2853053..6849a44 100644
@@ -14,3 +14,8 @@ virtio_rng_guest_not_ready(void *rng) "rng %p: guest not ready"
 virtio_rng_pushed(void *rng, size_t len) "rng %p: %zd bytes pushed"
 virtio_rng_request(void *rng, size_t size, unsigned quota) "rng %p: %zd bytes requested, %u bytes quota left"
 
+# hw/virtio/virtio-balloon.c
+virtio_balloon_handle_output(const char *name, uint64_t gpa) "section name: %s gpa: %"PRIx64
+virtio_balloon_get_config(uint32_t num_pages, uint32_t actual) "num_pages: %d actual: %d"
+virtio_balloon_set_config(uint32_t actual, uint32_t oldactual) "actual: %d oldactual: %d"
+virtio_balloon_to_target(uint64_t target, uint32_t num_pages) "balloon target: %"PRIx64" num_pages: %d"
trace-events +0 -4
index ae8f0ad..1de7e99 100644
@@ -37,10 +37,6 @@ cpu_out(unsigned int addr, char size, unsigned int val) "addr %#x(%c) value %u"
 # balloon.c
 # Since requests are raised via monitor, not many tracepoints are needed.
 balloon_event(void *opaque, unsigned long addr) "opaque %p addr %lu"
-virtio_balloon_handle_output(const char *name, uint64_t gpa) "section name: %s gpa: %"PRIx64
-virtio_balloon_get_config(uint32_t num_pages, uint32_t actual) "num_pages: %d actual: %d"
-virtio_balloon_set_config(uint32_t actual, uint32_t oldactual) "actual: %d oldactual: %d"
-virtio_balloon_to_target(uint64_t target, uint32_t num_pages) "balloon target: %"PRIx64" num_pages: %d"
 
 # vl.c
 vm_state_notify(int running, int reason) "running %d reason %d"
Signature · 1 line
2.7.4
#0 lore raw

cover Modular build of trace event files

I previously split the global trace-events file up into one file per-subdirectory to avoid merge conflict hell.

This series builds on that to now actually generate the individual trace files per-subdirectory too. The key benefit of doing this is that a change in a trace-events file will no longer cause a rebuild of the entire world. Instead only that one affected sub-directory will have files rebuilt.

The key problem faced when creating this patch series was the fact that the trace code had a global assumption that there was a single enum declaring all events in a sequence with no gaps. Most of the hard work in this series involves getting rid of that assumption throughout the code. Instead we now have a notion of trace event groups, each with their own distinct enum of events. As such the individual event IDs are no longer globally unique. Most of the code could be adapted to work with IDs that were unique only within a group.

The first sticky part was the simpletrace binary event format which includes the event ID. To deal with this I invented a notion of an ID offset per trace-events file. So simpletrace format will now
use "(id-offset << 16) | event-id" in order to get a globally
unique ID value for its trace files. This means each trace-events file can only have 65536 distinct events declared, but that ought to be enough for a while :-)

The second sticky part was the per-VCPU events, due to the use of a "trace_dstate" bitmap in the CPUState struct. The bitmap inherantly assumes a global ID sequence, and would not work well with the per-file id-offset concept, since it would require a huge mostly-sparse bitmap. Rather than try to solve this problem I took the easy way out and simply specified that all per-VCPU events need to be declared in the top level trace-events file. Since we have almost no per-vCPU events today, this works out just fine.

I've build-tested with all targets enabled in both VPATH and non-VPATH setups, on Fedora 24, with all 5 trace event backends enabled at once. I've tested that simpletrace.py can still extract events from generated traces. I've not functionally tested dtrace/ftrace/ust at this time.

Daniel P. Berrange (60):
trace: move util/buffer.c trace points into correct file
trace: move util/qemu-coroutine*.c trace points into correct file
trace: move hw/mem/pc-dimm.c trace points into correct file
trace: move hw/virtio/virtio-balloon.c trace points into correct file
trace: add trace event iterator APIs
trace: convert code to use event iterators
trace: remove some now unused functions
trace: provide mechanism for registering trace events
trace: remove use of TRACE_VCPU_EVENT_COUNT in cpu.h
trace: remove fixed global event state arrays
trace: remove use of event ID enums from APIs
trace: use -1 instead of TRACE_VCPU_EVENT_COUNT as magic value
trace: remove generated-events.h from many includes
trace: get rid of generated-events.h/generated-events.c
trace: introduce a formal group name for trace events
trace: introduce ID range offsets per trace-events file
trace: introduce some Makefile rules for module code gen
trace: switch io/ directory to modular trace.h file
trace: switch util/ directory to modular trace.h file
trace: switch crypto/ directory to modular trace.h file
trace: switch migration/ directory to modular trace.h file
trace: switch block/ directory to modular trace.h file
trace: switch hw/block/ directory to modular trace.h file
trace: switch hw/char/ directory to modular trace.h file
trace: switch hw/intc/ directory to modular trace.h file
trace: switch hw/net/ directory to modular trace.h file
trace: switch hw/virtio/ directory to modular trace.h file
trace: switch hw/audio/ directory to modular trace.h file
trace: switch hw/misc/ directory to modular trace.h file
trace: switch hw/usb/ directory to modular trace.h file
trace: switch hw/scsi/ directory to modular trace.h file
trace: switch hw/nvram/ directory to modular trace.h file
trace: switch hw/display/ directory to modular trace.h file
trace: switch hw/input/ directory to modular trace.h file
trace: switch hw/timer/ directory to modular trace.h file
trace: switch hw/dma/ directory to modular trace.h file
trace: switch hw/sparc/ directory to modular trace.h file
trace: switch hw/sd/ directory to modular trace.h file
trace: switch hw/isa/ directory to modular trace.h file
trace: switch hw/mem/ directory to modular trace.h file
trace: switch hw/i386/ directory to modular trace.h file
trace: switch hw/9pfs/ directory to modular trace.h file
trace: switch hw/ppc/ directory to modular trace.h file
trace: switch hw/pci/ directory to modular trace.h file
trace: switch hw/s390x/ directory to modular trace.h file
trace: switch hw/vfio/ directory to modular trace.h file
trace: switch hw/acpi/ directory to modular trace.h file
trace: switch hw/arm/ directory to modular trace.h file
trace: switch hw/alpha/ directory to modular trace.h file
trace: switch ui/ directory to modular trace.h file
trace: switch audio/ directory to modular trace.h file
trace: switch net/ directory to modular trace.h file
trace: switch target-i386/ directory to modular trace.h file
trace: switch target-sparc/ directory to modular trace.h file
trace: switch target-s390x/ directory to modular trace.h file
trace: switch target-ppc/ directory to modular trace.h file
trace: switch qom/ directory to modular trace.h file
trace: switch linux-user/ directory to modular trace.h file
trace: remove the global include/trace.h file
trace: update docs to reflect new code generation approach

 .gitignore                                       |  15 +-
 Makefile                                         | 116 +++++++++++---
 Makefile.objs                                    |  89 ++++++-----
 Makefile.target                                  |   7 +-
 audio/Makefile.objs                              |   2 +
 audio/alsaaudio.c                                |   2 +-
 audio/ossaudio.c                                 |   2 +-
 audio/trace-events                               |   2 +
 block.c                                          |   2 +-
 block/Makefile.objs                              |   2 +
 block/backup.c                                   |   2 +-
 block/block-backend.c                            |   2 +-
 block/commit.c                                   |   2 +-
 block/dirty-bitmap.c                             |   2 +-
 block/io.c                                       |   2 +-
 block/mirror.c                                   |   2 +-
 block/nfs.c                                      |   2 +-
 block/qcow2-cache.c                              |   2 +-
 block/qcow2-cluster.c                            |   2 +-
 block/qcow2.c                                    |   2 +-
 block/qed-l2-cache.c                             |   2 +-
 block/qed-table.c                                |   2 +-
 block/qed.c                                      |   2 +-
 block/raw-posix.c                                |   2 +-
 block/raw-win32.c                                |   2 +-
 block/stream.c                                   |   2 +-
 block/trace-events                               |   2 +
 blockdev.c                                       |   2 +-
 crypto/Makefile.objs                             |   2 +
 crypto/secret.c                                  |   2 +-
 crypto/tlscreds.c                                |   2 +-
 crypto/tlscredsanon.c                            |   2 +-
 crypto/tlscredsx509.c                            |   2 +-
 crypto/tlssession.c                              |   2 +-
 crypto/trace-events                              |   2 +
 docs/tracing.txt                                 |  61 ++++++--
 hw/9pfs/9p.c                                     |   2 +-
 hw/9pfs/Makefile.objs                            |   2 +
 hw/9pfs/trace-events                             |   2 +
 hw/acpi/Makefile.objs                            |   2 +
 hw/acpi/cpu.c                                    |   2 +-
 hw/acpi/memory_hotplug.c                         |   2 +-
 hw/acpi/trace-events                             |   2 +
 hw/alpha/Makefile.objs                           |   2 +
 hw/alpha/pci.c                                   |   2 +-
 hw/alpha/trace-events                            |   2 +
 hw/arm/Makefile.objs                             |   2 +
 hw/arm/trace-events                              |   2 +
 hw/arm/virt-acpi-build.c                         |   2 +-
 hw/audio/Makefile.objs                           |   3 +
 hw/audio/cs4231.c                                |   2 +-
 hw/audio/milkymist-ac97.c                        |   2 +-
 hw/audio/trace-events                            |   2 +
 hw/block/Makefile.objs                           |   2 +
 hw/block/dataplane/virtio-blk.c                  |   2 +-
 hw/block/hd-geometry.c                           |   2 +-
 hw/block/trace-events                            |   2 +
 hw/block/virtio-blk.c                            |   2 +-
 hw/char/Makefile.objs                            |   2 +
 hw/char/escc.c                                   |   2 +-
 hw/char/grlib_apbuart.c                          |   2 +-
 hw/char/lm32_juart.c                             |   2 +-
 hw/char/lm32_uart.c                              |   2 +-
 hw/char/milkymist-uart.c                         |   2 +-
 hw/char/trace-events                             |   2 +
 hw/char/virtio-console.c                         |   2 +-
 hw/char/virtio-serial-bus.c                      |   2 +-
 hw/display/Makefile.objs                         |   3 +
 hw/display/g364fb.c                              |   2 +-
 hw/display/jazz_led.c                            |   2 +-
 hw/display/milkymist-tmu2.c                      |   2 +-
 hw/display/milkymist-vgafb.c                     |   2 +-
 hw/display/qxl-render.c                          |   2 +-
 hw/display/qxl.c                                 |   2 +-
 hw/display/trace-events                          |   2 +
 hw/display/vga.c                                 |   2 +-
 hw/display/virtio-gpu-3d.c                       |   2 +-
 hw/display/virtio-gpu.c                          |   2 +-
 hw/display/vmware_vga.c                          |   2 +-
 hw/display/xenfb.c                               |   2 +-
 hw/dma/Makefile.objs                             |   2 +
 hw/dma/i8257.c                                   |   2 +-
 hw/dma/rc4030.c                                  |   2 +-
 hw/dma/sparc32_dma.c                             |   2 +-
 hw/dma/sun4m_iommu.c                             |   2 +-
 hw/dma/trace-events                              |   2 +
 hw/i386/Makefile.objs                            |   2 +
 hw/i386/trace-events                             |   6 +-
 hw/i386/x86-iommu.c                              |   2 +-
 hw/i386/xen/xen_platform.c                       |   1 +
 hw/i386/xen/xen_pvdevice.c                       |   1 +
 hw/input/Makefile.objs                           |   3 +
 hw/input/hid.c                                   |   2 +-
 hw/input/milkymist-softusb.c                     |   2 +-
 hw/input/ps2.c                                   |   2 +-
 hw/input/trace-events                            |   2 +
 hw/input/virtio-input.c                          |   2 +-
 hw/intc/Makefile.objs                            |   2 +
 hw/intc/apic.c                                   |   2 +-
 hw/intc/apic_common.c                            |   2 +-
 hw/intc/arm_gic.c                                |   2 +-
 hw/intc/arm_gicv3_cpuif.c                        |   2 +-
 hw/intc/arm_gicv3_dist.c                         |   2 +-
 hw/intc/arm_gicv3_redist.c                       |   2 +-
 hw/intc/aspeed_vic.c                             |   2 +-
 hw/intc/grlib_irqmp.c                            |   2 +-
 hw/intc/lm32_pic.c                               |   2 +-
 hw/intc/s390_flic.c                              |   2 +-
 hw/intc/s390_flic_kvm.c                          |   2 +-
 hw/intc/slavio_intctl.c                          |   2 +-
 hw/intc/trace-events                             |   2 +
 hw/intc/xics.c                                   |   2 +-
 hw/intc/xics_kvm.c                               |   2 +-
 hw/intc/xics_spapr.c                             |   2 +-
 hw/isa/Makefile.objs                             |   2 +
 hw/isa/pc87312.c                                 |   2 +-
 hw/isa/trace-events                              |   2 +
 hw/mem/Makefile.objs                             |   3 +
 hw/mem/pc-dimm.c                                 |   2 +-
 hw/mem/trace-events                              |   7 +
 hw/misc/Makefile.objs                            |   3 +
 hw/misc/aspeed_scu.c                             |   2 +-
 hw/misc/eccmemctl.c                              |   2 +-
 hw/misc/milkymist-hpdmc.c                        |   2 +-
 hw/misc/milkymist-pfpu.c                         |   2 +-
 hw/misc/slavio_misc.c                            |   2 +-
 hw/misc/trace-events                             |   2 +
 hw/net/Makefile.objs                             |   3 +
 hw/net/e1000e.c                                  |   2 +-
 hw/net/e1000e_core.c                             |   2 +-
 hw/net/e1000x_common.c                           |   2 +-
 hw/net/lance.c                                   |   2 +-
 hw/net/milkymist-minimac2.c                      |   2 +-
 hw/net/mipsnet.c                                 |   2 +-
 hw/net/net_rx_pkt.c                              |   2 +-
 hw/net/opencores_eth.c                           |   2 +-
 hw/net/pcnet-pci.c                               |   2 +-
 hw/net/pcnet.c                                   |   2 +-
 hw/net/trace-events                              |   2 +
 hw/nvram/Makefile.objs                           |   2 +
 hw/nvram/ds1225y.c                               |   2 +-
 hw/nvram/fw_cfg.c                                |   2 +-
 hw/nvram/trace-events                            |   2 +
 hw/pci/Makefile.objs                             |   2 +
 hw/pci/pci.c                                     |   2 +-
 hw/pci/pci_host.c                                |   2 +-
 hw/pci/trace-events                              |   2 +
 hw/ppc/Makefile.objs                             |   3 +
 hw/ppc/ppc.c                                     |   2 +-
 hw/ppc/prep.c                                    |   2 +-
 hw/ppc/spapr.c                                   |   2 +-
 hw/ppc/spapr_hcall.c                             |   2 +-
 hw/ppc/spapr_iommu.c                             |   2 +-
 hw/ppc/spapr_pci.c                               |   2 +-
 hw/ppc/spapr_rtas_ddw.c                          |   2 +-
 hw/ppc/trace-events                              |   2 +
 hw/s390x/Makefile.objs                           |   3 +
 hw/s390x/css.c                                   |   2 +-
 hw/s390x/trace-events                            |   2 +
 hw/s390x/virtio-ccw.c                            |   2 +-
 hw/scsi/Makefile.objs                            |   3 +
 hw/scsi/esp-pci.c                                |   2 +-
 hw/scsi/esp.c                                    |   2 +-
 hw/scsi/megasas.c                                |   2 +-
 hw/scsi/mptconfig.c                              |   2 +-
 hw/scsi/mptendian.c                              |   2 +-
 hw/scsi/mptsas.c                                 |   2 +-
 hw/scsi/scsi-bus.c                               |   2 +-
 hw/scsi/trace-events                             |   2 +
 hw/scsi/vmw_pvscsi.c                             |   2 +-
 hw/sd/Makefile.objs                              |   2 +
 hw/sd/milkymist-memcard.c                        |   2 +-
 hw/sd/trace-events                               |   2 +
 hw/sparc/Makefile.objs                           |   2 +
 hw/sparc/leon3.c                                 |   2 +-
 hw/sparc/sun4m.c                                 |   2 +-
 hw/sparc/trace-events                            |   2 +
 hw/timer/Makefile.objs                           |   2 +
 hw/timer/aspeed_timer.c                          |   2 +-
 hw/timer/grlib_gptimer.c                         |   2 +-
 hw/timer/lm32_timer.c                            |   2 +-
 hw/timer/milkymist-sysctl.c                      |   2 +-
 hw/timer/slavio_timer.c                          |   2 +-
 hw/timer/trace-events                            |   2 +
 hw/usb/Makefile.objs                             |   3 +
 hw/usb/bus.c                                     |   2 +-
 hw/usb/combined-packet.c                         |   2 +-
 hw/usb/core.c                                    |   2 +-
 hw/usb/desc.c                                    |   2 +-
 hw/usb/dev-hub.c                                 |   2 +-
 hw/usb/dev-mtp.c                                 |   2 +-
 hw/usb/dev-uas.c                                 |   2 +-
 hw/usb/hcd-ehci.c                                |   2 +-
 hw/usb/hcd-ohci.c                                |   8 +-
 hw/usb/hcd-uhci.c                                |   2 +-
 hw/usb/hcd-xhci.c                                |   2 +-
 hw/usb/host-libusb.c                             |   2 +-
 hw/usb/trace-events                              |   2 +
 hw/vfio/Makefile.objs                            |   2 +
 hw/vfio/common.c                                 |   2 +-
 hw/vfio/pci-quirks.c                             |   2 +-
 hw/vfio/pci.c                                    |   2 +-
 hw/vfio/platform.c                               |   2 +-
 hw/vfio/spapr.c                                  |   2 +-
 hw/vfio/trace-events                             |   2 +
 hw/virtio/Makefile.objs                          |   2 +
 hw/virtio/trace-events                           |   7 +
 hw/virtio/virtio-balloon.c                       |   2 +-
 hw/virtio/virtio-rng.c                           |   2 +-
 hw/virtio/virtio.c                               |   2 +-
 include/qemu/module.h                            |   2 +
 include/qom/cpu.h                                |  10 +-
 include/trace-tcg.h                              |   1 -
 include/trace.h                                  |   7 -
 io/Makefile.objs                                 |   2 +
 io/channel-buffer.c                              |   2 +-
 io/channel-command.c                             |   2 +-
 io/channel-file.c                                |   2 +-
 io/channel-socket.c                              |   2 +-
 io/channel-tls.c                                 |   2 +-
 io/channel-websock.c                             |   2 +-
 io/task.c                                        |   2 +-
 io/trace-events                                  |   6 +-
 linux-user/Makefile.objs                         |   2 +
 linux-user/signal.c                              |   2 +-
 linux-user/trace-events                          |   2 +
 migration/Makefile.objs                          |   2 +
 migration/exec.c                                 |   2 +-
 migration/fd.c                                   |   2 +-
 migration/migration.c                            |   2 +-
 migration/postcopy-ram.c                         |   2 +-
 migration/qemu-file.c                            |   2 +-
 migration/ram.c                                  |   2 +-
 migration/rdma.c                                 |   2 +-
 migration/savevm.c                               |   2 +-
 migration/socket.c                               |   2 +-
 migration/tls.c                                  |   2 +-
 migration/trace-events                           |   2 +
 migration/vmstate.c                              |   2 +-
 monitor.c                                        |  16 +-
 net/Makefile.objs                                |   2 +
 net/filter-mirror.c                              |   2 +-
 net/trace-events                                 |   2 +
 net/vhost-user.c                                 |   2 +-
 qemu-img.c                                       |   1 +
 qemu-io.c                                        |   1 +
 qemu-nbd.c                                       |   1 +
 qom/Makefile.objs                                |   2 +
 qom/cpu.c                                        |   2 +-
 qom/object.c                                     |   2 +-
 qom/trace-events                                 |   2 +
 scripts/simpletrace.py                           |   7 +-
 scripts/tracetool.py                             |  10 +-
 scripts/tracetool/__init__.py                    |  59 +++++--
 scripts/tracetool/backend/__init__.py            |  12 +-
 scripts/tracetool/backend/dtrace.py              |   6 +-
 scripts/tracetool/backend/ftrace.py              |   7 +-
 scripts/tracetool/backend/log.py                 |   6 +-
 scripts/tracetool/backend/simple.py              |  13 +-
 scripts/tracetool/backend/ust.py                 |   6 +-
 scripts/tracetool/format/__init__.py             |   4 +-
 scripts/tracetool/format/c.py                    |  48 +++++-
 scripts/tracetool/format/d.py                    |   2 +-
 scripts/tracetool/format/events_c.py             |  44 ------
 scripts/tracetool/format/events_h.py             |  60 -------
 scripts/tracetool/format/h.py                    |  51 +++++-
 scripts/tracetool/format/simpletrace_stap.py     |   4 +-
 scripts/tracetool/format/stap.py                 |   2 +-
 scripts/tracetool/format/tcg_h.py                |   2 +-
 scripts/tracetool/format/tcg_helper_c.py         |   2 +-
 scripts/tracetool/format/tcg_helper_h.py         |   2 +-
 scripts/tracetool/format/tcg_helper_wrapper_h.py |   2 +-
 scripts/tracetool/format/ust_events_c.py         |   4 +-
 scripts/tracetool/format/ust_events_h.py         |  15 +-
 stubs/trace-control.c                            |   8 +-
 target-i386/Makefile.objs                        |   2 +
 target-i386/kvm.c                                |   2 +-
 target-i386/trace-events                         |   2 +
 target-ppc/Makefile.objs                         |   2 +
 target-ppc/kvm.c                                 |   2 +-
 target-ppc/trace-events                          |   2 +
 target-s390x/Makefile.objs                       |   2 +
 target-s390x/cpu.c                               |   2 +-
 target-s390x/ioinst.c                            |   2 +-
 target-s390x/kvm.c                               |   2 +-
 target-s390x/mmu_helper.c                        |   2 +-
 target-s390x/trace-events                        |   2 +
 target-sparc/Makefile.objs                       |   2 +
 target-sparc/int32_helper.c                      |   2 +-
 target-sparc/int64_helper.c                      |   2 +-
 target-sparc/mmu_helper.c                        |   2 +-
 target-sparc/trace-events                        |   2 +
 target-sparc/win_helper.c                        |   2 +-
 trace-events                                     |  19 +--
 trace/Makefile.objs                              |  98 ++----------
 trace/control-internal.h                         |  39 ++---
 trace/control-target.c                           |  20 +--
 trace/control.c                                  | 191 +++++++++++++++++------
 trace/control.h                                  | 108 +++----------
 trace/event-internal.h                           |   7 +-
 trace/qmp.c                                      |  29 ++--
 trace/simple.c                                   |   6 +-
 trace/simple.h                                   |   6 +-
 ui/Makefile.objs                                 |   3 +
 ui/console.c                                     |   2 +-
 ui/gtk-egl.c                                     |   2 +-
 ui/gtk-gl-area.c                                 |   2 +-
 ui/gtk.c                                         |   2 +-
 ui/input.c                                       |   2 +-
 ui/spice-display.c                               |   2 +-
 ui/trace-events                                  |   2 +
 ui/vnc.c                                         |   2 +-
 util/Makefile.objs                               |   2 +
 util/buffer.c                                    |   2 +-
 util/hbitmap.c                                   |   2 +-
 util/oslib-posix.c                               |   2 +-
 util/oslib-win32.c                               |   2 +-
 util/qemu-coroutine-lock.c                       |   2 +-
 util/qemu-coroutine.c                            |   2 +-
 util/trace-events                                |  21 +++
 vl.c                                             |   2 +
 321 files changed, 1058 insertions(+), 768 deletions(-)
 create mode 100644 hw/mem/trace-events
 delete mode 100644 include/trace.h
 delete mode 100644 scripts/tracetool/format/events_c.py
 delete mode 100644 scripts/tracetool/format/events_h.py
Signature · 1 line
2.7.4
#3 lore raw

PATCH 3/60 trace: move hw/mem/pc-dimm.c trace points into correct file

The trace points for hw/mem/pc-dimm.c were mistakenly put in the hw/i386/trace-events file, instead of hw/mem/trace-events.

---
 Makefile.objs        | 1 +
 hw/i386/trace-events | 4 ----
 hw/mem/trace-events  | 5 +++++
 3 files changed, 6 insertions(+), 4 deletions(-)
 create mode 100644 hw/mem/trace-events
Makefile.objs +1 -0
index 6d5ddcf..b371ebb 100644
@@ -141,6 +141,7 @@ trace-events-y += hw/dma/trace-events
 trace-events-y += hw/sparc/trace-events
 trace-events-y += hw/sd/trace-events
 trace-events-y += hw/isa/trace-events
+trace-events-y += hw/mem/trace-events
 trace-events-y += hw/i386/trace-events
 trace-events-y += hw/9pfs/trace-events
 trace-events-y += hw/ppc/trace-events
hw/i386/trace-events +0 -4
index b4882c1..507f753 100644
@@ -7,9 +7,5 @@ xen_platform_log(char *s) "xen platform: %s"
 xen_pv_mmio_read(uint64_t addr) "WARNING: read from Xen PV Device MMIO space (address %"PRIx64")"
 xen_pv_mmio_write(uint64_t addr) "WARNING: write to Xen PV Device MMIO space (address %"PRIx64")"
 
-# hw/i386/pc.c
-mhp_pc_dimm_assigned_slot(int slot) "0x%d"
-mhp_pc_dimm_assigned_address(uint64_t addr) "0x%"PRIx64
-
 # hw/i386/x86-iommu.c
 x86_iommu_iec_notify(bool global, uint32_t index, uint32_t mask) "Notify IEC invalidation: global=%d index=%" PRIu32 " mask=%" PRIu32
hw/mem/trace-events new file +5 -0
new file mode 100644
index 0000000..3a49215
@@ -0,0 +1,5 @@
+# See docs/trace-events.txt for syntax documentation.
+
+# hw/mem/pc-dimm.c
+mhp_pc_dimm_assigned_slot(int slot) "0x%d"
+mhp_pc_dimm_assigned_address(uint64_t addr) "0x%"PRIx64
Signature · 1 line
2.7.4
#7 lore raw

PATCH 5/60 trace: add trace event iterator APIs

In reply to Daniel P. Berrange

Currently methods which want to iterate over trace events, do so using the trace_event_count() and trace_event_id() methods. This leaks the concept of a single ID enum to the callers. There is an alternative trace_event_pattern() method which can be used in an iteration context, but its design is stateless, so is not easy to expand it in the future.

This defines a formal iterator API will provide an future proof way of iterating over events.

The iterator is also able to apply a pattern match filter to events, further removing the need for the pattern

---
 trace/control.c | 26 ++++++++++++++++++++++++++
 trace/control.h |  9 +++++++++
 2 files changed, 35 insertions(+)
trace/control.c +26 -0
index d173c09..deab872 100644
@@ -124,6 +124,32 @@ TraceEvent *trace_event_pattern(const char *pat, TraceEvent *ev)
     return NULL;
 }
 
+void trace_event_iter_init(TraceEventIter *iter, const char *pattern)
+{
+    iter->event = 0;
+    iter->pattern = pattern;
+}
+
+TraceEvent *trace_event_iter_next(TraceEventIter *iter)
+{
+    TraceEvent *ev;
+
+    if (iter->event >= TRACE_EVENT_COUNT) {
+        return NULL;
+    }
+
+    ev = &(trace_events[iter->event]);
+
+    do {
+        iter->event++;
+    } while (iter->event < TRACE_EVENT_COUNT &&
+             iter->pattern &&
+             !pattern_glob(iter->pattern,
+                           trace_event_get_name(&(trace_events[iter->event]))));
+
+    return ev;
+}
+
 void trace_list_events(void)
 {
     int i;
trace/control.h +9 -0
index 0413b28..a3a8a78 100644
@@ -13,6 +13,10 @@
 #include "qemu-common.h"
 #include "trace/generated-events.h"
 
+typedef struct TraceEventIter {
+    size_t event;
+    const char *pattern;
+} TraceEventIter;
 
 /**
  * TraceEventID:
@@ -25,6 +29,11 @@
  */
 enum TraceEventID;
 
+
+void trace_event_iter_init(TraceEventIter *iter, const char *pattern);
+
+TraceEvent *trace_event_iter_next(TraceEventIter *iter);
+
 /**
  * trace_event_id:
  * @id: Event identifier.
Signature · 1 line
2.7.4
#10 lore raw

PATCH 6/60 trace: convert code to use event iterators

In reply to Daniel P. Berrange

This converts the HMP/QMP monitor API implementations and some internal trace control methods to use the new trace event iterator APIs.

---
 monitor.c       | 16 ++++++----
 trace/control.c | 92 +++++++++++++++++++++++++++++++++------------------------
 trace/qmp.c     | 16 ++++++----
 3 files changed, 73 insertions(+), 51 deletions(-)
monitor.c +10 -6
index 5c00373..7b979a6 100644
@@ -3335,9 +3335,11 @@ void info_trace_events_completion(ReadLineState *rs, int nb_args, const char *st
     len = strlen(str);
     readline_set_completion_index(rs, len);
     if (nb_args == 2) {
-        TraceEventID id;
-        for (id = 0; id < trace_event_count(); id++) {
-            const char *event_name = trace_event_get_name(trace_event_id(id));
+        TraceEventIter iter;
+        TraceEvent *ev;
+        trace_event_iter_init(&iter, NULL);
+        while ((ev = trace_event_iter_next(&iter)) != NULL) {
+            const char *event_name = trace_event_get_name(ev);
             if (!strncmp(str, event_name, len)) {
                 readline_add_completion(rs, event_name);
             }
@@ -3352,9 +3354,11 @@ void trace_event_completion(ReadLineState *rs, int nb_args, const char *str)
     len = strlen(str);
     readline_set_completion_index(rs, len);
     if (nb_args == 2) {
-        TraceEventID id;
-        for (id = 0; id < trace_event_count(); id++) {
-            const char *event_name = trace_event_get_name(trace_event_id(id));
+        TraceEventIter iter;
+        TraceEvent *ev;
+        trace_event_iter_init(&iter, NULL);
+        while ((ev = trace_event_iter_next(&iter)) != NULL) {
+            const char *event_name = trace_event_get_name(ev);
             if (!strncmp(str, event_name, len)) {
                 readline_add_completion(rs, event_name);
             }
trace/control.c +53 -39

133 lines not on this page · raw message

trace/qmp.c +10 -6
index 11d2564..88a907b 100644
@@ -52,8 +52,10 @@ static bool check_events(bool has_vcpu, bool ignore_unavailable, bool is_pattern
         return true;
     } else {
         /* error for unavailable events */
-        TraceEvent *ev = NULL;
-        while ((ev = trace_event_pattern(name, ev)) != NULL) {
+        TraceEventIter iter;
+        TraceEvent *ev;
+        trace_event_iter_init(&iter, name);
+        while ((ev = trace_event_iter_next(&iter)) != NULL) {
             if (!ignore_unavailable && !trace_event_get_state_static(ev)) {
                 error_setg(errp, "event \"%s\" is disabled", trace_event_get_name(ev));
                 return false;
@@ -69,6 +71,7 @@ TraceEventInfoList *qmp_trace_event_get_state(const char *name,
 {
     Error *err = NULL;
     TraceEventInfoList *events = NULL;
+    TraceEventIter iter;
     TraceEvent *ev;
     bool is_pattern = trace_event_is_pattern(name);
     CPUState *cpu;
@@ -86,8 +89,8 @@ TraceEventInfoList *qmp_trace_event_get_state(const char *name,
     }
 
     /* Get states (all errors checked above) */
-    ev = NULL;
-    while ((ev = trace_event_pattern(name, ev)) != NULL) {
+    trace_event_iter_init(&iter, is_pattern ? name : NULL);
+    while ((ev = trace_event_iter_next(&iter)) != NULL) {
         TraceEventInfoList *elem;
         bool is_vcpu = trace_event_is_vcpu(ev);
         if (has_vcpu && !is_vcpu) {
@@ -132,6 +135,7 @@ void qmp_trace_event_set_state(const char *name, bool enable,
                                Error **errp)
 {
     Error *err = NULL;
+    TraceEventIter iter;
     TraceEvent *ev;
     bool is_pattern = trace_event_is_pattern(name);
     CPUState *cpu;
@@ -150,8 +154,8 @@ void qmp_trace_event_set_state(const char *name, bool enable,
     }
 
     /* Apply changes (all errors checked above) */
-    ev = NULL;
-    while ((ev = trace_event_pattern(name, ev)) != NULL) {
+    trace_event_iter_init(&iter, name);
+    while ((ev = trace_event_iter_next(&iter)) != NULL) {
         if (!trace_event_get_state_static(ev) ||
             (has_vcpu && !trace_event_is_vcpu(ev))) {
             continue;
Signature · 1 line
2.7.4
#12 lore raw

PATCH 7/60 trace: remove some now unused functions

In reply to Daniel P. Berrange

The trace_event_count, trace_event_id and trace_event_pattern methods are no longer required now that everything is using the iterator APIs

The trace_event_set_state and trace_event_set_vcpu_state macros were also unused.

---
 trace/control-internal.h | 11 ---------
 trace/control.c          | 22 ------------------
 trace/control.h          | 59 ------------------------------------------------
 3 files changed, 92 deletions(-)
trace/control-internal.h +0 -11
index a4e5f4a..7f31e39 100644
@@ -20,17 +20,6 @@ extern uint16_t trace_events_dstate[];
 extern int trace_events_enabled_count;
 
 
-static inline TraceEventID trace_event_count(void)
-{
-    return TRACE_EVENT_COUNT;
-}
-
-static inline TraceEvent *trace_event_id(TraceEventID id)
-{
-    assert(id < trace_event_count());
-    return &trace_events[id];
-}
-
 static inline bool trace_event_is_pattern(const char *str)
 {
     assert(str != NULL);
trace/control.c +0 -22
index dbf47fc..7ba171b 100644
@@ -101,28 +101,6 @@ static bool pattern_glob(const char *pat, const char *ev)
     }
 }
 
-TraceEvent *trace_event_pattern(const char *pat, TraceEvent *ev)
-{
-    assert(pat != NULL);
-
-    bool matched = ev ? false : true;
-    TraceEventIter iter;
-    TraceEvent *thisev;
-    trace_event_iter_init(&iter, NULL);
-    while ((thisev = trace_event_iter_next(&iter)) != NULL) {
-        if (matched) {
-            if (pattern_glob(pat, trace_event_get_name(thisev))) {
-                return thisev;
-            }
-        } else {
-            if (ev == thisev) {
-                matched = true;
-            }
-        }
-    }
-
-    return NULL;
-}
 
 void trace_event_iter_init(TraceEventIter *iter, const char *pattern)
 {
trace/control.h +0 -59

83 lines not on this page · raw message

Signature · 1 line
2.7.4
#13 lore raw

PATCH 8/60 trace: provide mechanism for registering trace events

In reply to Daniel P. Berrange

Remove the notion of there being a single global array of trace events, by introducing a method for registering groups of events. The ID values will only be required to be unique within the scope of a group of events.

---
 include/qemu/module.h                |  2 ++
 qemu-img.c                           |  1 +
 qemu-io.c                            |  1 +
 qemu-nbd.c                           |  1 +
 scripts/tracetool/format/events_c.py |  6 ++++++
 scripts/tracetool/format/events_h.py |  1 +
 trace/control-internal.h             |  5 ++++-
 trace/control.c                      | 38 +++++++++++++++++++++++++++++++-----
 trace/control.h                      |  1 +
 vl.c                                 |  2 ++
 10 files changed, 52 insertions(+), 6 deletions(-)
include/qemu/module.h +2 -0
index 2370708..c700961 100644
@@ -44,6 +44,7 @@ typedef enum {
     MODULE_INIT_OPTS,
     MODULE_INIT_QAPI,
     MODULE_INIT_QOM,
+    MODULE_INIT_TRACE,
     MODULE_INIT_MAX
 } module_init_type;
 
@@ -51,6 +52,7 @@ typedef enum {
 #define opts_init(function) module_init(function, MODULE_INIT_OPTS)
 #define qapi_init(function) module_init(function, MODULE_INIT_QAPI)
 #define type_init(function) module_init(function, MODULE_INIT_QOM)
+#define trace_init(function) module_init(function, MODULE_INIT_TRACE)
 
 void register_module_init(void (*fn)(void), module_init_type type);
 void register_dso_module_init(void (*fn)(void), module_init_type type);
qemu-img.c +1 -0
index d2865a5..db97195 100644
@@ -3822,6 +3822,7 @@ int main(int argc, char **argv)
     signal(SIGPIPE, SIG_IGN);
 #endif
 
+    module_call_init(MODULE_INIT_TRACE);
     error_set_progname(argv[0]);
     qemu_init_exec_dir(argv[0]);
 
qemu-io.c +1 -0
index db129ea..23a229f 100644
@@ -467,6 +467,7 @@ int main(int argc, char **argv)
     signal(SIGPIPE, SIG_IGN);
 #endif
 
+    module_call_init(MODULE_INIT_TRACE);
     progname = basename(argv[0]);
     qemu_init_exec_dir(argv[0]);
 
qemu-nbd.c +1 -0
index e3571c2..ea1beed 100644
@@ -533,6 +533,7 @@ int main(int argc, char **argv)
     sa_sigterm.sa_handler = termsig_handler;
     sigaction(SIGTERM, &sa_sigterm, NULL);
 
+    module_call_init(MODULE_INIT_TRACE);
     qcrypto_init(&error_fatal);
 
     module_call_init(MODULE_INIT_QOM);
scripts/tracetool/format/events_c.py +6 -0
index 4012063..9203377 100644
@@ -42,3 +42,9 @@ def generate(events, backend):
 
     out('};',
         '')
+
+    out('void trace_register_events(void)',
+        '{',
+        '    trace_event_register_group(trace_events, TRACE_EVENT_COUNT);',
+        '}',
+        'trace_init(trace_register_events)')
scripts/tracetool/format/events_h.py +1 -0
index a9da60b..291c183 100644
@@ -56,5 +56,6 @@ def generate(events, backend):
         out('#define TRACE_%s_ENABLED %d' % (e.name.upper(), enabled))
 
     out('#include "trace/event-internal.h"',
+        'void trace_register_events(void);',
         '',
         '#endif  /* TRACE__GENERATED_EVENTS_H */')
trace/control-internal.h +4 -1
index 7f31e39..e95b031 100644
@@ -15,7 +15,6 @@
 #include "qom/cpu.h"
 
 
-extern TraceEvent trace_events[];
 extern uint16_t trace_events_dstate[];
 extern int trace_events_enabled_count;
 
@@ -88,4 +87,8 @@ static inline bool trace_event_get_vcpu_state_dynamic(CPUState *vcpu,
     return trace_event_get_vcpu_state_dynamic_by_vcpu_id(vcpu, id);
 }
 
+
+void trace_event_register_group(TraceEvent *events,
+                                size_t nevents);
+
 #endif /* TRACE__CONTROL_INTERNAL_H */
trace/control.c +33 -5
index 7ba171b..4847a51 100644
@@ -25,6 +25,15 @@
 #include "monitor/monitor.h"
 
 int trace_events_enabled_count;
+
+typedef struct TraceEventGroup {
+    TraceEvent *events;
+    size_t nevents;
+} TraceEventGroup;
+
+static TraceEventGroup *event_groups;
+static size_t nevent_groups;
+
 /*
  * Interpretation depends on wether the event has the 'vcpu' property:
  * - false: Boolean value indicating whether the event is active.
@@ -55,6 +64,16 @@ QemuOptsList qemu_trace_opts = {
 };
 
 
+void trace_event_register_group(TraceEvent *events,
+                                size_t nevents)
+{
+    event_groups = g_renew(TraceEventGroup, event_groups, nevent_groups + 1);
+    event_groups[nevent_groups].events = events;
+    event_groups[nevent_groups].nevents = nevents;
+    nevent_groups++;
+}
+
+
 TraceEvent *trace_event_name(const char *name)
 {
     assert(name != NULL);
@@ -105,6 +124,7 @@ static bool pattern_glob(const char *pat, const char *ev)
 void trace_event_iter_init(TraceEventIter *iter, const char *pattern)
 {
     iter->event = 0;
+    iter->group = 0;
     iter->pattern = pattern;
 }
 
@@ -112,18 +132,26 @@ TraceEvent *trace_event_iter_next(TraceEventIter *iter)
 {
     TraceEvent *ev;
 
-    if (iter->event >= TRACE_EVENT_COUNT) {
+    if (iter->group >= nevent_groups ||
+        iter->event >= event_groups[iter->group].nevents) {
         return NULL;
     }
 
-    ev = &(trace_events[iter->event]);
+    ev = &(event_groups[iter->group].events[iter->event]);
 
     do {
         iter->event++;
-    } while (iter->event < TRACE_EVENT_COUNT &&
+        if (iter->event >= event_groups[iter->group].nevents) {
+            iter->event = 0;
+            iter->group++;
+        }
+    } while (iter->group < nevent_groups &&
+             iter->event < event_groups[iter->group].nevents &&
              iter->pattern &&
-             !pattern_glob(iter->pattern,
-                           trace_event_get_name(&(trace_events[iter->event]))));
+             !pattern_glob(
+                 iter->pattern,
+                 trace_event_get_name(
+                     &(event_groups[iter->group].events[iter->event]))));
 
     return ev;
 }
trace/control.h +1 -0
index 3f00adc..81471ad 100644
@@ -15,6 +15,7 @@
 
 typedef struct TraceEventIter {
     size_t event;
+    size_t group;
     const char *pattern;
 } TraceEventIter;
 
vl.c +2 -0
index c4eeaff..f65deca 100644
@@ -2964,6 +2964,8 @@ int main(int argc, char **argv, char **envp)
     Error *err = NULL;
     bool list_data_dirs = false;
 
+    module_call_init(MODULE_INIT_TRACE);
+
     qemu_init_cpu_loop();
     qemu_mutex_lock_iothread();
 
Signature · 1 line
2.7.4
#16 lore raw

PATCH 9/60 trace: remove use of TRACE_VCPU_EVENT_COUNT in cpu.h

In reply to Daniel P. Berrange

The CPUState struct has a bitmap tracking which VCPU events are currently active. This is indexed based on the event ID values, and sized according the maximum TraceEventVCPUID enum value. Since there will the possibility of having multiple event groups, the indexes will potentially overlap.

Rather than creating a more complex 2 dimensional data structure in CPUState, make an assumption that all the per-VCPU events will be defined in the same event group. Do a sanity check for this assumption when registering event groups.

In addition, rather than using the TRACE_VCPU_EVENT_COUNT constant, which requires pulling in the enourmous trace events header, define a fixed bitmap size, which allows for 32 events. This will suffice for the immediate future and can be easily raised later if needed.

With this change, the cpu.h file no longer has a direct dependancy on the generate events header file.

---
 include/qom/cpu.h | 10 ++++++++--
 qom/cpu.c         |  2 +-
 trace/control.c   | 15 +++++++++++++++
 trace/control.h   |  1 +
 4 files changed, 25 insertions(+), 3 deletions(-)
include/qom/cpu.h +8 -2
index ce0c406..6e39cf7 100644
@@ -27,7 +27,6 @@
 #include "qemu/bitmap.h"
 #include "qemu/queue.h"
 #include "qemu/thread.h"
-#include "trace/generated-events.h"
 
 typedef int (*WriteCoreDumpFunction)(const void *buf, size_t size,
                                      void *opaque);
@@ -240,6 +239,13 @@ struct qemu_work_item {
     bool free;
 };
 
+
+/* Keep this a multiple of 8, or better yet a multiple
+ * of the platform word size, since the struct
+ * will be padded out to that regardless.
+ */
+#define TRACE_MAX_VCPU_EVENT 32
+
 /**
  * CPUState:
  * @cpu_index: CPU index (informative).
@@ -351,7 +357,7 @@ struct CPUState {
     struct kvm_run *kvm_run;
 
     /* Used for events with 'vcpu' and *without* the 'disabled' properties */
-    DECLARE_BITMAP(trace_dstate, TRACE_VCPU_EVENT_COUNT);
+    DECLARE_BITMAP(trace_dstate, TRACE_MAX_VCPU_EVENT);
 
     /* TODO Move common fields from CPUArchState here. */
     int cpu_index; /* used by alpha TCG */
qom/cpu.c +1 -1
index 2553247..8b5280a 100644
@@ -345,7 +345,7 @@ static void cpu_common_initfn(Object *obj)
     qemu_mutex_init(&cpu->work_mutex);
     QTAILQ_INIT(&cpu->breakpoints);
     QTAILQ_INIT(&cpu->watchpoints);
-    bitmap_zero(cpu->trace_dstate, TRACE_VCPU_EVENT_COUNT);
+    bitmap_zero(cpu->trace_dstate, TRACE_MAX_VCPU_EVENT);
 }
 
 static void cpu_common_finalize(Object *obj)
trace/control.c +15 -0
index 4847a51..d0aa075 100644
@@ -31,6 +31,7 @@ typedef struct TraceEventGroup {
     size_t nevents;
 } TraceEventGroup;
 
+static bool have_vcpu_events;
 static TraceEventGroup *event_groups;
 static size_t nevent_groups;
 
@@ -67,6 +68,20 @@ QemuOptsList qemu_trace_opts = {
 void trace_event_register_group(TraceEvent *events,
                                 size_t nevents)
 {
+    size_t nvcpuevents = 0;
+    for (size_t i = 0; i < nevents; i++) {
+        if (events[i].vcpu_id != TRACE_VCPU_EVENT_COUNT) {
+            nvcpuevents++;
+        }
+    }
+
+    if (nvcpuevents) {
+        /* We only support 1 group having vcpu events */
+        assert(!have_vcpu_events);
+        assert(nvcpuevents < TRACE_MAX_VCPU_EVENT);
+        have_vcpu_events = true;
+    }
+
     event_groups = g_renew(TraceEventGroup, event_groups, nevent_groups + 1);
     event_groups[nevent_groups].events = events;
     event_groups[nevent_groups].nevents = nevents;
trace/control.h +1 -0
index 81471ad..c9ea2f6 100644
@@ -19,6 +19,7 @@ typedef struct TraceEventIter {
     const char *pattern;
 } TraceEventIter;
 
+
 /**
  * TraceEventID:
  *
Signature · 1 line
2.7.4
#18 lore raw

PATCH 10/60 trace: remove fixed global event state arrays

In reply to Daniel P. Berrange

There are currently two global event state arrays, 'uint16 dstate[]' and 'bool dstate_init[]' whose sized is defined based on the TRACE_EVENT_COUNT enum value.

When multiple event groups are enabled, it won't be possible to used a fixed global event state. This change thus expands the event group register method so that the event state arrays can be passed in when the group is registered.

When calling the methods for setting/getting the trace event state, the caller also needs to pass in the corresponding 'dstate' array. While it would be possible to look up the array in the group list, these methods are in the hot-path, so passing in the array directly is hugely more efficient. The extra parameter is no real burden on callers, since all the code is auto-generated, with the exception of a call in hw/usb/hcd-ohci.c

---
 hw/usb/hcd-ohci.c                    |  4 +--
 scripts/tracetool/backend/simple.py  |  2 +-
 scripts/tracetool/format/events_c.py |  7 +++--
 scripts/tracetool/format/events_h.py |  3 ++
 stubs/trace-control.c                |  8 ++----
 trace/control-internal.h             | 17 ++++++-----
 trace/control-target.c               | 14 ++++-----
 trace/control.c                      | 56 ++++++++++++++++++++++++++----------
 trace/control.h                      | 15 ++++++----
 trace/qmp.c                          | 17 +++++++----
 10 files changed, 93 insertions(+), 50 deletions(-)
hw/usb/hcd-ohci.c +2 -2
index fa57038..87508a7 100644
@@ -937,8 +937,8 @@ static int ohci_service_iso_td(OHCIState *ohci, struct ohci_ed *ed,
 #ifdef trace_event_get_state
 static void ohci_td_pkt(const char *msg, const uint8_t *buf, size_t len)
 {
-    bool print16 = !!trace_event_get_state(TRACE_USB_OHCI_TD_PKT_SHORT);
-    bool printall = !!trace_event_get_state(TRACE_USB_OHCI_TD_PKT_FULL);
+    bool print16 = !!trace_event_get_state(dstate, TRACE_USB_OHCI_TD_PKT_SHORT);
+    bool printall = !!trace_event_get_state(dstate, TRACE_USB_OHCI_TD_PKT_FULL);
     const int width = 16;
     int i;
     char tmp[3 * width + 1];
scripts/tracetool/backend/simple.py +1 -1
index 1bccada..c2a8468 100644
@@ -73,7 +73,7 @@ def generate_c(event):
         # already checked on the generic format code
         cond = "true"
     else:
-        cond = "trace_event_get_state(%s)" % event_id
+        cond = "trace_event_get_state(dstate, %s)" % event_id
 
     out('',
         '    if (!%(cond)s) {',
scripts/tracetool/format/events_c.py +5 -2
index 9203377..bab6404 100644
@@ -25,7 +25,10 @@ def generate(events, backend):
         '#include "trace/control.h"',
         '')
 
-    out('TraceEvent trace_events[TRACE_EVENT_COUNT] = {')
+    out('uint16_t dstate[TRACE_EVENT_COUNT];')
+    out('bool dstate_init[TRACE_EVENT_COUNT];')
+
+    out('static TraceEvent trace_events[TRACE_EVENT_COUNT] = {')
 
     for e in events:
         if "vcpu" in e.properties:
@@ -45,6 +48,6 @@ def generate(events, backend):
 
     out('void trace_register_events(void)',
         '{',
-        '    trace_event_register_group(trace_events, TRACE_EVENT_COUNT);',
+        '    trace_event_register_group(trace_events, TRACE_EVENT_COUNT, dstate, dstate_init);',
         '}',
         'trace_init(trace_register_events)')
scripts/tracetool/format/events_h.py +3 -0
index 291c183..d6465d4 100644
@@ -55,6 +55,9 @@ def generate(events, backend):
                 enabled=enabled)
         out('#define TRACE_%s_ENABLED %d' % (e.name.upper(), enabled))
 
+    out('extern uint16_t dstate[TRACE_EVENT_COUNT];')
+    out('extern bool dstate_init[TRACE_EVENT_COUNT];')
+
     out('#include "trace/event-internal.h"',
         'void trace_register_events(void);',
         '',
stubs/trace-control.c +2 -6
index fe59836..31566c2 100644
@@ -11,16 +11,12 @@
 #include "trace/control.h"
 
 
-void trace_event_set_state_dynamic(TraceEvent *ev, bool state)
+void trace_event_set_state_dynamic(uint16_t *dstate, TraceEvent *ev, bool state)
 {
-    TraceEventID id;
     assert(trace_event_get_state_static(ev));
-    id = trace_event_get_id(ev);
-    trace_events_enabled_count += state - trace_events_dstate[id];
-    trace_events_dstate[id] = state;
 }
 
-void trace_event_set_vcpu_state_dynamic(CPUState *vcpu,
+void trace_event_set_vcpu_state_dynamic(uint16_t *dstate, CPUState *vcpu,
                                         TraceEvent *ev, bool state)
 {
     /* should never be called on non-target binaries */
trace/control-internal.h +10 -7
index e95b031..634effe 100644
@@ -15,7 +15,6 @@
 #include "qom/cpu.h"
 
 
-extern uint16_t trace_events_dstate[];
 extern int trace_events_enabled_count;
 
 
@@ -53,22 +52,24 @@ static inline bool trace_event_get_state_static(TraceEvent *ev)
     return ev->sstate;
 }
 
-static inline bool trace_event_get_state_dynamic_by_id(TraceEventID id)
+static inline bool trace_event_get_state_dynamic_by_id(
+    uint16_t *trace_events_dstate, TraceEventID id)
 {
     /* it's on fast path, avoid consistency checks (asserts) */
     return unlikely(trace_events_enabled_count) && trace_events_dstate[id];
 }
 
-static inline bool trace_event_get_state_dynamic(TraceEvent *ev)
+static inline bool trace_event_get_state_dynamic(
+    uint16_t *trace_events_dstate, TraceEvent *ev)
 {
     TraceEventID id;
     assert(trace_event_get_state_static(ev));
     id = trace_event_get_id(ev);
-    return trace_event_get_state_dynamic_by_id(id);
+    return trace_event_get_state_dynamic_by_id(trace_events_dstate, id);
 }
 
-static inline bool trace_event_get_vcpu_state_dynamic_by_vcpu_id(CPUState *vcpu,
-                                                                 TraceEventVCPUID id)
+static inline bool trace_event_get_vcpu_state_dynamic_by_vcpu_id(
+    CPUState *vcpu, TraceEventVCPUID id)
 {
     /* it's on fast path, avoid consistency checks (asserts) */
     if (unlikely(trace_events_enabled_count)) {
@@ -89,6 +90,8 @@ static inline bool trace_event_get_vcpu_state_dynamic(CPUState *vcpu,
 
 
 void trace_event_register_group(TraceEvent *events,
-                                size_t nevents);
+                                size_t nevents,
+                                uint16_t *dstate,
+                                bool *dstate_init);
 
 #endif /* TRACE__CONTROL_INTERNAL_H */
trace/control-target.c +7 -7
index 74c029a..da326b4 100644
@@ -13,22 +13,22 @@
 #include "translate-all.h"
 
 
-void trace_event_set_state_dynamic(TraceEvent *ev, bool state)
+void trace_event_set_state_dynamic(uint16_t *dstate, TraceEvent *ev, bool state)
 {
     CPUState *vcpu;
     assert(trace_event_get_state_static(ev));
     if (trace_event_is_vcpu(ev)) {
         CPU_FOREACH(vcpu) {
-            trace_event_set_vcpu_state_dynamic(vcpu, ev, state);
+            trace_event_set_vcpu_state_dynamic(dstate, vcpu, ev, state);
         }
     } else {
         TraceEventID id = trace_event_get_id(ev);
-        trace_events_enabled_count += state - trace_events_dstate[id];
-        trace_events_dstate[id] = state;
+        trace_events_enabled_count += state - dstate[id];
+        dstate[id] = state;
     }
 }
 
-void trace_event_set_vcpu_state_dynamic(CPUState *vcpu,
+void trace_event_set_vcpu_state_dynamic(uint16_t *dstate, CPUState *vcpu,
                                         TraceEvent *ev, bool state)
 {
     TraceEventID id;
@@ -43,11 +43,11 @@ void trace_event_set_vcpu_state_dynamic(CPUState *vcpu,
         if (state) {
             trace_events_enabled_count++;
             set_bit(vcpu_id, vcpu->trace_dstate);
-            trace_events_dstate[id]++;
+            dstate[id]++;
         } else {
             trace_events_enabled_count--;
             clear_bit(vcpu_id, vcpu->trace_dstate);
-            trace_events_dstate[id]--;
+            dstate[id]--;
         }
     }
 }
trace/control.c +41 -15

116 lines not on this page · raw message

trace/control.h +10 -5
index c9ea2f6..a5cb7f3 100644
@@ -35,6 +35,9 @@ enum TraceEventID;
 void trace_event_iter_init(TraceEventIter *iter, const char *pattern);
 
 TraceEvent *trace_event_iter_next(TraceEventIter *iter);
+TraceEvent *trace_event_iter_next_full(TraceEventIter *iter,
+                                       uint16_t **dstate,
+                                       bool **dstate_init);
 
 
 /**
@@ -97,8 +100,8 @@ static const char * trace_event_get_name(TraceEvent *ev);
  *
  * As a down side, you must always use an immediate #TraceEventID value.
  */
-#define trace_event_get_state(id)                       \
-    ((id ##_ENABLED) && trace_event_get_state_dynamic_by_id(id))
+#define trace_event_get_state(dstate, id)                                \
+    ((id ##_ENABLED) && trace_event_get_state_dynamic_by_id(dstate, id))
 
 /**
  * trace_event_get_vcpu_state:
@@ -135,7 +138,8 @@ static bool trace_event_get_state_static(TraceEvent *ev);
  *
  * If the event has the 'vcpu' property, gets the OR'ed state of all vCPUs.
  */
-static bool trace_event_get_state_dynamic(TraceEvent *ev);
+static bool trace_event_get_state_dynamic(uint16_t *dstate,
+                                          TraceEvent *ev);
 
 /**
  * trace_event_get_vcpu_state_dynamic:
@@ -154,7 +158,8 @@ static bool trace_event_get_vcpu_state_dynamic(CPUState *vcpu, TraceEvent *ev);
  *
  * Pre-condition: trace_event_get_state_static(ev) == true
  */
-void trace_event_set_state_dynamic(TraceEvent *ev, bool state);
+void trace_event_set_state_dynamic(uint16_t *dstate, TraceEvent *ev,
+                                   bool state);
 
 /**
  * trace_event_set_vcpu_state_dynamic:
@@ -163,7 +168,7 @@ void trace_event_set_state_dynamic(TraceEvent *ev, bool state);
  *
  * Pre-condition: trace_event_get_vcpu_state_static(ev) == true
  */
-void trace_event_set_vcpu_state_dynamic(CPUState *vcpu,
+void trace_event_set_vcpu_state_dynamic(uint16_t *dstate, CPUState *vcpu,
                                         TraceEvent *ev, bool state);
 
 
trace/qmp.c +12 -5
index 88a907b..190049a 100644
@@ -73,6 +73,8 @@ TraceEventInfoList *qmp_trace_event_get_state(const char *name,
     TraceEventInfoList *events = NULL;
     TraceEventIter iter;
     TraceEvent *ev;
+    uint16_t *dstate;
+    bool *dstate_init;
     bool is_pattern = trace_event_is_pattern(name);
     CPUState *cpu;
 
@@ -90,9 +92,11 @@ TraceEventInfoList *qmp_trace_event_get_state(const char *name,
 
     /* Get states (all errors checked above) */
     trace_event_iter_init(&iter, is_pattern ? name : NULL);
-    while ((ev = trace_event_iter_next(&iter)) != NULL) {
+    while ((ev = trace_event_iter_next_full(&iter, &dstate, &dstate_init)) !=
+           NULL) {
         TraceEventInfoList *elem;
         bool is_vcpu = trace_event_is_vcpu(ev);
+        g_assert(dstate);
         if (has_vcpu && !is_vcpu) {
             continue;
         }
@@ -115,7 +119,7 @@ TraceEventInfoList *qmp_trace_event_get_state(const char *name,
                 }
                 /* else: already skipped above */
             } else {
-                if (trace_event_get_state_dynamic(ev)) {
+                if (trace_event_get_state_dynamic(dstate, ev)) {
                     elem->value->state = TRACE_EVENT_STATE_ENABLED;
                 } else {
                     elem->value->state = TRACE_EVENT_STATE_DISABLED;
@@ -139,6 +143,8 @@ void qmp_trace_event_set_state(const char *name, bool enable,
     TraceEvent *ev;
     bool is_pattern = trace_event_is_pattern(name);
     CPUState *cpu;
+    uint16_t *dstate;
+    bool *dstate_init;
 
     /* Check provided vcpu */
     cpu = get_cpu(has_vcpu, vcpu, &err);
@@ -155,15 +161,16 @@ void qmp_trace_event_set_state(const char *name, bool enable,
 
     /* Apply changes (all errors checked above) */
     trace_event_iter_init(&iter, name);
-    while ((ev = trace_event_iter_next(&iter)) != NULL) {
+    while ((ev = trace_event_iter_next_full(&iter, &dstate, &dstate_init)) !=
+           NULL) {
         if (!trace_event_get_state_static(ev) ||
             (has_vcpu && !trace_event_is_vcpu(ev))) {
             continue;
         }
         if (has_vcpu) {
-            trace_event_set_vcpu_state_dynamic(cpu, ev, enable);
+            trace_event_set_vcpu_state_dynamic(dstate, cpu, ev, enable);
         } else {
-            trace_event_set_state_dynamic(ev, enable);
+            trace_event_set_state_dynamic(dstate, ev, enable);
         }
     }
 }
Signature · 1 line
2.7.4
#22 lore raw

PATCH 11/60 trace: remove use of event ID enums from APIs

In reply to Daniel P. Berrange

Since there will shortly be multiple event groups allowed, we can no longer use the TraceEventID and TraceEventVCPUID enums in the trace control APIs. There will in fact be multiple distinct enums, and the enum values will only be required to be unique per group.

---
 trace/control-internal.h | 14 +++++++-------
 trace/control-target.c   |  6 +++---
 trace/control.h          | 25 ++++++-------------------
 trace/event-internal.h   |  4 ++--
 trace/simple.c           |  6 +++---
 trace/simple.h           |  2 +-
 6 files changed, 22 insertions(+), 35 deletions(-)
trace/control-internal.h +7 -7
index 634effe..b7048d4 100644
@@ -24,13 +24,13 @@ static inline bool trace_event_is_pattern(const char *str)
     return strchr(str, '*') != NULL;
 }
 
-static inline TraceEventID trace_event_get_id(TraceEvent *ev)
+static inline size_t trace_event_get_id(TraceEvent *ev)
 {
     assert(ev != NULL);
     return ev->id;
 }
 
-static inline TraceEventVCPUID trace_event_get_vcpu_id(TraceEvent *ev)
+static inline size_t trace_event_get_vcpu_id(TraceEvent *ev)
 {
     return ev->vcpu_id;
 }
@@ -53,7 +53,7 @@ static inline bool trace_event_get_state_static(TraceEvent *ev)
 }
 
 static inline bool trace_event_get_state_dynamic_by_id(
-    uint16_t *trace_events_dstate, TraceEventID id)
+    uint16_t *trace_events_dstate, size_t id)
 {
     /* it's on fast path, avoid consistency checks (asserts) */
     return unlikely(trace_events_enabled_count) && trace_events_dstate[id];
@@ -62,14 +62,14 @@ static inline bool trace_event_get_state_dynamic_by_id(
 static inline bool trace_event_get_state_dynamic(
     uint16_t *trace_events_dstate, TraceEvent *ev)
 {
-    TraceEventID id;
+    size_t id;
     assert(trace_event_get_state_static(ev));
     id = trace_event_get_id(ev);
     return trace_event_get_state_dynamic_by_id(trace_events_dstate, id);
 }
 
-static inline bool trace_event_get_vcpu_state_dynamic_by_vcpu_id(
-    CPUState *vcpu, TraceEventVCPUID id)
+static inline bool trace_event_get_vcpu_state_dynamic_by_vcpu_id(CPUState *vcpu,
+                                                                 size_t id)
 {
     /* it's on fast path, avoid consistency checks (asserts) */
     if (unlikely(trace_events_enabled_count)) {
@@ -82,7 +82,7 @@ static inline bool trace_event_get_vcpu_state_dynamic_by_vcpu_id(
 static inline bool trace_event_get_vcpu_state_dynamic(CPUState *vcpu,
                                                       TraceEvent *ev)
 {
-    TraceEventVCPUID id;
+    size_t id;
     assert(trace_event_is_vcpu(ev));
     id = trace_event_get_vcpu_id(ev);
     return trace_event_get_vcpu_state_dynamic_by_vcpu_id(vcpu, id);
trace/control-target.c +3 -3
index da326b4..2f5a2c2 100644
@@ -22,7 +22,7 @@ void trace_event_set_state_dynamic(uint16_t *dstate, TraceEvent *ev, bool state)
             trace_event_set_vcpu_state_dynamic(dstate, vcpu, ev, state);
         }
     } else {
-        TraceEventID id = trace_event_get_id(ev);
+        size_t id = trace_event_get_id(ev);
         trace_events_enabled_count += state - dstate[id];
         dstate[id] = state;
     }
@@ -31,8 +31,8 @@ void trace_event_set_state_dynamic(uint16_t *dstate, TraceEvent *ev, bool state)
 void trace_event_set_vcpu_state_dynamic(uint16_t *dstate, CPUState *vcpu,
                                         TraceEvent *ev, bool state)
 {
-    TraceEventID id;
-    TraceEventVCPUID vcpu_id;
+    size_t id;
+    size_t vcpu_id;
     bool state_pre;
     assert(trace_event_get_state_static(ev));
     assert(trace_event_is_vcpu(ev));
trace/control.h +6 -19
index a5cb7f3..438c3d2 100644
@@ -19,19 +19,6 @@ typedef struct TraceEventIter {
     const char *pattern;
 } TraceEventIter;
 
-
-/**
- * TraceEventID:
- *
- * Unique tracing event identifier.
- *
- * These are named as 'TRACE_${EVENT_NAME}'.
- *
- * See also: "trace/generated-events.h"
- */
-enum TraceEventID;
-
-
 void trace_event_iter_init(TraceEventIter *iter, const char *pattern);
 
 TraceEvent *trace_event_iter_next(TraceEventIter *iter);
@@ -63,7 +50,7 @@ static bool trace_event_is_pattern(const char *str);
  *
  * Get the identifier of an event.
  */
-static TraceEventID trace_event_get_id(TraceEvent *ev);
+static size_t trace_event_get_id(TraceEvent *ev);
 
 /**
  * trace_event_get_vcpu_id:
@@ -73,7 +60,7 @@ static TraceEventID trace_event_get_id(TraceEvent *ev);
  * Special value #TRACE_VCPU_EVENT_COUNT means the event is not vCPU-specific
  * (does not have the "vcpu" property).
  */
-static TraceEventVCPUID trace_event_get_vcpu_id(TraceEvent *ev);
+static size_t trace_event_get_vcpu_id(TraceEvent *ev);
 
 /**
  * trace_event_is_vcpu:
@@ -98,7 +85,7 @@ static const char * trace_event_get_name(TraceEvent *ev);
  * If the event has the disabled property, the check will have no performance
  * impact.
  *
- * As a down side, you must always use an immediate #TraceEventID value.
+ * As a down side, you must always use an immediate event ID value.
  */
 #define trace_event_get_state(dstate, id)                                \
     ((id ##_ENABLED) && trace_event_get_state_dynamic_by_id(dstate, id))
@@ -106,8 +93,8 @@ static const char * trace_event_get_name(TraceEvent *ev);
 /**
  * trace_event_get_vcpu_state:
  * @vcpu: Target vCPU.
- * @id: Event identifier (TraceEventID).
- * @vcpu_id: Per-vCPU event identifier (TraceEventVCPUID).
+ * @id: Event identifier.
+ * @vcpu_id: Per-vCPU event identifier.
  *
  * Get the tracing state of an event (both static and dynamic) for the given
  * vCPU.
@@ -115,7 +102,7 @@ static const char * trace_event_get_name(TraceEvent *ev);
  * If the event has the disabled property, the check will have no performance
  * impact.
  *
- * As a down side, you must always use an immediate #TraceEventID value.
+ * As a down side, you must always use an immediate event ID value.
  */
 #define trace_event_get_vcpu_state(vcpu, id, vcpu_id)                   \
     ((id ##_ENABLED) && trace_event_get_vcpu_state_dynamic_by_vcpu_id(vcpu, vcpu_id))
trace/event-internal.h +2 -2
index 5d8fa97..618d1b5 100644
@@ -23,8 +23,8 @@
  * Opaque generic description of a tracing event.
  */
 typedef struct TraceEvent {
-    TraceEventID id;
-    TraceEventVCPUID vcpu_id;
+    size_t id;
+    size_t vcpu_id;
     const char * name;
     const bool sstate;
 } TraceEvent;
trace/simple.c +3 -3
index 2f09daf..2338ff8 100644
@@ -18,7 +18,7 @@
 #include "trace/simple.h"
 
 /** Trace file header event ID */
-#define HEADER_EVENT_ID (~(uint64_t)0) /* avoids conflicting with TraceEventIDs */
+#define HEADER_EVENT_ID (~(uint64_t)0) /* avoids conflicting with event IDs */
 
 /** Trace file magic number */
 #define HEADER_MAGIC 0xf2b177cb0aa429b4ULL
@@ -58,7 +58,7 @@ static char *trace_file_name;
 
 /* * Trace buffer entry */
 typedef struct {
-    uint64_t event; /*   TraceEventID */
+    uint64_t event; /*  event ID */
     uint64_t timestamp_ns;
     uint32_t length;   /*    in bytes */
     uint32_t pid;
@@ -202,7 +202,7 @@ void trace_record_write_str(TraceBufferRecord *rec, const char *s, uint32_t slen
     rec->rec_off = write_to_buffer(rec->rec_off, (void*)s, slen);
 }
 
-int trace_record_start(TraceBufferRecord *rec, TraceEventID event, size_t datasize)
+int trace_record_start(TraceBufferRecord *rec, size_t event, size_t datasize)
 {
     unsigned int idx, rec_off, old_idx, new_idx;
     uint32_t rec_len = sizeof(TraceRecord) + datasize;
trace/simple.h +1 -1
index 1e7de45..862bbc7 100644
@@ -33,7 +33,7 @@ typedef struct {
  *
  * @arglen  number of bytes required for arguments
  */
-int trace_record_start(TraceBufferRecord *rec, TraceEventID id, size_t arglen);
+int trace_record_start(TraceBufferRecord *rec, size_t id, size_t arglen);
 
 /**
  * Append a 64-bit argument to a trace record
Signature · 1 line
2.7.4
#28 lore raw

PATCH 12/60 trace: use -1 instead of TRACE_VCPU_EVENT_COUNT as magic value

In reply to Daniel P. Berrange

The TraceEvent struct vcpu_id field uses the constant TRACE_VCPU_EVENT_COUNT as a magic value to indicate this is not a per-VCPU event. The max count value will be different for each event group though, so this is no longer suitable. Instead use the value (size_t)-1 which is guaranteed to be available across all event groups.

---
 scripts/tracetool/format/events_c.py | 2 +-
 trace/control-internal.h             | 2 +-
 trace/control.c                      | 2 +-
 trace/control.h                      | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)
scripts/tracetool/format/events_c.py +1 -1
index bab6404..8482736 100644
@@ -34,7 +34,7 @@ def generate(events, backend):
         if "vcpu" in e.properties:
             vcpu_id = "TRACE_VCPU_" + e.name.upper()
         else:
-            vcpu_id = "TRACE_VCPU_EVENT_COUNT"
+            vcpu_id = "(size_t)-1";
         out('    { .id = %(id)s, .vcpu_id = %(vcpu_id)s,'
             ' .name = \"%(name)s\",'
             ' .sstate = %(sstate)s },',
trace/control-internal.h +1 -1
index b7048d4..c3cad80 100644
@@ -37,7 +37,7 @@ static inline size_t trace_event_get_vcpu_id(TraceEvent *ev)
 
 static inline bool trace_event_is_vcpu(TraceEvent *ev)
 {
-    return ev->vcpu_id != TRACE_VCPU_EVENT_COUNT;
+    return ev->vcpu_id != (size_t)-1;
 }
 
 static inline const char * trace_event_get_name(TraceEvent *ev)
trace/control.c +1 -1
index 29659a1..40a4f1e 100644
@@ -74,7 +74,7 @@ void trace_event_register_group(TraceEvent *events,
 {
     size_t nvcpuevents = 0;
     for (size_t i = 0; i < nevents; i++) {
-        if (events[i].vcpu_id != TRACE_VCPU_EVENT_COUNT) {
+        if (events[i].vcpu_id != (size_t)-1) {
             nvcpuevents++;
         }
     }
trace/control.h +1 -1
index 438c3d2..242fcf3 100644
@@ -57,7 +57,7 @@ static size_t trace_event_get_id(TraceEvent *ev);
  *
  * Get the per-vCPU identifier of an event.
  *
- * Special value #TRACE_VCPU_EVENT_COUNT means the event is not vCPU-specific
+ * Special value (size_t)-1 means the event is not vCPU-specific
  * (does not have the "vcpu" property).
  */
 static size_t trace_event_get_vcpu_id(TraceEvent *ev);
Signature · 1 line
2.7.4
#29 lore raw

PATCH 13/60 trace: remove generated-events.h from many includes

In reply to Daniel P. Berrange

Now that none of the public APIs rely on the TraceEventID enum, or related constants, it is possible to simplify the includes, dropping generated-events.h from many of them.

---
 scripts/tracetool/format/events_h.py | 3 +--
 scripts/tracetool/format/h.py        | 1 +
 trace/control.h                      | 2 +-
 trace/event-internal.h               | 3 ---
 trace/simple.h                       | 4 ----
 5 files changed, 3 insertions(+), 10 deletions(-)
scripts/tracetool/format/events_h.py +1 -2
index d6465d4..a0fe0c4 100644
@@ -58,7 +58,6 @@ def generate(events, backend):
     out('extern uint16_t dstate[TRACE_EVENT_COUNT];')
     out('extern bool dstate_init[TRACE_EVENT_COUNT];')
 
-    out('#include "trace/event-internal.h"',
-        'void trace_register_events(void);',
+    out('void trace_register_events(void);',
         '',
         '#endif  /* TRACE__GENERATED_EVENTS_H */')
scripts/tracetool/format/h.py +1 -0
index 3763e9a..2b82b91 100644
@@ -24,6 +24,7 @@ def generate(events, backend):
         '',
         '#include "qemu-common.h"',
         '#include "trace/control.h"',
+        '#include "trace/generated-events.h"',
         '')
 
     backend.generate_begin(events)
trace/control.h +1 -1
index 242fcf3..8ff0a8f 100644
@@ -11,7 +11,7 @@
 #define TRACE__CONTROL_H
 
 #include "qemu-common.h"
-#include "trace/generated-events.h"
+#include "event-internal.h"
 
 typedef struct TraceEventIter {
     size_t event;
trace/event-internal.h +0 -3
index 618d1b5..3e563fc 100644
@@ -10,9 +10,6 @@
 #ifndef TRACE__EVENT_INTERNAL_H
 #define TRACE__EVENT_INTERNAL_H
 
-#include "trace/generated-events.h"
-
-
 /**
  * TraceEvent:
  * @id: Unique event identifier.
trace/simple.h +0 -4
index 862bbc7..551aaae 100644
@@ -11,10 +11,6 @@
 #ifndef TRACE_SIMPLE_H
 #define TRACE_SIMPLE_H
 
-
-#include "trace/generated-events.h"
-
-
 void st_print_trace_file_status(FILE *stream, fprintf_function stream_printf);
 void st_set_trace_file_enabled(bool enable);
 void st_set_trace_file(const char *file);
Signature · 1 line
2.7.4
#30 lore raw

PATCH 14/60 trace: get rid of generated-events.h/generated-events.c

In reply to Daniel P. Berrange

Currently the generated-events.[ch] files contain the event enums, constants and TraceEvent arrays, while the generated-tracers.[ch] files contain the actual trace probe logic. With the decoupling of the event enums from the API there is no longer any compelling reason for the separation between these files. The enums/constants will only ever be needed from the generated-tracers.[ch] files.

The enums/constants/structs from generated-events.[ch] are thus moved into the generated-tracers.[ch], so that there is one less file to be generated.

---
 Makefile                             |  3 --
 include/trace-tcg.h                  |  1 -
 include/trace.h                      |  1 -
 scripts/tracetool/format/c.py        | 41 ++++++++++++++++++++---
 scripts/tracetool/format/events_c.py | 53 ------------------------------
 scripts/tracetool/format/events_h.py | 63 ------------------------------------
 scripts/tracetool/format/h.py        | 38 +++++++++++++++++++++-
 trace/Makefile.objs                  | 28 +++-------------
 8 files changed, 77 insertions(+), 151 deletions(-)
 delete mode 100644 scripts/tracetool/format/events_c.py
 delete mode 100644 scripts/tracetool/format/events_h.py
Makefile +0 -3
index 0d7647f..48673cb 100644
@@ -56,9 +56,6 @@ GENERATED_SOURCES += qmp-marshal.c qapi-types.c qapi-visit.c qapi-event.c
 GENERATED_HEADERS += qmp-introspect.h
 GENERATED_SOURCES += qmp-introspect.c
 
-GENERATED_HEADERS += trace/generated-events.h
-GENERATED_SOURCES += trace/generated-events.c
-
 GENERATED_HEADERS += trace/generated-tracers.h
 ifeq ($(findstring dtrace,$(TRACE_BACKENDS)),dtrace)
 GENERATED_HEADERS += trace/generated-tracers-dtrace.h
include/trace-tcg.h +0 -1
index edab4b1..da68608 100644
@@ -2,6 +2,5 @@
 #define TRACE_TCG_H
 
 #include "trace/generated-tcg-tracers.h"
-#include "trace/generated-events.h"
 
 #endif /* TRACE_TCG_H */
include/trace.h +0 -1
index 9a01e44..ac9ff3d 100644
@@ -2,6 +2,5 @@
 #define TRACE_H
 
 #include "trace/generated-tracers.h"
-#include "trace/generated-events.h"
 
 #endif /* TRACE_H */
scripts/tracetool/format/c.py +36 -5

48 lines not on this page · raw message

scripts/tracetool/format/events_c.py deleted +0 -53

53 lines not on this page · raw message

scripts/tracetool/format/events_h.py deleted +0 -63

63 lines not on this page · raw message

scripts/tracetool/format/h.py +37 -1
index 2b82b91..4b53ee2 100644
@@ -24,9 +24,45 @@ def generate(events, backend):
         '',
         '#include "qemu-common.h"',
         '#include "trace/control.h"',
-        '#include "trace/generated-events.h"',
         '')
 
+    # event identifiers
+    out('typedef enum {')
+
+    for e in events:
+        out('    TRACE_%s,' % e.name.upper())
+
+    out('    TRACE_EVENT_COUNT',
+        '} TraceEventID;')
+
+    # per-vCPU event identifiers
+    out('typedef enum {')
+
+    for e in events:
+        if "vcpu" in e.properties:
+            out('    TRACE_VCPU_%s,' % e.name.upper())
+
+    out('    TRACE_VCPU_EVENT_COUNT',
+        '} TraceEventVCPUID;')
+
+    # static state
+    for e in events:
+        if 'disable' in e.properties:
+            enabled = 0
+        else:
+            enabled = 1
+        if "tcg-exec" in e.properties:
+            # a single define for the two "sub-events"
+            out('#define TRACE_%(name)s_ENABLED %(enabled)d',
+                name=e.original.name.upper(),
+                enabled=enabled)
+        out('#define TRACE_%s_ENABLED %d' % (e.name.upper(), enabled))
+
+    out('extern uint16_t dstate[TRACE_EVENT_COUNT];')
+    out('extern bool dstate_init[TRACE_EVENT_COUNT];')
+
+    out('void trace_register_events(void);')
+
     backend.generate_begin(events)
 
     for e in events:
trace/Makefile.objs +4 -24
index 4d91b3b..83f754e 100644
@@ -32,32 +32,11 @@ $(obj)/generated-ust.c-timestamp: $(BUILD_DIR)/trace-events-all $(tracetool-y)
 		--backends=$(TRACE_BACKENDS) \
 		< $< > $@,"  GEN   $(patsubst %-timestamp,%,$@)")
 
-$(obj)/generated-events.h: $(obj)/generated-ust-provider.h
-$(obj)/generated-events.c: $(obj)/generated-ust.c
+$(obj)/generated-tracers.h: $(obj)/generated-ust-provider.h
+$(obj)/generated-tracers.c: $(obj)/generated-ust.c
 
 endif
 
-######################################################################
-# Auto-generated event descriptions
-
-$(obj)/generated-events.h: $(obj)/generated-events.h-timestamp
-	@cmp $< $@ >/dev/null 2>&1 || cp $< $@
-$(obj)/generated-events.h-timestamp: $(BUILD_DIR)/trace-events-all $(tracetool-y)
-	$(call quiet-command,$(TRACETOOL) \
-		--format=events-h \
-		--backends=$(TRACE_BACKENDS) \
-		< $< > $@,"  GEN   $(patsubst %-timestamp,%,$@)")
-
-$(obj)/generated-events.c: $(obj)/generated-events.c-timestamp $(BUILD_DIR)/config-host.mak
-	@cmp $< $@ >/dev/null 2>&1 || cp $< $@
-$(obj)/generated-events.c-timestamp: $(BUILD_DIR)/trace-events-all $(tracetool-y)
-	$(call quiet-command,$(TRACETOOL) \
-		--format=events-c \
-		--backends=$(TRACE_BACKENDS) \
-		< $< > $@,"  GEN   $(patsubst %-timestamp,%,$@)")
-
-util-obj-y += generated-events.o
-
 
 ######################################################################
 # Auto-generated tracing routines
@@ -154,7 +133,8 @@ $(obj)/generated-tcg-tracers.h-timestamp: $(BUILD_DIR)/trace-events-all $(BUILD_
 ######################################################################
 # Backend code
 
-util-obj-$(CONFIG_TRACE_SIMPLE) += simple.o generated-tracers.o
+util-obj-y += generated-tracers.o
+util-obj-$(CONFIG_TRACE_SIMPLE) += simple.o
 util-obj-$(CONFIG_TRACE_FTRACE) += ftrace.o
 util-obj-$(CONFIG_TRACE_UST) += generated-ust.o
 util-obj-y += control.o
Signature · 1 line
2.7.4
#31 lore raw

PATCH 15/60 trace: introduce a formal group name for trace events

In reply to Daniel P. Berrange

The declarations in the generated-tracers.h file are assuming there's only ever going to be one instance of this header, as they are not namespaced. When we have one header per event group, if a single source file needs to include multiple sets of trace events, the symbols will all clash.

This change thus introduces a '--group NAME' arg to the 'tracetool' program. This will cause all the symbols in the generated header files to be given a unique namespace.

If no group is given, the group name 'common' is used, which is suitable for the current usage where there is only one global trace-events file used for code generation.

---
 hw/usb/hcd-ohci.c                                |  6 +++--
 scripts/tracetool.py                             | 10 ++++++--
 scripts/tracetool/__init__.py                    | 10 ++++++--
 scripts/tracetool/backend/__init__.py            | 12 ++++-----
 scripts/tracetool/backend/dtrace.py              |  4 +--
 scripts/tracetool/backend/ftrace.py              |  7 +++---
 scripts/tracetool/backend/log.py                 |  6 ++---
 scripts/tracetool/backend/simple.py              | 10 ++++----
 scripts/tracetool/backend/ust.py                 |  4 +--
 scripts/tracetool/format/__init__.py             |  4 +--
 scripts/tracetool/format/c.py                    | 23 +++++++++--------
 scripts/tracetool/format/d.py                    |  2 +-
 scripts/tracetool/format/h.py                    | 32 ++++++++++++------------
 scripts/tracetool/format/simpletrace_stap.py     |  2 +-
 scripts/tracetool/format/stap.py                 |  2 +-
 scripts/tracetool/format/tcg_h.py                |  2 +-
 scripts/tracetool/format/tcg_helper_c.py         |  2 +-
 scripts/tracetool/format/tcg_helper_h.py         |  2 +-
 scripts/tracetool/format/tcg_helper_wrapper_h.py |  2 +-
 scripts/tracetool/format/ust_events_c.py         |  2 +-
 scripts/tracetool/format/ust_events_h.py         |  8 +++---
 21 files changed, 85 insertions(+), 67 deletions(-)
hw/usb/hcd-ohci.c +4 -2
index 87508a7..43b5181 100644
@@ -937,8 +937,10 @@ static int ohci_service_iso_td(OHCIState *ohci, struct ohci_ed *ed,
 #ifdef trace_event_get_state
 static void ohci_td_pkt(const char *msg, const uint8_t *buf, size_t len)
 {
-    bool print16 = !!trace_event_get_state(dstate, TRACE_USB_OHCI_TD_PKT_SHORT);
-    bool printall = !!trace_event_get_state(dstate, TRACE_USB_OHCI_TD_PKT_FULL);
+    bool print16 = !!trace_event_get_state(common_dstate,
+                                           TRACE_USB_OHCI_TD_PKT_SHORT);
+    bool printall = !!trace_event_get_state(common_dstate,
+                                            TRACE_USB_OHCI_TD_PKT_FULL);
     const int width = 16;
     int i;
     char tmp[3 * width + 1];
scripts/tracetool.py +8 -2
index 7b82959..1ce8799 100755
@@ -44,6 +44,7 @@ Options:
     --help                   This help message.
     --list-backends          Print list of available backends.
     --check-backends         Check if the given backend is valid.
+    --group <name>           Name of the event group
     --binary <path>          Full path to QEMU binary.
     --target-type <type>     QEMU emulator target type ('system' or 'user').
     --target-name <name>     QEMU emulator target name.
@@ -67,7 +68,8 @@ def main(args):
 
     long_opts = ["backends=", "format=", "help", "list-backends",
                  "check-backends"]
-    long_opts += ["binary=", "target-type=", "target-name=", "probe-prefix="]
+    long_opts += ["binary=", "target-type=", "target-name=", "probe-prefix=",
+                  "group="]
 
     try:
         opts, args = getopt.getopt(args[1:], "", long_opts)
@@ -81,6 +83,7 @@ def main(args):
     target_type = None
     target_name = None
     probe_prefix = None
+    group = None
     for opt, arg in opts:
         if opt == "--help":
             error_opt()
@@ -105,6 +108,8 @@ def main(args):
             target_name = arg
         elif opt == '--probe-prefix':
             probe_prefix = arg
+        elif opt == '--group':
+            group = arg
 
         else:
             error_opt("unhandled option: %s" % opt)
@@ -131,7 +136,8 @@ def main(args):
 
     try:
         tracetool.generate(sys.stdin, arg_format, arg_backends,
-                           binary=binary, probe_prefix=probe_prefix)
+                           binary=binary, probe_prefix=probe_prefix,
+                           group=group)
     except tracetool.TracetoolError as e:
         error_opt(str(e))
 
scripts/tracetool/__init__.py +8 -2
index be24039..aebabaf 100644
@@ -353,7 +353,8 @@ def try_import(mod_name, attr_name=None, attr_default=None):
 
 
 def generate(fevents, format, backends,
-             binary=None, probe_prefix=None):
+             binary=None, probe_prefix=None,
+             group=None):
     """Generate the output for the given (format, backends) pair.
 
     Parameters
@@ -368,6 +369,8 @@ def generate(fevents, format, backends,
         See tracetool.backend.dtrace.BINARY.
     probe_prefix : str or None
         See tracetool.backend.dtrace.PROBEPREFIX.
+    group: str
+        Name of the tracing group
     """
     # fix strange python error (UnboundLocalError tracetool)
     import tracetool
@@ -378,6 +381,9 @@ def generate(fevents, format, backends,
     if not tracetool.format.exists(format):
         raise TracetoolError("unknown format: %s" % format)
 
+    if group is None:
+        group = "common"
+
     if len(backends) is 0:
         raise TracetoolError("no backends specified")
     for backend in backends:
@@ -391,4 +397,4 @@ def generate(fevents, format, backends,
 
     events = _read_events(fevents)
 
-    tracetool.format.generate(events, format, backend)
+    tracetool.format.generate(events, format, backend, group)
scripts/tracetool/backend/__init__.py +6 -6
index d4b6dab..f735a25 100644
@@ -113,11 +113,11 @@ class Wrapper:
             if func is not None:
                 func(*args, **kwargs)
 
-    def generate_begin(self, events):
-        self._run_function("generate_%s_begin", events)
+    def generate_begin(self, events, group):
+        self._run_function("generate_%s_begin", events, group)
 
-    def generate(self, event):
-        self._run_function("generate_%s", event)
+    def generate(self, event, group):
+        self._run_function("generate_%s", event, group)
 
-    def generate_end(self, events):
-        self._run_function("generate_%s_end", events)
+    def generate_end(self, events, group):
+        self._run_function("generate_%s_end", events, group)
scripts/tracetool/backend/dtrace.py +2 -2
index ab9ecfa..79505c6 100644
@@ -35,12 +35,12 @@ def binary():
     return BINARY
 
 
-def generate_h_begin(events):
+def generate_h_begin(events, group):
     out('#include "trace/generated-tracers-dtrace.h"',
         '')
 
 
-def generate_h(event):
+def generate_h(event, group):
     out('        QEMU_%(uppername)s(%(argnames)s);',
         uppername=event.name.upper(),
         argnames=", ".join(event.args.names()))
scripts/tracetool/backend/ftrace.py +4 -3
index 80dcf30..9bda5f9 100644
@@ -19,13 +19,13 @@ from tracetool import out
 PUBLIC = True
 
 
-def generate_h_begin(events):
+def generate_h_begin(events, group):
     out('#include "trace/ftrace.h"',
         '#include "trace/control.h"',
         '')
 
 
-def generate_h(event):
+def generate_h(event, group):
     argnames = ", ".join(event.args.names())
     if len(event.args) > 0:
         argnames = ", " + argnames
@@ -34,13 +34,14 @@ def generate_h(event):
         '            char ftrace_buf[MAX_TRACE_STRLEN];',
         '            int unused __attribute__ ((unused));',
         '            int trlen;',
-        '            if (trace_event_get_state(%(event_id)s)) {',
+        '            if (trace_event_get_state(%(group)s_dstate, %(event_id)s)) {',
         '                trlen = snprintf(ftrace_buf, MAX_TRACE_STRLEN,',
         '                                 "%(name)s " %(fmt)s "\\n" %(argnames)s);',
         '                trlen = MIN(trlen, MAX_TRACE_STRLEN - 1);',
         '                unused = write(trace_marker_fd, ftrace_buf, trlen);',
         '            }',
         '        }',
+        group=group.lower(),
         name=event.name,
         args=event.args,
         event_id="TRACE_" + event.name.upper(),
scripts/tracetool/backend/log.py +3 -3
index b3ff064..8438b83 100644
@@ -19,13 +19,13 @@ from tracetool import out
 PUBLIC = True
 
 
-def generate_h_begin(events):
+def generate_h_begin(events, group):
     out('#include "trace/control.h"',
         '#include "qemu/log.h"',
         '')
 
 
-def generate_h(event):
+def generate_h(event, group):
     argnames = ", ".join(event.args.names())
     if len(event.args) > 0:
         argnames = ", " + argnames
@@ -34,7 +34,7 @@ def generate_h(event):
         # already checked on the generic format code
         cond = "true"
     else:
-        cond = "trace_event_get_state(%s)" % ("TRACE_" + event.name.upper())
+        cond = "trace_event_get_state(%s_dstate, %s)" % (group.lower(), "TRACE_" + event.name.upper())
 
     out('        if (%(cond)s) {',
         '            struct timeval _now;',
scripts/tracetool/backend/simple.py +5 -5
index c2a8468..8c27b68 100644
@@ -27,7 +27,7 @@ def is_string(arg):
         return False
 
 
-def generate_h_begin(events):
+def generate_h_begin(events, group):
     for event in events:
         out('void _simple_%(api)s(%(args)s);',
             api=event.api(),
@@ -35,13 +35,13 @@ def generate_h_begin(events):
     out('')
 
 
-def generate_h(event):
+def generate_h(event, group):
     out('        _simple_%(api)s(%(args)s);',
         api=event.api(),
         args=", ".join(event.args.names()))
 
 
-def generate_c_begin(events):
+def generate_c_begin(events, group):
     out('#include "qemu/osdep.h"',
         '#include "trace.h"',
         '#include "trace/control.h"',
@@ -49,7 +49,7 @@ def generate_c_begin(events):
         '')
 
 
-def generate_c(event):
+def generate_c(event, group):
     out('void _simple_%(api)s(%(args)s)',
         '{',
         '    TraceBufferRecord rec;',
@@ -73,7 +73,7 @@ def generate_c(event):
         # already checked on the generic format code
         cond = "true"
     else:
-        cond = "trace_event_get_state(dstate, %s)" % event_id
+        cond = "trace_event_get_state(%s_dstate, %s)" % (group.lower(), event_id)
 
     out('',
         '    if (!%(cond)s) {',
scripts/tracetool/backend/ust.py +2 -2
index ed4c227..4594db6 100644
@@ -19,13 +19,13 @@ from tracetool import out
 PUBLIC = True
 
 
-def generate_h_begin(events):
+def generate_h_begin(events, group):
     out('#include <lttng/tracepoint.h>',
         '#include "trace/generated-ust-provider.h"',
         '')
 
 
-def generate_h(event):
+def generate_h(event, group):
     argnames = ", ".join(event.args.names())
     if len(event.args) > 0:
         argnames = ", " + argnames
scripts/tracetool/format/__init__.py +2 -2
index 812570f..cf6e0e2 100644
@@ -74,7 +74,7 @@ def exists(name):
     return tracetool.try_import("tracetool.format." + name)[1]
 
 
-def generate(events, format, backend):
+def generate(events, format, backend, group):
     if not exists(format):
         raise ValueError("unknown format: %s" % format)
     format = format.replace("-", "_")
@@ -82,4 +82,4 @@ def generate(events, format, backend):
                                 "generate")[1]
     if func is None:
         raise AttributeError("format has no 'generate': %s" % format)
-    func(events, backend)
+    func(events, backend, group)
scripts/tracetool/format/c.py +13 -10
index d496109..d98785d 100644
@@ -16,7 +16,7 @@ __email__      = "[email protected]"
 from tracetool import out
 
 
-def generate(events, backend):
+def generate(events, backend, group):
     active_events = [e for e in events
                      if "disable" not in e.properties]
 
@@ -26,10 +26,10 @@ def generate(events, backend):
         '#include "trace.h"',
         '')
 
-    out('uint16_t dstate[TRACE_EVENT_COUNT];')
-    out('bool dstate_init[TRACE_EVENT_COUNT];')
+    out('uint16_t %s_dstate[TRACE_%s_EVENT_COUNT];' % (group.lower(), group.upper()))
+    out('bool %s_dstate_init[TRACE_%s_EVENT_COUNT];' % (group.lower(), group.upper()))
 
-    out('static TraceEvent trace_events[TRACE_EVENT_COUNT] = {')
+    out('static TraceEvent %s_trace_events[TRACE_%s_EVENT_COUNT] = {' % (group.lower(), group.upper()))
 
     for e in events:
         if "vcpu" in e.properties:
@@ -47,13 +47,16 @@ def generate(events, backend):
     out('};',
         '')
 
-    out('void trace_register_events(void)',
+    out('void trace_%s_register_events(void)' % group.lower(),
         '{',
-        '    trace_event_register_group(trace_events, TRACE_EVENT_COUNT, dstate, dstate_init);',
+        '    trace_event_register_group(%s_trace_events,' % group.lower(),
+        '                               TRACE_%s_EVENT_COUNT,' % group.upper(),
+        '                               %s_dstate,' % group.lower(),
+        '                               %s_dstate_init);' % group.lower(),
         '}',
-        'trace_init(trace_register_events)')
+        'trace_init(trace_%s_register_events)' % group.lower())
 
-    backend.generate_begin(active_events)
+    backend.generate_begin(active_events, group)
     for event in active_events:
-        backend.generate(event)
-    backend.generate_end(active_events)
+        backend.generate(event, group)
+    backend.generate_end(active_events, group)
scripts/tracetool/format/d.py +1 -1
index c77d5b7..78397c2 100644
@@ -29,7 +29,7 @@ RESERVED_WORDS = (
 )
 
 
-def generate(events, backend):
+def generate(events, backend, group):
     events = [e for e in events
               if "disable" not in e.properties]
 
scripts/tracetool/format/h.py +16 -16
index 4b53ee2..25ffe2b 100644
@@ -16,34 +16,34 @@ __email__      = "[email protected]"
 from tracetool import out
 
 
-def generate(events, backend):
+def generate(events, backend, group):
     out('/* This file is autogenerated by tracetool, do not edit. */',
         '',
-        '#ifndef TRACE__GENERATED_TRACERS_H',
-        '#define TRACE__GENERATED_TRACERS_H',
+        '#ifndef TRACE_%s_GENERATED_TRACERS_H' % group.upper(),
+        '#define TRACE_%s_GENERATED_TRACERS_H' % group.upper(),
         '',
         '#include "qemu-common.h"',
         '#include "trace/control.h"',
         '')
 
     # event identifiers
-    out('typedef enum {')
+    out('enum {')
 
     for e in events:
         out('    TRACE_%s,' % e.name.upper())
 
-    out('    TRACE_EVENT_COUNT',
-        '} TraceEventID;')
+    out('    TRACE_%s_EVENT_COUNT' % group.upper(),
+        '};')
 
     # per-vCPU event identifiers
-    out('typedef enum {')
+    out('enum {')
 
     for e in events:
         if "vcpu" in e.properties:
             out('    TRACE_VCPU_%s,' % e.name.upper())
 
-    out('    TRACE_VCPU_EVENT_COUNT',
-        '} TraceEventVCPUID;')
+    out('    TRACE_%s_VCPU_EVENT_COUNT' % group.upper(),
+        '};')
 
     # static state
     for e in events:
@@ -58,12 +58,12 @@ def generate(events, backend):
                 enabled=enabled)
         out('#define TRACE_%s_ENABLED %d' % (e.name.upper(), enabled))
 
-    out('extern uint16_t dstate[TRACE_EVENT_COUNT];')
-    out('extern bool dstate_init[TRACE_EVENT_COUNT];')
+    out('extern uint16_t %s_dstate[TRACE_%s_EVENT_COUNT];' % (group.lower(), group.upper()))
+    out('extern bool %s_dstate_init[TRACE_%s_EVENT_COUNT];' % (group.lower(), group.upper()))
 
-    out('void trace_register_events(void);')
+    out('void trace_%s_register_events(void);' % group.lower())
 
-    backend.generate_begin(events)
+    backend.generate_begin(events, group)
 
     for e in events:
         if "vcpu" in e.properties:
@@ -86,11 +86,11 @@ def generate(events, backend):
             cond=cond)
 
         if "disable" not in e.properties:
-            backend.generate(e)
+            backend.generate(e, group)
 
         out('    }',
             '}')
 
-    backend.generate_end(events)
+    backend.generate_end(events, group)
 
-    out('#endif /* TRACE__GENERATED_TRACERS_H */')
+    out('#endif /* TRACE_%s_GENERATED_TRACERS_H */' % group.upper())
scripts/tracetool/format/simpletrace_stap.py +1 -1
index 7e44bc1..c8b3850 100644
@@ -19,7 +19,7 @@ from tracetool.backend.simple import is_string
 from tracetool.format.stap import stap_escape
 
 
-def generate(events, backend):
+def generate(events, backend, group):
     out('/* This file is autogenerated by tracetool, do not edit. */',
         '')
 
scripts/tracetool/format/stap.py +1 -1
index 9e780f1..e8ef3e7 100644
@@ -34,7 +34,7 @@ def stap_escape(identifier):
     return identifier
 
 
-def generate(events, backend):
+def generate(events, backend, group):
     events = [e for e in events
               if "disable" not in e.properties]
 
scripts/tracetool/format/tcg_h.py +1 -1
index e2331f2..628388a 100644
@@ -27,7 +27,7 @@ def vcpu_transform_args(args):
     ])
 
 
-def generate(events, backend):
+def generate(events, backend, group):
     out('/* This file is autogenerated by tracetool, do not edit. */',
         '/* You must include this file after the inclusion of helper.h */',
         '',
scripts/tracetool/format/tcg_helper_c.py +1 -1
index e3485b7..cc26e03 100644
@@ -40,7 +40,7 @@ def vcpu_transform_args(args, mode):
             assert False
 
 
-def generate(events, backend):
+def generate(events, backend, group):
     events = [e for e in events
               if "disable" not in e.properties]
 
scripts/tracetool/format/tcg_helper_h.py +1 -1
index dc76c15..6b184b6 100644
@@ -18,7 +18,7 @@ from tracetool.transform import *
 import tracetool.vcpu
 
 
-def generate(events, backend):
+def generate(events, backend, group):
     events = [e for e in events
               if "disable" not in e.properties]
 
scripts/tracetool/format/tcg_helper_wrapper_h.py +1 -1
index 020f442..ff53447 100644
@@ -18,7 +18,7 @@ from tracetool.transform import *
 import tracetool.vcpu
 
 
-def generate(events, backend):
+def generate(events, backend, group):
     events = [e for e in events
               if "disable" not in e.properties]
 
scripts/tracetool/format/ust_events_c.py +1 -1
index 9967c7a..cd87d8a 100644
@@ -16,7 +16,7 @@ __email__      = "[email protected]"
 from tracetool import out
 
 
-def generate(events, backend):
+def generate(events, backend, group):
     events = [e for e in events
               if "disabled" not in e.properties]
 
scripts/tracetool/format/ust_events_h.py +4 -4
index 3e8a7cd..00b69d9 100644
@@ -16,7 +16,7 @@ __email__      = "[email protected]"
 from tracetool import out
 
 
-def generate(events, backend):
+def generate(events, backend, group):
     events = [e for e in events
               if "disabled" not in e.properties]
 
@@ -28,8 +28,8 @@ def generate(events, backend):
         '#undef TRACEPOINT_INCLUDE_FILE',
         '#define TRACEPOINT_INCLUDE_FILE ./generated-ust-provider.h',
         '',
-        '#if !defined (TRACE__GENERATED_UST_H) || defined(TRACEPOINT_HEADER_MULTI_READ)',
-        '#define TRACE__GENERATED_UST_H',
+        '#if !defined (TRACE_%s_GENERATED_UST_H) || defined(TRACEPOINT_HEADER_MULTI_READ)' % group.upper(),
+        '#define TRACE_%s_GENERATED_UST_H' % group.upper(),
         '',
         '#include "qemu-common.h"',
         '#include <lttng/tracepoint.h>',
@@ -94,7 +94,7 @@ def generate(events, backend):
                 '',
                 name=e.name)
 
-    out('#endif /* TRACE__GENERATED_UST_H */',
+    out('#endif /* TRACE_%s_GENERATED_UST_H */' % group.upper(),
         '',
         '/* This part must be outside ifdef protection */',
         '#include <lttng/tracepoint-event.h>')
Signature · 1 line
2.7.4
#33 lore raw

PATCH 17/60 trace: introduce some Makefile rules for module code gen

In reply to Daniel P. Berrange

Introduce rules that are able to generate trace.[ch] files in every subdirectory which has a trace-events file.

---
 .gitignore                               |  6 +++
 Makefile                                 | 69 +++++++++++++++++++++++++++-----
 Makefile.objs                            |  5 +++
 Makefile.target                          |  7 +++-
 scripts/tracetool/backend/dtrace.py      |  7 +++-
 scripts/tracetool/backend/ust.py         |  7 +++-
 scripts/tracetool/format/ust_events_c.py |  2 +-
 scripts/tracetool/format/ust_events_h.py |  7 +++-
 trace/Makefile.objs                      | 23 ++++++++---
 9 files changed, 112 insertions(+), 21 deletions(-)
.gitignore +6 -0
index 88ec249..7249070 100644
@@ -115,3 +115,9 @@ tags
 TAGS
 docker-src.*
 *~
+trace.h
+trace.c
+trace-events-common
+trace-ust.h
+trace-dtrace.h
+trace-dtrace.dtrace
Makefile +60 -9

113 lines not on this page · raw message

Makefile.objs +5 -0
index b371ebb..ede6dd3 100644
@@ -118,6 +118,7 @@ ivshmem-server-obj-y = contrib/ivshmem-server/
 
 
 ######################################################################
+trace-events-subdirs =
 trace-events-y = trace-events
 trace-events-y += util/trace-events
 trace-events-y += crypto/trace-events
@@ -160,3 +161,7 @@ trace-events-y += target-s390x/trace-events
 trace-events-y += target-ppc/trace-events
 trace-events-y += qom/trace-events
 trace-events-y += linux-user/trace-events
+
+trace-events-files = trace-events $(trace-events-subdirs:%=%/trace-events)
+
+trace-obj-y = $(trace-events-subdirs:%=%/)
Makefile.target +5 -2
index a440bcb..46b5ccf 100644
@@ -180,7 +180,8 @@ dummy := $(call unnest-vars,.., \
                qom-obj-y \
                io-obj-y \
                common-obj-y \
-               common-obj-m)
+               common-obj-m \
+               trace-obj-y)
 target-obj-y := $(target-obj-y-save)
 all-obj-y += $(common-obj-y)
 all-obj-y += $(target-obj-y)
@@ -192,8 +193,10 @@ all-obj-$(CONFIG_SOFTMMU) += $(io-obj-y)
 
 $(QEMU_PROG_BUILD): config-devices.mak
 
+COMMON_LDADDS = $(trace-obj-y) ../libqemuutil.a ../libqemustub.a
+
 # build either PROG or PROGW
-$(QEMU_PROG_BUILD): $(all-obj-y) ../libqemuutil.a ../libqemustub.a
+$(QEMU_PROG_BUILD): $(all-obj-y) $(COMMON_LDADDS)
 	$(call LINK, $(filter-out %.mak, $^))
 ifdef CONFIG_DARWIN
 	$(call quiet-command,Rez -append $(SRC_PATH)/pc-bios/qemu.rsrc -o $@,"  REZ   $(TARGET_DIR)$@")
scripts/tracetool/backend/dtrace.py +6 -1
index 79505c6..1319990 100644
@@ -36,7 +36,12 @@ def binary():
 
 
 def generate_h_begin(events, group):
-    out('#include "trace/generated-tracers-dtrace.h"',
+    if group == "common":
+        include = "trace/generated-tracers-dtrace.h"
+    else:
+        include = "trace-dtrace.h"
+
+    out('#include "%s"' % include,
         '')
 
 
scripts/tracetool/backend/ust.py +6 -1
index 4594db6..599c12e 100644
@@ -20,8 +20,13 @@ PUBLIC = True
 
 
 def generate_h_begin(events, group):
+    if group == "common":
+        include = "trace/generated-ust-provider.h"
+    else:
+        include = "trace-ust.h"
+
     out('#include <lttng/tracepoint.h>',
-        '#include "trace/generated-ust-provider.h"',
+        '#include "%s"' % include,
         '')
 
 
scripts/tracetool/format/ust_events_c.py +1 -1
index cd87d8a..8be8116 100644
@@ -32,4 +32,4 @@ def generate(events, backend, group):
         ' */',
         '#pragma GCC diagnostic ignored "-Wredundant-decls"',
         '',
-        '#include "generated-ust-provider.h"')
+        '#include "generated-ust-provider-all.h"')
scripts/tracetool/format/ust_events_h.py +6 -1
index 00b69d9..f4258e5 100644
@@ -20,13 +20,18 @@ def generate(events, backend, group):
     events = [e for e in events
               if "disabled" not in e.properties]
 
+    if group == "common":
+        include = "generated-ust-provider.h"
+    else:
+        include = "trace-ust.h"
+
     out('/* This file is autogenerated by tracetool, do not edit. */',
         '',
         '#undef TRACEPOINT_PROVIDER',
         '#define TRACEPOINT_PROVIDER qemu',
         '',
         '#undef TRACEPOINT_INCLUDE_FILE',
-        '#define TRACEPOINT_INCLUDE_FILE ./generated-ust-provider.h',
+        '#define TRACEPOINT_INCLUDE_FILE ./%s' % include,
         '',
         '#if !defined (TRACE_%s_GENERATED_UST_H) || defined(TRACEPOINT_HEADER_MULTI_READ)' % group.upper(),
         '#define TRACE_%s_GENERATED_UST_H' % group.upper(),
trace/Makefile.objs +17 -6
index 83f754e..00ebe3a 100644
@@ -8,7 +8,10 @@
 tracetool-y = $(SRC_PATH)/scripts/tracetool.py
 tracetool-y += $(shell find $(SRC_PATH)/scripts/tracetool -name "*.py")
 
-$(BUILD_DIR)/trace-events-all: $(trace-events-y:%=$(SRC_PATH)/%)
+$(BUILD_DIR)/trace-events-all: $(trace-events-files:%=$(SRC_PATH)/%)
+	$(call quiet-command,cat $^ > $@)
+
+$(BUILD_DIR)/trace-events-common: $(trace-events-y:%=$(SRC_PATH)/%)
 	$(call quiet-command,cat $^ > $@)
 
 ######################################################################
@@ -18,7 +21,15 @@ ifeq ($(findstring ust,$(TRACE_BACKENDS)),ust)
 
 $(obj)/generated-ust-provider.h: $(obj)/generated-ust-provider.h-timestamp
 	@cmp $< $@ >/dev/null 2>&1 || cp $< $@
-$(obj)/generated-ust-provider.h-timestamp: $(BUILD_DIR)/trace-events-all $(tracetool-y)
+$(obj)/generated-ust-provider.h-timestamp: $(BUILD_DIR)/trace-events-common $(tracetool-y)
+	$(call quiet-command,$(TRACETOOL) \
+		--format=ust-events-h \
+		--backends=$(TRACE_BACKENDS) \
+		< $< > $@,"  GEN   $(patsubst %-timestamp,%,$@)")
+
+$(obj)/generated-ust-provider-all.h: $(obj)/generated-ust-provider-all.h-timestamp
+	@cmp $< $@ >/dev/null 2>&1 || cp $< $@
+$(obj)/generated-ust-provider-all.h-timestamp: $(BUILD_DIR)/trace-events-all $(tracetool-y)
 	$(call quiet-command,$(TRACETOOL) \
 		--format=ust-events-h \
 		--backends=$(TRACE_BACKENDS) \
@@ -32,7 +43,7 @@ $(obj)/generated-ust.c-timestamp: $(BUILD_DIR)/trace-events-all $(tracetool-y)
 		--backends=$(TRACE_BACKENDS) \
 		< $< > $@,"  GEN   $(patsubst %-timestamp,%,$@)")
 
-$(obj)/generated-tracers.h: $(obj)/generated-ust-provider.h
+$(obj)/generated-tracers.h: $(obj)/generated-ust-provider.h $(obj)/generated-ust-provider-all.h
 $(obj)/generated-tracers.c: $(obj)/generated-ust.c
 
 endif
@@ -46,7 +57,7 @@ endif
 
 $(obj)/generated-tracers.h: $(obj)/generated-tracers.h-timestamp
 	@cmp -s $< $@ || cp $< $@
-$(obj)/generated-tracers.h-timestamp: $(BUILD_DIR)/trace-events-all $(BUILD_DIR)/config-host.mak $(tracetool-y)
+$(obj)/generated-tracers.h-timestamp: $(BUILD_DIR)/trace-events-common $(BUILD_DIR)/config-host.mak $(tracetool-y)
 	$(call quiet-command,$(TRACETOOL) \
 		--format=h \
 		--backends=$(TRACE_BACKENDS) \
@@ -57,7 +68,7 @@ $(obj)/generated-tracers.h-timestamp: $(BUILD_DIR)/trace-events-all $(BUILD_DIR)
 
 $(obj)/generated-tracers.c: $(obj)/generated-tracers.c-timestamp
 	@cmp -s $< $@ || cp $< $@
-$(obj)/generated-tracers.c-timestamp: $(BUILD_DIR)/trace-events-all $(BUILD_DIR)/config-host.mak $(tracetool-y)
+$(obj)/generated-tracers.c-timestamp: $(BUILD_DIR)/trace-events-common $(BUILD_DIR)/config-host.mak $(tracetool-y)
 	$(call quiet-command,$(TRACETOOL) \
 		--format=c \
 		--backends=$(TRACE_BACKENDS) \
@@ -75,7 +86,7 @@ ifeq ($(findstring dtrace,$(TRACE_BACKENDS)),dtrace)
 
 $(obj)/generated-tracers-dtrace.dtrace: $(obj)/generated-tracers-dtrace.dtrace-timestamp
 	@cmp $< $@ >/dev/null 2>&1 || cp $< $@
-$(obj)/generated-tracers-dtrace.dtrace-timestamp: $(BUILD_DIR)/trace-events-all $(BUILD_DIR)/config-host.mak $(tracetool-y)
+$(obj)/generated-tracers-dtrace.dtrace-timestamp: $(BUILD_DIR)/trace-events-common $(BUILD_DIR)/config-host.mak $(tracetool-y)
 	$(call quiet-command,$(TRACETOOL) \
 		--format=d \
 		--backends=$(TRACE_BACKENDS) \
Signature · 1 line
2.7.4
#37 lore raw

PATCH 19/60 trace: switch util/ directory to modular trace.h file

In reply to Daniel P. Berrange

Switch files in the util/ directory to include the util/trace.h file instead of the global trace.h file.

---
 Makefile.objs              | 2 +-
 util/Makefile.objs         | 2 ++
 util/buffer.c              | 2 +-
 util/hbitmap.c             | 2 +-
 util/oslib-posix.c         | 2 +-
 util/oslib-win32.c         | 2 +-
 util/qemu-coroutine-lock.c | 2 +-
 util/qemu-coroutine.c      | 2 +-
 8 files changed, 9 insertions(+), 7 deletions(-)
Makefile.objs +1 -1
index 9243d5b..53b2785 100644
@@ -120,7 +120,7 @@ ivshmem-server-obj-y = contrib/ivshmem-server/
 ######################################################################
 trace-events-subdirs =
 trace-events-y = trace-events
-trace-events-y += util/trace-events
+trace-events-subdirs += util
 trace-events-y += crypto/trace-events
 trace-events-subdirs += io
 trace-events-y += migration/trace-events
util/Makefile.objs +2 -0
index 96cb1e0..824e769 100644
@@ -35,3 +35,5 @@ util-obj-y += log.o
 util-obj-y += qdist.o
 util-obj-y += qht.o
 util-obj-y += range.o
+trace-obj-y += trace.o
+trace-obj-$(CONFIG_TRACE_DTRACE) += trace-dtrace.o
util/buffer.c +1 -1
index d8bb874..f59aef9 100644
@@ -21,7 +21,7 @@
 #include "qemu/osdep.h"
 #include "qemu/host-utils.h"
 #include "qemu/buffer.h"
-#include "trace.h"
+#include "util/trace.h"
 
 #define BUFFER_MIN_INIT_SIZE     4096
 #define BUFFER_MIN_SHRINK_SIZE  65536
util/hbitmap.c +1 -1
index 99fd2ba..4c94a01 100644
@@ -12,7 +12,7 @@
 #include "qemu/osdep.h"
 #include "qemu/hbitmap.h"
 #include "qemu/host-utils.h"
-#include "trace.h"
+#include "util/trace.h"
 
 /* HBitmaps provides an array of bits.  The bits are stored as usual in an
  * array of unsigned longs, but HBitmap is also optimized to provide fast
util/oslib-posix.c +1 -1
index f2d4e9e..afde145 100644
@@ -33,7 +33,7 @@
 #include <glib/gprintf.h>
 
 #include "sysemu/sysemu.h"
-#include "trace.h"
+#include "util/trace.h"
 #include "qapi/error.h"
 #include "qemu/sockets.h"
 #include <libgen.h>
util/oslib-win32.c +1 -1
index 4c1dcf1..2c539bc 100644
@@ -34,7 +34,7 @@
 #include "qapi/error.h"
 #include "sysemu/sysemu.h"
 #include "qemu/main-loop.h"
-#include "trace.h"
+#include "util/trace.h"
 #include "qemu/sockets.h"
 #include "qemu/cutils.h"
 
util/qemu-coroutine-lock.c +1 -1
index 22aa9ab..ff5bf99 100644
@@ -27,7 +27,7 @@
 #include "qemu/coroutine.h"
 #include "qemu/coroutine_int.h"
 #include "qemu/queue.h"
-#include "trace.h"
+#include "util/trace.h"
 
 void qemu_co_queue_init(CoQueue *queue)
 {
util/qemu-coroutine.c +1 -1
index 89f21a9..c953db6 100644
@@ -13,7 +13,7 @@
  */
 
 #include "qemu/osdep.h"
-#include "trace.h"
+#include "util/trace.h"
 #include "qemu-common.h"
 #include "qemu/thread.h"
 #include "qemu/atomic.h"
Signature · 1 line
2.7.4
#38 lore raw

PATCH 20/60 trace: switch crypto/ directory to modular trace.h file

In reply to Daniel P. Berrange

Switch files in the crypto/ directory to include the crypto/trace.h file instead of the global trace.h file.

---
 Makefile.objs         | 2 +-
 crypto/Makefile.objs  | 2 ++
 crypto/secret.c       | 2 +-
 crypto/tlscreds.c     | 2 +-
 crypto/tlscredsanon.c | 2 +-
 crypto/tlscredsx509.c | 2 +-
 crypto/tlssession.c   | 2 +-
 7 files changed, 8 insertions(+), 6 deletions(-)
Makefile.objs +1 -1
index 53b2785..99e7c1f 100644
@@ -121,7 +121,7 @@ ivshmem-server-obj-y = contrib/ivshmem-server/
 trace-events-subdirs =
 trace-events-y = trace-events
 trace-events-subdirs += util
-trace-events-y += crypto/trace-events
+trace-events-subdirs += crypto
 trace-events-subdirs += io
 trace-events-y += migration/trace-events
 trace-events-y += block/trace-events
crypto/Makefile.objs +2 -0
index a36d2d9..aa09450 100644
@@ -26,6 +26,8 @@ crypto-obj-y += xts.o
 crypto-obj-y += block.o
 crypto-obj-y += block-qcow.o
 crypto-obj-y += block-luks.o
+trace-obj-y += trace.o
+trace-obj-$(CONFIG_TRACE_DTRACE) += trace-dtrace.o
 
 # Let the userspace emulators avoid linking gnutls/etc
 crypto-aes-obj-y = aes.o
crypto/secret.c +1 -1
index 285ab7a..b936615 100644
@@ -24,7 +24,7 @@
 #include "qapi/error.h"
 #include "qom/object_interfaces.h"
 #include "qemu/base64.h"
-#include "trace.h"
+#include "crypto/trace.h"
 
 
 static void
crypto/tlscreds.c +1 -1
index a896553..7e7f974 100644
@@ -21,7 +21,7 @@
 #include "qemu/osdep.h"
 #include "qapi/error.h"
 #include "crypto/tlscredspriv.h"
-#include "trace.h"
+#include "crypto/trace.h"
 
 #define DH_BITS 2048
 
crypto/tlscredsanon.c +1 -1
index 1464220..c94c09b 100644
@@ -23,7 +23,7 @@
 #include "crypto/tlscredspriv.h"
 #include "qapi/error.h"
 #include "qom/object_interfaces.h"
-#include "trace.h"
+#include "crypto/trace.h"
 
 
 #ifdef CONFIG_GNUTLS
crypto/tlscredsx509.c +1 -1
index 520d34d..35c728c 100644
@@ -24,7 +24,7 @@
 #include "crypto/secret.h"
 #include "qapi/error.h"
 #include "qom/object_interfaces.h"
-#include "trace.h"
+#include "crypto/trace.h"
 
 
 #ifdef CONFIG_GNUTLS
crypto/tlssession.c +1 -1
index 2de42c6..876df60 100644
@@ -24,7 +24,7 @@
 #include "crypto/tlscredsx509.h"
 #include "qapi/error.h"
 #include "qemu/acl.h"
-#include "trace.h"
+#include "crypto/trace.h"
 
 #ifdef CONFIG_GNUTLS
 
Signature · 1 line
2.7.4
#32 lore raw

PATCH 16/60 trace: introduce ID range offsets per trace-events file

In reply to Daniel P. Berrange

For simpletrace we need to be able to form a globally unique ID value for trace records. Since the individual events no longer have globally unique ID values, we define an event ID offset per trace-events file.

The simpletrace records will now use

    (id_offset << 16) | event_id

for the ID value in trace records.

---
 audio/trace-events                           |  2 ++
 block/trace-events                           |  2 ++
 crypto/trace-events                          |  2 ++
 hw/9pfs/trace-events                         |  2 ++
 hw/acpi/trace-events                         |  2 ++
 hw/alpha/trace-events                        |  2 ++
 hw/arm/trace-events                          |  2 ++
 hw/audio/trace-events                        |  2 ++
 hw/block/trace-events                        |  2 ++
 hw/char/trace-events                         |  2 ++
 hw/display/trace-events                      |  2 ++
 hw/dma/trace-events                          |  2 ++
 hw/i386/trace-events                         |  2 ++
 hw/input/trace-events                        |  2 ++
 hw/intc/trace-events                         |  2 ++
 hw/isa/trace-events                          |  2 ++
 hw/mem/trace-events                          |  2 ++
 hw/misc/trace-events                         |  2 ++
 hw/net/trace-events                          |  2 ++
 hw/nvram/trace-events                        |  2 ++
 hw/pci/trace-events                          |  2 ++
 hw/ppc/trace-events                          |  2 ++
 hw/s390x/trace-events                        |  2 ++
 hw/scsi/trace-events                         |  2 ++
 hw/sd/trace-events                           |  2 ++
 hw/sparc/trace-events                        |  2 ++
 hw/timer/trace-events                        |  2 ++
 hw/usb/trace-events                          |  2 ++
 hw/vfio/trace-events                         |  2 ++
 hw/virtio/trace-events                       |  2 ++
 io/trace-events                              |  2 ++
 linux-user/trace-events                      |  2 ++
 migration/trace-events                       |  2 ++
 net/trace-events                             |  2 ++
 qom/trace-events                             |  2 ++
 scripts/simpletrace.py                       |  7 ++--
 scripts/tracetool/__init__.py                | 49 +++++++++++++++++++++++-----
 scripts/tracetool/backend/simple.py          |  3 +-
 scripts/tracetool/format/simpletrace_stap.py |  2 +-
 target-i386/trace-events                     |  2 ++
 target-ppc/trace-events                      |  2 ++
 target-s390x/trace-events                    |  2 ++
 target-sparc/trace-events                    |  2 ++
 trace-events                                 |  2 ++
 ui/trace-events                              |  2 ++
 util/trace-events                            |  2 ++
 46 files changed, 131 insertions(+), 14 deletions(-)
audio/trace-events +2 -0
index 5638ea1..5630465 100644
@@ -1,5 +1,7 @@
 # See docs/trace-events.txt for syntax documentation.
 
+@id_offset(512)
+
 # audio/alsaaudio.c
 alsa_revents(int revents) "revents = %d"
 alsa_pollout(int i, int fd) "i = %d fd = %d"
block/trace-events +2 -0
index 978ef4f..8286458 100644
@@ -1,5 +1,7 @@
 # See docs/trace-events.txt for syntax documentation.
 
+@id_offset(25)
+
 # block.c
 bdrv_open_common(void *bs, const char *filename, int flags, const char *format_name) "bs %p filename \"%s\" flags %#x format_name \"%s\""
 bdrv_lock_medium(void *bs, bool locked) "bs %p locked %d"
crypto/trace-events +2 -0
index 71f1d99..9850d0d 100644
@@ -1,5 +1,7 @@
 # See docs/trace-events.txt for syntax documentation.
 
+@id_offset(32)
+
 # crypto/tlscreds.c
 qcrypto_tls_creds_load_dh(void *creds, const char *filename) "TLS creds load DH creds=%p filename=%s"
 qcrypto_tls_creds_get_path(void *creds, const char *filename, const char *path) "TLS creds path creds=%p filename=%s path=%s"
hw/9pfs/trace-events +2 -0
index 63efa27..84275da 100644
@@ -1,5 +1,7 @@
 # See docs/trace-events.txt for syntax documentation.
 
+@id_offset(196)
+
 # hw/9pfs/virtio-9p.c
 v9fs_rerror(uint16_t tag, uint8_t id, int err) "tag %d id %d err %d"
 v9fs_version(uint16_t tag, uint8_t id, int32_t msize, char* version) "tag %d id %d msize %d version %s"
hw/acpi/trace-events +2 -0
index 5aa3ba6..840928e 100644
@@ -1,5 +1,7 @@
 # See docs/trace-events.txt for syntax documentation.
 
+@id_offset(225)
+
 # hw/acpi/memory_hotplug.c
 mhp_acpi_invalid_slot_selected(uint32_t slot) "0x%"PRIx32
 mhp_acpi_ejecting_invalid_slot(uint32_t slot) "0x%"PRIx32
hw/alpha/trace-events +2 -0
index 7d52b5d..7963ee4 100644
@@ -1,4 +1,6 @@
 # See docs/trace-events.txt for syntax documentation.
 
+@id_offset(169)
+
 # hw/alpha/pci.c
 alpha_pci_iack_write(void) ""
hw/arm/trace-events +2 -0
index d0dad16..e1f9d5c 100644
@@ -1,4 +1,6 @@
 # See docs/trace-events.txt for syntax documentation.
 
+@id_offset(324)
+
 # hw/arm/virt-acpi-build.c
 virt_acpi_setup(void) "No fw cfg or ACPI disabled. Bailing out."
hw/audio/trace-events +2 -0
index 796f4a1..0610b63 100644
@@ -1,5 +1,7 @@
 # See docs/trace-events.txt for syntax documentation.
 
+@id_offset(243)
+
 # hw/audio/cs4231.c
 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"
hw/block/trace-events +2 -0
index 31df44b..4c79bc0 100644
@@ -1,5 +1,7 @@
 # See docs/trace-events.txt for syntax documentation.
 
+@id_offset(49)
+
 # hw/block/virtio-blk.c
 virtio_blk_req_complete(void *req, int status) "req %p status %d"
 virtio_blk_rw_complete(void *req, int ret) "req %p ret %d"
hw/char/trace-events +2 -0
index 005fcd8..fec6fc3 100644
@@ -1,5 +1,7 @@
 # See docs/trace-events.txt for syntax documentation.
 
+@id_offset(288)
+
 # hw/char/virtio-serial-bus.c
 virtio_serial_send_control_event(unsigned int port, uint16_t event, uint16_t value) "port %u, event %u, value %u"
 virtio_serial_throttle_port(unsigned int port, bool throttle) "port %u, throttle %d"
hw/display/trace-events +2 -0
index 78f0465..4dd88aa 100644
@@ -1,5 +1,7 @@
 # See docs/trace-events.txt for syntax documentation.
 
+@id_offset(100)
+
 # hw/display/jazz_led.c
 jazz_led_read(uint64_t addr, uint8_t val) "read addr=0x%"PRIx64": 0x%x"
 jazz_led_write(uint64_t addr, uint8_t new) "write addr=0x%"PRIx64": 0x%x"
hw/dma/trace-events +2 -0
index d8a5674..685460d 100644
@@ -1,5 +1,7 @@
 # See docs/trace-events.txt for syntax documentation.
 
+@id_offset(72)
+
 # hw/dma/rc4030.c
 jazzio_read(uint64_t addr, uint32_t ret) "read reg[0x%"PRIx64"] = 0x%x"
 jazzio_write(uint64_t addr, uint32_t val) "write reg[0x%"PRIx64"] = 0x%x"
hw/i386/trace-events +2 -0
index 507f753..6ee0130 100644
@@ -1,5 +1,7 @@
 # See docs/trace-events.txt for syntax documentation.
 
+@id_offset(392)
+
 # hw/i386/xen/xen_platform.c
 xen_platform_log(char *s) "xen platform: %s"
 
hw/input/trace-events +2 -0
index f24dff2..c78af6c 100644
@@ -1,5 +1,7 @@
 # See docs/trace-events.txt for syntax documentation.
 
+@id_offset(432)
+
 # hw/input/ps2.c
 ps2_put_keycode(void *opaque, int keycode) "%p keycode %d"
 ps2_read_data(void *opaque) "%p"
hw/intc/trace-events +2 -0
index 376dd18..ee46617 100644
@@ -1,5 +1,7 @@
 # See docs/trace-events.txt for syntax documentation.
 
+@id_offset(144)
+
 # hw/intc/apic_common.c
 cpu_set_apic_base(uint64_t val) "%016"PRIx64
 cpu_get_apic_base(uint64_t val) "%016"PRIx64
hw/isa/trace-events +2 -0
index 686282f..b6b8ba6 100644
@@ -1,5 +1,7 @@
 # See docs/trace-events.txt for syntax documentation.
 
+@id_offset(400)
+
 # hw/isa/pc87312.c
 pc87312_io_read(uint32_t addr, uint32_t val) "read addr=%x val=%x"
 pc87312_io_write(uint32_t addr, uint32_t val) "write addr=%x val=%x"
hw/mem/trace-events +2 -0
index 3a49215..4b67bba 100644
@@ -1,5 +1,7 @@
 # See docs/trace-events.txt for syntax documentation.
 
+@id_offset(36)
+
 # hw/mem/pc-dimm.c
 mhp_pc_dimm_assigned_slot(int slot) "0x%d"
 mhp_pc_dimm_assigned_address(uint64_t addr) "0x%"PRIx64
hw/misc/trace-events +2 -0
index ea52a14..31db6a7 100644
@@ -1,5 +1,7 @@
 # See docs/trace-events.txt for syntax documentation.
 
+@id_offset(361)
+
 # hw/misc/eccmemctl.c
 ecc_mem_writel_mer(uint32_t val) "Write memory enable %08x"
 ecc_mem_writel_mdr(uint32_t val) "Write memory delay %08x"
hw/net/trace-events +2 -0
index aaa905f..a78e8c6 100644
@@ -1,5 +1,7 @@
 # See docs/trace-events.txt for syntax documentation.
 
+@id_offset(289)
+
 # hw/net/lance.c
 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/nvram/trace-events +2 -0
index 325447d..f026896 100644
@@ -1,5 +1,7 @@
 # See docs/trace-events.txt for syntax documentation.
 
+@id_offset(256)
+
 # hw/nvram/ds1225y.c
 nvram_read(uint32_t addr, uint32_t ret) "read addr %d: 0x%02x"
 nvram_write(uint32_t addr, uint32_t old, uint32_t val) "write addr %d: 0x%02x -> 0x%02x"
hw/pci/trace-events +2 -0
index 285338a..7803590 100644
@@ -1,5 +1,7 @@
 # See docs/trace-events.txt for syntax documentation.
 
+@id_offset(121)
+
 # hw/pci/pci.c
 pci_update_mappings_del(void *d, uint32_t bus, uint32_t slot, uint32_t func, int bar, uint64_t addr, uint64_t size) "d=%p %02x:%02x.%x %d,%#"PRIx64"+%#"PRIx64
 pci_update_mappings_add(void *d, uint32_t bus, uint32_t slot, uint32_t func, int bar, uint64_t addr, uint64_t size) "d=%p %02x:%02x.%x %d,%#"PRIx64"+%#"PRIx64
hw/ppc/trace-events +2 -0
index 900679b..d372099 100644
@@ -1,5 +1,7 @@
 # See docs/trace-events.txt for syntax documentation.
 
+@id_offset(125)
+
 # hw/ppc/spapr_pci.c
 spapr_pci_msi(const char *msg, uint32_t ca) "%s (cfg=%x)"
 spapr_pci_msi_setup(const char *name, unsigned vector, uint64_t addr) "dev\"%s\" vector %u, addr=%"PRIx64
hw/s390x/trace-events +2 -0
index 72c4549..59305ca 100644
@@ -1,5 +1,7 @@
 # See docs/trace-events.txt for syntax documentation.
 
+@id_offset(64)
+
 # hw/s390x/css.c
 css_enable_facility(const char *facility) "CSS: enable %s"
 css_crw(uint8_t rsc, uint8_t erc, uint16_t rsid, const char *chained) "CSS: queueing crw: rsc=%x, erc=%x, rsid=%x %s"
hw/scsi/trace-events +2 -0
index 5f19e32..42e699e 100644
@@ -1,5 +1,7 @@
 # See docs/trace-events.txt for syntax documentation.
 
+@id_offset(200)
+
 # hw/scsi/scsi-bus.c
 scsi_req_alloc(int target, int lun, int tag) "target %d lun %d tag %d"
 scsi_req_cancel(int target, int lun, int tag) "target %d lun %d tag %d"
hw/sd/trace-events +2 -0
index b580a0f..7e5a87a 100644
@@ -1,5 +1,7 @@
 # See docs/trace-events.txt for syntax documentation.
 
+@id_offset(441)
+
 # hw/sd/milkymist-memcard.c
 milkymist_memcard_memory_read(uint32_t addr, uint32_t value) "addr %08x value %08x"
 milkymist_memcard_memory_write(uint32_t addr, uint32_t value) "addr %08x value %08x"
hw/sparc/trace-events +2 -0
index ab677a3..3701222 100644
@@ -1,5 +1,7 @@
 # See docs/trace-events.txt for syntax documentation.
 
+@id_offset(81)
+
 # hw/sparc/sun4m.c
 sun4m_cpu_interrupt(unsigned int level) "Set CPU IRQ %d"
 sun4m_cpu_reset_interrupt(unsigned int level) "Reset CPU IRQ %d"
hw/timer/trace-events +2 -0
index 19db4bf..884cce6 100644
@@ -1,5 +1,7 @@
 # See docs/trace-events.txt for syntax documentation.
 
+@id_offset(484)
+
 # hw/timer/slavio_timer.c
 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"
hw/usb/trace-events +2 -0
index ac2d951..c913c99 100644
@@ -1,5 +1,7 @@
 # See docs/trace-events.txt for syntax documentation.
 
+@id_offset(343)
+
 # hw/usb/core.c
 usb_packet_state_change(int bus, const char *port, int ep, void *p, const char *o, const char *n) "bus %d, port %s, ep %d, packet %p, state %s -> %s"
 usb_packet_state_fault(int bus, const char *port, int ep, void *p, const char *o, const char *n) "bus %d, port %s, ep %d, packet %p, state %s, expected %s"
hw/vfio/trace-events +2 -0
index 4bb7690..b3898d7 100644
@@ -1,5 +1,7 @@
 # See docs/trace-events.txt for syntax documentation.
 
+@id_offset(108)
+
 # hw/vfio/pci.c
 vfio_intx_interrupt(const char *name, char line) " (%s) Pin %c"
 vfio_intx_eoi(const char *name) " (%s) EOI"
hw/virtio/trace-events +2 -0
index 6849a44..e5350c6 100644
@@ -1,5 +1,7 @@
 # See docs/trace-events.txt for syntax documentation.
 
+@id_offset(500)
+
 # hw/virtio/virtio.c
 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"
io/trace-events +2 -0
index 8d84eda..910c9b9 100644
@@ -1,5 +1,7 @@
 # See docs/trace-events.txt for syntax documentation.
 
+@id_offset(529)
+
 # io/task.c
 qio_task_new(void *task, void *source, void *func, void *opaque) "Task new task=%p source=%p func=%p opaque=%p"
 qio_task_complete(void *task) "Task complete task=%p"
linux-user/trace-events +2 -0
index 80a2e07..e8d4229 100644
@@ -1,5 +1,7 @@
 # See docs/trace-events.txt for syntax documentation.
 
+@id_offset(4)
+
 # linux-user/signal.c
 user_setup_frame(void *env, uint64_t frame_addr) "env=%p frame_addr=%"PRIx64
 user_setup_rt_frame(void *env, uint64_t frame_addr) "env=%p frame_addr=%"PRIx64
migration/trace-events +2 -0
index 8568dab..43ce7f7 100644
@@ -1,5 +1,7 @@
 # See docs/trace-events.txt for syntax documentation.
 
+@id_offset(9)
+
 # migration/savevm.c
 qemu_loadvm_state_section(unsigned int section_type) "%d"
 qemu_loadvm_state_section_command(int ret) "%d"
net/trace-events +2 -0
index 32a0a8a..49b0174 100644
@@ -1,4 +1,6 @@
 # See docs/trace-events.txt for syntax documentation.
 
+@id_offset(625)
+
 # net/vhost-user.c
 vhost_user_event(const char *chr, int event) "chr: %s got event: %d"
qom/trace-events +2 -0
index 350fc1f..4c76f43 100644
@@ -1,5 +1,7 @@
 # See docs/trace-events.txt for syntax documentation.
 
+@id_offset(675)
+
 # qom/object.c
 object_dynamic_cast_assert(const char *type, const char *target, const char *file, int line, const char *func) "%s->%s (%s:%d:%s)"
 object_class_dynamic_cast_assert(const char *type, const char *target, const char *file, int line, const char *func) "%s->%s (%s:%d:%s)"
scripts/simpletrace.py +4 -3
index 3916c6d..0f4d020 100755
@@ -114,11 +114,12 @@ def process(events, log, analyzer, read_header=True):
     if read_header:
         read_trace_header(log)
 
-    dropped_event = Event.build("Dropped_Event(uint64_t num_events_dropped)")
+    dropped_event = Event.build("Dropped_Event(uint64_t num_events_dropped)",
+                                dropped_event_id, 0)
     edict = {dropped_event_id: dropped_event}
 
-    for num, event in enumerate(events):
-        edict[num] = event
+    for event in events:
+        edict[event.global_id] = event
 
     def build_fn(analyzer, event):
         if isinstance(event, str):
scripts/tracetool/__init__.py +40 -9

112 lines not on this page · raw message

scripts/tracetool/backend/simple.py +2 -1
index 8c27b68..b4f6ea4 100644
@@ -80,11 +80,12 @@ def generate_c(event, group):
         '        return;',
         '    }',
         '',
-        '    if (trace_record_start(&rec, %(event_id)s, %(size_str)s)) {',
+        '    if (trace_record_start(&rec, (%(id_offset)d << 16) | %(event_id)s, %(size_str)s)) {',
         '        return; /* Trace Buffer Full, Event Dropped ! */',
         '    }',
         cond=cond,
         event_id=event_id,
+        id_offset=event.id_offset,
         size_str=sizestr)
 
     if len(event.args) > 0:
scripts/tracetool/format/simpletrace_stap.py +1 -1
index c8b3850..9ec107c 100644
@@ -48,7 +48,7 @@ def generate(events, backend, group):
         sizestr = ' + '.join(sizes)
 
         # Generate format string and value pairs for record header and arguments
-        fields = [('8b', str(event_id)),
+        fields = [('8b', str((e.id_offset << 16) | event_id)),
                   ('8b', 'gettimeofday_ns()'),
                   ('4b', sizestr),
                   ('4b', 'pid()')]
target-i386/trace-events +2 -0
index ccc49e3..6882f35 100644
@@ -1,5 +1,7 @@
 # See docs/trace-events.txt for syntax documentation.
 
+@id_offset(8)
+
 # target-i386/kvm.c
 kvm_x86_fixup_msi_error(uint32_t gsi) "VT-d failed to remap interrupt for GSI %" PRIu32
 kvm_x86_add_msi_route(int virq) "Adding route entry for virq %d"
target-ppc/trace-events +2 -0
index d37da2b..a81d2e7 100644
@@ -1,5 +1,7 @@
 # See docs/trace-events.txt for syntax documentation.
 
+@id_offset(676)
+
 # target-ppc/kvm.c
 kvm_failed_spr_set(int str, const char *msg) "Warning: Unable to set SPR %d to KVM: %s"
 kvm_failed_spr_get(int str, const char *msg) "Warning: Unable to retrieve SPR %d from KVM: %s"
target-s390x/trace-events +2 -0
index 9589b16..ac2b6ec 100644
@@ -1,5 +1,7 @@
 # See docs/trace-events.txt for syntax documentation.
 
+@id_offset(16)
+
 # target-s390x/mmu_helper.c
 get_skeys_nonzero(int rc) "SKEY: Call to get_skeys unexpectedly returned %d"
 set_skeys_nonzero(int rc) "SKEY: Call to set_skeys unexpectedly returned %d"
target-sparc/trace-events +2 -0
index c75faf9..0022c45 100644
@@ -1,5 +1,7 @@
 # See docs/trace-events.txt for syntax documentation.
 
+@id_offset(576)
+
 # target-sparc/mmu_helper.c
 mmu_helper_dfault(uint64_t address, uint64_t context, int mmu_idx, uint32_t tl) "DFAULT at %"PRIx64" context %"PRIx64" mmu_idx=%d tl=%d"
 mmu_helper_dprot(uint64_t address, uint64_t context, int mmu_idx, uint32_t tl) "DPROT at %"PRIx64" context %"PRIx64" mmu_idx=%d tl=%d"
trace-events +2 -0
index 1de7e99..08c0b1e 100644
@@ -25,6 +25,8 @@
 #
 # The <format-string> should be a sprintf()-compatible format string.
 
+@id_offset(1)
+
 # thread-pool.c
 thread_pool_submit(void *pool, void *req, void *opaque) "pool %p req %p opaque %p"
 thread_pool_complete(void *pool, void *req, void *opaque, int ret) "pool %p req %p opaque %p ret %d"
ui/trace-events +2 -0
index d36dbbb..1649aa1 100644
@@ -1,5 +1,7 @@
 # See docs/trace-events.txt for syntax documentation.
 
+@id_offset(27)
+
 # ui/console.c
 console_gfx_new(void) ""
 console_putchar_csi(int esc_param0, int esc_param1, int ch, int nb_esc_params) "escape sequence CSI%d;%d%c, %d parameters"
util/trace-events +2 -0
index 111e1de..f83fbde 100644
@@ -1,5 +1,7 @@
 # See docs/trace-events.txt for syntax documentation.
 
+@id_offset(648)
+
 # util/buffer.c
 buffer_resize(const char *buf, size_t olen, size_t len) "%s: old %zd, new %zd"
 buffer_move_empty(const char *buf, size_t len, const char *from) "%s: %zd bytes from %s"
Signature · 1 line
2.7.4
#40 lore raw

PATCH 22/60 trace: switch block/ directory to modular trace.h file

In reply to Daniel P. Berrange

Switch files in the block/ directory to include the block/trace.h file instead of the global trace.h file.

---
 Makefile.objs         | 2 +-
 block.c               | 2 +-
 block/Makefile.objs   | 2 ++
 block/backup.c        | 2 +-
 block/block-backend.c | 2 +-
 block/commit.c        | 2 +-
 block/dirty-bitmap.c  | 2 +-
 block/io.c            | 2 +-
 block/mirror.c        | 2 +-
 block/nfs.c           | 2 +-
 block/qcow2-cache.c   | 2 +-
 block/qcow2-cluster.c | 2 +-
 block/qcow2.c         | 2 +-
 block/qed-l2-cache.c  | 2 +-
 block/qed-table.c     | 2 +-
 block/qed.c           | 2 +-
 block/raw-posix.c     | 2 +-
 block/raw-win32.c     | 2 +-
 block/stream.c        | 2 +-
 blockdev.c            | 2 +-
 20 files changed, 21 insertions(+), 19 deletions(-)
Makefile.objs +1 -1
index 483430e..3ab3c10 100644
@@ -124,7 +124,7 @@ trace-events-subdirs += util
 trace-events-subdirs += crypto
 trace-events-subdirs += io
 trace-events-subdirs += migration
-trace-events-y += block/trace-events
+trace-events-subdirs += block
 trace-events-y += hw/block/trace-events
 trace-events-y += hw/char/trace-events
 trace-events-y += hw/intc/trace-events
block.c +1 -1
index 30d64e6..e446b69 100644
@@ -22,7 +22,7 @@
  * THE SOFTWARE.
  */
 #include "qemu/osdep.h"
-#include "trace.h"
+#include "block/trace.h"
 #include "block/block_int.h"
 #include "block/blockjob.h"
 #include "qemu/error-report.h"
block/Makefile.objs +2 -0
index 2593a2f..ebf4787 100644
@@ -24,6 +24,8 @@ block-obj-y += accounting.o dirty-bitmap.o
 block-obj-y += write-threshold.o
 
 block-obj-y += crypto.o
+trace-obj-y += trace.o
+trace-obj-$(CONFIG_TRACE_DTRACE) += trace-dtrace.o
 
 common-obj-y += stream.o
 common-obj-y += backup.o
block/backup.c +1 -1
index 2c05323..9f329d0 100644
@@ -13,7 +13,7 @@
 
 #include "qemu/osdep.h"
 
-#include "trace.h"
+#include "block/trace.h"
 #include "block/block.h"
 #include "block/block_int.h"
 #include "block/blockjob.h"
block/block-backend.c +1 -1
index effa038..3ed6296 100644
@@ -19,7 +19,7 @@
 #include "sysemu/sysemu.h"
 #include "qapi-event.h"
 #include "qemu/id.h"
-#include "trace.h"
+#include "block/trace.h"
 
 /* Number of coroutines to reserve per attached device model */
 #define COROUTINE_POOL_RESERVATION 64
block/commit.c +1 -1
index 553e18d..5e7b6c2 100644
@@ -13,7 +13,7 @@
  */
 
 #include "qemu/osdep.h"
-#include "trace.h"
+#include "block/trace.h"
 #include "block/block_int.h"
 #include "block/blockjob.h"
 #include "qapi/error.h"
block/dirty-bitmap.c +1 -1
index f2bfdcf..ea0bd35 100644
@@ -24,7 +24,7 @@
 #include "qemu/osdep.h"
 #include "qapi/error.h"
 #include "qemu-common.h"
-#include "trace.h"
+#include "block/trace.h"
 #include "block/block_int.h"
 #include "block/blockjob.h"
 
block/io.c +1 -1
index d5493ba..1166a21 100644
@@ -23,7 +23,7 @@
  */
 
 #include "qemu/osdep.h"
-#include "trace.h"
+#include "block/trace.h"
 #include "sysemu/block-backend.h"
 #include "block/blockjob.h"
 #include "block/block_int.h"
block/mirror.c +1 -1
index e0b3f41..7f3acb4 100644
@@ -12,7 +12,7 @@
  */
 
 #include "qemu/osdep.h"
-#include "trace.h"
+#include "block/trace.h"
 #include "block/blockjob.h"
 #include "block/block_int.h"
 #include "sysemu/block-backend.h"
block/nfs.c +1 -1
index 8602a44..7b92c19 100644
@@ -30,7 +30,7 @@
 #include "qemu/error-report.h"
 #include "qapi/error.h"
 #include "block/block_int.h"
-#include "trace.h"
+#include "block/trace.h"
 #include "qemu/iov.h"
 #include "qemu/uri.h"
 #include "qemu/cutils.h"
block/qcow2-cache.c +1 -1
index 6eaefed..d22043e 100644
@@ -27,7 +27,7 @@
 #include "block/block_int.h"
 #include "qemu-common.h"
 #include "qcow2.h"
-#include "trace.h"
+#include "block/trace.h"
 
 typedef struct Qcow2CachedTable {
     int64_t  offset;
block/qcow2-cluster.c +1 -1
index f941835..22dbb4d 100644
@@ -30,7 +30,7 @@
 #include "block/block_int.h"
 #include "block/qcow2.h"
 #include "qemu/bswap.h"
-#include "trace.h"
+#include "block/trace.h"
 
 int qcow2_grow_l1_table(BlockDriverState *bs, uint64_t min_size,
                         bool exact_size)
block/qcow2.c +1 -1
index 91ef4df..6f3b538 100644
@@ -33,7 +33,7 @@
 #include "qapi/util.h"
 #include "qapi/qmp/types.h"
 #include "qapi-event.h"
-#include "trace.h"
+#include "block/trace.h"
 #include "qemu/option_int.h"
 #include "qemu/cutils.h"
 #include "qemu/bswap.h"
block/qed-l2-cache.c +1 -1
index 5cba794..b413753 100644
@@ -51,7 +51,7 @@
  */
 
 #include "qemu/osdep.h"
-#include "trace.h"
+#include "block/trace.h"
 #include "qed.h"
 
 /* Each L2 holds 2GB so this let's us fully cache a 100GB disk */
block/qed-table.c +1 -1
index 1a731df..d473e85 100644
@@ -13,7 +13,7 @@
  */
 
 #include "qemu/osdep.h"
-#include "trace.h"
+#include "block/trace.h"
 #include "qemu/sockets.h" /* for EINPROGRESS on Windows */
 #include "qed.h"
 #include "qemu/bswap.h"
block/qed.c +1 -1
index 426f3cb..db2cfc9 100644
@@ -16,7 +16,7 @@
 #include "qapi/error.h"
 #include "qemu/timer.h"
 #include "qemu/bswap.h"
-#include "trace.h"
+#include "block/trace.h"
 #include "qed.h"
 #include "qapi/qmp/qerror.h"
 #include "migration/migration.h"
block/raw-posix.c +1 -1
index 6ed7547..b551db4 100644
@@ -29,7 +29,7 @@
 #include "qemu/log.h"
 #include "block/block_int.h"
 #include "qemu/module.h"
-#include "trace.h"
+#include "block/trace.h"
 #include "block/thread-pool.h"
 #include "qemu/iov.h"
 #include "block/raw-aio.h"
block/raw-win32.c +1 -1
index 56f45fe..149118d 100644
@@ -28,7 +28,7 @@
 #include "block/block_int.h"
 #include "qemu/module.h"
 #include "block/raw-aio.h"
-#include "trace.h"
+#include "block/trace.h"
 #include "block/thread-pool.h"
 #include "qemu/iov.h"
 #include "qapi/qmp/qstring.h"
block/stream.c +1 -1
index 3187481..9289c1a 100644
@@ -12,7 +12,7 @@
  */
 
 #include "qemu/osdep.h"
-#include "trace.h"
+#include "block/trace.h"
 #include "block/block_int.h"
 #include "block/blockjob.h"
 #include "qapi/error.h"
blockdev.c +1 -1
index 2161400..347eb6e 100644
@@ -48,7 +48,7 @@
 #include "sysemu/sysemu.h"
 #include "block/block_int.h"
 #include "qmp-commands.h"
-#include "trace.h"
+#include "block/trace.h"
 #include "sysemu/arch_init.h"
 #include "qemu/cutils.h"
 #include "qemu/help_option.h"
Signature · 1 line
2.7.4
#36 lore raw

PATCH 18/60 trace: switch io/ directory to modular trace.h file

In reply to Daniel P. Berrange

Switch files in the io/ directory to include the
io/trace.h file instead of the global trace.h
file.

---
 Makefile.objs        | 2 +-
 io/Makefile.objs     | 2 ++
 io/channel-buffer.c  | 2 +-
 io/channel-command.c | 2 +-
 io/channel-file.c    | 2 +-
 io/channel-socket.c  | 2 +-
 io/channel-tls.c     | 2 +-
 io/channel-websock.c | 2 +-
 io/task.c            | 2 +-
 9 files changed, 10 insertions(+), 8 deletions(-)
Makefile.objs +1 -1
index ede6dd3..9243d5b 100644
@@ -122,7 +122,7 @@ trace-events-subdirs =
 trace-events-y = trace-events
 trace-events-y += util/trace-events
 trace-events-y += crypto/trace-events
-trace-events-y += io/trace-events
+trace-events-subdirs += io
 trace-events-y += migration/trace-events
 trace-events-y += block/trace-events
 trace-events-y += hw/block/trace-events
io/Makefile.objs +2 -0
index 9d8337d..94cb74e 100644
@@ -8,3 +8,5 @@ io-obj-y += channel-watch.o
 io-obj-y += channel-websock.o
 io-obj-y += channel-util.o
 io-obj-y += task.o
+trace-obj-y += trace.o
+trace-obj-$(CONFIG_TRACE_DTRACE) += trace-dtrace.o
io/channel-buffer.c +1 -1
index 43d7959..b4e50d6 100644
@@ -22,7 +22,7 @@
 #include "io/channel-buffer.h"
 #include "io/channel-watch.h"
 #include "qemu/sockets.h"
-#include "trace.h"
+#include "io/trace.h"
 
 QIOChannelBuffer *
 qio_channel_buffer_new(size_t capacity)
io/channel-command.c +1 -1
index ad25313..7624653 100644
@@ -23,7 +23,7 @@
 #include "io/channel-watch.h"
 #include "qapi/error.h"
 #include "qemu/sockets.h"
-#include "trace.h"
+#include "io/trace.h"
 
 
 QIOChannelCommand *
io/channel-file.c +1 -1
index e1da243..7b064ef 100644
@@ -23,7 +23,7 @@
 #include "io/channel-watch.h"
 #include "qapi/error.h"
 #include "qemu/sockets.h"
-#include "trace.h"
+#include "io/trace.h"
 
 QIOChannelFile *
 qio_channel_file_new_fd(int fd)
io/channel-socket.c +1 -1
index 196a4f1..a31964a 100644
@@ -22,7 +22,7 @@
 #include "qapi/error.h"
 #include "io/channel-socket.h"
 #include "io/channel-watch.h"
-#include "trace.h"
+#include "io/trace.h"
 #include "qapi/clone-visitor.h"
 
 #define SOCKET_MAX_FDS 16
io/channel-tls.c +1 -1
index 9a8525c..a2473f4 100644
@@ -21,7 +21,7 @@
 #include "qemu/osdep.h"
 #include "qapi/error.h"
 #include "io/channel-tls.h"
-#include "trace.h"
+#include "io/trace.h"
 
 
 static ssize_t qio_channel_tls_write_handler(const char *buf,
io/channel-websock.c +1 -1
index 533bd4b..24d226b 100644
@@ -23,7 +23,7 @@
 #include "qemu/bswap.h"
 #include "io/channel-websock.h"
 #include "crypto/hash.h"
-#include "trace.h"
+#include "io/trace.h"
 
 
 /* Max amount to allow in rawinput/rawoutput buffers */
io/task.c +1 -1
index c7f97a9..d81adf2 100644
@@ -22,7 +22,7 @@
 #include "io/task.h"
 #include "qapi/error.h"
 #include "qemu/thread.h"
-#include "trace.h"
+#include "io/trace.h"
 
 struct QIOTask {
     Object *source;
Signature · 1 line
2.7.4
#39 lore raw

PATCH 21/60 trace: switch migration/ directory to modular trace.h file

In reply to Daniel P. Berrange

Switch files in the migration/ directory to include the migration/trace.h file instead of the global trace.h file.

---
 Makefile.objs            | 2 +-
 migration/Makefile.objs  | 2 ++
 migration/exec.c         | 2 +-
 migration/fd.c           | 2 +-
 migration/migration.c    | 2 +-
 migration/postcopy-ram.c | 2 +-
 migration/qemu-file.c    | 2 +-
 migration/ram.c          | 2 +-
 migration/rdma.c         | 2 +-
 migration/savevm.c       | 2 +-
 migration/socket.c       | 2 +-
 migration/tls.c          | 2 +-
 migration/vmstate.c      | 2 +-
 13 files changed, 14 insertions(+), 12 deletions(-)
Makefile.objs +1 -1
index 99e7c1f..483430e 100644
@@ -123,7 +123,7 @@ trace-events-y = trace-events
 trace-events-subdirs += util
 trace-events-subdirs += crypto
 trace-events-subdirs += io
-trace-events-y += migration/trace-events
+trace-events-subdirs += migration
 trace-events-y += block/trace-events
 trace-events-y += hw/block/trace-events
 trace-events-y += hw/char/trace-events
migration/Makefile.objs +2 -0
index 30ad945..33517a8 100644
@@ -10,3 +10,5 @@ common-obj-$(CONFIG_RDMA) += rdma.o
 
 common-obj-y += block.o
 
+trace-obj-y += trace.o
+trace-obj-$(CONFIG_TRACE_DTRACE) += trace-dtrace.o
migration/exec.c +1 -1
index 2af63cc..a7f1e70 100644
@@ -22,7 +22,7 @@
 #include "qemu-common.h"
 #include "migration/migration.h"
 #include "io/channel-command.h"
-#include "trace.h"
+#include "migration/trace.h"
 
 
 void exec_start_outgoing_migration(MigrationState *s, const char *command, Error **errp)
migration/fd.c +1 -1
index 84a10fd..03bd2d6 100644
@@ -20,7 +20,7 @@
 #include "migration/migration.h"
 #include "monitor/monitor.h"
 #include "io/channel-util.h"
-#include "trace.h"
+#include "migration/trace.h"
 
 
 void fd_start_outgoing_migration(MigrationState *s, const char *fdname, Error **errp)
migration/migration.c +1 -1
index 955d5ee..635547b 100644
@@ -29,7 +29,7 @@
 #include "migration/postcopy-ram.h"
 #include "qemu/thread.h"
 #include "qmp-commands.h"
-#include "trace.h"
+#include "migration/trace.h"
 #include "qapi-event.h"
 #include "qom/cpu.h"
 #include "exec/memory.h"
migration/postcopy-ram.c +1 -1
index abe8c60..e0eb218 100644
@@ -24,7 +24,7 @@
 #include "sysemu/sysemu.h"
 #include "sysemu/balloon.h"
 #include "qemu/error-report.h"
-#include "trace.h"
+#include "migration/trace.h"
 
 /* Arbitrary limit on size of each discard command,
  * keeps them around ~200 bytes
migration/qemu-file.c +1 -1
index bbc565e..96de887 100644
@@ -30,7 +30,7 @@
 #include "qemu/coroutine.h"
 #include "migration/migration.h"
 #include "migration/qemu-file.h"
-#include "trace.h"
+#include "migration/trace.h"
 
 #define IO_BUF_SIZE 32768
 #define MAX_IOV_SIZE MIN(IOV_MAX, 64)
migration/ram.c +1 -1
index 815bc0e..5500cb5 100644
@@ -40,7 +40,7 @@
 #include "exec/address-spaces.h"
 #include "migration/page_cache.h"
 #include "qemu/error-report.h"
-#include "trace.h"
+#include "migration/trace.h"
 #include "exec/ram_addr.h"
 #include "qemu/rcu_queue.h"
 
migration/rdma.c +1 -1
index 5110ec8..71c19df 100644
@@ -29,7 +29,7 @@
 #include <netdb.h>
 #include <arpa/inet.h>
 #include <rdma/rdma_cma.h>
-#include "trace.h"
+#include "migration/trace.h"
 
 /*
  * Print and error on both the Monitor and the Log file.
migration/savevm.c +1 -1
index 33a2911..6bd108b 100644
@@ -46,7 +46,7 @@
 #include "sysemu/cpus.h"
 #include "exec/memory.h"
 #include "qmp-commands.h"
-#include "trace.h"
+#include "migration/trace.h"
 #include "qemu/bitops.h"
 #include "qemu/iov.h"
 #include "block/snapshot.h"
migration/socket.c +1 -1
index 5c0a38f..71b0573 100644
@@ -22,7 +22,7 @@
 #include "migration/migration.h"
 #include "migration/qemu-file.h"
 #include "io/channel-socket.h"
-#include "trace.h"
+#include "migration/trace.h"
 
 
 static SocketAddress *tcp_build_address(const char *host_port, Error **errp)
migration/tls.c +1 -1
index 12c053d..fa61aef 100644
@@ -24,7 +24,7 @@
 #include "crypto/tlscreds.h"
 #include "qemu/error-report.h"
 #include "qapi/error.h"
-#include "trace.h"
+#include "migration/trace.h"
 
 static QCryptoTLSCreds *
 migration_tls_get_creds(MigrationState *s,
migration/vmstate.c +1 -1
index fc29acf..6d65b44 100644
@@ -5,7 +5,7 @@
 #include "migration/vmstate.h"
 #include "qemu/bitops.h"
 #include "qemu/error-report.h"
-#include "trace.h"
+#include "migration/trace.h"
 
 static void vmstate_subsection_save(QEMUFile *f, const VMStateDescription *vmsd,
                                     void *opaque, QJSON *vmdesc);
Signature · 1 line
2.7.4
#41 lore raw

PATCH 23/60 trace: switch hw/block/ directory to modular trace.h file

In reply to Daniel P. Berrange

Switch files in the hw/block/ directory to include the hw/block/trace.h file instead of the global trace.h file.

---
 Makefile.objs                   | 2 +-
 hw/block/Makefile.objs          | 2 ++
 hw/block/dataplane/virtio-blk.c | 2 +-
 hw/block/hd-geometry.c          | 2 +-
 hw/block/virtio-blk.c           | 2 +-
 5 files changed, 6 insertions(+), 4 deletions(-)
Makefile.objs +1 -1
index 3ab3c10..8fe8b71 100644
@@ -125,7 +125,7 @@ trace-events-subdirs += crypto
 trace-events-subdirs += io
 trace-events-subdirs += migration
 trace-events-subdirs += block
-trace-events-y += hw/block/trace-events
+trace-events-subdirs += hw/block
 trace-events-y += hw/char/trace-events
 trace-events-y += hw/intc/trace-events
 trace-events-y += hw/net/trace-events
hw/block/Makefile.objs +2 -0
index d4c3ab7..a2f523d 100644
@@ -8,6 +8,8 @@ common-obj-$(CONFIG_XEN_BACKEND) += xen_disk.o
 common-obj-$(CONFIG_ECC) += ecc.o
 common-obj-$(CONFIG_ONENAND) += onenand.o
 common-obj-$(CONFIG_NVME_PCI) += nvme.o
+trace-obj-y += trace.o
+trace-obj-$(CONFIG_TRACE_DTRACE) += trace-dtrace.o
 
 obj-$(CONFIG_SH4) += tc58128.o
 
hw/block/dataplane/virtio-blk.c +1 -1
index 704a763..28e7163 100644
@@ -14,7 +14,7 @@
 
 #include "qemu/osdep.h"
 #include "qapi/error.h"
-#include "trace.h"
+#include "hw/block/trace.h"
 #include "qemu/iov.h"
 #include "qemu/thread.h"
 #include "qemu/error-report.h"
hw/block/hd-geometry.c +1 -1
index 57ad501..5d3691a 100644
@@ -34,7 +34,7 @@
 #include "sysemu/block-backend.h"
 #include "qemu/bswap.h"
 #include "hw/block/block.h"
-#include "trace.h"
+#include "hw/block/trace.h"
 
 struct partition {
         uint8_t boot_ind;           /* 0x80 - active */
hw/block/virtio-blk.c +1 -1
index 331d766..856c0e3 100644
@@ -16,7 +16,7 @@
 #include "qemu-common.h"
 #include "qemu/iov.h"
 #include "qemu/error-report.h"
-#include "trace.h"
+#include "hw/block/trace.h"
 #include "hw/block/block.h"
 #include "sysemu/block-backend.h"
 #include "sysemu/blockdev.h"
Signature · 1 line
2.7.4
#42 lore raw

PATCH 24/60 trace: switch hw/char/ directory to modular trace.h file

In reply to Daniel P. Berrange

Switch files in the hw/char/ directory to include the hw/char/trace.h file instead of the global trace.h file.

---
 Makefile.objs               | 2 +-
 hw/char/Makefile.objs       | 2 ++
 hw/char/escc.c              | 2 +-
 hw/char/grlib_apbuart.c     | 2 +-
 hw/char/lm32_juart.c        | 2 +-
 hw/char/lm32_uart.c         | 2 +-
 hw/char/milkymist-uart.c    | 2 +-
 hw/char/virtio-console.c    | 2 +-
 hw/char/virtio-serial-bus.c | 2 +-
 9 files changed, 10 insertions(+), 8 deletions(-)
Makefile.objs +1 -1
index 8fe8b71..ad44cbc 100644
@@ -126,7 +126,7 @@ trace-events-subdirs += io
 trace-events-subdirs += migration
 trace-events-subdirs += block
 trace-events-subdirs += hw/block
-trace-events-y += hw/char/trace-events
+trace-events-subdirs += hw/char
 trace-events-y += hw/intc/trace-events
 trace-events-y += hw/net/trace-events
 trace-events-y += hw/virtio/trace-events
hw/char/Makefile.objs +2 -0
index 69a553c..13db97f 100644
@@ -26,5 +26,7 @@ common-obj-$(CONFIG_LM32) += lm32_juart.o
 common-obj-$(CONFIG_LM32) += lm32_uart.o
 common-obj-$(CONFIG_MILKYMIST) += milkymist-uart.o
 common-obj-$(CONFIG_SCLPCONSOLE) += sclpconsole.o sclpconsole-lm.o
+trace-obj-y += trace.o
+trace-obj-$(CONFIG_TRACE_DTRACE) += trace-dtrace.o
 
 obj-$(CONFIG_VIRTIO) += virtio-serial-bus.o
hw/char/escc.c +1 -1
index 31a5f90..f004b3c 100644
@@ -29,7 +29,7 @@
 #include "sysemu/char.h"
 #include "ui/console.h"
 #include "ui/input.h"
-#include "trace.h"
+#include "hw/char/trace.h"
 
 /*
  * Chipset docs:
hw/char/grlib_apbuart.c +1 -1
index 871524c..9212361 100644
@@ -26,7 +26,7 @@
 #include "hw/sysbus.h"
 #include "sysemu/char.h"
 
-#include "trace.h"
+#include "hw/char/trace.h"
 
 #define UART_REG_SIZE 20     /* Size of memory mapped registers */
 
hw/char/lm32_juart.c +1 -1
index 28c2cf7..bdab1b7 100644
@@ -20,7 +20,7 @@
 #include "qemu/osdep.h"
 #include "hw/hw.h"
 #include "hw/sysbus.h"
-#include "trace.h"
+#include "hw/char/trace.h"
 #include "sysemu/char.h"
 
 #include "hw/char/lm32_juart.h"
hw/char/lm32_uart.c +1 -1
index b5c760d..2ca5678 100644
@@ -25,7 +25,7 @@
 #include "qemu/osdep.h"
 #include "hw/hw.h"
 #include "hw/sysbus.h"
-#include "trace.h"
+#include "hw/char/trace.h"
 #include "sysemu/char.h"
 #include "qemu/error-report.h"
 
hw/char/milkymist-uart.c +1 -1
index baddb37..9f5d5e4 100644
@@ -24,7 +24,7 @@
 #include "qemu/osdep.h"
 #include "hw/hw.h"
 #include "hw/sysbus.h"
-#include "trace.h"
+#include "hw/char/trace.h"
 #include "sysemu/char.h"
 #include "qemu/error-report.h"
 
hw/char/virtio-console.c +1 -1
index 2e36481..b5e28e1 100644
@@ -13,7 +13,7 @@
 #include "qemu/osdep.h"
 #include "sysemu/char.h"
 #include "qemu/error-report.h"
-#include "trace.h"
+#include "hw/char/trace.h"
 #include "hw/virtio/virtio-serial.h"
 #include "qapi-event.h"
 
hw/char/virtio-serial-bus.c +1 -1
index db57a38..28cab84 100644
@@ -25,7 +25,7 @@
 #include "qemu/error-report.h"
 #include "qemu/queue.h"
 #include "hw/sysbus.h"
-#include "trace.h"
+#include "hw/char/trace.h"
 #include "hw/virtio/virtio-serial.h"
 #include "hw/virtio/virtio-access.h"
 
Signature · 1 line
2.7.4
#43 lore raw

PATCH 25/60 trace: switch hw/intc/ directory to modular trace.h file

In reply to Daniel P. Berrange

Switch files in the hw/intc/ directory to include the hw/intc/trace.h file instead of the global trace.h file.

---
 Makefile.objs              | 2 +-
 hw/intc/Makefile.objs      | 2 ++
 hw/intc/apic.c             | 2 +-
 hw/intc/apic_common.c      | 2 +-
 hw/intc/arm_gic.c          | 2 +-
 hw/intc/arm_gicv3_cpuif.c  | 2 +-
 hw/intc/arm_gicv3_dist.c   | 2 +-
 hw/intc/arm_gicv3_redist.c | 2 +-
 hw/intc/aspeed_vic.c       | 2 +-
 hw/intc/grlib_irqmp.c      | 2 +-
 hw/intc/lm32_pic.c         | 2 +-
 hw/intc/s390_flic.c        | 2 +-
 hw/intc/s390_flic_kvm.c    | 2 +-
 hw/intc/slavio_intctl.c    | 2 +-
 hw/intc/xics.c             | 2 +-
 hw/intc/xics_kvm.c         | 2 +-
 hw/intc/xics_spapr.c       | 2 +-
 17 files changed, 18 insertions(+), 16 deletions(-)
Makefile.objs +1 -1
index ad44cbc..b1306fa 100644
@@ -127,7 +127,7 @@ trace-events-subdirs += migration
 trace-events-subdirs += block
 trace-events-subdirs += hw/block
 trace-events-subdirs += hw/char
-trace-events-y += hw/intc/trace-events
+trace-events-subdirs += hw/intc
 trace-events-y += hw/net/trace-events
 trace-events-y += hw/virtio/trace-events
 trace-events-y += hw/audio/trace-events
hw/intc/Makefile.objs +2 -0
index 05ec21b..2b8493e 100644
@@ -17,6 +17,8 @@ common-obj-$(CONFIG_ARM_GIC) += arm_gicv3.o
 common-obj-$(CONFIG_ARM_GIC) += arm_gicv3_dist.o
 common-obj-$(CONFIG_ARM_GIC) += arm_gicv3_redist.o
 common-obj-$(CONFIG_OPENPIC) += openpic.o
+trace-obj-y += trace.o
+trace-obj-$(CONFIG_TRACE_DTRACE) += trace-dtrace.o
 
 obj-$(CONFIG_APIC) += apic.o apic_common.o
 obj-$(CONFIG_ARM_GIC_KVM) += arm_gic_kvm.o
hw/intc/apic.c +1 -1
index 45887d9..18db178 100644
@@ -25,7 +25,7 @@
 #include "hw/i386/ioapic.h"
 #include "hw/pci/msi.h"
 #include "qemu/host-utils.h"
-#include "trace.h"
+#include "hw/intc/trace.h"
 #include "hw/i386/pc.h"
 #include "hw/i386/apic-msidef.h"
 #include "qapi/error.h"
hw/intc/apic_common.c +1 -1
index 14ac43c..772419e 100644
@@ -23,7 +23,7 @@
 #include "cpu.h"
 #include "hw/i386/apic.h"
 #include "hw/i386/apic_internal.h"
-#include "trace.h"
+#include "hw/intc/trace.h"
 #include "sysemu/kvm.h"
 #include "hw/qdev.h"
 #include "hw/sysbus.h"
hw/intc/arm_gic.c +1 -1
index b30cc91..8ad10c6 100644
@@ -24,7 +24,7 @@
 #include "qapi/error.h"
 #include "qom/cpu.h"
 #include "qemu/log.h"
-#include "trace.h"
+#include "hw/intc/trace.h"
 
 //#define DEBUG_GIC
 
hw/intc/arm_gicv3_cpuif.c +1 -1
index 4633172..6336b87 100644
@@ -13,7 +13,7 @@
  */
 
 #include "qemu/osdep.h"
-#include "trace.h"
+#include "hw/intc/trace.h"
 #include "gicv3_internal.h"
 #include "cpu.h"
 
hw/intc/arm_gicv3_dist.c +1 -1
index 3ea3dd0..dc405e9 100644
@@ -11,7 +11,7 @@
 
 #include "qemu/osdep.h"
 #include "qemu/log.h"
-#include "trace.h"
+#include "hw/intc/trace.h"
 #include "gicv3_internal.h"
 
 /* The GICD_NSACR registers contain a two bit field for each interrupt which
hw/intc/arm_gicv3_redist.c +1 -1
index 77e5cfa..f1a6b08 100644
@@ -11,7 +11,7 @@
 
 #include "qemu/osdep.h"
 #include "qemu/log.h"
-#include "trace.h"
+#include "hw/intc/trace.h"
 #include "gicv3_internal.h"
 
 static uint32_t mask_group(GICv3CPUState *cs, MemTxAttrs attrs)
hw/intc/aspeed_vic.c +1 -1
index 2370e74..c152d78 100644
@@ -31,7 +31,7 @@
 #include "hw/intc/aspeed_vic.h"
 #include "qemu/bitops.h"
 #include "qemu/log.h"
-#include "trace.h"
+#include "hw/intc/trace.h"
 
 #define AVIC_NEW_BASE_OFFSET 0x80
 
hw/intc/grlib_irqmp.c +1 -1
index ac7e63f..26c89af 100644
@@ -30,7 +30,7 @@
 
 #include "hw/sparc/grlib.h"
 
-#include "trace.h"
+#include "hw/intc/trace.h"
 #include "qapi/error.h"
 
 #define IRQMP_MAX_CPU 16
hw/intc/lm32_pic.c +1 -1
index 3dad01c..37a393f 100644
@@ -23,7 +23,7 @@
 #include "hw/i386/pc.h"
 #include "monitor/monitor.h"
 #include "hw/sysbus.h"
-#include "trace.h"
+#include "hw/intc/trace.h"
 #include "hw/lm32/lm32_pic.h"
 
 #define TYPE_LM32_PIC "lm32-pic"
hw/intc/s390_flic.c +1 -1
index 6ab29ef..44d3ea4 100644
@@ -15,7 +15,7 @@
 #include "hw/sysbus.h"
 #include "migration/qemu-file.h"
 #include "hw/s390x/s390_flic.h"
-#include "trace.h"
+#include "hw/intc/trace.h"
 
 S390FLICState *s390_get_flic(void)
 {
hw/intc/s390_flic_kvm.c +1 -1
index fef8080..5bfc772 100644
@@ -20,7 +20,7 @@
 #include "migration/qemu-file.h"
 #include "hw/s390x/s390_flic.h"
 #include "hw/s390x/adapter.h"
-#include "trace.h"
+#include "hw/intc/trace.h"
 
 #define FLIC_SAVE_INITIAL_SIZE getpagesize()
 #define FLIC_FAILED (-1UL)
hw/intc/slavio_intctl.c +1 -1
index e82e893..ecf09ca 100644
@@ -26,7 +26,7 @@
 #include "hw/sparc/sun4m.h"
 #include "monitor/monitor.h"
 #include "hw/sysbus.h"
-#include "trace.h"
+#include "hw/intc/trace.h"
 
 //#define DEBUG_IRQ_COUNT
 
hw/intc/xics.c +1 -1
index cd48f42..49a1146 100644
@@ -30,7 +30,7 @@
 #include "qemu-common.h"
 #include "cpu.h"
 #include "hw/hw.h"
-#include "trace.h"
+#include "hw/intc/trace.h"
 #include "qemu/timer.h"
 #include "hw/ppc/xics.h"
 #include "qemu/error-report.h"
hw/intc/xics_kvm.c +1 -1
index edbd62f..9d944e3 100644
@@ -30,7 +30,7 @@
 #include "qemu-common.h"
 #include "cpu.h"
 #include "hw/hw.h"
-#include "trace.h"
+#include "hw/intc/trace.h"
 #include "sysemu/kvm.h"
 #include "hw/ppc/spapr.h"
 #include "hw/ppc/xics.h"
hw/intc/xics_spapr.c +1 -1
index 618826d..8e83709 100644
@@ -28,7 +28,7 @@
 #include "qemu/osdep.h"
 #include "cpu.h"
 #include "hw/hw.h"
-#include "trace.h"
+#include "hw/intc/trace.h"
 #include "qemu/timer.h"
 #include "hw/ppc/spapr.h"
 #include "hw/ppc/xics.h"
Signature · 1 line
2.7.4
#44 lore raw

PATCH 26/60 trace: switch hw/net/ directory to modular trace.h file

In reply to Daniel P. Berrange

Switch files in the hw/net/ directory to include the hw/net/trace.h file instead of the global trace.h file.

---
 Makefile.objs               | 2 +-
 hw/net/Makefile.objs        | 3 +++
 hw/net/e1000e.c             | 2 +-
 hw/net/e1000e_core.c        | 2 +-
 hw/net/e1000x_common.c      | 2 +-
 hw/net/lance.c              | 2 +-
 hw/net/milkymist-minimac2.c | 2 +-
 hw/net/mipsnet.c            | 2 +-
 hw/net/net_rx_pkt.c         | 2 +-
 hw/net/opencores_eth.c      | 2 +-
 hw/net/pcnet-pci.c          | 2 +-
 hw/net/pcnet.c              | 2 +-
 12 files changed, 14 insertions(+), 11 deletions(-)
Makefile.objs +1 -1
index b1306fa..049be9c 100644
@@ -128,7 +128,7 @@ trace-events-subdirs += block
 trace-events-subdirs += hw/block
 trace-events-subdirs += hw/char
 trace-events-subdirs += hw/intc
-trace-events-y += hw/net/trace-events
+trace-events-subdirs += hw/net
 trace-events-y += hw/virtio/trace-events
 trace-events-y += hw/audio/trace-events
 trace-events-y += hw/misc/trace-events
hw/net/Makefile.objs +3 -0
index 610ed3e..da244c2 100644
@@ -43,3 +43,6 @@ common-obj-$(CONFIG_ROCKER) += rocker/rocker.o rocker/rocker_fp.o \
                                rocker/rocker_desc.o rocker/rocker_world.o \
                                rocker/rocker_of_dpa.o
 obj-$(call lnot,$(CONFIG_ROCKER)) += rocker/qmp-norocker.o
+
+trace-obj-y += trace.o
+trace-obj-$(CONFIG_TRACE_DTRACE) += trace-dtrace.o
hw/net/e1000e.c +1 -1
index d001c96..51591e8 100644
@@ -46,7 +46,7 @@
 #include "e1000x_common.h"
 #include "e1000e_core.h"
 
-#include "trace.h"
+#include "hw/net/trace.h"
 
 #define TYPE_E1000E "e1000e"
 #define E1000E(obj) OBJECT_CHECK(E1000EState, (obj), TYPE_E1000E)
hw/net/e1000e_core.c +1 -1
index badb1fe..6bfd692 100644
@@ -46,7 +46,7 @@
 #include "e1000x_common.h"
 #include "e1000e_core.h"
 
-#include "trace.h"
+#include "hw/net/trace.h"
 
 #define E1000E_MIN_XITR     (500) /* No more then 7813 interrupts per
                                      second according to spec 10.2.4.2 */
hw/net/e1000x_common.c +1 -1
index eb0e097..7b6cfa8 100644
@@ -29,7 +29,7 @@
 
 #include "e1000x_common.h"
 
-#include "trace.h"
+#include "hw/net/trace.h"
 
 bool e1000x_rx_ready(PCIDevice *d, uint32_t *mac)
 {
hw/net/lance.c +1 -1
index 573d724..6e36f9f 100644
@@ -42,7 +42,7 @@
 #include "qemu/sockets.h"
 #include "hw/sparc/sun4m.h"
 #include "pcnet.h"
-#include "trace.h"
+#include "hw/net/trace.h"
 #include "sysemu/sysemu.h"
 
 #define TYPE_LANCE "lance"
hw/net/milkymist-minimac2.c +1 -1
index c3a12e1..0a0d43f 100644
@@ -28,7 +28,7 @@
 #include "cpu.h" /* FIXME: why does this use TARGET_PAGE_ALIGN? */
 #include "hw/hw.h"
 #include "hw/sysbus.h"
-#include "trace.h"
+#include "hw/net/trace.h"
 #include "net/net.h"
 #include "qemu/error-report.h"
 
hw/net/mipsnet.c +1 -1
index 5a63df7..5f8fd6a 100644
@@ -1,7 +1,7 @@
 #include "qemu/osdep.h"
 #include "hw/hw.h"
 #include "net/net.h"
-#include "trace.h"
+#include "hw/net/trace.h"
 #include "hw/sysbus.h"
 
 /* MIPSnet register offsets */
hw/net/net_rx_pkt.c +1 -1
index 1019b50..9ec6e61 100644
@@ -16,7 +16,7 @@
  */
 
 #include "qemu/osdep.h"
-#include "trace.h"
+#include "hw/net/trace.h"
 #include "net_rx_pkt.h"
 #include "net/checksum.h"
 #include "net/tap.h"
hw/net/opencores_eth.c +1 -1
index 268d6a7..2a38c05 100644
@@ -37,7 +37,7 @@
 #include "hw/sysbus.h"
 #include "net/net.h"
 #include "sysemu/sysemu.h"
-#include "trace.h"
+#include "hw/net/trace.h"
 
 /* RECSMALL is not used because it breaks tap networking in linux:
  * incoming ARP responses are too short
hw/net/pcnet-pci.c +1 -1
index 0acf8a4..6cfc121 100644
@@ -34,7 +34,7 @@
 #include "qemu/timer.h"
 #include "sysemu/dma.h"
 #include "sysemu/sysemu.h"
-#include "trace.h"
+#include "hw/net/trace.h"
 
 #include "pcnet.h"
 
hw/net/pcnet.c +1 -1
index 198a01f..4e19d4e 100644
@@ -41,7 +41,7 @@
 #include "qemu/timer.h"
 #include "qemu/sockets.h"
 #include "sysemu/sysemu.h"
-#include "trace.h"
+#include "hw/net/trace.h"
 
 #include "pcnet.h"
 
Signature · 1 line
2.7.4
#45 lore raw

PATCH 27/60 trace: switch hw/virtio/ directory to modular trace.h file

In reply to Daniel P. Berrange

Switch files in the hw/virtio/ directory to include the hw/virtio/trace.h file instead of the global trace.h file.

---
 Makefile.objs              | 2 +-
 hw/virtio/Makefile.objs    | 2 ++
 hw/virtio/virtio-balloon.c | 2 +-
 hw/virtio/virtio-rng.c     | 2 +-
 hw/virtio/virtio.c         | 2 +-
 5 files changed, 6 insertions(+), 4 deletions(-)
Makefile.objs +1 -1
index 049be9c..0840225 100644
@@ -129,7 +129,7 @@ trace-events-subdirs += hw/block
 trace-events-subdirs += hw/char
 trace-events-subdirs += hw/intc
 trace-events-subdirs += hw/net
-trace-events-y += hw/virtio/trace-events
+trace-events-subdirs += hw/virtio
 trace-events-y += hw/audio/trace-events
 trace-events-y += hw/misc/trace-events
 trace-events-y += hw/usb/trace-events
hw/virtio/Makefile.objs +2 -0
index 3e2b175..1bd2195 100644
@@ -2,6 +2,8 @@ common-obj-y += virtio-rng.o
 common-obj-$(CONFIG_VIRTIO_PCI) += virtio-pci.o
 common-obj-y += virtio-bus.o
 common-obj-y += virtio-mmio.o
+trace-obj-y += trace.o
+trace-obj-$(CONFIG_TRACE_DTRACE) += trace-dtrace.o
 
 obj-y += virtio.o virtio-balloon.o 
 obj-$(CONFIG_LINUX) += vhost.o vhost-backend.o vhost-user.o
hw/virtio/virtio-balloon.c +1 -1
index 5af429a..fb60da5 100644
@@ -25,7 +25,7 @@
 #include "exec/address-spaces.h"
 #include "qapi/visitor.h"
 #include "qapi-event.h"
-#include "trace.h"
+#include "hw/virtio/trace.h"
 
 #include "hw/virtio/virtio-bus.h"
 #include "hw/virtio/virtio-access.h"
hw/virtio/virtio-rng.c +1 -1
index cd8ca10..0ad894e 100644
@@ -17,7 +17,7 @@
 #include "hw/virtio/virtio-rng.h"
 #include "sysemu/rng.h"
 #include "qom/object_interfaces.h"
-#include "trace.h"
+#include "hw/virtio/trace.h"
 
 static bool is_guest_ready(VirtIORNG *vrng)
 {
hw/virtio/virtio.c +1 -1
index 15ee3a7..2d205e2 100644
@@ -15,7 +15,7 @@
 #include "qapi/error.h"
 #include "qemu-common.h"
 #include "cpu.h"
-#include "trace.h"
+#include "hw/virtio/trace.h"
 #include "exec/address-spaces.h"
 #include "qemu/error-report.h"
 #include "hw/virtio/virtio.h"
Signature · 1 line
2.7.4
#46 lore raw

PATCH 28/60 trace: switch hw/audio/ directory to modular trace.h file

In reply to Daniel P. Berrange

Switch files in the hw/audio/ directory to include the hw/audio/trace.h file instead of the global trace.h file.

---
 Makefile.objs             | 2 +-
 hw/audio/Makefile.objs    | 3 +++
 hw/audio/cs4231.c         | 2 +-
 hw/audio/milkymist-ac97.c | 2 +-
 4 files changed, 6 insertions(+), 3 deletions(-)
Makefile.objs +1 -1
index 0840225..80f91ee 100644
@@ -130,7 +130,7 @@ trace-events-subdirs += hw/char
 trace-events-subdirs += hw/intc
 trace-events-subdirs += hw/net
 trace-events-subdirs += hw/virtio
-trace-events-y += hw/audio/trace-events
+trace-events-subdirs += hw/audio
 trace-events-y += hw/misc/trace-events
 trace-events-y += hw/usb/trace-events
 trace-events-y += hw/scsi/trace-events
hw/audio/Makefile.objs +3 -0
index 7ce85a2..d779550 100644
@@ -16,3 +16,6 @@ common-obj-$(CONFIG_MARVELL_88W8618) += marvell_88w8618.o
 common-obj-$(CONFIG_MILKYMIST) += milkymist-ac97.o
 
 $(obj)/adlib.o $(obj)/fmopl.o: QEMU_CFLAGS += -DBUILD_Y8950=0
+
+trace-obj-y += trace.o
+trace-obj-$(CONFIG_TRACE_DTRACE) += trace-dtrace.o
hw/audio/cs4231.c +1 -1
index 30690f9..8c7eb1e 100644
@@ -24,7 +24,7 @@
 
 #include "qemu/osdep.h"
 #include "hw/sysbus.h"
-#include "trace.h"
+#include "hw/audio/trace.h"
 
 /*
  * In addition to Crystal CS4231 there is a DMA controller on Sparc.
hw/audio/milkymist-ac97.c +1 -1
index bc8db71..fd994b4 100644
@@ -24,7 +24,7 @@
 #include "qemu/osdep.h"
 #include "hw/hw.h"
 #include "hw/sysbus.h"
-#include "trace.h"
+#include "hw/audio/trace.h"
 #include "audio/audio.h"
 #include "qemu/error-report.h"
 
Signature · 1 line
2.7.4
#48 lore raw

PATCH 30/60 trace: switch hw/usb/ directory to modular trace.h file

In reply to Daniel P. Berrange

Switch files in the hw/usb/ directory to include the hw/usb/trace.h file instead of the global trace.h file.

---
 Makefile.objs            | 2 +-
 hw/usb/Makefile.objs     | 3 +++
 hw/usb/bus.c             | 2 +-
 hw/usb/combined-packet.c | 2 +-
 hw/usb/core.c            | 2 +-
 hw/usb/desc.c            | 2 +-
 hw/usb/dev-hub.c         | 2 +-
 hw/usb/dev-mtp.c         | 2 +-
 hw/usb/dev-uas.c         | 2 +-
 hw/usb/hcd-ehci.c        | 2 +-
 hw/usb/hcd-ohci.c        | 6 +++---
 hw/usb/hcd-uhci.c        | 2 +-
 hw/usb/hcd-xhci.c        | 2 +-
 hw/usb/host-libusb.c     | 2 +-
 14 files changed, 18 insertions(+), 15 deletions(-)
Makefile.objs +1 -1
index ec58269..e1596cb 100644
@@ -132,7 +132,7 @@ trace-events-subdirs += hw/net
 trace-events-subdirs += hw/virtio
 trace-events-subdirs += hw/audio
 trace-events-subdirs += hw/misc
-trace-events-y += hw/usb/trace-events
+trace-events-subdirs += hw/usb
 trace-events-y += hw/scsi/trace-events
 trace-events-y += hw/nvram/trace-events
 trace-events-y += hw/display/trace-events
hw/usb/Makefile.objs +3 -0
index 98b5c9d..c7b85c4 100644
@@ -42,3 +42,6 @@ common-obj-y += $(patsubst %,host-%.o,$(HOST_USB))
 ifeq ($(CONFIG_USB_LIBUSB),y)
 common-obj-$(CONFIG_XEN_BACKEND) += xen-usb.o
 endif
+
+trace-obj-y += trace.o
+trace-obj-$(CONFIG_TRACE_DTRACE) += trace-dtrace.o
hw/usb/bus.c +1 -1
index 25913ad..e41cf29 100644
@@ -6,7 +6,7 @@
 #include "qemu/error-report.h"
 #include "sysemu/sysemu.h"
 #include "monitor/monitor.h"
-#include "trace.h"
+#include "hw/usb/trace.h"
 #include "qemu/cutils.h"
 
 static void usb_bus_dev_print(Monitor *mon, DeviceState *qdev, int indent);
hw/usb/combined-packet.c +1 -1
index 48cac87..fb5b87f 100644
@@ -23,7 +23,7 @@
 #include "qemu-common.h"
 #include "hw/usb.h"
 #include "qemu/iov.h"
-#include "trace.h"
+#include "hw/usb/trace.h"
 
 static void usb_combined_packet_add(USBCombinedPacket *combined, USBPacket *p)
 {
hw/usb/core.c +1 -1
index 45fa00c..68668c3 100644
@@ -27,7 +27,7 @@
 #include "qemu-common.h"
 #include "hw/usb.h"
 #include "qemu/iov.h"
-#include "trace.h"
+#include "hw/usb/trace.h"
 
 void usb_pick_speed(USBPort *port)
 {
hw/usb/desc.c +1 -1
index 5e0e1d1..5d64552 100644
@@ -2,7 +2,7 @@
 
 #include "hw/usb.h"
 #include "hw/usb/desc.h"
-#include "trace.h"
+#include "hw/usb/trace.h"
 
 /* ------------------------------------------------------------------ */
 
hw/usb/dev-hub.c +1 -1
index a33f21c..5359688 100644
@@ -24,7 +24,7 @@
 #include "qemu/osdep.h"
 #include "qapi/error.h"
 #include "qemu-common.h"
-#include "trace.h"
+#include "hw/usb/trace.h"
 #include "hw/usb.h"
 #include "hw/usb/desc.h"
 #include "qemu/error-report.h"
hw/usb/dev-mtp.c +1 -1
index 1be85ae..4c73547 100644
@@ -23,7 +23,7 @@
 
 #include "qemu-common.h"
 #include "qemu/iov.h"
-#include "trace.h"
+#include "hw/usb/trace.h"
 #include "hw/usb.h"
 #include "hw/usb/desc.h"
 
hw/usb/dev-uas.c +1 -1
index 3a8ff18..46efc5a 100644
@@ -13,7 +13,7 @@
 #include "qemu-common.h"
 #include "qemu/option.h"
 #include "qemu/config-file.h"
-#include "trace.h"
+#include "hw/usb/trace.h"
 #include "qemu/error-report.h"
 
 #include "hw/usb.h"
hw/usb/hcd-ehci.c +1 -1
index b093db7..fb0e798 100644
@@ -31,7 +31,7 @@
 #include "qapi/error.h"
 #include "hw/usb/ehci-regs.h"
 #include "hw/usb/hcd-ehci.h"
-#include "trace.h"
+#include "hw/usb/trace.h"
 
 #define FRAME_TIMER_FREQ 1000
 #define FRAME_TIMER_NS   (NANOSECONDS_PER_SECOND / FRAME_TIMER_FREQ)
hw/usb/hcd-ohci.c +3 -3
index 43b5181..8481490 100644
@@ -33,7 +33,7 @@
 #include "hw/pci/pci.h"
 #include "hw/sysbus.h"
 #include "hw/qdev-dma.h"
-#include "trace.h"
+#include "hw/usb/trace.h"
 
 /* This causes frames to occur 1000x slower */
 //#define OHCI_TIME_WARP 1
@@ -937,9 +937,9 @@ static int ohci_service_iso_td(OHCIState *ohci, struct ohci_ed *ed,
 #ifdef trace_event_get_state
 static void ohci_td_pkt(const char *msg, const uint8_t *buf, size_t len)
 {
-    bool print16 = !!trace_event_get_state(common_dstate,
+    bool print16 = !!trace_event_get_state(hw_usb_dstate,
                                            TRACE_USB_OHCI_TD_PKT_SHORT);
-    bool printall = !!trace_event_get_state(common_dstate,
+    bool printall = !!trace_event_get_state(hw_usb_dstate,
                                             TRACE_USB_OHCI_TD_PKT_FULL);
     const int width = 16;
     int i;
hw/usb/hcd-uhci.c +1 -1
index ca72a80..ee7de68 100644
@@ -34,7 +34,7 @@
 #include "qemu/timer.h"
 #include "qemu/iov.h"
 #include "sysemu/dma.h"
-#include "trace.h"
+#include "hw/usb/trace.h"
 #include "qemu/main-loop.h"
 
 #define FRAME_TIMER_FREQ 1000
hw/usb/hcd-xhci.c +1 -1
index 188f954..6871b06 100644
@@ -25,7 +25,7 @@
 #include "hw/pci/pci.h"
 #include "hw/pci/msi.h"
 #include "hw/pci/msix.h"
-#include "trace.h"
+#include "hw/usb/trace.h"
 #include "qapi/error.h"
 
 //#define DEBUG_XHCI
hw/usb/host-libusb.c +1 -1
index e94672c..8dcfb83 100644
@@ -44,7 +44,7 @@
 #include "monitor/monitor.h"
 #include "qemu/error-report.h"
 #include "sysemu/sysemu.h"
-#include "trace.h"
+#include "hw/usb/trace.h"
 
 #include "hw/usb.h"
 
Signature · 1 line
2.7.4
#47 lore raw

PATCH 29/60 trace: switch hw/misc/ directory to modular trace.h file

In reply to Daniel P. Berrange

Switch files in the hw/misc/ directory to include the hw/misc/trace.h file instead of the global trace.h file.

---
 Makefile.objs             | 2 +-
 hw/misc/Makefile.objs     | 3 +++
 hw/misc/aspeed_scu.c      | 2 +-
 hw/misc/eccmemctl.c       | 2 +-
 hw/misc/milkymist-hpdmc.c | 2 +-
 hw/misc/milkymist-pfpu.c  | 2 +-
 hw/misc/slavio_misc.c     | 2 +-
 7 files changed, 9 insertions(+), 6 deletions(-)
Makefile.objs +1 -1
index 80f91ee..ec58269 100644
@@ -131,7 +131,7 @@ trace-events-subdirs += hw/intc
 trace-events-subdirs += hw/net
 trace-events-subdirs += hw/virtio
 trace-events-subdirs += hw/audio
-trace-events-y += hw/misc/trace-events
+trace-events-subdirs += hw/misc
 trace-events-y += hw/usb/trace-events
 trace-events-y += hw/scsi/trace-events
 trace-events-y += hw/nvram/trace-events
hw/misc/Makefile.objs +3 -0
index 4cfbd10..9251f6d 100644
@@ -53,3 +53,6 @@ obj-$(CONFIG_EDU) += edu.o
 obj-$(CONFIG_HYPERV_TESTDEV) += hyperv_testdev.o
 obj-$(CONFIG_AUX) += auxbus.o
 obj-$(CONFIG_ASPEED_SOC) += aspeed_scu.o
+
+trace-obj-y += trace.o
+trace-obj-$(CONFIG_TRACE_DTRACE) += trace-dtrace.o
hw/misc/aspeed_scu.c +1 -1
index c7e2c82..0adbec1 100644
@@ -16,7 +16,7 @@
 #include "qapi/visitor.h"
 #include "qemu/bitops.h"
 #include "qemu/log.h"
-#include "trace.h"
+#include "hw/misc/trace.h"
 
 #define TO_REG(offset) ((offset) >> 2)
 
hw/misc/eccmemctl.c +1 -1
index a0071f3..a0424f9 100644
@@ -24,7 +24,7 @@
 
 #include "qemu/osdep.h"
 #include "hw/sysbus.h"
-#include "trace.h"
+#include "hw/misc/trace.h"
 
 /* There are 3 versions of this chip used in SMP sun4m systems:
  * MCC (version 0, implementation 0) SS-600MP
hw/misc/milkymist-hpdmc.c +1 -1
index e6140ee..8596437 100644
@@ -24,7 +24,7 @@
 #include "qemu/osdep.h"
 #include "hw/hw.h"
 #include "hw/sysbus.h"
-#include "trace.h"
+#include "hw/misc/trace.h"
 #include "qemu/error-report.h"
 
 enum {
hw/misc/milkymist-pfpu.c +1 -1
index 1da21a6..f95e2f4 100644
@@ -25,7 +25,7 @@
 #include "qemu/osdep.h"
 #include "hw/hw.h"
 #include "hw/sysbus.h"
-#include "trace.h"
+#include "hw/misc/trace.h"
 #include "qemu/log.h"
 #include "qemu/error-report.h"
 #include <math.h>
hw/misc/slavio_misc.c +1 -1
index edd5de0..a4820c5 100644
@@ -25,7 +25,7 @@
 #include "qemu/osdep.h"
 #include "sysemu/sysemu.h"
 #include "hw/sysbus.h"
-#include "trace.h"
+#include "hw/misc/trace.h"
 
 /*
  * This is the auxio port, chip control and system control part of
Signature · 1 line
2.7.4
#49 lore raw

PATCH 31/60 trace: switch hw/scsi/ directory to modular trace.h file

In reply to Daniel P. Berrange

Switch files in the hw/scsi/ directory to include the hw/scsi/trace.h file instead of the global trace.h file.

---
 Makefile.objs         | 2 +-
 hw/scsi/Makefile.objs | 3 +++
 hw/scsi/esp-pci.c     | 2 +-
 hw/scsi/esp.c         | 2 +-
 hw/scsi/megasas.c     | 2 +-
 hw/scsi/mptconfig.c   | 2 +-
 hw/scsi/mptendian.c   | 2 +-
 hw/scsi/mptsas.c      | 2 +-
 hw/scsi/scsi-bus.c    | 2 +-
 hw/scsi/vmw_pvscsi.c  | 2 +-
 10 files changed, 12 insertions(+), 9 deletions(-)
Makefile.objs +1 -1
index e1596cb..8d7b678 100644
@@ -133,7 +133,7 @@ trace-events-subdirs += hw/virtio
 trace-events-subdirs += hw/audio
 trace-events-subdirs += hw/misc
 trace-events-subdirs += hw/usb
-trace-events-y += hw/scsi/trace-events
+trace-events-subdirs += hw/scsi
 trace-events-y += hw/nvram/trace-events
 trace-events-y += hw/display/trace-events
 trace-events-y += hw/input/trace-events
hw/scsi/Makefile.objs +3 -0
index 5a2248b..cdf229b 100644
@@ -12,3 +12,6 @@ ifeq ($(CONFIG_VIRTIO),y)
 obj-y += virtio-scsi.o virtio-scsi-dataplane.o
 obj-$(CONFIG_VHOST_SCSI) += vhost-scsi.o
 endif
+
+trace-obj-y += trace.o
+trace-obj-$(CONFIG_TRACE_DTRACE) += trace-dtrace.o
hw/scsi/esp-pci.c +1 -1
index 595f88b..1a94cb7 100644
@@ -27,7 +27,7 @@
 #include "hw/pci/pci.h"
 #include "hw/nvram/eeprom93xx.h"
 #include "hw/scsi/esp.h"
-#include "trace.h"
+#include "hw/scsi/trace.h"
 #include "qapi/error.h"
 #include "qemu/log.h"
 
hw/scsi/esp.c +1 -1
index 1f2f2d3..2a37377 100644
@@ -26,7 +26,7 @@
 #include "qemu/osdep.h"
 #include "hw/sysbus.h"
 #include "hw/scsi/esp.h"
-#include "trace.h"
+#include "hw/scsi/trace.h"
 #include "qapi/error.h"
 #include "qemu/log.h"
 
hw/scsi/megasas.c +1 -1
index e968302..8a8a59a 100644
@@ -28,7 +28,7 @@
 #include "qemu/iov.h"
 #include "hw/scsi/scsi.h"
 #include "block/scsi.h"
-#include "trace.h"
+#include "hw/scsi/trace.h"
 #include "qapi/error.h"
 #include "mfi.h"
 
hw/scsi/mptconfig.c +1 -1
index 7071854..84fa3e4 100644
@@ -22,7 +22,7 @@
 
 #include "mptsas.h"
 #include "mpi.h"
-#include "trace.h"
+#include "hw/scsi/trace.h"
 
 /* Generic functions for marshaling and unmarshaling.  */
 
hw/scsi/mptendian.c +1 -1
index b7fe2a2..1584246 100644
@@ -29,7 +29,7 @@
 #include "qemu/iov.h"
 #include "hw/scsi/scsi.h"
 #include "block/scsi.h"
-#include "trace.h"
+#include "hw/scsi/trace.h"
 
 #include "mptsas.h"
 #include "mpi.h"
hw/scsi/mptsas.c +1 -1
index 0e0a22f..ad3021d 100644
@@ -31,7 +31,7 @@
 #include "qemu/iov.h"
 #include "hw/scsi/scsi.h"
 #include "block/scsi.h"
-#include "trace.h"
+#include "hw/scsi/trace.h"
 #include "qapi/error.h"
 #include "mptsas.h"
 #include "mpi.h"
hw/scsi/scsi-bus.c +1 -1
index 297216d..e79721c 100644
@@ -7,7 +7,7 @@
 #include "hw/qdev.h"
 #include "sysemu/block-backend.h"
 #include "sysemu/blockdev.h"
-#include "trace.h"
+#include "hw/scsi/trace.h"
 #include "sysemu/dma.h"
 #include "qemu/cutils.h"
 
hw/scsi/vmw_pvscsi.c +1 -1
index 5116f4a..6309e8d 100644
@@ -31,7 +31,7 @@
 #include "block/scsi.h"
 #include "hw/pci/msi.h"
 #include "vmw_pvscsi.h"
-#include "trace.h"
+#include "hw/scsi/trace.h"
 
 
 #define PVSCSI_USE_64BIT         (true)
Signature · 1 line
2.7.4
#50 lore raw

PATCH 32/60 trace: switch hw/nvram/ directory to modular trace.h file

In reply to Daniel P. Berrange

Switch files in the hw/nvram/ directory to include the hw/nvram/trace.h file instead of the global trace.h file.

---
 Makefile.objs          | 2 +-
 hw/nvram/Makefile.objs | 2 ++
 hw/nvram/ds1225y.c     | 2 +-
 hw/nvram/fw_cfg.c      | 2 +-
 4 files changed, 5 insertions(+), 3 deletions(-)
Makefile.objs +1 -1
index 8d7b678..aca8fb0 100644
@@ -134,7 +134,7 @@ trace-events-subdirs += hw/audio
 trace-events-subdirs += hw/misc
 trace-events-subdirs += hw/usb
 trace-events-subdirs += hw/scsi
-trace-events-y += hw/nvram/trace-events
+trace-events-subdirs += hw/nvram
 trace-events-y += hw/display/trace-events
 trace-events-y += hw/input/trace-events
 trace-events-y += hw/timer/trace-events
hw/nvram/Makefile.objs +2 -0
index e9a6694..f0ca020 100644
@@ -3,3 +3,5 @@ common-obj-y += eeprom93xx.o
 common-obj-y += fw_cfg.o
 common-obj-$(CONFIG_MAC_NVRAM) += mac_nvram.o
 obj-$(CONFIG_PSERIES) += spapr_nvram.o
+trace-obj-y += trace.o
+trace-obj-$(CONFIG_TRACE_DTRACE) += trace-dtrace.o
hw/nvram/ds1225y.c +1 -1
index 57d5ab2..cb4d4cc 100644
@@ -24,7 +24,7 @@
 
 #include "qemu/osdep.h"
 #include "hw/sysbus.h"
-#include "trace.h"
+#include "hw/nvram/trace.h"
 
 typedef struct {
     MemoryRegion iomem;
hw/nvram/fw_cfg.c +1 -1
index 6a68e59..db155af 100644
@@ -30,7 +30,7 @@
 #include "hw/nvram/fw_cfg.h"
 #include "hw/sysbus.h"
 #include "hw/boards.h"
-#include "trace.h"
+#include "hw/nvram/trace.h"
 #include "qemu/error-report.h"
 #include "qemu/config-file.h"
 #include "qemu/cutils.h"
Signature · 1 line
2.7.4
#51 lore raw

PATCH 33/60 trace: switch hw/display/ directory to modular trace.h file

In reply to Daniel P. Berrange

Switch files in the hw/display/ directory to include the hw/display/trace.h file instead of the global trace.h file.

---
 Makefile.objs                | 2 +-
 hw/display/Makefile.objs     | 3 +++
 hw/display/g364fb.c          | 2 +-
 hw/display/jazz_led.c        | 2 +-
 hw/display/milkymist-tmu2.c  | 2 +-
 hw/display/milkymist-vgafb.c | 2 +-
 hw/display/qxl-render.c      | 2 +-
 hw/display/qxl.c             | 2 +-
 hw/display/vga.c             | 2 +-
 hw/display/virtio-gpu-3d.c   | 2 +-
 hw/display/virtio-gpu.c      | 2 +-
 hw/display/vmware_vga.c      | 2 +-
 hw/display/xenfb.c           | 2 +-
 13 files changed, 15 insertions(+), 12 deletions(-)
Makefile.objs +1 -1
index aca8fb0..b3978f4 100644
@@ -135,7 +135,7 @@ trace-events-subdirs += hw/misc
 trace-events-subdirs += hw/usb
 trace-events-subdirs += hw/scsi
 trace-events-subdirs += hw/nvram
-trace-events-y += hw/display/trace-events
+trace-events-subdirs += hw/display
 trace-events-y += hw/input/trace-events
 trace-events-y += hw/timer/trace-events
 trace-events-y += hw/dma/trace-events
hw/display/Makefile.objs +3 -0
index 063889b..8279083 100644
@@ -45,3 +45,6 @@ virtio-gpu-3d.o-cflags := $(VIRGL_CFLAGS)
 virtio-gpu-3d.o-libs += $(VIRGL_LIBS)
 obj-$(CONFIG_DPCD) += dpcd.o
 obj-$(CONFIG_XLNX_ZYNQMP) += xlnx_dp.o
+
+trace-obj-y += trace.o
+trace-obj-$(CONFIG_TRACE_DTRACE) += trace-dtrace.o
hw/display/g364fb.c +1 -1
index 70ef2c7..5342e07 100644
@@ -22,7 +22,7 @@
 #include "qemu/error-report.h"
 #include "ui/console.h"
 #include "ui/pixel_ops.h"
-#include "trace.h"
+#include "hw/display/trace.h"
 #include "hw/sysbus.h"
 
 typedef struct G364State {
hw/display/jazz_led.c +1 -1
index b72fdb1..a11125c 100644
@@ -26,7 +26,7 @@
 #include "qemu-common.h"
 #include "ui/console.h"
 #include "ui/pixel_ops.h"
-#include "trace.h"
+#include "hw/display/trace.h"
 #include "hw/sysbus.h"
 
 typedef enum {
hw/display/milkymist-tmu2.c +1 -1
index 9c00184..7fc6141 100644
@@ -27,7 +27,7 @@
 #include "qemu/osdep.h"
 #include "hw/hw.h"
 #include "hw/sysbus.h"
-#include "trace.h"
+#include "hw/display/trace.h"
 #include "qemu/error-report.h"
 #include "qapi/error.h"
 
hw/display/milkymist-vgafb.c +1 -1
index 177fdac..2180e6d 100644
@@ -25,7 +25,7 @@
 #include "qemu/osdep.h"
 #include "hw/hw.h"
 #include "hw/sysbus.h"
-#include "trace.h"
+#include "hw/display/trace.h"
 #include "ui/console.h"
 #include "framebuffer.h"
 #include "ui/pixel_ops.h"
hw/display/qxl-render.c +1 -1
index 9ad9d9e..d1f0db3 100644
@@ -21,7 +21,7 @@
 
 #include "qemu/osdep.h"
 #include "qxl.h"
-#include "trace.h"
+#include "hw/display/trace.h"
 
 static void qxl_blit(PCIQXLDevice *qxl, QXLRect *rect)
 {
hw/display/qxl.c +1 -1
index 0e2682d..8cc4781 100644
@@ -26,7 +26,7 @@
 #include "qemu/queue.h"
 #include "qemu/atomic.h"
 #include "sysemu/sysemu.h"
-#include "trace.h"
+#include "hw/display/trace.h"
 
 #include "qxl.h"
 
hw/display/vga.c +1 -1
index 2a88b3c..8dafd26 100644
@@ -32,7 +32,7 @@
 #include "ui/pixel_ops.h"
 #include "qemu/timer.h"
 #include "hw/xen/xen.h"
-#include "trace.h"
+#include "hw/display/trace.h"
 
 //#define DEBUG_VGA
 //#define DEBUG_VGA_MEM
hw/display/virtio-gpu-3d.c +1 -1
index 758d33a..8a3851f 100644
@@ -14,7 +14,7 @@
 #include "qemu/osdep.h"
 #include "qemu-common.h"
 #include "qemu/iov.h"
-#include "trace.h"
+#include "hw/display/trace.h"
 #include "hw/virtio/virtio.h"
 #include "hw/virtio/virtio-gpu.h"
 #include "qapi/error.h"
hw/display/virtio-gpu.c +1 -1
index 7fe6ed8..270d6f4 100644
@@ -15,7 +15,7 @@
 #include "qemu-common.h"
 #include "qemu/iov.h"
 #include "ui/console.h"
-#include "trace.h"
+#include "hw/display/trace.h"
 #include "hw/virtio/virtio.h"
 #include "hw/virtio/virtio-gpu.h"
 #include "hw/virtio/virtio-bus.h"
hw/display/vmware_vga.c +1 -1
index e51a05e..b188130 100644
@@ -25,7 +25,7 @@
 #include "qapi/error.h"
 #include "hw/hw.h"
 #include "hw/loader.h"
-#include "trace.h"
+#include "hw/display/trace.h"
 #include "ui/console.h"
 #include "ui/vnc.h"
 #include "hw/pci/pci.h"
hw/display/xenfb.c +1 -1
index 46b7d5e..0e4c335 100644
@@ -36,7 +36,7 @@
 #include <xen/io/kbdif.h>
 #include <xen/io/protocols.h>
 
-#include "trace.h"
+#include "hw/display/trace.h"
 
 #ifndef BTN_LEFT
 #define BTN_LEFT 0x110 /* from <linux/input.h> */
Signature · 1 line
2.7.4
#52 lore raw

PATCH 34/60 trace: switch hw/input/ directory to modular trace.h file

In reply to Daniel P. Berrange

Switch files in the hw/input/ directory to include the hw/input/trace.h file instead of the global trace.h file.

---
 Makefile.objs                | 2 +-
 hw/input/Makefile.objs       | 3 +++
 hw/input/hid.c               | 2 +-
 hw/input/milkymist-softusb.c | 2 +-
 hw/input/ps2.c               | 2 +-
 hw/input/virtio-input.c      | 2 +-
 6 files changed, 8 insertions(+), 5 deletions(-)
Makefile.objs +1 -1
index b3978f4..49cc98c 100644
@@ -136,7 +136,7 @@ trace-events-subdirs += hw/usb
 trace-events-subdirs += hw/scsi
 trace-events-subdirs += hw/nvram
 trace-events-subdirs += hw/display
-trace-events-y += hw/input/trace-events
+trace-events-subdirs += hw/input
 trace-events-y += hw/timer/trace-events
 trace-events-y += hw/dma/trace-events
 trace-events-y += hw/sparc/trace-events
hw/input/Makefile.objs +3 -0
index 7715d72..fc40638 100644
@@ -17,3 +17,6 @@ endif
 obj-$(CONFIG_MILKYMIST) += milkymist-softusb.o
 obj-$(CONFIG_PXA2XX) += pxa2xx_keypad.o
 obj-$(CONFIG_TSC210X) += tsc210x.o
+
+trace-obj-y += trace.o
+trace-obj-$(CONFIG_TRACE_DTRACE) += trace-dtrace.o
hw/input/hid.c +1 -1
index 5e2850e..dd9c13a 100644
@@ -27,7 +27,7 @@
 #include "ui/console.h"
 #include "qemu/timer.h"
 #include "hw/input/hid.h"
-#include "trace.h"
+#include "hw/input/trace.h"
 
 #define HID_USAGE_ERROR_ROLLOVER        0x01
 #define HID_USAGE_POSTFAIL              0x02
hw/input/milkymist-softusb.c +1 -1
index 40dfca1..41f2211 100644
@@ -25,7 +25,7 @@
 #include "qapi/error.h"
 #include "hw/hw.h"
 #include "hw/sysbus.h"
-#include "trace.h"
+#include "hw/input/trace.h"
 #include "ui/console.h"
 #include "hw/input/hid.h"
 #include "qemu/error-report.h"
hw/input/ps2.c +1 -1
index a8aa36f..c57e117 100644
@@ -28,7 +28,7 @@
 #include "ui/input.h"
 #include "sysemu/sysemu.h"
 
-#include "trace.h"
+#include "hw/input/trace.h"
 
 /* debug PC keyboard */
 //#define DEBUG_KBD
hw/input/virtio-input.c +1 -1
index ccdf730..5210f8b 100644
@@ -7,7 +7,7 @@
 #include "qemu/osdep.h"
 #include "qapi/error.h"
 #include "qemu/iov.h"
-#include "trace.h"
+#include "hw/input/trace.h"
 
 #include "hw/qdev.h"
 #include "hw/virtio/virtio.h"
Signature · 1 line
2.7.4
#53 lore raw

PATCH 35/60 trace: switch hw/timer/ directory to modular trace.h file

In reply to Daniel P. Berrange

Switch files in the hw/timer/ directory to include the hw/timer/trace.h file instead of the global trace.h file.

---
 Makefile.objs               | 2 +-
 hw/timer/Makefile.objs      | 2 ++
 hw/timer/aspeed_timer.c     | 2 +-
 hw/timer/grlib_gptimer.c    | 2 +-
 hw/timer/lm32_timer.c       | 2 +-
 hw/timer/milkymist-sysctl.c | 2 +-
 hw/timer/slavio_timer.c     | 2 +-
 7 files changed, 8 insertions(+), 6 deletions(-)
Makefile.objs +1 -1
index 49cc98c..553c738 100644
@@ -137,7 +137,7 @@ trace-events-subdirs += hw/scsi
 trace-events-subdirs += hw/nvram
 trace-events-subdirs += hw/display
 trace-events-subdirs += hw/input
-trace-events-y += hw/timer/trace-events
+trace-events-subdirs += hw/timer
 trace-events-y += hw/dma/trace-events
 trace-events-y += hw/sparc/trace-events
 trace-events-y += hw/sd/trace-events
hw/timer/Makefile.objs +2 -0
index 7ba8c23..e764fc1 100644
@@ -34,3 +34,5 @@ obj-$(CONFIG_ALLWINNER_A10_PIT) += allwinner-a10-pit.o
 
 common-obj-$(CONFIG_STM32F2XX_TIMER) += stm32f2xx_timer.o
 common-obj-$(CONFIG_ASPEED_SOC) += aspeed_timer.o
+trace-obj-y += trace.o
+trace-obj-$(CONFIG_TRACE_DTRACE) += trace-dtrace.o
hw/timer/aspeed_timer.c +1 -1
index 9b70ee0..081e160 100644
@@ -16,7 +16,7 @@
 #include "qemu/bitops.h"
 #include "qemu/timer.h"
 #include "qemu/log.h"
-#include "trace.h"
+#include "hw/timer/trace.h"
 
 #define TIMER_NR_REGS 4
 
hw/timer/grlib_gptimer.c +1 -1
index dd000f5..cb0f13e 100644
@@ -29,7 +29,7 @@
 #include "qemu/timer.h"
 #include "qemu/main-loop.h"
 
-#include "trace.h"
+#include "hw/timer/trace.h"
 
 #define UNIT_REG_SIZE    16     /* Size of memory mapped regs for the unit */
 #define GPTIMER_REG_SIZE 16     /* Size of memory mapped regs for a GPTimer */
hw/timer/lm32_timer.c +1 -1
index e45a65b..c6c0d95 100644
@@ -24,7 +24,7 @@
 #include "qemu/osdep.h"
 #include "hw/hw.h"
 #include "hw/sysbus.h"
-#include "trace.h"
+#include "hw/timer/trace.h"
 #include "qemu/timer.h"
 #include "hw/ptimer.h"
 #include "qemu/error-report.h"
hw/timer/milkymist-sysctl.c +1 -1
index 2194832..789c11c 100644
@@ -25,7 +25,7 @@
 #include "hw/hw.h"
 #include "hw/sysbus.h"
 #include "sysemu/sysemu.h"
-#include "trace.h"
+#include "hw/timer/trace.h"
 #include "qemu/timer.h"
 #include "hw/ptimer.h"
 #include "qemu/error-report.h"
hw/timer/slavio_timer.c +1 -1
index fb3e08b..afc44f6 100644
@@ -27,7 +27,7 @@
 #include "qemu/timer.h"
 #include "hw/ptimer.h"
 #include "hw/sysbus.h"
-#include "trace.h"
+#include "hw/timer/trace.h"
 #include "qemu/main-loop.h"
 
 /*
Signature · 1 line
2.7.4
#55 lore raw

PATCH 37/60 trace: switch hw/sparc/ directory to modular trace.h file

In reply to Daniel P. Berrange

Switch files in the hw/sparc/ directory to include the hw/sparc/trace.h file instead of the global trace.h file.

---
 Makefile.objs          | 2 +-
 hw/sparc/Makefile.objs | 2 ++
 hw/sparc/leon3.c       | 2 +-
 hw/sparc/sun4m.c       | 2 +-
 4 files changed, 5 insertions(+), 3 deletions(-)
Makefile.objs +1 -1
index ce8d111..83e9506 100644
@@ -139,7 +139,7 @@ trace-events-subdirs += hw/display
 trace-events-subdirs += hw/input
 trace-events-subdirs += hw/timer
 trace-events-subdirs += hw/dma
-trace-events-y += hw/sparc/trace-events
+trace-events-subdirs += hw/sparc
 trace-events-y += hw/sd/trace-events
 trace-events-y += hw/isa/trace-events
 trace-events-y += hw/mem/trace-events
hw/sparc/Makefile.objs +2 -0
index c987b5b..f509dc7 100644
@@ -1 +1,3 @@
 obj-y += sun4m.o leon3.o
+trace-obj-y += trace.o
+trace-obj-$(CONFIG_TRACE_DTRACE) += trace-dtrace.o
hw/sparc/leon3.c +1 -1
index 6e16478..2cc29d4 100644
@@ -34,7 +34,7 @@
 #include "hw/boards.h"
 #include "hw/loader.h"
 #include "elf.h"
-#include "trace.h"
+#include "hw/sparc/trace.h"
 #include "exec/address-spaces.h"
 
 #include "hw/sparc/grlib.h"
hw/sparc/sun4m.c +1 -1
index 478fda8..ac7228f 100644
@@ -45,7 +45,7 @@
 #include "hw/loader.h"
 #include "elf.h"
 #include "sysemu/block-backend.h"
-#include "trace.h"
+#include "hw/sparc/trace.h"
 #include "qemu/cutils.h"
 
 /*
Signature · 1 line
2.7.4
#56 lore raw

PATCH 38/60 trace: switch hw/sd/ directory to modular trace.h file

In reply to Daniel P. Berrange

Switch files in the hw/sd/ directory to include the hw/sd/trace.h file instead of the global trace.h file.

---
 Makefile.objs             | 2 +-
 hw/sd/Makefile.objs       | 2 ++
 hw/sd/milkymist-memcard.c | 2 +-
 3 files changed, 4 insertions(+), 2 deletions(-)
Makefile.objs +1 -1
index 83e9506..af169ff 100644
@@ -140,7 +140,7 @@ trace-events-subdirs += hw/input
 trace-events-subdirs += hw/timer
 trace-events-subdirs += hw/dma
 trace-events-subdirs += hw/sparc
-trace-events-y += hw/sd/trace-events
+trace-events-subdirs += hw/sd
 trace-events-y += hw/isa/trace-events
 trace-events-y += hw/mem/trace-events
 trace-events-y += hw/i386/trace-events
hw/sd/Makefile.objs +2 -0
index 31c8330..9fe778a 100644
@@ -6,3 +6,5 @@ common-obj-$(CONFIG_SDHCI) += sdhci.o
 obj-$(CONFIG_MILKYMIST) += milkymist-memcard.o
 obj-$(CONFIG_OMAP) += omap_mmc.o
 obj-$(CONFIG_PXA2XX) += pxa2xx_mmci.o
+trace-obj-y += trace.o
+trace-obj-$(CONFIG_TRACE_DTRACE) += trace-dtrace.o
hw/sd/milkymist-memcard.c +1 -1
index 1f2f0ed..ce93fc2 100644
@@ -25,7 +25,7 @@
 #include "hw/hw.h"
 #include "hw/sysbus.h"
 #include "sysemu/sysemu.h"
-#include "trace.h"
+#include "hw/sd/trace.h"
 #include "qemu/error-report.h"
 #include "sysemu/block-backend.h"
 #include "sysemu/blockdev.h"
Signature · 1 line
2.7.4
#57 lore raw

PATCH 39/60 trace: switch hw/isa/ directory to modular trace.h file

In reply to Daniel P. Berrange

Switch files in the hw/isa/ directory to include the hw/isa/trace.h file instead of the global trace.h file.

---
 Makefile.objs        | 2 +-
 hw/isa/Makefile.objs | 2 ++
 hw/isa/pc87312.c     | 2 +-
 3 files changed, 4 insertions(+), 2 deletions(-)
Makefile.objs +1 -1
index af169ff..14c7df1 100644
@@ -141,7 +141,7 @@ trace-events-subdirs += hw/timer
 trace-events-subdirs += hw/dma
 trace-events-subdirs += hw/sparc
 trace-events-subdirs += hw/sd
-trace-events-y += hw/isa/trace-events
+trace-events-subdirs += hw/isa
 trace-events-y += hw/mem/trace-events
 trace-events-y += hw/i386/trace-events
 trace-events-y += hw/9pfs/trace-events
hw/isa/Makefile.objs +2 -0
index 9164556..a273afd 100644
@@ -6,3 +6,5 @@ common-obj-$(CONFIG_PIIX4) += piix4.o
 common-obj-$(CONFIG_VT82C686) += vt82c686.o
 
 obj-$(CONFIG_LPC_ICH9) += lpc_ich9.o
+trace-obj-y += trace.o
+trace-obj-$(CONFIG_TRACE_DTRACE) += trace-dtrace.o
hw/isa/pc87312.c +1 -1
index c3ebf3e..6f2a187 100644
@@ -31,7 +31,7 @@
 #include "sysemu/blockdev.h"
 #include "sysemu/sysemu.h"
 #include "sysemu/char.h"
-#include "trace.h"
+#include "hw/isa/trace.h"
 
 
 #define REG_FER 0
Signature · 1 line
2.7.4
#58 lore raw

PATCH 40/60 trace: switch hw/mem/ directory to modular trace.h file

In reply to Daniel P. Berrange

Switch files in the hw/mem/ directory to include the hw/mem/trace.h file instead of the global trace.h file.

---
 Makefile.objs        | 2 +-
 hw/mem/Makefile.objs | 3 +++
 hw/mem/pc-dimm.c     | 2 +-
 3 files changed, 5 insertions(+), 2 deletions(-)
Makefile.objs +1 -1
index 14c7df1..af4fea7 100644
@@ -142,7 +142,7 @@ trace-events-subdirs += hw/dma
 trace-events-subdirs += hw/sparc
 trace-events-subdirs += hw/sd
 trace-events-subdirs += hw/isa
-trace-events-y += hw/mem/trace-events
+trace-events-subdirs += hw/mem
 trace-events-y += hw/i386/trace-events
 trace-events-y += hw/9pfs/trace-events
 trace-events-y += hw/ppc/trace-events
hw/mem/Makefile.objs +3 -0
index f12f8b9..ae1f513 100644
@@ -1,2 +1,5 @@
 common-obj-$(CONFIG_MEM_HOTPLUG) += pc-dimm.o
 common-obj-$(CONFIG_NVDIMM) += nvdimm.o
+
+trace-obj-y += trace.o
+trace-obj-$(CONFIG_TRACE_DTRACE) += trace-dtrace.o
hw/mem/pc-dimm.c +1 -1
index 9e8dab0..bcbaa32 100644
@@ -26,7 +26,7 @@
 #include "qemu/range.h"
 #include "sysemu/numa.h"
 #include "sysemu/kvm.h"
-#include "trace.h"
+#include "hw/mem/trace.h"
 #include "hw/virtio/vhost.h"
 
 typedef struct pc_dimms_capacity {
Signature · 1 line
2.7.4
#59 lore raw

PATCH 41/60 trace: switch hw/i386/ directory to modular trace.h file

In reply to Daniel P. Berrange

Switch files in the hw/i386/ directory to include the hw/i386/trace.h file instead of the global trace.h file.

---
 Makefile.objs              | 2 +-
 hw/i386/Makefile.objs      | 2 ++
 hw/i386/x86-iommu.c        | 2 +-
 hw/i386/xen/xen_platform.c | 1 +
 hw/i386/xen/xen_pvdevice.c | 1 +
 5 files changed, 6 insertions(+), 2 deletions(-)
Makefile.objs +1 -1
index af4fea7..1dc55aa 100644
@@ -143,7 +143,7 @@ trace-events-subdirs += hw/sparc
 trace-events-subdirs += hw/sd
 trace-events-subdirs += hw/isa
 trace-events-subdirs += hw/mem
-trace-events-y += hw/i386/trace-events
+trace-events-subdirs += hw/i386
 trace-events-y += hw/9pfs/trace-events
 trace-events-y += hw/ppc/trace-events
 trace-events-y += hw/pci/trace-events
hw/i386/Makefile.objs +2 -0
index 90e94ff..ffbbb6c 100644
@@ -8,3 +8,5 @@ obj-$(CONFIG_XEN) += ../xenpv/ xen/
 obj-y += kvmvapic.o
 obj-y += acpi-build.o
 obj-y += pci-assign-load-rom.o
+trace-obj-y += trace.o
+trace-obj-$(CONFIG_TRACE_DTRACE) += trace-dtrace.o
hw/i386/x86-iommu.c +1 -1
index ce26b2a..af486ce 100644
@@ -22,7 +22,7 @@
 #include "hw/boards.h"
 #include "hw/i386/x86-iommu.h"
 #include "qemu/error-report.h"
-#include "trace.h"
+#include "hw/i386/trace.h"
 
 void x86_iommu_iec_register_notifier(X86IOMMUState *iommu,
                                      iec_notify_fn fn, void *data)
hw/i386/xen/xen_platform.c +1 -0
index aa78393..88ea922 100644
@@ -33,6 +33,7 @@
 #include "hw/xen/xen_common.h"
 #include "hw/xen/xen_backend.h"
 #include "trace.h"
+#include "hw/i386/trace.h"
 #include "exec/address-spaces.h"
 #include "sysemu/block-backend.h"
 #include "qemu/error-report.h"
hw/i386/xen/xen_pvdevice.c +1 -0
index c093b34..742a3d9 100644
@@ -34,6 +34,7 @@
 #include "hw/hw.h"
 #include "hw/pci/pci.h"
 #include "trace.h"
+#include "hw/i386/trace.h"
 
 #define TYPE_XEN_PV_DEVICE  "xen-pvdevice"
 
Signature · 1 line
2.7.4
#54 lore raw

PATCH 36/60 trace: switch hw/dma/ directory to modular trace.h file

In reply to Daniel P. Berrange

Switch files in the hw/dma/ directory to include the hw/dma/trace.h file instead of the global trace.h file.

---
 Makefile.objs        | 2 +-
 hw/dma/Makefile.objs | 2 ++
 hw/dma/i8257.c       | 2 +-
 hw/dma/rc4030.c      | 2 +-
 hw/dma/sparc32_dma.c | 2 +-
 hw/dma/sun4m_iommu.c | 2 +-
 6 files changed, 7 insertions(+), 5 deletions(-)
Makefile.objs +1 -1
index 553c738..ce8d111 100644
@@ -138,7 +138,7 @@ trace-events-subdirs += hw/nvram
 trace-events-subdirs += hw/display
 trace-events-subdirs += hw/input
 trace-events-subdirs += hw/timer
-trace-events-y += hw/dma/trace-events
+trace-events-subdirs += hw/dma
 trace-events-y += hw/sparc/trace-events
 trace-events-y += hw/sd/trace-events
 trace-events-y += hw/isa/trace-events
hw/dma/Makefile.objs +2 -0
index 087c8e6..c3f6aae 100644
@@ -14,3 +14,5 @@ obj-$(CONFIG_XLNX_ZYNQMP) += xlnx_dpdma.o
 obj-$(CONFIG_OMAP) += omap_dma.o soc_dma.o
 obj-$(CONFIG_PXA2XX) += pxa2xx_dma.o
 obj-$(CONFIG_RASPI) += bcm2835_dma.o
+trace-obj-y += trace.o
+trace-obj-$(CONFIG_TRACE_DTRACE) += trace-dtrace.o
hw/dma/i8257.c +1 -1
index f345c54..fd89223 100644
@@ -26,7 +26,7 @@
 #include "hw/isa/isa.h"
 #include "hw/isa/i8257.h"
 #include "qemu/main-loop.h"
-#include "trace.h"
+#include "hw/dma/trace.h"
 
 #define I8257(obj) \
     OBJECT_CHECK(I8257State, (obj), TYPE_I8257)
hw/dma/rc4030.c +1 -1
index 2f2576f..088cbb5 100644
@@ -29,7 +29,7 @@
 #include "qemu/timer.h"
 #include "qemu/log.h"
 #include "exec/address-spaces.h"
-#include "trace.h"
+#include "hw/dma/trace.h"
 
 /********************************************************/
 /* rc4030 emulation                                     */
hw/dma/sparc32_dma.c +1 -1
index 9d545e4..fc2cc94 100644
@@ -30,7 +30,7 @@
 #include "hw/sparc/sparc32_dma.h"
 #include "hw/sparc/sun4m.h"
 #include "hw/sysbus.h"
-#include "trace.h"
+#include "hw/dma/trace.h"
 
 /*
  * This is the DMA controller part of chip STP2000 (Master I/O), also
hw/dma/sun4m_iommu.c +1 -1
index b3cbc54..b7bd15e 100644
@@ -26,7 +26,7 @@
 #include "hw/sparc/sun4m.h"
 #include "hw/sysbus.h"
 #include "exec/address-spaces.h"
-#include "trace.h"
+#include "hw/dma/trace.h"
 
 /*
  * I/O MMU used by Sun4m systems
Signature · 1 line
2.7.4
#61 lore raw

PATCH 43/60 trace: switch hw/ppc/ directory to modular trace.h file

In reply to Daniel P. Berrange

Switch files in the hw/ppc/ directory to include the hw/ppc/trace.h file instead of the global trace.h file.

---
 Makefile.objs           | 2 +-
 hw/ppc/Makefile.objs    | 3 +++
 hw/ppc/ppc.c            | 2 +-
 hw/ppc/prep.c           | 2 +-
 hw/ppc/spapr.c          | 2 +-
 hw/ppc/spapr_hcall.c    | 2 +-
 hw/ppc/spapr_iommu.c    | 2 +-
 hw/ppc/spapr_pci.c      | 2 +-
 hw/ppc/spapr_rtas_ddw.c | 2 +-
 9 files changed, 11 insertions(+), 8 deletions(-)
Makefile.objs +1 -1
index 4734bac..0458667 100644
@@ -145,7 +145,7 @@ trace-events-subdirs += hw/isa
 trace-events-subdirs += hw/mem
 trace-events-subdirs += hw/i386
 trace-events-subdirs += hw/9pfs
-trace-events-y += hw/ppc/trace-events
+trace-events-subdirs += hw/ppc
 trace-events-y += hw/pci/trace-events
 trace-events-y += hw/s390x/trace-events
 trace-events-y += hw/vfio/trace-events
hw/ppc/Makefile.objs +3 -0
index 91a3420..8cf7759 100644
@@ -23,3 +23,6 @@ obj-$(CONFIG_E500) += e500.o mpc8544ds.o e500plat.o
 obj-$(CONFIG_E500) += mpc8544_guts.o ppce500_spin.o
 # PowerPC 440 Xilinx ML507 reference board.
 obj-$(CONFIG_XILINX) += virtex_ml507.o
+
+common-obj-y += trace.o
+common-obj-$(CONFIG_TRACE_DTRACE) += trace-dtrace.o
hw/ppc/ppc.c +1 -1
index e425252..1816fac 100644
@@ -36,7 +36,7 @@
 #include "hw/loader.h"
 #include "sysemu/kvm.h"
 #include "kvm_ppc.h"
-#include "trace.h"
+#include "hw/ppc/trace.h"
 
 //#define PPC_DEBUG_IRQ
 //#define PPC_DEBUG_TB
hw/ppc/prep.c +1 -1
index 054af1e..c5c97b1 100644
@@ -45,7 +45,7 @@
 #include "sysemu/arch_init.h"
 #include "sysemu/qtest.h"
 #include "exec/address-spaces.h"
-#include "trace.h"
+#include "hw/ppc/trace.h"
 #include "elf.h"
 #include "qemu/cutils.h"
 
hw/ppc/spapr.c +1 -1
index 57564e5..4236315 100644
@@ -61,7 +61,7 @@
 #include "hw/usb.h"
 #include "qemu/config-file.h"
 #include "qemu/error-report.h"
-#include "trace.h"
+#include "hw/ppc/trace.h"
 #include "hw/nmi.h"
 
 #include "hw/compat.h"
hw/ppc/spapr_hcall.c +1 -1
index 73af112..6d277b6 100644
@@ -8,7 +8,7 @@
 #include "hw/ppc/spapr.h"
 #include "mmu-hash64.h"
 #include "cpu-models.h"
-#include "trace.h"
+#include "hw/ppc/trace.h"
 #include "sysemu/kvm.h"
 #include "kvm_ppc.h"
 
hw/ppc/spapr_iommu.c +1 -1
index 6bc4d4d..e8e7900 100644
@@ -25,7 +25,7 @@
 #include "kvm_ppc.h"
 #include "sysemu/dma.h"
 #include "exec/address-spaces.h"
-#include "trace.h"
+#include "hw/ppc/trace.h"
 
 #include "hw/ppc/spapr.h"
 #include "hw/ppc/spapr_vio.h"
hw/ppc/spapr_pci.c +1 -1
index 949c44f..598a79c 100644
@@ -37,7 +37,7 @@
 #include "exec/address-spaces.h"
 #include "exec/ram_addr.h"
 #include <libfdt.h>
-#include "trace.h"
+#include "hw/ppc/trace.h"
 #include "qemu/error-report.h"
 #include "qapi/qmp/qerror.h"
 
hw/ppc/spapr_rtas_ddw.c +1 -1
index 177dcff..3dad98c 100644
@@ -22,7 +22,7 @@
 #include "qemu/error-report.h"
 #include "hw/ppc/spapr.h"
 #include "hw/pci-host/spapr.h"
-#include "trace.h"
+#include "hw/ppc/trace.h"
 
 static int spapr_phb_get_active_win_num_cb(Object *child, void *opaque)
 {
Signature · 1 line
2.7.4
#60 lore raw

PATCH 42/60 trace: switch hw/9pfs/ directory to modular trace.h file

In reply to Daniel P. Berrange

Switch files in the hw/9pfs/ directory to include the hw/9pfs/trace.h file instead of the global trace.h file.

---
 Makefile.objs         | 2 +-
 hw/9pfs/9p.c          | 2 +-
 hw/9pfs/Makefile.objs | 2 ++
 3 files changed, 4 insertions(+), 2 deletions(-)
Makefile.objs +1 -1
index 1dc55aa..4734bac 100644
@@ -144,7 +144,7 @@ trace-events-subdirs += hw/sd
 trace-events-subdirs += hw/isa
 trace-events-subdirs += hw/mem
 trace-events-subdirs += hw/i386
-trace-events-y += hw/9pfs/trace-events
+trace-events-subdirs += hw/9pfs
 trace-events-y += hw/ppc/trace-events
 trace-events-y += hw/pci/trace-events
 trace-events-y += hw/s390x/trace-events
hw/9pfs/9p.c +1 -1
index b6b02b4..2531c82 100644
@@ -21,7 +21,7 @@
 #include "fsdev/qemu-fsdev.h"
 #include "9p-xattr.h"
 #include "coth.h"
-#include "trace.h"
+#include "hw/9pfs/trace.h"
 #include "migration/migration.h"
 
 int open_fd_hw;
hw/9pfs/Makefile.objs +2 -0
index da0ae0c..28eb2e5 100644
@@ -7,3 +7,5 @@ common-obj-$(CONFIG_OPEN_BY_HANDLE) +=  9p-handle.o
 common-obj-y += 9p-proxy.o
 
 obj-y += virtio-9p-device.o
+trace-obj-y += trace.o
+trace-obj-$(CONFIG_TRACE_DTRACE) += trace-dtrace.o
Signature · 1 line
2.7.4
#62 lore raw

PATCH 44/60 trace: switch hw/pci/ directory to modular trace.h file

In reply to Daniel P. Berrange

Switch files in the hw/pci/ directory to include the hw/pci/trace.h file instead of the global trace.h file.

---
 Makefile.objs        | 2 +-
 hw/pci/Makefile.objs | 2 ++
 hw/pci/pci.c         | 2 +-
 hw/pci/pci_host.c    | 2 +-
 hw/ppc/Makefile.objs | 4 ++--
 5 files changed, 7 insertions(+), 5 deletions(-)
Makefile.objs +1 -1
index 0458667..d63efb2 100644
@@ -146,7 +146,7 @@ trace-events-subdirs += hw/mem
 trace-events-subdirs += hw/i386
 trace-events-subdirs += hw/9pfs
 trace-events-subdirs += hw/ppc
-trace-events-y += hw/pci/trace-events
+trace-events-subdirs += hw/pci
 trace-events-y += hw/s390x/trace-events
 trace-events-y += hw/vfio/trace-events
 trace-events-y += hw/acpi/trace-events
hw/pci/Makefile.objs +2 -0
index 9f905e6..b075774 100644
@@ -7,3 +7,5 @@ common-obj-$(CONFIG_PCI) += pcie.o pcie_aer.o pcie_port.o
 
 common-obj-$(call lnot,$(CONFIG_PCI)) += pci-stub.o
 common-obj-$(CONFIG_ALL) += pci-stub.o
+trace-obj-y += trace.o
+trace-obj-$(CONFIG_TRACE_DTRACE) += trace-dtrace.o
hw/pci/pci.c +1 -1
index 24fae16..8c1c7b9 100644
@@ -34,7 +34,7 @@
 #include "qemu/error-report.h"
 #include "qemu/range.h"
 #include "qmp-commands.h"
-#include "trace.h"
+#include "hw/pci/trace.h"
 #include "hw/pci/msi.h"
 #include "hw/pci/msix.h"
 #include "exec/address-spaces.h"
hw/pci/pci_host.c +1 -1
index 5eaa935..2ecf5b9 100644
@@ -22,7 +22,7 @@
 #include "hw/pci/pci.h"
 #include "hw/pci/pci_host.h"
 #include "hw/pci/pci_bus.h"
-#include "trace.h"
+#include "hw/pci/trace.h"
 
 /* debug PCI */
 //#define DEBUG_PCI
hw/ppc/Makefile.objs +2 -2
index 8cf7759..39bc56f 100644
@@ -24,5 +24,5 @@ obj-$(CONFIG_E500) += mpc8544_guts.o ppce500_spin.o
 # PowerPC 440 Xilinx ML507 reference board.
 obj-$(CONFIG_XILINX) += virtex_ml507.o
 
-common-obj-y += trace.o
-common-obj-$(CONFIG_TRACE_DTRACE) += trace-dtrace.o
+trace-obj-y += trace.o
+trace-obj-$(CONFIG_TRACE_DTRACE) += trace-dtrace.o
Signature · 1 line
2.7.4
#63 lore raw

PATCH 45/60 trace: switch hw/s390x/ directory to modular trace.h file

In reply to Daniel P. Berrange

Switch files in the hw/s390x/ directory to include the hw/s390x/trace.h file instead of the global trace.h file.

---
 Makefile.objs          | 2 +-
 hw/s390x/Makefile.objs | 3 +++
 hw/s390x/css.c         | 2 +-
 hw/s390x/virtio-ccw.c  | 2 +-
 4 files changed, 6 insertions(+), 3 deletions(-)
Makefile.objs +1 -1
index d63efb2..296c824 100644
@@ -147,7 +147,7 @@ trace-events-subdirs += hw/i386
 trace-events-subdirs += hw/9pfs
 trace-events-subdirs += hw/ppc
 trace-events-subdirs += hw/pci
-trace-events-y += hw/s390x/trace-events
+trace-events-subdirs += hw/s390x
 trace-events-y += hw/vfio/trace-events
 trace-events-y += hw/acpi/trace-events
 trace-events-y += hw/arm/trace-events
hw/s390x/Makefile.objs +3 -0
index 41ac4ec..ac66483 100644
@@ -13,3 +13,6 @@ obj-y += ccw-device.o
 obj-y += s390-pci-bus.o s390-pci-inst.o
 obj-y += s390-skeys.o
 obj-$(CONFIG_KVM) += s390-skeys-kvm.o
+
+trace-obj-y += trace.o
+trace-obj-$(CONFIG_TRACE_DTRACE) += trace-dtrace.o
hw/s390x/css.c +1 -1
index bb8e4be..c0c3c48 100644
@@ -18,7 +18,7 @@
 #include "cpu.h"
 #include "hw/s390x/ioinst.h"
 #include "hw/s390x/css.h"
-#include "trace.h"
+#include "hw/s390x/trace.h"
 #include "hw/s390x/s390_flic.h"
 
 typedef struct CrwContainer {
hw/s390x/virtio-ccw.c +1 -1
index a554a24..e489277 100644
@@ -32,7 +32,7 @@
 #include "hw/s390x/ioinst.h"
 #include "hw/s390x/css.h"
 #include "virtio-ccw.h"
-#include "trace.h"
+#include "hw/s390x/trace.h"
 #include "hw/s390x/css-bridge.h"
 
 static void virtio_ccw_bus_new(VirtioBusState *bus, size_t bus_size,
Signature · 1 line
2.7.4
#64 lore raw

PATCH 46/60 trace: switch hw/vfio/ directory to modular trace.h file

In reply to Daniel P. Berrange

Switch files in the hw/vfio/ directory to include the hw/vfio/trace.h file instead of the global trace.h file.

---
 Makefile.objs         | 2 +-
 hw/vfio/Makefile.objs | 2 ++
 hw/vfio/common.c      | 2 +-
 hw/vfio/pci-quirks.c  | 2 +-
 hw/vfio/pci.c         | 2 +-
 hw/vfio/platform.c    | 2 +-
 hw/vfio/spapr.c       | 2 +-
 7 files changed, 8 insertions(+), 6 deletions(-)
Makefile.objs +1 -1
index 296c824..19645ec 100644
@@ -148,7 +148,7 @@ trace-events-subdirs += hw/9pfs
 trace-events-subdirs += hw/ppc
 trace-events-subdirs += hw/pci
 trace-events-subdirs += hw/s390x
-trace-events-y += hw/vfio/trace-events
+trace-events-subdirs += hw/vfio
 trace-events-y += hw/acpi/trace-events
 trace-events-y += hw/arm/trace-events
 trace-events-y += hw/alpha/trace-events
hw/vfio/Makefile.objs +2 -0
index c25e32b..33f7d4f 100644
@@ -5,4 +5,6 @@ obj-$(CONFIG_SOFTMMU) += platform.o
 obj-$(CONFIG_SOFTMMU) += calxeda-xgmac.o
 obj-$(CONFIG_SOFTMMU) += amd-xgbe.o
 obj-$(CONFIG_SOFTMMU) += spapr.o
+trace-obj-y += trace.o
+trace-obj-$(CONFIG_TRACE_DTRACE) += trace-dtrace.o
 endif
hw/vfio/common.c +1 -1
index b313e7c..5092def 100644
@@ -33,7 +33,7 @@
 #include "qemu/error-report.h"
 #include "qemu/range.h"
 #include "sysemu/kvm.h"
-#include "trace.h"
+#include "hw/vfio/trace.h"
 
 struct vfio_group_head vfio_group_list =
     QLIST_HEAD_INITIALIZER(vfio_group_list);
hw/vfio/pci-quirks.c +1 -1
index bec694c..72acb72 100644
@@ -16,7 +16,7 @@
 #include "qapi/error.h"
 #include "hw/nvram/fw_cfg.h"
 #include "pci.h"
-#include "trace.h"
+#include "hw/vfio/trace.h"
 
 /* Use uin32_t for vendor & device so PCI_ANY_ID expands and cannot match hw */
 static bool vfio_pci_is(VFIOPCIDevice *vdev, uint32_t vendor, uint32_t device)
hw/vfio/pci.c +1 -1
index 7bfa17c..e9d0fc9 100644
@@ -30,7 +30,7 @@
 #include "sysemu/kvm.h"
 #include "sysemu/sysemu.h"
 #include "pci.h"
-#include "trace.h"
+#include "hw/vfio/trace.h"
 #include "qapi/error.h"
 
 #define MSIX_CAP_LENGTH 12
hw/vfio/platform.c +1 -1
index a559e7b..5ddfb30 100644
@@ -26,7 +26,7 @@
 #include "exec/memory.h"
 #include "qemu/queue.h"
 #include "hw/sysbus.h"
-#include "trace.h"
+#include "hw/vfio/trace.h"
 #include "hw/platform-bus.h"
 #include "sysemu/kvm.h"
 
hw/vfio/spapr.c +1 -1
index 7443d34..b1b9895 100644
@@ -16,7 +16,7 @@
 #include "hw/vfio/vfio-common.h"
 #include "hw/hw.h"
 #include "qemu/error-report.h"
-#include "trace.h"
+#include "hw/vfio/trace.h"
 
 static bool vfio_prereg_listener_skipped_section(MemoryRegionSection *section)
 {
Signature · 1 line
2.7.4
#66 lore raw

PATCH 48/60 trace: switch hw/arm/ directory to modular trace.h file

In reply to Daniel P. Berrange

Switch files in the hw/arm/ directory to include the hw/arm/trace.h file instead of the global trace.h file.

---
 Makefile.objs            | 2 +-
 hw/arm/Makefile.objs     | 2 ++
 hw/arm/virt-acpi-build.c | 2 +-
 3 files changed, 4 insertions(+), 2 deletions(-)
Makefile.objs +1 -1
index 1cbd038..fbcf040 100644
@@ -150,7 +150,7 @@ trace-events-subdirs += hw/pci
 trace-events-subdirs += hw/s390x
 trace-events-subdirs += hw/vfio
 trace-events-subdirs += hw/acpi
-trace-events-y += hw/arm/trace-events
+trace-events-subdirs += hw/arm
 trace-events-y += hw/alpha/trace-events
 trace-events-y += ui/trace-events
 trace-events-y += audio/trace-events
hw/arm/Makefile.objs +2 -0
index 12764ef..ac9fa9a 100644
@@ -18,3 +18,5 @@ obj-$(CONFIG_FSL_IMX25) += fsl-imx25.o imx25_pdk.o
 obj-$(CONFIG_FSL_IMX31) += fsl-imx31.o kzm.o
 obj-$(CONFIG_FSL_IMX6) += fsl-imx6.o sabrelite.o
 obj-$(CONFIG_ASPEED_SOC) += ast2400.o palmetto-bmc.o
+trace-obj-y += trace.o
+trace-obj-$(CONFIG_TRACE_DTRACE) += trace-dtrace.o
hw/arm/virt-acpi-build.c +1 -1
index 28fc59c..775be61 100644
@@ -31,7 +31,7 @@
 #include "qemu-common.h"
 #include "hw/arm/virt-acpi-build.h"
 #include "qemu/bitmap.h"
-#include "trace.h"
+#include "hw/arm/trace.h"
 #include "qom/cpu.h"
 #include "target-arm/cpu.h"
 #include "hw/acpi/acpi-defs.h"
Signature · 1 line
2.7.4
#65 lore raw

PATCH 47/60 trace: switch hw/acpi/ directory to modular trace.h file

In reply to Daniel P. Berrange

Switch files in the hw/acpi/ directory to include the hw/acpi/trace.h file instead of the global trace.h file.

---
 Makefile.objs            | 2 +-
 hw/acpi/Makefile.objs    | 2 ++
 hw/acpi/cpu.c            | 2 +-
 hw/acpi/memory_hotplug.c | 2 +-
 4 files changed, 5 insertions(+), 3 deletions(-)
Makefile.objs +1 -1
index 19645ec..1cbd038 100644
@@ -149,7 +149,7 @@ trace-events-subdirs += hw/ppc
 trace-events-subdirs += hw/pci
 trace-events-subdirs += hw/s390x
 trace-events-subdirs += hw/vfio
-trace-events-y += hw/acpi/trace-events
+trace-events-subdirs += hw/acpi
 trace-events-y += hw/arm/trace-events
 trace-events-y += hw/alpha/trace-events
 trace-events-y += ui/trace-events
hw/acpi/Makefile.objs +2 -0
index 4b7da66..d2744a4 100644
@@ -8,3 +8,5 @@ common-obj-$(CONFIG_ACPI) += acpi_interface.o
 common-obj-$(CONFIG_ACPI) += bios-linker-loader.o
 common-obj-$(CONFIG_ACPI) += aml-build.o
 common-obj-$(call land,$(CONFIG_ACPI),$(CONFIG_IPMI)) += ipmi.o
+trace-obj-y += trace.o
+trace-obj-$(CONFIG_TRACE_DTRACE) += trace-dtrace.o
hw/acpi/cpu.c +1 -1
index c13b65c..a33efaf 100644
@@ -3,7 +3,7 @@
 #include "hw/acpi/cpu.h"
 #include "qapi/error.h"
 #include "qapi-event.h"
-#include "trace.h"
+#include "hw/acpi/trace.h"
 
 #define ACPI_CPU_HOTPLUG_REG_LEN 12
 #define ACPI_CPU_SELECTOR_OFFSET_WR 0
hw/acpi/memory_hotplug.c +1 -1
index ec4e64b..e442970 100644
@@ -4,7 +4,7 @@
 #include "hw/mem/pc-dimm.h"
 #include "hw/boards.h"
 #include "hw/qdev-core.h"
-#include "trace.h"
+#include "hw/acpi/trace.h"
 #include "qapi-event.h"
 
 static ACPIOSTInfo *acpi_memory_device_status(int slot, MemStatus *mdev)
Signature · 1 line
2.7.4
#68 lore raw

PATCH 50/60 trace: switch ui/ directory to modular trace.h file

In reply to Daniel P. Berrange

Switch files in the ui/ directory to include the
ui/trace.h file instead of the global trace.h
file.

---
 Makefile.objs      | 2 +-
 ui/Makefile.objs   | 3 +++
 ui/console.c       | 2 +-
 ui/gtk-egl.c       | 2 +-
 ui/gtk-gl-area.c   | 2 +-
 ui/gtk.c           | 2 +-
 ui/input.c         | 2 +-
 ui/spice-display.c | 2 +-
 ui/vnc.c           | 2 +-
 9 files changed, 11 insertions(+), 8 deletions(-)
Makefile.objs +1 -1
index 510083c..b81db74 100644
@@ -152,7 +152,7 @@ trace-events-subdirs += hw/vfio
 trace-events-subdirs += hw/acpi
 trace-events-subdirs += hw/arm
 trace-events-subdirs += hw/alpha
-trace-events-y += ui/trace-events
+trace-events-subdirs += ui
 trace-events-y += audio/trace-events
 trace-events-y += net/trace-events
 trace-events-y += target-i386/trace-events
ui/Makefile.objs +3 -0
index dc936f1..c9d1847 100644
@@ -51,3 +51,6 @@ gtk-egl.o-libs += $(OPENGL_LIBS)
 shader.o-libs += $(OPENGL_LIBS)
 console-gl.o-libs += $(OPENGL_LIBS)
 egl-helpers.o-libs += $(OPENGL_LIBS)
+
+trace-obj-y += trace.o
+trace-obj-$(CONFIG_TRACE_DTRACE) += trace-dtrace.o
ui/console.c +1 -1
index c24bfe4..8adfff7 100644
@@ -28,7 +28,7 @@
 #include "qemu/timer.h"
 #include "qmp-commands.h"
 #include "sysemu/char.h"
-#include "trace.h"
+#include "ui/trace.h"
 #include "exec/memory.h"
 
 #define DEFAULT_BACKSCROLL 512
ui/gtk-egl.c +1 -1
index 3f5d328..1c12d34 100644
@@ -14,7 +14,7 @@
 #include "qemu/osdep.h"
 #include "qemu-common.h"
 
-#include "trace.h"
+#include "ui/trace.h"
 
 #include "ui/console.h"
 #include "ui/gtk.h"
ui/gtk-gl-area.c +1 -1
index 0df5a36..49c9e00 100644
@@ -10,7 +10,7 @@
 #include "qemu/osdep.h"
 #include "qemu-common.h"
 
-#include "trace.h"
+#include "ui/trace.h"
 
 #include "ui/console.h"
 #include "ui/gtk.h"
ui/gtk.c +1 -1
index 58d20ee..58c66be 100644
@@ -48,7 +48,7 @@
 #endif
 #include <math.h>
 
-#include "trace.h"
+#include "ui/trace.h"
 #include "ui/input.h"
 #include "sysemu/sysemu.h"
 #include "qmp-commands.h"
ui/input.c +1 -1
index ed88cda..b3b881b 100644
@@ -4,7 +4,7 @@
 #include "qapi-types.h"
 #include "qemu/error-report.h"
 #include "qmp-commands.h"
-#include "trace.h"
+#include "ui/trace.h"
 #include "ui/input.h"
 #include "ui/console.h"
 #include "sysemu/replay.h"
ui/spice-display.c +1 -1
index 99132b6..9065e74 100644
@@ -22,7 +22,7 @@
 #include "qemu/queue.h"
 #include "ui/console.h"
 #include "sysemu/sysemu.h"
-#include "trace.h"
+#include "ui/trace.h"
 
 #include "ui/spice-display.h"
 
ui/vnc.c +1 -1
index 853b57e..564c80e 100644
@@ -27,7 +27,7 @@
 #include "qemu/osdep.h"
 #include "vnc.h"
 #include "vnc-jobs.h"
-#include "trace.h"
+#include "ui/trace.h"
 #include "hw/qdev.h"
 #include "sysemu/sysemu.h"
 #include "qemu/error-report.h"
Signature · 1 line
2.7.4
#67 lore raw

PATCH 49/60 trace: switch hw/alpha/ directory to modular trace.h file

In reply to Daniel P. Berrange

Switch files in the hw/alpha/ directory to include the hw/alpha/trace.h file instead of the global trace.h file.

---
 Makefile.objs          | 2 +-
 hw/alpha/Makefile.objs | 2 ++
 hw/alpha/pci.c         | 2 +-
 3 files changed, 4 insertions(+), 2 deletions(-)
Makefile.objs +1 -1
index fbcf040..510083c 100644
@@ -151,7 +151,7 @@ trace-events-subdirs += hw/s390x
 trace-events-subdirs += hw/vfio
 trace-events-subdirs += hw/acpi
 trace-events-subdirs += hw/arm
-trace-events-y += hw/alpha/trace-events
+trace-events-subdirs += hw/alpha
 trace-events-y += ui/trace-events
 trace-events-y += audio/trace-events
 trace-events-y += net/trace-events
hw/alpha/Makefile.objs +2 -0
index 5c74275..e8e0573 100644
@@ -1 +1,3 @@
 obj-y += dp264.o pci.o typhoon.o
+trace-obj-y += trace.o
+trace-obj-$(CONFIG_TRACE_DTRACE) += trace-dtrace.o
hw/alpha/pci.c +1 -1
index 8dde637..3fafb1b 100644
@@ -11,7 +11,7 @@
 #include "alpha_sys.h"
 #include "qemu/log.h"
 #include "sysemu/sysemu.h"
-#include "trace.h"
+#include "hw/alpha/trace.h"
 
 
 /* Fallback for unassigned PCI I/O operations.  Avoids MCHK.  */
Signature · 1 line
2.7.4
#70 lore raw

PATCH 52/60 trace: switch net/ directory to modular trace.h file

In reply to Daniel P. Berrange

Switch files in the net/ directory to include the
net/trace.h file instead of the global trace.h
file.

---
 Makefile.objs       | 2 +-
 net/Makefile.objs   | 2 ++
 net/filter-mirror.c | 2 +-
 net/vhost-user.c    | 2 +-
 4 files changed, 5 insertions(+), 3 deletions(-)
Makefile.objs +1 -1
index bcd830e..2f892ed 100644
@@ -154,7 +154,7 @@ trace-events-subdirs += hw/arm
 trace-events-subdirs += hw/alpha
 trace-events-subdirs += ui
 trace-events-subdirs += audio
-trace-events-y += net/trace-events
+trace-events-subdirs += net
 trace-events-y += target-i386/trace-events
 trace-events-y += target-sparc/trace-events
 trace-events-y += target-s390x/trace-events
net/Makefile.objs +2 -0
index b7c22fd..4939b48 100644
@@ -16,3 +16,5 @@ common-obj-$(CONFIG_NETMAP) += netmap.o
 common-obj-y += filter.o
 common-obj-y += filter-buffer.o
 common-obj-y += filter-mirror.o
+trace-obj-y += trace.o
+trace-obj-$(CONFIG_TRACE_DTRACE) += trace-dtrace.o
net/filter-mirror.c +1 -1
index 35df374..a0d1eca 100644
@@ -19,7 +19,7 @@
 #include "qom/object.h"
 #include "qemu/main-loop.h"
 #include "qemu/error-report.h"
-#include "trace.h"
+#include "net/trace.h"
 #include "sysemu/char.h"
 #include "qemu/iov.h"
 #include "qemu/sockets.h"
net/vhost-user.c +1 -1
index b0595f8..b2b53ca 100644
@@ -16,7 +16,7 @@
 #include "qemu/config-file.h"
 #include "qemu/error-report.h"
 #include "qmp-commands.h"
-#include "trace.h"
+#include "net/trace.h"
 
 typedef struct VhostUserState {
     NetClientState nc;
Signature · 1 line
2.7.4
#69 lore raw

PATCH 51/60 trace: switch audio/ directory to modular trace.h file

In reply to Daniel P. Berrange

Switch files in the audio/ directory to include the audio/trace.h file instead of the global trace.h file.

---
 Makefile.objs       | 2 +-
 audio/Makefile.objs | 2 ++
 audio/alsaaudio.c   | 2 +-
 audio/ossaudio.c    | 2 +-
 4 files changed, 5 insertions(+), 3 deletions(-)
Makefile.objs +1 -1
index b81db74..bcd830e 100644
@@ -153,7 +153,7 @@ trace-events-subdirs += hw/acpi
 trace-events-subdirs += hw/arm
 trace-events-subdirs += hw/alpha
 trace-events-subdirs += ui
-trace-events-y += audio/trace-events
+trace-events-subdirs += audio
 trace-events-y += net/trace-events
 trace-events-y += target-i386/trace-events
 trace-events-y += target-sparc/trace-events
audio/Makefile.objs +2 -0
index 481d1aa..4eef4b4 100644
@@ -9,5 +9,7 @@ common-obj-$(CONFIG_PA) += paaudio.o
 common-obj-$(CONFIG_AUDIO_PT_INT) += audio_pt_int.o
 common-obj-$(CONFIG_AUDIO_WIN_INT) += audio_win_int.o
 common-obj-y += wavcapture.o
+trace-obj-y += trace.o
+trace-obj-$(CONFIG_TRACE_DTRACE) += trace-dtrace.o
 
 sdlaudio.o-cflags := $(SDL_CFLAGS)
audio/alsaaudio.c +1 -1
index 3652a7b..1111b71 100644
@@ -26,7 +26,7 @@
 #include "qemu-common.h"
 #include "qemu/main-loop.h"
 #include "audio.h"
-#include "trace.h"
+#include "audio/trace.h"
 
 #if QEMU_GNUC_PREREQ(4, 3)
 #pragma GCC diagnostic ignored "-Waddress"
audio/ossaudio.c +1 -1
index 0edd7ea..c04da5e 100644
@@ -28,7 +28,7 @@
 #include "qemu/main-loop.h"
 #include "qemu/host-utils.h"
 #include "audio.h"
-#include "trace.h"
+#include "audio/trace.h"
 
 #define AUDIO_CAP "oss"
 #include "audio_int.h"
Signature · 1 line
2.7.4
#71 lore raw

PATCH 53/60 trace: switch target-i386/ directory to modular trace.h file

In reply to Daniel P. Berrange

Switch files in the target-i386/ directory to include the target-i386/trace.h file instead of the global trace.h file.

---
 Makefile.objs             | 2 +-
 target-i386/Makefile.objs | 2 ++
 target-i386/kvm.c         | 2 +-
 3 files changed, 4 insertions(+), 2 deletions(-)
Makefile.objs +1 -1
index 2f892ed..3fc6365 100644
@@ -155,7 +155,7 @@ trace-events-subdirs += hw/alpha
 trace-events-subdirs += ui
 trace-events-subdirs += audio
 trace-events-subdirs += net
-trace-events-y += target-i386/trace-events
+trace-events-subdirs += target-i386
 trace-events-y += target-sparc/trace-events
 trace-events-y += target-s390x/trace-events
 trace-events-y += target-ppc/trace-events
target-i386/Makefile.objs +2 -0
index b223d79..a73e6f3 100644
@@ -5,3 +5,5 @@ obj-y += gdbstub.o
 obj-$(CONFIG_SOFTMMU) += machine.o arch_memory_mapping.o arch_dump.o monitor.o
 obj-$(CONFIG_KVM) += kvm.o hyperv.o
 obj-$(call lnot,$(CONFIG_KVM)) += kvm-stub.o
+trace-obj-y += trace.o
+trace-obj-$(CONFIG_TRACE_DTRACE) += trace-dtrace.o
target-i386/kvm.c +1 -1
index 0b2016a..d4a63e7 100644
@@ -44,7 +44,7 @@
 #include "hw/pci/msi.h"
 #include "migration/migration.h"
 #include "exec/memattrs.h"
-#include "trace.h"
+#include "target-i386/trace.h"
 
 //#define DEBUG_KVM
 
Signature · 1 line
2.7.4
#72 lore raw

PATCH 54/60 trace: switch target-sparc/ directory to modular trace.h file

In reply to Daniel P. Berrange

Switch files in the target-sparc/ directory to include the target-sparc/trace.h file instead of the global trace.h file.

---
 Makefile.objs               | 2 +-
 target-sparc/Makefile.objs  | 2 ++
 target-sparc/int32_helper.c | 2 +-
 target-sparc/int64_helper.c | 2 +-
 target-sparc/mmu_helper.c   | 2 +-
 target-sparc/win_helper.c   | 2 +-
 6 files changed, 7 insertions(+), 5 deletions(-)
Makefile.objs +1 -1
index 3fc6365..9cddc6d 100644
@@ -156,7 +156,7 @@ trace-events-subdirs += ui
 trace-events-subdirs += audio
 trace-events-subdirs += net
 trace-events-subdirs += target-i386
-trace-events-y += target-sparc/trace-events
+trace-events-subdirs += target-sparc
 trace-events-y += target-s390x/trace-events
 trace-events-y += target-ppc/trace-events
 trace-events-y += qom/trace-events
target-sparc/Makefile.objs +2 -0
index ec90569..0ca6e73 100644
@@ -5,3 +5,5 @@ obj-$(TARGET_SPARC) += int32_helper.o
 obj-$(TARGET_SPARC64) += int64_helper.o
 obj-$(TARGET_SPARC64) += vis_helper.o
 obj-y += gdbstub.o
+trace-obj-y += trace.o
+trace-obj-$(CONFIG_TRACE_DTRACE) += trace-dtrace.o
target-sparc/int32_helper.c +1 -1
index 09afe13..d930e10 100644
@@ -19,7 +19,7 @@
 
 #include "qemu/osdep.h"
 #include "cpu.h"
-#include "trace.h"
+#include "target-sparc/trace.h"
 #include "sysemu/sysemu.h"
 #include "exec/log.h"
 
target-sparc/int64_helper.c +1 -1
index 29360fa..5b9f2ce 100644
@@ -21,7 +21,7 @@
 #include "cpu.h"
 #include "exec/helper-proto.h"
 #include "exec/log.h"
-#include "trace.h"
+#include "target-sparc/trace.h"
 
 #define DEBUG_PCALL
 
target-sparc/mmu_helper.c +1 -1
index 32b629f..dcafe3a 100644
@@ -20,7 +20,7 @@
 #include "qemu/osdep.h"
 #include "cpu.h"
 #include "exec/exec-all.h"
-#include "trace.h"
+#include "target-sparc/trace.h"
 #include "exec/address-spaces.h"
 
 /* Sparc MMU emulation */
target-sparc/win_helper.c +1 -1
index a8a6c0c..f95ecc3 100644
@@ -20,7 +20,7 @@
 #include "qemu/osdep.h"
 #include "cpu.h"
 #include "exec/helper-proto.h"
-#include "trace.h"
+#include "target-sparc/trace.h"
 
 static inline void memcpy32(target_ulong *dst, const target_ulong *src)
 {
Signature · 1 line
2.7.4
#73 lore raw

PATCH 55/60 trace: switch target-s390x/ directory to modular trace.h file

In reply to Daniel P. Berrange

Switch files in the target-s390x/ directory to include the target-s390x/trace.h file instead of the global trace.h file.

---
 Makefile.objs              | 2 +-
 target-s390x/Makefile.objs | 2 ++
 target-s390x/cpu.c         | 2 +-
 target-s390x/ioinst.c      | 2 +-
 target-s390x/kvm.c         | 2 +-
 target-s390x/mmu_helper.c  | 2 +-
 6 files changed, 7 insertions(+), 5 deletions(-)
Makefile.objs +1 -1
index 9cddc6d..5734475 100644
@@ -157,7 +157,7 @@ trace-events-subdirs += audio
 trace-events-subdirs += net
 trace-events-subdirs += target-i386
 trace-events-subdirs += target-sparc
-trace-events-y += target-s390x/trace-events
+trace-events-subdirs += target-s390x
 trace-events-y += target-ppc/trace-events
 trace-events-y += qom/trace-events
 trace-events-y += linux-user/trace-events
target-s390x/Makefile.objs +2 -0
index dd62cbd..97bfbfd 100644
@@ -3,3 +3,5 @@ obj-y += int_helper.o fpu_helper.o cc_helper.o mem_helper.o misc_helper.o
 obj-y += gdbstub.o
 obj-$(CONFIG_SOFTMMU) += machine.o ioinst.o arch_dump.o mmu_helper.o
 obj-$(CONFIG_KVM) += kvm.o
+trace-obj-y += trace.o
+trace-obj-$(CONFIG_TRACE_DTRACE) += trace-dtrace.o
target-s390x/cpu.c +1 -1
index e43e2d6..1d93d03 100644
@@ -30,7 +30,7 @@
 #include "qemu/cutils.h"
 #include "qemu/timer.h"
 #include "qemu/error-report.h"
-#include "trace.h"
+#include "target-s390x/trace.h"
 #include "qapi/visitor.h"
 #include "migration/vmstate.h"
 #include "exec/exec-all.h"
target-s390x/ioinst.c +1 -1
index a5a288b..43c3a96 100644
@@ -13,7 +13,7 @@
 
 #include "cpu.h"
 #include "hw/s390x/ioinst.h"
-#include "trace.h"
+#include "target-s390x/trace.h"
 #include "hw/s390x/s390-pci-bus.h"
 
 int ioinst_disassemble_sch_ident(uint32_t value, int *m, int *cssid, int *ssid,
target-s390x/kvm.c +1 -1
index 80ac621..7732ae5 100644
@@ -38,7 +38,7 @@
 #include "qapi/qmp/qjson.h"
 #include "exec/gdbstub.h"
 #include "exec/address-spaces.h"
-#include "trace.h"
+#include "target-s390x/trace.h"
 #include "qapi-event.h"
 #include "hw/s390x/s390-pci-inst.h"
 #include "hw/s390x/s390-pci-bus.h"
target-s390x/mmu_helper.c +1 -1
index b11a027..5ebf8d8 100644
@@ -20,7 +20,7 @@
 #include "exec/address-spaces.h"
 #include "cpu.h"
 #include "sysemu/kvm.h"
-#include "trace.h"
+#include "target-s390x/trace.h"
 #include "hw/s390x/storage-keys.h"
 
 /* #define DEBUG_S390 */
Signature · 1 line
2.7.4
#74 lore raw

PATCH 56/60 trace: switch target-ppc/ directory to modular trace.h file

In reply to Daniel P. Berrange

Switch files in the target-ppc/ directory to include the target-ppc/trace.h file instead of the global trace.h file.

---
 Makefile.objs            | 2 +-
 target-ppc/Makefile.objs | 2 ++
 target-ppc/kvm.c         | 2 +-
 3 files changed, 4 insertions(+), 2 deletions(-)
Makefile.objs +1 -1
index 5734475..9ba93dd 100644
@@ -158,7 +158,7 @@ trace-events-subdirs += net
 trace-events-subdirs += target-i386
 trace-events-subdirs += target-sparc
 trace-events-subdirs += target-s390x
-trace-events-y += target-ppc/trace-events
+trace-events-subdirs += target-ppc
 trace-events-y += qom/trace-events
 trace-events-y += linux-user/trace-events
 
target-ppc/Makefile.objs +2 -0
index e667e69..7a71b38 100644
@@ -15,3 +15,5 @@ obj-y += misc_helper.o
 obj-y += mem_helper.o
 obj-$(CONFIG_USER_ONLY) += user_only_helper.o
 obj-y += gdbstub.o
+trace-obj-y += trace.o
+trace-obj-$(CONFIG_TRACE_DTRACE) += trace-dtrace.o
target-ppc/kvm.c +1 -1
index 84764ed..7d55145 100644
@@ -38,7 +38,7 @@
 #include "hw/ppc/spapr_vio.h"
 #include "hw/ppc/ppc.h"
 #include "sysemu/watchdog.h"
-#include "trace.h"
+#include "target-ppc/trace.h"
 #include "exec/gdbstub.h"
 #include "exec/memattrs.h"
 #include "sysemu/hostmem.h"
Signature · 1 line
2.7.4
#75 lore raw

PATCH 57/60 trace: switch qom/ directory to modular trace.h file

In reply to Daniel P. Berrange

Switch files in the qom/ directory to include the
qom/trace.h file instead of the global trace.h
file.

---
 Makefile.objs     | 2 +-
 qom/Makefile.objs | 2 ++
 qom/object.c      | 2 +-
 3 files changed, 4 insertions(+), 2 deletions(-)
Makefile.objs +1 -1
index 9ba93dd..53a26fb 100644
@@ -159,7 +159,7 @@ trace-events-subdirs += target-i386
 trace-events-subdirs += target-sparc
 trace-events-subdirs += target-s390x
 trace-events-subdirs += target-ppc
-trace-events-y += qom/trace-events
+trace-events-subdirs += qom
 trace-events-y += linux-user/trace-events
 
 trace-events-files = trace-events $(trace-events-subdirs:%=%/trace-events)
qom/Makefile.objs +2 -0
index 516349e..8cc7800 100644
@@ -1,4 +1,6 @@
 qom-obj-y = object.o container.o qom-qobject.o
 qom-obj-y += object_interfaces.o
+trace-obj-y += trace.o
+trace-obj-$(CONFIG_TRACE_DTRACE) += trace-dtrace.o
 
 common-obj-y = cpu.o
qom/object.c +1 -1
index 8166b7d..553f385 100644
@@ -20,7 +20,7 @@
 #include "qapi/string-input-visitor.h"
 #include "qapi/string-output-visitor.h"
 #include "qapi/qmp/qerror.h"
-#include "trace.h"
+#include "qom/trace.h"
 
 /* TODO: replace QObject with a simpler visitor to avoid a dependency
  * of the QOM core on QObject?  */
Signature · 1 line
2.7.4
#76 lore raw

PATCH 58/60 trace: switch linux-user/ directory to modular trace.h file

In reply to Daniel P. Berrange

Switch files in the linux-user/ directory to include the linux-user/trace.h file instead of the global trace.h file.

---
 Makefile.objs            | 2 +-
 linux-user/Makefile.objs | 2 ++
 linux-user/signal.c      | 2 +-
 3 files changed, 4 insertions(+), 2 deletions(-)
Makefile.objs +1 -1
index 53a26fb..c2ee78e 100644
@@ -160,7 +160,7 @@ trace-events-subdirs += target-sparc
 trace-events-subdirs += target-s390x
 trace-events-subdirs += target-ppc
 trace-events-subdirs += qom
-trace-events-y += linux-user/trace-events
+trace-events-subdirs += linux-user
 
 trace-events-files = trace-events $(trace-events-subdirs:%=%/trace-events)
 
linux-user/Makefile.objs +2 -0
index 8c93058..7a05775 100644
@@ -6,3 +6,5 @@ obj-$(TARGET_HAS_BFLT) += flatload.o
 obj-$(TARGET_I386) += vm86.o
 obj-$(TARGET_ARM) += arm/nwfpe/
 obj-$(TARGET_M68K) += m68k-sim.o
+trace-obj-y += trace.o
+trace-obj-$(CONFIG_TRACE_DTRACE) += trace-dtrace.o
linux-user/signal.c +1 -1
index 9a4d894..3db2faa 100644
@@ -24,7 +24,7 @@
 #include "qemu.h"
 #include "qemu-common.h"
 #include "target_signal.h"
-#include "trace.h"
+#include "linux-user/trace.h"
 
 static struct target_sigaltstack target_sigaltstack_used = {
     .ss_sp = 0,
Signature · 1 line
2.7.4
#78 lore raw

PATCH 60/60 trace: update docs to reflect new code generation approach

In reply to Daniel P. Berrange

Describe use of per-subdir trace events files and how it impacts code generation.

---
 docs/tracing.txt | 61 +++++++++++++++++++++++++++++++++++++++++++++++---------
 1 file changed, 52 insertions(+), 9 deletions(-)
docs/tracing.txt +52 -9
index 29f2f9a..b7ba179 100644
@@ -27,18 +27,51 @@ for debugging, profiling, and observing execution.
 
 == Trace events ==
 
+=== Sub-directory setup ===
+
 Each directory in the source tree can declare a set of static trace events
-in a "trace-events" file. Each trace event declaration names the event, its
-arguments, and the format string which can be used for pretty-printing:
+in a "trace-events" file. The first (non-comment) statement in the file
+must be "@id_offset(NN)" where NN is an integer that is unique among all
+"trace-events" files in the QEMU source tree. The IDs can be arbitrarily
+chosen, but extra fun the current "trace-events" files use values from the
+"powerful number" integer sequence :-)
 
-    qemu_vmalloc(size_t size, void *ptr) "size %zu ptr %p"
-    qemu_vfree(void *ptr) "ptr %p"
+Any subdirectory which contains a "trace-events" file must be listed in the
+"trace-events-subdirs" make variable in the top level Makefile.objs. During
+build, the "trace-events" file in each listed subdirectory will be processed
+by the "tracetool" script to generate code for the trace events.
+
+The individual "trace-events" files are merged together into a "trace-events-all"
+file, which is also installed into "/usr/share/qemu" with the name "trace-events".
+This merge file is to be used by the "simpletrace.py" script to later analyse
+traces in the simpletrace data format.
+
+The Makefile.objs in the subdirectory should have two lines added
+
+  trace-obj-y += trace.o
+  trace-obj-$(CONFIG_TRACE_DTRACE) += trace-dtrace.o
+
+In the sub-directory the following files will be automatically generated
+
+ - trace.c - the trace event state declarations
+ - trace.h - the trace event enums and probe functions
+ - trace-dtrace.h - DTrace speci
+ - trace-dtrace.dtrace - DTrace event probe helper declaration
+ - trace-dtrace.o - binary DTrace provider (generated by dtrace)
+ - trace-ust.h - UST event probe helper declarations
+
+Source files in the sub-directory should only #include the 'trace.h'
+file and use the full sub-directory path. eg io/channel-buffer.c
+would do
 
-All "trace-events" files must be listed in the "trace-event-y" make variable
-in the top level Makefile.objs. During build the individual files are combined
-to create a "trace-events-all" file, which is processed by the "tracetool"
-script during build to generate code for the trace events. The
-"trace-events-all" file is also installed into "/usr/share/qemu".
+  #include "io/trace.h"
+
+While it is permited to include a trace.h file from outside a source
+files' own sub-directory, this is discouraged in general. It is strongly
+preferred that all events be declared directly in the sub-directory that
+uses them.
+
+=== Using trace events ===
 
 Trace events are invoked directly from source code like this:
 
@@ -83,6 +116,13 @@ Format strings should reflect the types defined in the trace event.  Take
 special care to use PRId64 and PRIu64 for int64_t and uint64_t types,
 respectively.  This ensures portability between 32- and 64-bit platforms.
 
+Each event declaration will start with the event name, then its arguments,
+finally a format string for pretty-printing. For example:
+
+    qemu_vmalloc(size_t size, void *ptr) "size %zu ptr %p"
+    qemu_vfree(void *ptr) "ptr %p"
+
+
 === Hints for adding new trace events ===
 
 1. Trace state changes in the code.  Interesting points in the code usually
@@ -357,6 +397,9 @@ information. If used together with the "tcg" property, it adds a second
 "TCGv_env" argument that must point to the per-target global TCG register that
 points to the vCPU when guest code is executed (usually the "cpu_env" variable).
 
+All "vcpu" events *must* be declared in the top level "trace-events" file. It
+is not permitted to have them declared in sub-directories.
+
 The following example events:
 
     foo(uint32_t a) "a=%x"
Signature · 1 line
2.7.4
#77 lore raw

PATCH 59/60 trace: remove the global include/trace.h file

In reply to Daniel P. Berrange

Switch to generating top level trace.[hc] files, instead of using include/trace.h with trace/generated-tracers.[ch], so the top level directory works in the same manner as all the sub-dirs.

---
 .gitignore                               |  9 ++--
 Makefile                                 | 56 ++++++++++++++++------
 Makefile.objs                            |  5 +-
 include/trace.h                          |  6 ---
 scripts/tracetool/backend/dtrace.py      |  7 +--
 scripts/tracetool/backend/ust.py         |  7 +--
 scripts/tracetool/format/ust_events_c.py |  2 +-
 scripts/tracetool/format/ust_events_h.py |  2 +-
 trace/Makefile.objs                      | 79 +++-----------------------------
 9 files changed, 57 insertions(+), 116 deletions(-)
 delete mode 100644 include/trace.h
.gitignore +3 -6
index 7249070..4920850 100644
@@ -6,18 +6,14 @@
 /config.status
 /config-temp
 /trace-events-all
-/trace/generated-tracers.h
-/trace/generated-tracers.c
-/trace/generated-tracers-dtrace.h
-/trace/generated-tracers.dtrace
 /trace/generated-events.h
 /trace/generated-events.c
 /trace/generated-helpers-wrappers.h
 /trace/generated-helpers.h
 /trace/generated-helpers.c
 /trace/generated-tcg-tracers.h
-/trace/generated-ust-provider.h
-/trace/generated-ust.c
+/trace/trace-ust-all.h
+/trace/trace-ust-all.c
 /ui/shader/texture-blit-frag.h
 /ui/shader/texture-blit-vert.h
 *-timestamp
@@ -117,6 +113,7 @@ docker-src.*
 *~
 trace.h
 trace.c
+trace-ust.h
 trace-events-common
 trace-ust.h
 trace-dtrace.h
Makefile +41 -15

80 lines not on this page · raw message

Makefile.objs +3 -2
index c2ee78e..ba5f75f 100644
@@ -119,7 +119,6 @@ ivshmem-server-obj-y = contrib/ivshmem-server/
 
 ######################################################################
 trace-events-subdirs =
-trace-events-y = trace-events
 trace-events-subdirs += util
 trace-events-subdirs += crypto
 trace-events-subdirs += io
@@ -164,4 +163,6 @@ trace-events-subdirs += linux-user
 
 trace-events-files = trace-events $(trace-events-subdirs:%=%/trace-events)
 
-trace-obj-y = $(trace-events-subdirs:%=%/)
+trace-obj-y = trace.o
+trace-obj-$(CONFIG_TRACE_DTRACE) += trace-dtrace.o
+trace-obj-y += $(trace-events-subdirs:%=%/)
include/trace.h deleted +0 -6
deleted file mode 100644
index ac9ff3d..0000000
@@ -1,6 +0,0 @@
-#ifndef TRACE_H
-#define TRACE_H
-
-#include "trace/generated-tracers.h"
-
-#endif /* TRACE_H */
scripts/tracetool/backend/dtrace.py +1 -6
index 1319990..6df33fc 100644
@@ -36,12 +36,7 @@ def binary():
 
 
 def generate_h_begin(events, group):
-    if group == "common":
-        include = "trace/generated-tracers-dtrace.h"
-    else:
-        include = "trace-dtrace.h"
-
-    out('#include "%s"' % include,
+    out('#include "trace-dtrace.h"',
         '')
 
 
scripts/tracetool/backend/ust.py +1 -6
index 599c12e..92b2837 100644
@@ -20,13 +20,8 @@ PUBLIC = True
 
 
 def generate_h_begin(events, group):
-    if group == "common":
-        include = "trace/generated-ust-provider.h"
-    else:
-        include = "trace-ust.h"
-
     out('#include <lttng/tracepoint.h>',
-        '#include "%s"' % include,
+        '#include "trace-ust.h"',
         '')
 
 
scripts/tracetool/format/ust_events_c.py +1 -1
index 8be8116..264784c 100644
@@ -32,4 +32,4 @@ def generate(events, backend, group):
         ' */',
         '#pragma GCC diagnostic ignored "-Wredundant-decls"',
         '',
-        '#include "generated-ust-provider-all.h"')
+        '#include "trace-ust-all.h"')
scripts/tracetool/format/ust_events_h.py +1 -1
index f4258e5..70d525f 100644
@@ -21,7 +21,7 @@ def generate(events, backend, group):
               if "disabled" not in e.properties]
 
     if group == "common":
-        include = "generated-ust-provider.h"
+        include = "trace-ust-all.h"
     else:
         include = "trace-ust.h"
 
trace/Makefile.objs +6 -73

105 lines not on this page · raw message

Signature · 1 line
2.7.4
#14 lore raw

Re: [Qemu-devel] [PATCH for-2.8 v1 08/60] trace: provide mechanism for registering trace events

In reply to Daniel P. Berrange

scripts/tracetool/format/events_c.py def generate(events, backend): · line 50

Quoted 5 lines · Daniel P. Berrange
scripts/tracetool/format/events_c.py +5 -0
+    out('void trace_register_events(void)',
+        '{',
+        '    trace_event_register_group(trace_events, TRACE_EVENT_COUNT);',
+        '}',
+        'trace_init(trace_register_events)')

Should this function be static?

Paolo

#15 lore raw

Re: [Qemu-devel] [PATCH for-2.8 v1 08/60] trace: provide mechanism for registering trace events

Quoted 10 lines · Paolo Bonzini

scripts/tracetool/format/events_c.py def generate(events, backend): · line 50

Quoted 5 lines · Daniel P. Berrange
scripts/tracetool/format/events_c.py +5 -0
+    out('void trace_register_events(void)',
+        '{',
+        '    trace_event_register_group(trace_events, TRACE_EVENT_COUNT);',
+        '}',
+        'trace_init(trace_register_events)')

Should this function be static?

Yes it should be actually - left over from before I was using the qemu-module support to register these.

Regards,
Daniel

Signature · 4 lines
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|
#23 lore raw

Re: [Qemu-devel] [PATCH for-2.8 v1 11/60] trace: remove use of event ID enums from APIs

In reply to Daniel P. Berrange
Quoted 21 lines · Daniel P. Berrange

Since there will shortly be multiple event groups allowed, we can no longer use the TraceEventID and TraceEventVCPUID enums in the trace control APIs. There will in fact be multiple distinct enums, and the enum values will only be required to be unique per group.

---
 trace/control-internal.h | 14 +++++++-------
 trace/control-target.c   |  6 +++---
 trace/control.h          | 25 ++++++-------------------
 trace/event-internal.h   |  4 ++--
 trace/simple.c           |  6 +++---
 trace/simple.h           |  2 +-
 6 files changed, 22 insertions(+), 35 deletions(-)
trace/control-internal.h +0 -0
index 634effe..b7048d4 100644

trace/control-internal.h static inline bool trace_event_is_pattern(const char *str) · line 30

Quoted 8 lines
trace/control-internal.h +1 -1
@@ -24,13 +24,13 @@ static inline bool trace_event_is_pattern(const char *str)
     return strchr(str, '*') != NULL;
 }
 
-static inline TraceEventID trace_event_get_id(TraceEvent *ev)
+static inline size_t trace_event_get_id(TraceEvent *ev)
 {
     assert(ev != NULL);
     return ev->id;

Perhaps "unsigned" is a better match than size_t?

Paolo

#24 lore raw

Re: [Qemu-devel] [PATCH for-2.8 v1 11/60] trace: remove use of event ID enums from APIs

Quoted 27 lines · Paolo Bonzini
Quoted 24 lines · Daniel P. Berrange

Since there will shortly be multiple event groups allowed, we can no longer use the TraceEventID and TraceEventVCPUID enums in the trace control APIs. There will in fact be multiple distinct enums, and the enum values will only be required to be unique per group.

---
 trace/control-internal.h | 14 +++++++-------
 trace/control-target.c   |  6 +++---
 trace/control.h          | 25 ++++++-------------------
 trace/event-internal.h   |  4 ++--
 trace/simple.c           |  6 +++---
 trace/simple.h           |  2 +-
 6 files changed, 22 insertions(+), 35 deletions(-)
trace/control-internal.h +0 -0
index 634effe..b7048d4 100644
@@ -24,13 +24,13 @@ static inline bool trace_event_is_pattern(const char *str)
     return strchr(str, '*') != NULL;
 }
 
Quoted 7 lines

trace/control-internal.h static inline bool trace_event_is_pattern(const char *str) · line 30

Quoted 5 lines
trace/control-internal.h +1 -1
-static inline TraceEventID trace_event_get_id(TraceEvent *ev)
+static inline size_t trace_event_get_id(TraceEvent *ev)
 {
     assert(ev != NULL);
     return ev->id;

Perhaps "unsigned" is a better match than size_t?

I don't mind either way - I just happen to personally always use size_t for anything that ends up being used primarily as an array index.

Regards,
Daniel

Signature · 4 lines
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|
#25 lore raw

Re: [Qemu-devel] [PATCH for-2.8 v1 11/60] trace: remove use of event ID enums from APIs

Quoted 9 lines · Daniel P. Berrange
Quoted 7 lines
Quoted 7 lines
Quoted 5 lines

trace/control-internal.h static inline bool trace_event_is_pattern(const char *str) · line 30

Quoted 5 lines
trace/control-internal.h +1 -1
-static inline TraceEventID trace_event_get_id(TraceEvent *ev)
+static inline size_t trace_event_get_id(TraceEvent *ev)
 {
     assert(ev != NULL);
     return ev->id;

Perhaps "unsigned" is a better match than size_t?

I don't mind either way - I just happen to personally always use size_t for anything that ends up being used primarily as an array index.

Makes sense. I was thinking of simpletrace's 32-bit id instead.

Paolo

#86 lore raw
In reply to Daniel P. Berrange
Your series failed automatic build test. Please find the testing commands and their output below. If you have docker installed, you can probably reproduce it locally.

Hi,

Your series failed automatic build test. Please find the testing commands and their output below. If you have docker installed, you can probably reproduce it locally.

Message-id: [email protected]
Type: series
Subject: [Qemu-devel] [PATCH for-2.8 v1 00/60] Modular build of trace event files

=== TEST SCRIPT BEGIN ===
#!/bin/bash
set -e
git submodule update --init dtc
make J=8 docker-test-quick@centos6

# we need CURL DPRINTF patch
# http://patchew.org/QEMU/1470027888-24381-1-git-send-email-famz%40redhat.com/
#make J=8 docker-test-mingw@fedora
=== TEST SCRIPT END ===

Updating 3c8cf5a9c21ff8782164d1def7f44bd888713384
From https://github.com/patchew-project/qemu
* [new tag] patchew/[email protected] -> patchew/[email protected]
Switched to a new branch 'test'
f782d9f trace: update docs to reflect new code generation approach 8b58708 trace: remove the global include/trace.h file
19403bf trace: switch linux-user/ directory to modular trace.h file 0a68cb2 trace: switch qom/ directory to modular trace.h file da8cde7 trace: switch target-ppc/ directory to modular trace.h file 172fdf5 trace: switch target-s390x/ directory to modular trace.h file 001334e trace: switch target-sparc/ directory to modular trace.h file fbf7e8d trace: switch target-i386/ directory to modular trace.h file 5b3a404 trace: switch net/ directory to modular trace.h file e4008a1 trace: switch audio/ directory to modular trace.h file 0d0c118 trace: switch ui/ directory to modular trace.h file a424af5 trace: switch hw/alpha/ directory to modular trace.h file 6899dbc trace: switch hw/arm/ directory to modular trace.h file 698e90e trace: switch hw/acpi/ directory to modular trace.h file 6798bcb trace: switch hw/vfio/ directory to modular trace.h file 777af60 trace: switch hw/s390x/ directory to modular trace.h file 0d37f07 trace: switch hw/pci/ directory to modular trace.h file 8a745ba trace: switch hw/ppc/ directory to modular trace.h file d315fff trace: switch hw/9pfs/ directory to modular trace.h file 200d752 trace: switch hw/i386/ directory to modular trace.h file 5963cc6 trace: switch hw/mem/ directory to modular trace.h file 3cd532b trace: switch hw/isa/ directory to modular trace.h file 6e0943c trace: switch hw/sd/ directory to modular trace.h file d48f418 trace: switch hw/sparc/ directory to modular trace.h file f30fb3c trace: switch hw/dma/ directory to modular trace.h file aeff5ce trace: switch hw/timer/ directory to modular trace.h file 0a357f4 trace: switch hw/input/ directory to modular trace.h file 788e458 trace: switch hw/display/ directory to modular trace.h file 9e0ec18 trace: switch hw/nvram/ directory to modular trace.h file f66d633 trace: switch hw/scsi/ directory to modular trace.h file 2c27a5c trace: switch hw/usb/ directory to modular trace.h file c2c6a4a trace: switch hw/misc/ directory to modular trace.h file 5e51950 trace: switch hw/audio/ directory to modular trace.h file 24e7612 trace: switch hw/virtio/ directory to modular trace.h file 3f96b32 trace: switch hw/net/ directory to modular trace.h file 6cb5b07 trace: switch hw/intc/ directory to modular trace.h file 7138800 trace: switch hw/char/ directory to modular trace.h file 8e60ca5 trace: switch hw/block/ directory to modular trace.h file ce95a93 trace: switch block/ directory to modular trace.h file c1f9359 trace: switch migration/ directory to modular trace.h file a9399ee trace: switch crypto/ directory to modular trace.h file cf9d0b1 trace: switch util/ directory to modular trace.h file b22e603 trace: switch io/ directory to modular trace.h file b7dfca1 trace: introduce some Makefile rules for module code gen eb94362 trace: introduce ID range offsets per trace-events file 5b37803 trace: introduce a formal group name for trace events 85db364 trace: get rid of generated-events.h/generated-events.c b2a27bd trace: remove generated-events.h from many includes 08d783c3 trace: use -1 instead of TRACE_VCPU_EVENT_COUNT as magic value 3c2bc9c trace: remove use of event ID enums from APIs
35a51ca trace: remove fixed global event state arrays
584727d trace: remove use of TRACE_VCPU_EVENT_COUNT in cpu.h cc33976 trace: provide mechanism for registering trace events 832db43 trace: remove some now unused functions
59adbd8 trace: convert code to use event iterators
58f9e9d trace: add trace event iterator APIs
969db6a trace: move hw/virtio/virtio-balloon.c trace points into correct file 2a9286e trace: move hw/mem/pc-dimm.c trace points into correct file b8fe348 trace: move util/qemu-coroutine*.c trace points into correct file b4b74ca trace: move util/buffer.c trace points into correct file

=== OUTPUT BEGIN ===
Submodule 'dtc' (git://git.qemu-project.org/dtc.git) registered for path 'dtc' Cloning into 'dtc'...
Submodule path 'dtc': checked out '65cc4d2748a2c2e6f27f1cf39e07a5dbabd80ebf'
BUILD centos6
ARCHIVE qemu.tgz
ARCHIVE dtc.tgz
COPY RUNNER
RUN test-quick in centos6
No C++ compiler available; disabling C++ specific optional code

Install prefix    /tmp/qemu-test/src/tests/docker/install
BIOS directory    /tmp/qemu-test/src/tests/docker/install/share/qemu
binary directory  /tmp/qemu-test/src/tests/docker/install/bin

library directory /tmp/qemu-test/src/tests/docker/install/lib module directory /tmp/qemu-test/src/tests/docker/install/lib/qemu libexec directory /tmp/qemu-test/src/tests/docker/install/libexec include directory /tmp/qemu-test/src/tests/docker/install/include config directory /tmp/qemu-test/src/tests/docker/install/etc
local state directory /tmp/qemu-test/src/tests/docker/install/var
Manual directory /tmp/qemu-test/src/tests/docker/install/share/man ELF interp prefix /usr/gnemul/qemu-%M

Source path       /tmp/qemu-test/src
C compiler        cc
Host C compiler   cc
C++ compiler      
Objective-C compiler cc
ARFLAGS           rv
CFLAGS            -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -pthread -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include   -g 
QEMU_CFLAGS       -I/usr/include/pixman-1    -fPIE -DPIE -m64 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common  -Wendif-labels -Wmissing-include-dirs -Wempty-body -Wnested-externs -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wold-style-declaration -Wold-style-definition -Wtype-limits -fstack-protector-all
LDFLAGS           -Wl,--warn-common -Wl,-z,relro -Wl,-z,now -pie -m64 -g 
make              make
install           install
python            python -B
smbd              /usr/sbin/smbd
module support    no
host CPU          x86_64
host big endian   no
target list       x86_64-softmmu aarch64-softmmu
tcg debug enabled no
gprof enabled     no
sparse enabled    no
strip binaries    yes
profiler          no
static build      no
pixman            system
SDL support       yes (1.2.14)
GTK support       no 
GTK GL support    no
VTE support       no 
TLS priority      NORMAL
GNUTLS support    no
GNUTLS rnd        no
libgcrypt         no
libgcrypt kdf     no
nettle            no 
nettle kdf        no
libtasn1          no
curses support    no
virgl support     no
curl support      no
mingw32 support   no
Audio drivers     oss
Block whitelist (rw) 
Block whitelist (ro) 
VirtFS support    no
VNC support       yes
VNC SASL support  no
VNC JPEG support  no
VNC PNG support   no
xen support       no
brlapi support    no
bluez  support    no
Documentation     no
PIE               yes
vde support       no
netmap support    no
Linux AIO support no
ATTR/XATTR support yes
Install blobs     yes
KVM support       yes
RDMA support      no
TCG interpreter   no
fdt support       yes
preadv support    yes
fdatasync         yes
madvise           yes
posix_madvise     yes
uuid support      no
libcap-ng support no
vhost-net support yes
vhost-scsi support yes
Trace backends    log
spice support     no 
rbd support       no
xfsctl support    no
smartcard support no
libusb            no
usb net redir     no
OpenGL support    no
OpenGL dmabufs    no
libiscsi support  no
libnfs support    no

build guest agent yes
QGA VSS support no
QGA w32 disk info no
QGA MSI support no
seccomp support no
coroutine backend ucontext
coroutine pool yes
GlusterFS support no
Archipelago support no

gcov              gcov
gcov enabled      no
TPM support       yes
libssh2 support   no
TPM passthrough   yes
QOM debugging     yes
vhdx              no
lzo support       no
snappy support    no
bzip2 support     no

NUMA host support no
tcmalloc support no
jemalloc support no
avx2 optimization no

  GEN   x86_64-softmmu/config-devices.mak.tmp
  GEN   aarch64-softmmu/config-devices.mak.tmp
  GEN   config-host.h
  GEN   qemu-options.def
  GEN   qmp-commands.h
  GEN   x86_64-softmmu/config-devices.mak
  GEN   qapi-types.h
  GEN   qapi-visit.h
  GEN   aarch64-softmmu/config-devices.mak
  GEN   qapi-event.h
  GEN   qmp-introspect.h
  GEN   trace.h
  GEN   util/trace.h
  GEN   crypto/trace.h
  GEN   io/trace.h
  GEN   migration/trace.h
  GEN   block/trace.h
  GEN   hw/block/trace.h
  GEN   hw/char/trace.h
  GEN   hw/intc/trace.h
  GEN   hw/net/trace.h
  GEN   hw/virtio/trace.h
  GEN   hw/audio/trace.h
  GEN   hw/misc/trace.h
  GEN   hw/usb/trace.h
  GEN   hw/scsi/trace.h
  GEN   hw/nvram/trace.h
  GEN   hw/display/trace.h
  GEN   hw/input/trace.h
  GEN   hw/timer/trace.h
  GEN   hw/dma/trace.h
  GEN   hw/sparc/trace.h
  GEN   hw/sd/trace.h
  GEN   hw/isa/trace.h
  GEN   hw/mem/trace.h
  GEN   hw/i386/trace.h
  GEN   hw/9pfs/trace.h
  GEN   hw/ppc/trace.h
  GEN   hw/pci/trace.h
  GEN   hw/s390x/trace.h
  GEN   hw/vfio/trace.h
  GEN   hw/acpi/trace.h
  GEN   hw/arm/trace.h
  GEN   hw/alpha/trace.h
  GEN   ui/trace.h
  GEN   audio/trace.h
  GEN   net/trace.h
  GEN   target-i386/trace.h
  GEN   target-sparc/trace.h
  GEN   target-s390x/trace.h
  GEN   target-ppc/trace.h
  GEN   qom/trace.h
  GEN   linux-user/trace.h
  GEN   tests/test-qapi-types.h
  GEN   tests/test-qapi-visit.h
  GEN   tests/test-qmp-commands.h
  GEN   tests/test-qapi-event.h
  GEN   tests/test-qmp-introspect.h
  GEN   config-all-devices.mak
  GEN   trace/generated-tcg-tracers.h
  GEN   trace/generated-helpers-wrappers.h
  GEN   trace/generated-helpers.h
  CC    tests/qemu-iotests/socket_scm_helper.o
  GEN   qga/qapi-generated/qga-qapi-types.h
  GEN   qga/qapi-generated/qga-qapi-visit.h
  GEN   qga/qapi-generated/qga-qmp-commands.h
  GEN   qga/qapi-generated/qga-qapi-types.c
  GEN   qga/qapi-generated/qga-qapi-visit.c
  GEN   qga/qapi-generated/qga-qmp-marshal.c
  GEN   trace.c
  GEN   audio/trace.c
  GEN   block/trace.c
  GEN   crypto/trace.c
  GEN   hw/9pfs/trace.c
  GEN   hw/acpi/trace.c
  GEN   hw/alpha/trace.c
  GEN   hw/arm/trace.c
  GEN   hw/audio/trace.c
  GEN   hw/block/trace.c
  GEN   hw/char/trace.c
  GEN   hw/display/trace.c
  GEN   hw/dma/trace.c
  GEN   hw/i386/trace.c
  GEN   hw/input/trace.c
  GEN   hw/intc/trace.c
  GEN   hw/isa/trace.c
  GEN   hw/mem/trace.c
  GEN   hw/misc/trace.c
  GEN   hw/net/trace.c
  GEN   hw/nvram/trace.c
  GEN   hw/pci/trace.c
  GEN   hw/ppc/trace.c
  GEN   hw/s390x/trace.c
  GEN   hw/scsi/trace.c
  GEN   hw/sd/trace.c
  GEN   hw/sparc/trace.c
  GEN   hw/timer/trace.c
  GEN   hw/usb/trace.c
  GEN   hw/vfio/trace.c
  GEN   hw/virtio/trace.c
  GEN   io/trace.c
  GEN   linux-user/trace.c
  GEN   migration/trace.c
  GEN   net/trace.c
  GEN   qom/trace.c
  GEN   target-i386/trace.c
  GEN   target-ppc/trace.c
  GEN   target-s390x/trace.c
  GEN   target-sparc/trace.c
  GEN   ui/trace.c
  GEN   util/trace.c
  GEN   qmp-introspect.c
  GEN   qapi-types.c
  GEN   qapi-visit.c
  GEN   qapi-event.c
  CC    qapi/qapi-visit-core.o
  CC    qapi/qapi-dealloc-visitor.o
  CC    qapi/qmp-input-visitor.o
  CC    qapi/qmp-output-visitor.o
  CC    qapi/qmp-registry.o
  CC    qapi/qmp-dispatch.o
  CC    qapi/string-input-visitor.o
  CC    qapi/string-output-visitor.o
  CC    qapi/opts-visitor.o
  CC    qapi/qapi-clone-visitor.o
  CC    qapi/qmp-event.o
  CC    qapi/qapi-util.o
  CC    qobject/qnull.o
  CC    qobject/qint.o
  CC    qobject/qstring.o
  CC    qobject/qdict.o
  CC    qobject/qlist.o
  CC    qobject/qfloat.o
  CC    qobject/qbool.o
  CC    qobject/qjson.o
  CC    qobject/qobject.o
  CC    qobject/json-lexer.o
  CC    qobject/json-streamer.o
  CC    qobject/json-parser.o
  CC    trace/control.o
  CC    trace/qmp.o
  CC    util/osdep.o
  CC    util/cutils.o
  CC    util/compatfd.o
  CC    util/unicode.o
  CC    util/qemu-timer-common.o
  CC    util/event_notifier-posix.o

/tmp/qemu-test/src/trace/control.c: In function ‘trace_event_register_group’:
/tmp/qemu-test/src/trace/control.c:76: error: ‘for’ loop initial declarations are only allowed in C99 mode /tmp/qemu-test/src/trace/control.c:76: note: use option -std=c99 or -std=gnu99 to compile your code
make: *** [trace/control.o] Error 1
make: *** Waiting for unfinished jobs....
CC util/mmap-alloc.o
tests/docker/Makefile.include:104: recipe for target 'docker-run-test-quick@centos6' failed
make: *** [docker-run-test-quick@centos6] Error 1
=== OUTPUT END ===

Test command exited with code: 2

---
Email generated automatically by Patchew [http://patchew.org/].
Please send your feedback to [email protected]

#87 lore raw
Quoted 19 lines · On Tue, Aug 09, 2016 at 10:03:49AM -0700…

Hi,

Your series failed automatic build test. Please find the testing commands and their output below. If you have docker installed, you can probably reproduce it locally.

Message-id: [email protected]
Type: series
Subject: [Qemu-devel] [PATCH for-2.8 v1 00/60] Modular build of trace event files

=== TEST SCRIPT BEGIN ===
#!/bin/bash
set -e
git submodule update --init dtc
make J=8 docker-test-quick@centos6

# we need CURL DPRINTF patch
# http://patchew.org/QEMU/1470027888-24381-1-git-send-email-famz%40redhat.com/
#make J=8 docker-test-mingw@fedora

[snip]

Quoted 9 lines

=== OUTPUT BEGIN ===
Submodule 'dtc' (git://git.qemu-project.org/dtc.git) registered for path 'dtc' Cloning into 'dtc'...
Submodule path 'dtc': checked out '65cc4d2748a2c2e6f27f1cf39e07a5dbabd80ebf'
BUILD centos6
ARCHIVE qemu.tgz
ARCHIVE dtc.tgz
COPY RUNNER
RUN test-quick in centos6

Can we get this report to include details of the

a) the software versions of gcc, binutils, and any -devel packages we're building against

b) the exact arguments + env variables used to invoke configure, not merely its output

so we don't have to go digging into the docker test systemm to try and reverse engineer this info

Quoted 116 lines

No C++ compiler available; disabling C++ specific optional code

Install prefix    /tmp/qemu-test/src/tests/docker/install
BIOS directory    /tmp/qemu-test/src/tests/docker/install/share/qemu
binary directory  /tmp/qemu-test/src/tests/docker/install/bin

library directory /tmp/qemu-test/src/tests/docker/install/lib module directory /tmp/qemu-test/src/tests/docker/install/lib/qemu libexec directory /tmp/qemu-test/src/tests/docker/install/libexec include directory /tmp/qemu-test/src/tests/docker/install/include config directory /tmp/qemu-test/src/tests/docker/install/etc
local state directory /tmp/qemu-test/src/tests/docker/install/var
Manual directory /tmp/qemu-test/src/tests/docker/install/share/man ELF interp prefix /usr/gnemul/qemu-%M

Source path       /tmp/qemu-test/src
C compiler        cc
Host C compiler   cc
C++ compiler      
Objective-C compiler cc
ARFLAGS           rv
CFLAGS            -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 -pthread -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include   -g 
QEMU_CFLAGS       -I/usr/include/pixman-1    -fPIE -DPIE -m64 -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -Wstrict-prototypes -Wredundant-decls -Wall -Wundef -Wwrite-strings -Wmissing-prototypes -fno-strict-aliasing -fno-common  -Wendif-labels -Wmissing-include-dirs -Wempty-body -Wnested-externs -Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers -Wold-style-declaration -Wold-style-definition -Wtype-limits -fstack-protector-all
LDFLAGS           -Wl,--warn-common -Wl,-z,relro -Wl,-z,now -pie -m64 -g 
make              make
install           install
python            python -B
smbd              /usr/sbin/smbd
module support    no
host CPU          x86_64
host big endian   no
target list       x86_64-softmmu aarch64-softmmu
tcg debug enabled no
gprof enabled     no
sparse enabled    no
strip binaries    yes
profiler          no
static build      no
pixman            system
SDL support       yes (1.2.14)
GTK support       no 
GTK GL support    no
VTE support       no 
TLS priority      NORMAL
GNUTLS support    no
GNUTLS rnd        no
libgcrypt         no
libgcrypt kdf     no
nettle            no 
nettle kdf        no
libtasn1          no
curses support    no
virgl support     no
curl support      no
mingw32 support   no
Audio drivers     oss
Block whitelist (rw) 
Block whitelist (ro) 
VirtFS support    no
VNC support       yes
VNC SASL support  no
VNC JPEG support  no
VNC PNG support   no
xen support       no
brlapi support    no
bluez  support    no
Documentation     no
PIE               yes
vde support       no
netmap support    no
Linux AIO support no
ATTR/XATTR support yes
Install blobs     yes
KVM support       yes
RDMA support      no
TCG interpreter   no
fdt support       yes
preadv support    yes
fdatasync         yes
madvise           yes
posix_madvise     yes
uuid support      no
libcap-ng support no
vhost-net support yes
vhost-scsi support yes
Trace backends    log
spice support     no 
rbd support       no
xfsctl support    no
smartcard support no
libusb            no
usb net redir     no
OpenGL support    no
OpenGL dmabufs    no
libiscsi support  no
libnfs support    no

build guest agent yes
QGA VSS support no
QGA w32 disk info no
QGA MSI support no
seccomp support no
coroutine backend ucontext
coroutine pool yes
GlusterFS support no
Archipelago support no

gcov              gcov
gcov enabled      no
TPM support       yes
libssh2 support   no
TPM passthrough   yes
QOM debugging     yes
vhdx              no
lzo support       no
snappy support    no
bzip2 support     no

NUMA host support no
tcmalloc support no
jemalloc support no
avx2 optimization no

[snip]

Quoted 8 lines
  CC    trace/control.o
  CC    trace/qmp.o
  CC    util/osdep.o
  CC    util/cutils.o
  CC    util/compatfd.o
  CC    util/unicode.o
  CC    util/qemu-timer-common.o
  CC    util/event_notifier-posix.o
Quoted 9 lines

/tmp/qemu-test/src/trace/control.c: In function ‘trace_event_register_group’:
/tmp/qemu-test/src/trace/control.c:76: error: ‘for’ loop initial declarations are only allowed in C99 mode /tmp/qemu-test/src/trace/control.c:76: note: use option -std=c99 or -std=gnu99 to compile your code
make: *** [trace/control.o] Error 1
make: *** Waiting for unfinished jobs....
CC util/mmap-alloc.o
tests/docker/Makefile.include:104: recipe for target 'docker-run-test-quick@centos6' failed
make: *** [docker-run-test-quick@centos6] Error 1
=== OUTPUT END ===

Regards,
Daniel

Signature · 4 lines
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|
#88 lore raw
Quoted 11 lines · Daniel P. Berrange

Can we get this report to include details of the

a) the software versions of gcc, binutils, and any -devel packages we're building against

b) the exact arguments + env variables used to invoke configure, not merely its output

so we don't have to go digging into the docker test systemm to try and reverse engineer this info

The whole point of docker test system is offer a relatively easy reproducer to developers, so I'm reluctant to engineer patchew or the test script it runs for that.

On the other hand, it's reasonable to allow the docker testing code to be more verbose than currently. Or maybe we can patch ./configure to output these information?

Fam

#95 lore raw
In reply to Daniel P. Berrange
Quoted 2 lines · Daniel P. Berrange

so we don't have to go digging into the docker test systemm to try and reverse engineer this info

Actually, digging this info is pretty easy if you already use docker test locally (if you don't, may I ask why?). Just append DEBUG=1 and you can mess with things in the building env. Something like this

    $ make docker-test-quick@centos6 DEBUG=1

Then you'll be dropped in the shell that is all set up to run the build command.

Fam

#89 lore raw
In reply to Fam Zheng
Quoted 10 lines · Fam Zheng
Quoted 9 lines · Daniel P. Berrange

Can we get this report to include details of the

a) the software versions of gcc, binutils, and any -devel packages we're building against

b) the exact arguments + env variables used to invoke configure, not merely its output

Quoted 6 lines
Quoted 2 lines

so we don't have to go digging into the docker test systemm to try and reverse engineer this info

The whole point of docker test system is offer a relatively easy reproducer to developers, so I'm reluctant to engineer patchew or the test script it runs for that.

That's just pointlessly creating extra work for the developers reading these build reports. If you outputted the info I suggest, it can help developers diagnose the problems more quickly. Even if running the docker env locally is possible & even easy, it doesn't make it faster than reading the relevant info from email report in front of you.

Regards,
Daniel

Signature · 4 lines
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|
#90 lore raw
Quoted 18 lines · Daniel P. Berrange
Quoted 10 lines · Fam Zheng
Quoted 9 lines · Daniel P. Berrange

Can we get this report to include details of the

a) the software versions of gcc, binutils, and any -devel packages we're building against

b) the exact arguments + env variables used to invoke configure, not merely its output

Quoted 6 lines
Quoted 2 lines

so we don't have to go digging into the docker test systemm to try and reverse engineer this info

The whole point of docker test system is offer a relatively easy reproducer to developers, so I'm reluctant to engineer patchew or the test script it runs for that.

Quoted 5 lines

That's just pointlessly creating extra work for the developers reading these build reports. If you outputted the info I suggest, it can help developers diagnose the problems more quickly. Even if running the docker env locally is possible & even easy, it doesn't make it faster than reading the relevant info from email report in front of you.

I agree with your point, I just don't know how to do a) neatly, except for a vast change to configure.

Fam

#91 lore raw
Quoted 19 lines · Fam Zheng
Quoted 18 lines · Daniel P. Berrange
Quoted 16 lines · Fam Zheng
Quoted 11 lines · Daniel P. Berrange

Can we get this report to include details of the

a) the software versions of gcc, binutils, and any -devel packages we're building against

b) the exact arguments + env variables used to invoke configure, not merely its output

so we don't have to go digging into the docker test systemm to try and reverse engineer this info

The whole point of docker test system is offer a relatively easy reproducer to developers, so I'm reluctant to engineer patchew or the test script it runs for that.

Quoted 8 lines
Quoted 5 lines

That's just pointlessly creating extra work for the developers reading these build reports. If you outputted the info I suggest, it can help developers diagnose the problems more quickly. Even if running the docker env locally is possible & even easy, it doesn't make it faster than reading the relevant info from email report in front of you.

I agree with your point, I just don't know how to do a) neatly, except for a vast change to configure.

Why do you need todo it in configure ? I was thinking your docker receipe that invokes configure could just do it - not least because the commands to run to get the data will be different based on which distro you're running in the docker image in question.

Regards,
Daniel

Signature · 4 lines
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|
#92 lore raw
Quoted 26 lines · Daniel P. Berrange
Quoted 25 lines · Fam Zheng
Quoted 23 lines · Daniel P. Berrange
Quoted 10 lines · Fam Zheng
Quoted 9 lines · Daniel P. Berrange

Can we get this report to include details of the

a) the software versions of gcc, binutils, and any -devel packages we're building against

b) the exact arguments + env variables used to invoke configure, not merely its output

Quoted 6 lines
Quoted 2 lines

so we don't have to go digging into the docker test systemm to try and reverse engineer this info

The whole point of docker test system is offer a relatively easy reproducer to developers, so I'm reluctant to engineer patchew or the test script it runs for that.

That's just pointlessly creating extra work for the developers reading these build reports. If you outputted the info I suggest, it can help developers diagnose the problems more quickly. Even if running the docker env locally is possible & even easy, it doesn't make it faster than reading the relevant info from email report in front of you.

Quoted 7 lines
Quoted 2 lines

I agree with your point, I just don't know how to do a) neatly, except for a vast change to configure.

Why do you need todo it in configure ? I was thinking your docker receipe that invokes configure could just do it - not least because the commands to run to get the data will be different based on which distro you're running in the docker image in question.

Then the script needs to be updated to work with different package management systems (rpm and deb). For now they only call standard Linux commands. That's least of the problem, though.

The more tricky question is how the script can tell which packages are relevant (or, used). I assume the number of packages in a docker image is quite limited (fedora has 396, ubuntu 574), but dumping the whole list is still noisy nevertheless. Also, depending on the configure option, a submodule can be used instead, or a local built library. Not that we have a lot of these now, but it's a factor of complication.

On the other hand, configure knows when to use pkg-config --modversion, or git describe, or something else, depending on how and where it discovers the compiler and -devel libs etc..

Fam

#93 lore raw
Quoted 46 lines · Fam Zheng
Quoted 26 lines · Daniel P. Berrange
Quoted 25 lines · Fam Zheng
Quoted 23 lines · Daniel P. Berrange
Quoted 10 lines · Fam Zheng
Quoted 9 lines · Daniel P. Berrange

Can we get this report to include details of the

a) the software versions of gcc, binutils, and any -devel packages we're building against

b) the exact arguments + env variables used to invoke configure, not merely its output

Quoted 6 lines
Quoted 2 lines

so we don't have to go digging into the docker test systemm to try and reverse engineer this info

The whole point of docker test system is offer a relatively easy reproducer to developers, so I'm reluctant to engineer patchew or the test script it runs for that.

That's just pointlessly creating extra work for the developers reading these build reports. If you outputted the info I suggest, it can help developers diagnose the problems more quickly. Even if running the docker env locally is possible & even easy, it doesn't make it faster than reading the relevant info from email report in front of you.

Quoted 7 lines
Quoted 2 lines

I agree with your point, I just don't know how to do a) neatly, except for a vast change to configure.

Why do you need todo it in configure ? I was thinking your docker receipe that invokes configure could just do it - not least because the commands to run to get the data will be different based on which distro you're running in the docker image in question.

Then the script needs to be updated to work with different package management systems (rpm and deb). For now they only call standard Linux commands. That's least of the problem, though.

The more tricky question is how the script can tell which packages are relevant (or, used). I assume the number of packages in a docker image is quite limited (fedora has 396, ubuntu 574), but dumping the whole list is still noisy nevertheless. Also, depending on the configure option, a submodule can be used instead, or a local built library. Not that we have a lot of these now, but it's a factor of complication.

Quoted 3 lines

On the other hand, configure knows when to use pkg-config --modversion, or git describe, or something else, depending on how and where it discovers the compiler and -devel libs etc..

In the tests/docker/dockerfiles/*.docker files you install a bunch of RPMs we build against. I was just thinking to report versions of those particular RPMs.

IIt would be sufficient if you just captured the output of the 'dnf install' command (or equivalent) to, say /tmp/installed.txt. Then have build_qemu() in common.rc simply cat /tmp/installed.txt before running configure. That way all the distro-specific bits stay in the *.docker files.

Regards,
Daniel

Signature · 4 lines
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|
#19 lore raw

Re: [Qemu-devel] [PATCH for-2.8 v1 10/60] trace: remove fixed global event state arrays

In reply to Daniel P. Berrange

Daniel P Berrange writes:
[...]

Quoted 6 lines
scripts/tracetool/format/events_c.py +0 -0
index 9203377..bab6404 100644
@@ -25,7 +25,10 @@ def generate(events, backend):
         '#include "trace/control.h"',

scripts/tracetool/format/events_c.py def generate(events, backend): · line 34

Quoted 10 lines
scripts/tracetool/format/events_c.py +4 -1
         '')
 
-    out('TraceEvent trace_events[TRACE_EVENT_COUNT] = {')
+    out('uint16_t dstate[TRACE_EVENT_COUNT];')
+    out('bool dstate_init[TRACE_EVENT_COUNT];')
+
+    out('static TraceEvent trace_events[TRACE_EVENT_COUNT] = {')
 
     for e in events:
         if "vcpu" in e.properties:

I'd rather keep them as 'trace_events_dstate' and 'trace_events_dstate_init' if most references are auto-generated. Or maybe I just missed something.

Also, maybe we should just try to get rid of the dstate_init structure. Only vcpu events need late initialization, which could be something like:

   trace_events_enabled_count--;
   dstate[ev->id]--;
   trace_event_set_state_dynamic(dstate, ev, true);

Non-vcpu events shouldn't need late initialization.

[...]

Quoted 7 lines
stubs/trace-control.c +0 -0
index fe59836..31566c2 100644
@@ -11,16 +11,12 @@
 #include "trace/control.h"
 

stubs/trace-control.c line 17

Quoted 10 lines
stubs/trace-control.c +1 -5
 
-void trace_event_set_state_dynamic(TraceEvent *ev, bool state)
+void trace_event_set_state_dynamic(uint16_t *dstate, TraceEvent *ev, bool state)
 {
-    TraceEventID id;
     assert(trace_event_get_state_static(ev));
-    id = trace_event_get_id(ev);
-    trace_events_enabled_count += state - trace_events_dstate[id];
-    trace_events_dstate[id] = state;
 }

Should not be empty (here, stub means it's not target code).

Cheers,
Lluis

#96 lore raw
In reply to Daniel P. Berrange
Quoted 8 lines · Daniel P Berrange

I previously split the global trace-events file up into one file per-subdirectory to avoid merge conflict hell.

This series builds on that to now actually generate the individual trace files per-subdirectory too. The key benefit of doing this is that a change in a trace-events file will no longer cause a rebuild of the entire world. Instead only that one affected sub-directory will have files rebuilt.

Is re-compilation time worth the effort?

Cheers,
Lluis

#34 lore raw

Re: [Qemu-devel] [PATCH for-2.8 v1 17/60] trace: introduce some Makefile rules for module code gen

In reply to Daniel P. Berrange

Daniel P Berrange writes:
[...]

Quoted 50 lines
Makefile +39 -0
index 48673cb..2b9ba60 100644
@@ -70,9 +70,55 @@ GENERATED_SOURCES += trace/generated-helpers.c
 
 ifeq ($(findstring ust,$(TRACE_BACKENDS)),ust)
 GENERATED_HEADERS += trace/generated-ust-provider.h
+GENERATED_HEADERS += trace/generated-ust-provider-all.h
 GENERATED_SOURCES += trace/generated-ust.c
 endif
 
+GENERATED_HEADERS += $(trace-events-subdirs:%=%/trace.h)
+GENERATED_SOURCES += $(trace-events-subdirs:%=%/trace.c)
+GENERATED_DTRACE =
+ifdef CONFIG_TRACE_DTRACE
+GENERATED_HEADERS += $(trace-events-subdirs:%=%/trace-dtrace.h)
+GENERATED_DTRACE += $(trace-events-subdirs:%=%/trace-dtrace.dtrace)
+endif
+ifdef CONFIG_TRACE_UST
+GENERATED_HEADERS += $(trace-events-subdirs:%=%/trace-ust.h)
+endif
+
+%/trace.h: $(SRC_PATH)/%/trace-events $(tracetool-y)
+	$(call quiet-command,$(TRACETOOL) \
+		--format=h \
+		--backends=$(TRACE_BACKENDS) \
+		--group=$(shell dirname $@ | tr /- _) \
+		< $< > $@,"  GEN   $@")
+
+%/trace.c: $(SRC_PATH)/%/trace-events $(tracetool-y)
+	$(call quiet-command,$(TRACETOOL) \
+		--format=c \
+		--backends=$(TRACE_BACKENDS) \
+		--group=$(shell dirname $@ | tr /- _) \
+		< $< > $@,"  GEN   $@")
+
+%/trace-ust.h: $(SRC_PATH)/%/trace-events $(tracetool-y)
+	$(call quiet-command,$(TRACETOOL) \
+		--format=ust-events-h \
+		--backends=$(TRACE_BACKENDS) \
+		--group=$(shell dirname $@ | tr /- _) \
+		< $< > $@,"  GEN   $@")
+
+%/trace-dtrace.dtrace: $(SRC_PATH)/%/trace-events $(BUILD_DIR)/config-host.mak $(tracetool-y)
+	$(call quiet-command,$(TRACETOOL) \
+		--format=d \
+		--backends=$(TRACE_BACKENDS) \
+		--group=$(shell dirname $@ | tr /- _) \
+		< $< > $@,"  GEN   $@")

Makefile GENERATED_SOURCES += trace/generated-helpers.c · line 124

Quoted 10 lines
Makefile +7 -0
+
+%/trace-dtrace.h: %/trace-dtrace.dtrace $(tracetool-y)
+	$(call quiet-command,dtrace -o $@ -h -s $<, "  GEN   $@")
+
+%/trace-dtrace.o: %/trace-dtrace.dtrace $(tracetool-y)
+
+
 # Don't try to regenerate Makefile or configure
 # We don't generate any of them
 Makefile: ;

I'd rather keep the "generated-" prefix on all files that usually are not directly included by QEMU developers.

Cheers,
Lluis

#79 lore raw

Re: [Qemu-devel] [PATCH for-2.8 v1 60/60] trace: update docs to reflect new code generation approach

In reply to Daniel P. Berrange
Quoted 16 lines · Daniel P Berrange

Describe use of per-subdir trace events files and how it impacts code generation.

---
 docs/tracing.txt | 61 +++++++++++++++++++++++++++++++++++++++++++++++---------
 1 file changed, 52 insertions(+), 9 deletions(-)
docs/tracing.txt +0 -0
index 29f2f9a..b7ba179 100644
@@ -27,18 +27,51 @@ for debugging, profiling, and observing execution.
 
 == Trace events ==
 

docs/tracing.txt for debugging, profiling, and observing execution. · line 37

Quoted 10 lines
docs/tracing.txt +7 -2
+=== Sub-directory setup ===
+
 Each directory in the source tree can declare a set of static trace events
-in a "trace-events" file. Each trace event declaration names the event, its
-arguments, and the format string which can be used for pretty-printing:
+in a "trace-events" file. The first (non-comment) statement in the file
+must be "@id_offset(NN)" where NN is an integer that is unique among all
+"trace-events" files in the QEMU source tree. The IDs can be arbitrarily
+chosen, but extra fun the current "trace-events" files use values from the
+"powerful number" integer sequence :-)

Can we get rid of the "@id_offset(NN)"? If we're generating a trace-events-all all the same, we can use that to generate all the per-directory file *and* still keep the simpler flat event ids.

For example, first we concatenate /trace-events, /io/trace-events and /hw/usb/trace-events into /trace-events-all to produce:

@group core
@dir /

   # contents of /trace-events
   @group io
   @dir /io
   # contents of /io/trace-events
   @group hw_usb
   @dir /hw/usb
   # contents of /hw/usb/trace-events

Then we can use /trace-events-all to generate all the per-directory trace.h files while ensuring a perfectly flat event identifier space (a single generated-events.c is used).

This should minimize changes to tracing code and avoid further restrictions (like the "top-level vcpu" one).

Cheers,
Lluis

#20 lore raw

Re: [Qemu-devel] [PATCH for-2.8 v1 10/60] trace: remove fixed global event state arrays

In reply to Lluís Vilanova
Quoted 16 lines · Lluís Vilanova

Daniel P Berrange writes:
[...]

Quoted 13 lines
scripts/tracetool/format/events_c.py +4 -1
index 9203377..bab6404 100644
@@ -25,7 +25,10 @@ def generate(events, backend):
         '#include "trace/control.h"',
         '')
 
-    out('TraceEvent trace_events[TRACE_EVENT_COUNT] = {')
+    out('uint16_t dstate[TRACE_EVENT_COUNT];')
+    out('bool dstate_init[TRACE_EVENT_COUNT];')
+
+    out('static TraceEvent trace_events[TRACE_EVENT_COUNT] = {')
Quoted 5 lines

scripts/tracetool/format/events_c.py def generate(events, backend): · line 34

Quoted 2 lines
scripts/tracetool/format/events_c.py +0 -0
     for e in events:
         if "vcpu" in e.properties:

I'd rather keep them as 'trace_events_dstate' and 'trace_events_dstate_init' if most references are auto-generated. Or maybe I just missed something.

Later patches rename this again, giving it a custom prefix for each group

Quoted 8 lines

Also, maybe we should just try to get rid of the dstate_init structure. Only vcpu events need late initialization, which could be something like:

   trace_events_enabled_count--;
   dstate[ev->id]--;
   trace_event_set_state_dynamic(dstate, ev, true);

Non-vcpu events shouldn't need late initialization.

I'd rather not try to refactor that logic at the same time - it could be done as a later patch, or if you want to submit a patch to fix that I can rebase on top of it.

Quoted 9 lines

[...]

Quoted 6 lines
stubs/trace-control.c +0 -0
index fe59836..31566c2 100644
@@ -11,16 +11,12 @@
 #include "trace/control.h"
Quoted 11 lines

stubs/trace-control.c line 17

Quoted 9 lines
stubs/trace-control.c +1 -5
-void trace_event_set_state_dynamic(TraceEvent *ev, bool state)
+void trace_event_set_state_dynamic(uint16_t *dstate, TraceEvent *ev, bool state)
 {
-    TraceEventID id;
     assert(trace_event_get_state_static(ev));
-    id = trace_event_get_id(ev);
-    trace_events_enabled_count += state - trace_events_dstate[id];
-    trace_events_dstate[id] = state;
 }

Should not be empty (here, stub means it's not target code).

Oh hmm, for qemu-img & friends, i geuss

Regards,
Daniel

Signature · 4 lines
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|
#35 lore raw

Re: [Qemu-devel] [PATCH for-2.8 v1 17/60] trace: introduce some Makefile rules for module code gen

In reply to Lluís Vilanova
Quoted 57 lines · Lluís Vilanova

Daniel P Berrange writes:
[...]

Quoted 55 lines
Makefile +44 -0
index 48673cb..2b9ba60 100644
@@ -70,9 +70,55 @@ GENERATED_SOURCES += trace/generated-helpers.c
 
 ifeq ($(findstring ust,$(TRACE_BACKENDS)),ust)
 GENERATED_HEADERS += trace/generated-ust-provider.h
+GENERATED_HEADERS += trace/generated-ust-provider-all.h
 GENERATED_SOURCES += trace/generated-ust.c
 endif
 
+GENERATED_HEADERS += $(trace-events-subdirs:%=%/trace.h)
+GENERATED_SOURCES += $(trace-events-subdirs:%=%/trace.c)
+GENERATED_DTRACE =
+ifdef CONFIG_TRACE_DTRACE
+GENERATED_HEADERS += $(trace-events-subdirs:%=%/trace-dtrace.h)
+GENERATED_DTRACE += $(trace-events-subdirs:%=%/trace-dtrace.dtrace)
+endif
+ifdef CONFIG_TRACE_UST
+GENERATED_HEADERS += $(trace-events-subdirs:%=%/trace-ust.h)
+endif
+
+%/trace.h: $(SRC_PATH)/%/trace-events $(tracetool-y)
+	$(call quiet-command,$(TRACETOOL) \
+		--format=h \
+		--backends=$(TRACE_BACKENDS) \
+		--group=$(shell dirname $@ | tr /- _) \
+		< $< > $@,"  GEN   $@")
+
+%/trace.c: $(SRC_PATH)/%/trace-events $(tracetool-y)
+	$(call quiet-command,$(TRACETOOL) \
+		--format=c \
+		--backends=$(TRACE_BACKENDS) \
+		--group=$(shell dirname $@ | tr /- _) \
+		< $< > $@,"  GEN   $@")
+
+%/trace-ust.h: $(SRC_PATH)/%/trace-events $(tracetool-y)
+	$(call quiet-command,$(TRACETOOL) \
+		--format=ust-events-h \
+		--backends=$(TRACE_BACKENDS) \
+		--group=$(shell dirname $@ | tr /- _) \
+		< $< > $@,"  GEN   $@")
+
+%/trace-dtrace.dtrace: $(SRC_PATH)/%/trace-events $(BUILD_DIR)/config-host.mak $(tracetool-y)
+	$(call quiet-command,$(TRACETOOL) \
+		--format=d \
+		--backends=$(TRACE_BACKENDS) \
+		--group=$(shell dirname $@ | tr /- _) \
+		< $< > $@,"  GEN   $@")
+
+%/trace-dtrace.h: %/trace-dtrace.dtrace $(tracetool-y)
+	$(call quiet-command,dtrace -o $@ -h -s $<, "  GEN   $@")
+
+%/trace-dtrace.o: %/trace-dtrace.dtrace $(tracetool-y)
Quoted 8 lines

Makefile GENERATED_SOURCES += trace/generated-helpers.c · line 124

Quoted 5 lines
Makefile +2 -0
+
+
 # Don't try to regenerate Makefile or configure
 # We don't generate any of them
 Makefile: ;

I'd rather keep the "generated-" prefix on all files that usually are not directly included by QEMU developers.

I don't think that's really needed - all these files are in sub-dirs now and its a clear rule that trace*.[hc] is auto-generated in every sub-dir now. Also no oither code in QEMU thats auto-generated adds this prefix on so trace is inconsistent with practice elsewhere.

Regards,
Daniel

Signature · 4 lines
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|
#80 lore raw

Re: [Qemu-devel] [PATCH for-2.8 v1 60/60] trace: update docs to reflect new code generation approach

In reply to Lluís Vilanova
Quoted 18 lines · Lluís Vilanova
Quoted 15 lines · Daniel P Berrange

Describe use of per-subdir trace events files and how it impacts code generation.

---
 docs/tracing.txt | 61 +++++++++++++++++++++++++++++++++++++++++++++++---------
 1 file changed, 52 insertions(+), 9 deletions(-)
docs/tracing.txt +0 -0
index 29f2f9a..b7ba179 100644
@@ -27,18 +27,51 @@ for debugging, profiling, and observing execution.
 
 == Trace events ==
Quoted 14 lines

docs/tracing.txt for debugging, profiling, and observing execution. · line 37

Quoted 10 lines
docs/tracing.txt +7 -2
+=== Sub-directory setup ===
+
 Each directory in the source tree can declare a set of static trace events
-in a "trace-events" file. Each trace event declaration names the event, its
-arguments, and the format string which can be used for pretty-printing:
+in a "trace-events" file. The first (non-comment) statement in the file
+must be "@id_offset(NN)" where NN is an integer that is unique among all
+"trace-events" files in the QEMU source tree. The IDs can be arbitrarily
+chosen, but extra fun the current "trace-events" files use values from the
+"powerful number" integer sequence :-)

Can we get rid of the "@id_offset(NN)"? If we're generating a trace-events-all all the same, we can use that to generate all the per-directory file *and* still keep the simpler flat event ids.

One thing that occurred to me is that we could take a hash of the group name. Since we have few enough sub-dirs / groups, and a large enough ID space, it ought to be possible to get a hash which is unique. The trace tool can double check that all groups get a unique hash

Quoted 13 lines

For example, first we concatenate /trace-events, /io/trace-events and /hw/usb/trace-events into /trace-events-all to produce:

@group core
@dir /

   # contents of /trace-events
   @group io
   @dir /io
   # contents of /io/trace-events
   @group hw_usb
   @dir /hw/usb
   # contents of /hw/usb/trace-events
Quoted 6 lines

Then we can use /trace-events-all to generate all the per-directory trace.h files while ensuring a perfectly flat event identifier space (a single generated-events.c is used).

This should minimize changes to tracing code and avoid further restrictions (like the "top-level vcpu" one).

That means when any individual trace file is changed, we re-generate the world, which is exactly what this series is designed to avoid.

Regards,
Daniel

Signature · 4 lines
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|
#97 lore raw
In reply to Lluís Vilanova
Quoted 5 lines · Lluís Vilanova
Quoted 2 lines · Daniel P Berrange

I previously split the global trace-events file up into one file per-subdirectory to avoid merge conflict hell.

Quoted 7 lines
Quoted 5 lines

This series builds on that to now actually generate the individual trace files per-subdirectory too. The key benefit of doing this is that a change in a trace-events file will no longer cause a rebuild of the entire world. Instead only that one affected sub-directory will have files rebuilt.

Is re-compilation time worth the effort?

Absolutely yes, especially if you have build for multiple targets enabled. Rebuilding all files when you have all 30+ targets enabled takes an incredibly long time.

Regards,
Daniel

Signature · 4 lines
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|
#94 lore raw
In reply to Fam Zheng
Quoted 11 lines · Fam Zheng

Then the script needs to be updated to work with different package management systems (rpm and deb). For now they only call standard Linux commands. That's least of the problem, though.

The more tricky question is how the script can tell which packages are relevant (or, used). I assume the number of packages in a docker image is quite limited (fedora has 396, ubuntu 574), but dumping the whole list is still noisy nevertheless. Also, depending on the configure option, a submodule can be used instead, or a local built library. Not that we have a lot of these now, but it's a factor of complication.

Quoted 3 lines

On the other hand, configure knows when to use pkg-config --modversion, or git describe, or something else, depending on how and where it discovers the compiler and -devel libs etc..

Can you include a description of how to reproduce with "make docker-test-FOO@BAR DEBUG=1"?

Thanks,

Paolo

#81 lore raw

Re: [Qemu-devel] [PATCH for-2.8 v1 60/60] trace: update docs to reflect new code generation approach

In reply to Daniel P. Berrange
Quoted 34 lines · Daniel P Berrange
Quoted 18 lines · Lluís Vilanova
Quoted 15 lines · Daniel P Berrange

Describe use of per-subdir trace events files and how it impacts code generation.

---
 docs/tracing.txt | 61 +++++++++++++++++++++++++++++++++++++++++++++++---------
 1 file changed, 52 insertions(+), 9 deletions(-)
docs/tracing.txt +0 -0
index 29f2f9a..b7ba179 100644
@@ -27,18 +27,51 @@ for debugging, profiling, and observing execution.
 
 == Trace events ==
Quoted 14 lines

docs/tracing.txt for debugging, profiling, and observing execution. · line 37

Quoted 10 lines
docs/tracing.txt +7 -2
+=== Sub-directory setup ===
+
 Each directory in the source tree can declare a set of static trace events
-in a "trace-events" file. Each trace event declaration names the event, its
-arguments, and the format string which can be used for pretty-printing:
+in a "trace-events" file. The first (non-comment) statement in the file
+must be "@id_offset(NN)" where NN is an integer that is unique among all
+"trace-events" files in the QEMU source tree. The IDs can be arbitrarily
+chosen, but extra fun the current "trace-events" files use values from the
+"powerful number" integer sequence :-)

Can we get rid of the "@id_offset(NN)"? If we're generating a trace-events-all all the same, we can use that to generate all the per-directory file *and* still keep the simpler flat event ids.

Quoted 5 lines

One thing that occurred to me is that we could take a hash of the group name. Since we have few enough sub-dirs / groups, and a large enough ID space, it ought to be possible to get a hash which is unique. The trace tool can double check that all groups get a unique hash

Eliminating "@id_offset" is nice, but I would prefer to eliminate the event hierarchy too.

Quoted 17 lines
Quoted 17 lines

For example, first we concatenate /trace-events, /io/trace-events and /hw/usb/trace-events into /trace-events-all to produce:

@group core
@dir /

# contents of /trace-events
@group io
@dir /io
# contents of /io/trace-events
@group hw_usb
@dir /hw/usb
# contents of /hw/usb/trace-events

Then we can use /trace-events-all to generate all the per-directory trace.h files while ensuring a perfectly flat event identifier space (a single generated-events.c is used).

Quoted 5 lines
Quoted 2 lines

This should minimize changes to tracing code and avoid further restrictions (like the "top-level vcpu" one).

That means when any individual trace file is changed, we re-generate the world, which is exactly what this series is designed to avoid.

Nope. We re-generate /trace-events-all, but each individual file generated afterwards (taken from the "@dir" directive) will change only if its new contents do (the Makefile uses cmp to check if files need updating from their corresponding timestamp file).

Cheers,
Lluis

#21 lore raw

Re: [Qemu-devel] [PATCH for-2.8 v1 10/60] trace: remove fixed global event state arrays

In reply to Daniel P. Berrange
Quoted 17 lines · Daniel P Berrange
Quoted 16 lines · Lluís Vilanova

Daniel P Berrange writes:
[...]

Quoted 13 lines
scripts/tracetool/format/events_c.py +4 -1
index 9203377..bab6404 100644
@@ -25,7 +25,10 @@ def generate(events, backend):
         '#include "trace/control.h"',
         '')
 
-    out('TraceEvent trace_events[TRACE_EVENT_COUNT] = {')
+    out('uint16_t dstate[TRACE_EVENT_COUNT];')
+    out('bool dstate_init[TRACE_EVENT_COUNT];')
+
+    out('static TraceEvent trace_events[TRACE_EVENT_COUNT] = {')
Quoted 8 lines
Quoted 5 lines

scripts/tracetool/format/events_c.py def generate(events, backend): · line 34

Quoted 2 lines
scripts/tracetool/format/events_c.py +0 -0
     for e in events:
         if "vcpu" in e.properties:

I'd rather keep them as 'trace_events_dstate' and 'trace_events_dstate_init' if most references are auto-generated. Or maybe I just missed something.

Later patches rename this again, giving it a custom prefix for each group

I saw them later, sorry. But I still think these too should be renamed, to make it clear it's related to tracing.

Quoted 7 lines
Quoted 7 lines

Also, maybe we should just try to get rid of the dstate_init structure. Only vcpu events need late initialization, which could be something like:

trace_events_enabled_count--;
dstate[ev->id]--;
trace_event_set_state_dynamic(dstate, ev, true);

Quoted 5 lines
Quoted 1 line

Non-vcpu events shouldn't need late initialization.

I'd rather not try to refactor that logic at the same time - it could be done as a later patch, or if you want to submit a patch to fix that I can rebase on top of it.

I can do that.

Quoted 21 lines
Quoted 9 lines

[...]

Quoted 6 lines
stubs/trace-control.c +0 -0
index fe59836..31566c2 100644
@@ -11,16 +11,12 @@
 #include "trace/control.h"
Quoted 11 lines

stubs/trace-control.c line 17

Quoted 9 lines
stubs/trace-control.c +1 -5
-void trace_event_set_state_dynamic(TraceEvent *ev, bool state)
+void trace_event_set_state_dynamic(uint16_t *dstate, TraceEvent *ev, bool state)
 {
-    TraceEventID id;
     assert(trace_event_get_state_static(ev));
-    id = trace_event_get_id(ev);
-    trace_events_enabled_count += state - trace_events_dstate[id];
-    trace_events_dstate[id] = state;
 }

Should not be empty (here, stub means it's not target code).

Quoted 1 line

Oh hmm, for qemu-img & friends, i geuss

Exactly.

Cheers,
Lluis

#82 lore raw

Re: [Qemu-devel] [PATCH for-2.8 v1 60/60] trace: update docs to reflect new code generation approach

In reply to Lluís Vilanova
Quoted 36 lines · Lluís Vilanova
Quoted 33 lines · Daniel P Berrange
Quoted 32 lines · Lluís Vilanova
Quoted 16 lines · Daniel P Berrange

Describe use of per-subdir trace events files and how it impacts code generation.

---
 docs/tracing.txt | 61 +++++++++++++++++++++++++++++++++++++++++++++++---------
 1 file changed, 52 insertions(+), 9 deletions(-)
docs/tracing.txt +0 -0
index 29f2f9a..b7ba179 100644
@@ -27,18 +27,51 @@ for debugging, profiling, and observing execution.
 
 == Trace events ==
 

docs/tracing.txt for debugging, profiling, and observing execution. · line 37

Quoted 10 lines
docs/tracing.txt +7 -2
+=== Sub-directory setup ===
+
 Each directory in the source tree can declare a set of static trace events
-in a "trace-events" file. Each trace event declaration names the event, its
-arguments, and the format string which can be used for pretty-printing:
+in a "trace-events" file. The first (non-comment) statement in the file
+must be "@id_offset(NN)" where NN is an integer that is unique among all
+"trace-events" files in the QEMU source tree. The IDs can be arbitrarily
+chosen, but extra fun the current "trace-events" files use values from the
+"powerful number" integer sequence :-)

Can we get rid of the "@id_offset(NN)"? If we're generating a trace-events-all all the same, we can use that to generate all the per-directory file *and* still keep the simpler flat event ids.

Quoted 8 lines
Quoted 5 lines

One thing that occurred to me is that we could take a hash of the group name. Since we have few enough sub-dirs / groups, and a large enough ID space, it ought to be possible to get a hash which is unique. The trace tool can double check that all groups get a unique hash

Eliminating "@id_offset" is nice, but I would prefer to eliminate the event hierarchy too.

Having the event groups is the only way to avoid re-numbering all events when a new one is added.

Quoted 20 lines
Quoted 19 lines
Quoted 19 lines

For example, first we concatenate /trace-events, /io/trace-events and /hw/usb/trace-events into /trace-events-all to produce:

@group core
@dir /

# contents of /trace-events
@group io
@dir /io
# contents of /io/trace-events
@group hw_usb
@dir /hw/usb
# contents of /hw/usb/trace-events

Then we can use /trace-events-all to generate all the per-directory trace.h files while ensuring a perfectly flat event identifier space (a single generated-events.c is used).

This should minimize changes to tracing code and avoid further restrictions (like the "top-level vcpu" one).

Quoted 7 lines
Quoted 2 lines

That means when any individual trace file is changed, we re-generate the world, which is exactly what this series is designed to avoid.

Nope. We re-generate /trace-events-all, but each individual file generated afterwards (taken from the "@dir" directive) will change only if its new contents do (the Makefile uses cmp to check if files need updating from their corresponding timestamp file).

The contents will still need to change too if we have a global numbering space as your suggestion requires. The event groups are the only way to avoid that.

Regards,
Daniel

Signature · 4 lines
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|
#83 lore raw

Re: [Qemu-devel] [PATCH for-2.8 v1 60/60] trace: update docs to reflect new code generation approach

Quoted 5 lines · Daniel P Berrange
Quoted 4 lines · Lluís Vilanova
Quoted 2 lines · Daniel P Berrange
Quoted 1 line · Lluís Vilanova

Daniel P Berrange writes:

[...]

Quoted 23 lines
Quoted 23 lines
Quoted 22 lines
Quoted 13 lines

For example, first we concatenate /trace-events, /io/trace-events and /hw/usb/trace-events into /trace-events-all to produce:

@group core
@dir /

# contents of /trace-events
@group io
@dir /io
# contents of /io/trace-events
@group hw_usb
@dir /hw/usb
# contents of /hw/usb/trace-events
Quoted 6 lines

Then we can use /trace-events-all to generate all the per-directory trace.h files while ensuring a perfectly flat event identifier space (a single generated-events.c is used).

This should minimize changes to tracing code and avoid further restrictions (like the "top-level vcpu" one).

That means when any individual trace file is changed, we re-generate the world, which is exactly what this series is designed to avoid.

Quoted 8 lines
Quoted 4 lines

Nope. We re-generate /trace-events-all, but each individual file generated afterwards (taken from the "@dir" directive) will change only if its new contents do (the Makefile uses cmp to check if files need updating from their corresponding timestamp file).

The contents will still need to change too if we have a global numbering space as your suggestion requires. The event groups are the only way to avoid that.

Aha, that's true. I didn't think of that, sorry.

Cheers,
Lluis

#8 lore raw

Re: [Qemu-devel] [PATCH for-2.8 v1 05/60] trace: add trace event iterator APIs

In reply to Daniel P. Berrange
Quoted 9 lines · Daniel P. Berrange
trace/control.c +9 -0
+TraceEvent *trace_event_iter_next(TraceEventIter *iter)
+{
+    TraceEvent *ev;
+
+    if (iter->event >= TRACE_EVENT_COUNT) {
+        return NULL;
+    }
+
+    ev = &(trace_events[iter->event]);

trace/control.c TraceEvent *trace_event_pattern(const char *pat, TraceEvent *ev) · line 151

Quoted 10 lines
trace/control.c +10 -0
+
+    do {
+        iter->event++;
+    } while (iter->event < TRACE_EVENT_COUNT &&
+             iter->pattern &&
+             !pattern_glob(iter->pattern,
+                           trace_event_get_name(&(trace_events[iter->event]))));
+
+    return ev;
+}

Shouldn't ev be updated inside the while loop? Otherwise the iterator always returns &trace_events[0] the first time it's called.

A doc comment would help clarify the intended semantics of trace_event_iter_next().

Reviewed-by on v1 6/60
#11 lore raw

Re: [Qemu-devel] [PATCH for-2.8 v1 06/60] trace: convert code to use event iterators

In reply to Daniel P. Berrange
Quoted 10 lines · Daniel P. Berrange

This converts the HMP/QMP monitor API implementations and some internal trace control methods to use the new trace event iterator APIs.

---
 monitor.c       | 16 ++++++----
 trace/control.c | 92 +++++++++++++++++++++++++++++++++------------------------
 trace/qmp.c     | 16 ++++++----
 3 files changed, 73 insertions(+), 51 deletions(-)
#17 lore raw

Re: [Qemu-devel] [PATCH for-2.8 v1 09/60] trace: remove use of TRACE_VCPU_EVENT_COUNT in cpu.h

In reply to Daniel P. Berrange

include/qom/cpu.h struct qemu_work_item { · line 247

Quoted 5 lines · Daniel P. Berrange
include/qom/cpu.h +5 -0
+/* Keep this a multiple of 8, or better yet a multiple
+ * of the platform word size, since the struct
+ * will be padded out to that regardless.
+ */
+#define TRACE_MAX_VCPU_EVENT 32

Hard-coding this is awkward. Can it be generated by tracetool at build time so the bitmap is always large enough without manually bumping this definition?

Stefan

#26 lore raw

Re: [Qemu-devel] [PATCH for-2.8 v1 11/60] trace: remove use of event ID enums from APIs

In reply to Paolo Bonzini
Quoted 10 lines · Paolo Bonzini
Quoted 7 lines · Daniel P. Berrange
Quoted 7 lines
Quoted 7 lines
Quoted 5 lines

trace/control-internal.h static inline bool trace_event_is_pattern(const char *str) · line 30

Quoted 5 lines
trace/control-internal.h +1 -1
-static inline TraceEventID trace_event_get_id(TraceEvent *ev)
+static inline size_t trace_event_get_id(TraceEvent *ev)
 {
     assert(ev != NULL);
     return ev->id;

Perhaps "unsigned" is a better match than size_t?

Quoted 4 lines
Quoted 2 lines

I don't mind either way - I just happen to personally always use size_t for anything that ends up being used primarily as an array index.

Makes sense. I was thinking of simpletrace's 32-bit id instead.

I think unsigned is slightly clearer since it expresses the intent that the values are limited to 32 bits.

Stefan

#84 lore raw

Re: [Qemu-devel] [PATCH for-2.8 v1 60/60] trace: update docs to reflect new code generation approach

In reply to Lluís Vilanova
Quoted 36 lines · Lluís Vilanova
Quoted 5 lines · Daniel P Berrange
Quoted 4 lines · Lluís Vilanova
Quoted 2 lines · Daniel P Berrange
Quoted 1 line · Lluís Vilanova

Daniel P Berrange writes:

[...]

Quoted 27 lines
Quoted 27 lines
Quoted 17 lines
Quoted 17 lines

For example, first we concatenate /trace-events, /io/trace-events and /hw/usb/trace-events into /trace-events-all to produce:

@group core
@dir /

# contents of /trace-events
@group io
@dir /io
# contents of /io/trace-events
@group hw_usb
@dir /hw/usb
# contents of /hw/usb/trace-events

Then we can use /trace-events-all to generate all the per-directory trace.h files while ensuring a perfectly flat event identifier space (a single generated-events.c is used).

Quoted 5 lines
Quoted 2 lines

This should minimize changes to tracing code and avoid further restrictions (like the "top-level vcpu" one).

That means when any individual trace file is changed, we re-generate the world, which is exactly what this series is designed to avoid.

Nope. We re-generate /trace-events-all, but each individual file generated afterwards (taken from the "@dir" directive) will change only if its new contents do (the Makefile uses cmp to check if files need updating from their corresponding timestamp file).

Quoted 5 lines
Quoted 3 lines

The contents will still need to change too if we have a global numbering space as your suggestion requires. The event groups are the only way to avoid that.

Aha, that's true. I didn't think of that, sorry.

Nevertheless, I agree that @id_offset() should be eliminated to avoid collisions and manual effort when trace-events files are added.

#98 lore raw
In reply to Daniel P. Berrange
Quoted 2 lines · Daniel P Berrange

I previously split the global trace-events file up into one file per-subdirectory to avoid merge conflict hell.

[...]

Sorry, I could not find the message where the infrastructure is modified to provide this. But I think there's a more efficient way to provide modular auto-generated tracing code without the hierarchical indexing you proposed.

What about using global variables? Instead of the dstate array, each event could have this on the "public" header:

  /* define for static state */
  #define TRACE_EVENTNAME_ENABLED 1
  /* pointer to event descriptor */
  extern TraceEvent *TRACE_EVENTNAME;
  /* variable with dynamic state */
  extern bool ___TRACE_EVENTNAME_DSTATE;

  void trace_eventname(...) {
      if (trace_event_get_stateTRACE_EVENTNAME_ENABLED && ___trace_eventname_dstate) {
          /* ... */
      }
  }

The use of event IDs on generic code can be adapted like this:

  #define trace_event_get_state_dynamic_by_id(id) \
      (unlikely(trace_events_enabled_count) && \
       (___ ## id ## _DSTATE))

And then we can concatenate all "trace-events" files to generate the .c files:

  struct TraceEvent {
      /* ... */
      bool *dstate;
  };

bool ___TRACE_EVENTNAME_DSTATE;

  struct TraceEvent ___trace_events[] = {
      {
          .name = "eventname",
          .sstate = 1,
          .dstate = ___trace_eventname_dstate;
      }
  }

  TraceEvent *TRACE_EVENTNAME = &___trace_events[...];

So updating a single "trace-events" file does not force a recompile of the whole QEMU, but we retain the performance of the flat dstate array (now a per-event pointer) and the simpler flat structure for iteration based on event names.

Cheers,
Lluis

#99 lore raw
Quoted 9 lines · Lluís Vilanova
Quoted 2 lines · Daniel P Berrange

I previously split the global trace-events file up into one file per-subdirectory to avoid merge conflict hell.

[...]

Sorry, I could not find the message where the infrastructure is modified to provide this. But I think there's a more efficient way to provide modular auto-generated tracing code without the hierarchical indexing you proposed.

[snip]

Quoted 9 lines
  struct TraceEvent ___trace_events[] = {
      {
          .name = "eventname",
          .sstate = 1,
          .dstate = ___trace_eventname_dstate;
      }
  }

  TraceEvent *TRACE_EVENTNAME = &___trace_events[...];

Life would be simpler if we had the 'bool dstate' as part of the TraceEvent struct, but doing so would essentially be reverting this previous change:

commit 585ec7273e6fdab902b2128bc6c2a8136aafef04
Author: Paolo Bonzini <[email protected]>
Date: Wed Oct 28 07:06:27 2015 +0100

trace: track enabled events in a separate array

This is more cache friendly on the fast path, where we already have the event id available.

I asked Paolo about this previously and he indicated it was a notable performance improvement, so we can't put dstate back into the TraceEvent struct :-(

Regards,
Daniel

Signature · 4 lines
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|
#5 lore raw

Re: [Qemu-devel] [PATCH for-2.8 v1 04/60] trace: move hw/virtio/virtio-balloon.c trace points into correct file

In reply to Daniel P. Berrange
Quoted 2 lines · Daniel P. Berrange

The trace points for hw/virtio/virtio-balloon.c were mistakenly put in the top level trace-events file, instead of util/trace-events.

Is it worth updating the commit messages to commit ids that caused that need for 1-4 in your series?

Signature · 2 lines
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org
#100 lore raw
In reply to Daniel P. Berrange
Quoted 31 lines · Daniel P Berrange
Quoted 9 lines · Lluís Vilanova
Quoted 2 lines · Daniel P Berrange

I previously split the global trace-events file up into one file per-subdirectory to avoid merge conflict hell.

[...]

Sorry, I could not find the message where the infrastructure is modified to provide this. But I think there's a more efficient way to provide modular auto-generated tracing code without the hierarchical indexing you proposed.

[snip]

Quoted 9 lines

struct TraceEvent ___trace_events[] = {
{
.name = "eventname",
.sstate = 1,
.dstate = ___trace_eventname_dstate;
}
}

TraceEvent *TRACE_EVENTNAME = &___trace_events[...];

Life would be simpler if we had the 'bool dstate' as part of the TraceEvent struct, but doing so would essentially be reverting this previous change:

commit 585ec7273e6fdab902b2128bc6c2a8136aafef04
Author: Paolo Bonzini <[email protected]>
Date: Wed Oct 28 07:06:27 2015 +0100

Quoted 8 lines

trace: track enabled events in a separate array

This is more cache friendly on the fast path, where we already have the event id available.

I asked Paolo about this previously and he indicated it was a notable performance improvement, so we can't put dstate back into the TraceEvent struct :-(

Sorry, there was a typo in my example code that led to this misunderstanding.

I meant this for the global auto-generated .c:

  struct TraceEvent {
      /* ... */
      bool *dstate;
  };

bool ___TRACE_EVENTNAME_DSTATE;

  struct TraceEvent ___trace_events[] = {
      {
          .name = "eventname",
          .sstate = 1,
          .dstate = &___TRACE_EVENTNAME_DSTATE;
      }
  }

  TraceEvent *TRACE_EVENTNAME = &___trace_events[...];

If you look at the modified macro I pasted for "trace/control-internal.h":

  #define trace_event_get_state_dynamic_by_id(id) \
      (unlikely(trace_events_enabled_count) && \
       (___ ## id ## _DSTATE))

We're retaining the fast-path performance of the seggregated boolean dstate array, while the event descriptor contains a pointer to the per-event dstate global boolean variable in case you want to get/set the dstate based on an event pointer.

Cheers,
Lluis

#101 lore raw
Quoted 67 lines · Lluís Vilanova
Quoted 31 lines · Daniel P Berrange
Quoted 9 lines · Lluís Vilanova
Quoted 2 lines · Daniel P Berrange

I previously split the global trace-events file up into one file per-subdirectory to avoid merge conflict hell.

[...]

Sorry, I could not find the message where the infrastructure is modified to provide this. But I think there's a more efficient way to provide modular auto-generated tracing code without the hierarchical indexing you proposed.

[snip]

Quoted 9 lines

struct TraceEvent ___trace_events[] = {
{
.name = "eventname",
.sstate = 1,
.dstate = ___trace_eventname_dstate;
}
}

TraceEvent *TRACE_EVENTNAME = &___trace_events[...];

Life would be simpler if we had the 'bool dstate' as part of the TraceEvent struct, but doing so would essentially be reverting this previous change:

commit 585ec7273e6fdab902b2128bc6c2a8136aafef04
Author: Paolo Bonzini <[email protected]>
Date: Wed Oct 28 07:06:27 2015 +0100

Quoted 8 lines

trace: track enabled events in a separate array

This is more cache friendly on the fast path, where we already have the event id available.

I asked Paolo about this previously and he indicated it was a notable performance improvement, so we can't put dstate back into the TraceEvent struct :-(

Sorry, there was a typo in my example code that led to this misunderstanding.

I meant this for the global auto-generated .c:

  struct TraceEvent {
      /* ... */
      bool *dstate;
  };

bool ___TRACE_EVENTNAME_DSTATE;

  struct TraceEvent ___trace_events[] = {
      {
          .name = "eventname",
          .sstate = 1,
          .dstate = &___TRACE_EVENTNAME_DSTATE;
      }
  }

  TraceEvent *TRACE_EVENTNAME = &___trace_events[...];

If you look at the modified macro I pasted for "trace/control-internal.h":

Quoted 8 lines
  #define trace_event_get_state_dynamic_by_id(id) \
      (unlikely(trace_events_enabled_count) && \
       (___ ## id ## _DSTATE))

We're retaining the fast-path performance of the seggregated boolean dstate array, while the event descriptor contains a pointer to the per-event dstate global boolean variable in case you want to get/set the dstate based on an event pointer.

The various _DSTATE variables are still arbitrarily scattered in memory, as opposed to in a contiguous cache friendly array, which is one of the goals of Paolo's original change.

That said, I'm unclear on how much of the performance win from Paolo's change came from eliminating the struct field de-reference, vs having the contiguous array. I'm guessing most of the win is from the former, the latter only being important if we hit multiple related tracepoints on close succession.

Regards,
Daniel

Signature · 4 lines
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|
#102 lore raw
Quoted 81 lines · Daniel P Berrange
Quoted 67 lines · Lluís Vilanova
Quoted 31 lines · Daniel P Berrange
Quoted 9 lines · Lluís Vilanova
Quoted 2 lines · Daniel P Berrange

I previously split the global trace-events file up into one file per-subdirectory to avoid merge conflict hell.

[...]

Sorry, I could not find the message where the infrastructure is modified to provide this. But I think there's a more efficient way to provide modular auto-generated tracing code without the hierarchical indexing you proposed.

[snip]

Quoted 9 lines

struct TraceEvent ___trace_events[] = {
{
.name = "eventname",
.sstate = 1,
.dstate = ___trace_eventname_dstate;
}
}

TraceEvent *TRACE_EVENTNAME = &___trace_events[...];

Life would be simpler if we had the 'bool dstate' as part of the TraceEvent struct, but doing so would essentially be reverting this previous change:

commit 585ec7273e6fdab902b2128bc6c2a8136aafef04
Author: Paolo Bonzini <[email protected]>
Date: Wed Oct 28 07:06:27 2015 +0100

Quoted 8 lines

trace: track enabled events in a separate array

This is more cache friendly on the fast path, where we already have the event id available.

I asked Paolo about this previously and he indicated it was a notable performance improvement, so we can't put dstate back into the TraceEvent struct :-(

Sorry, there was a typo in my example code that led to this misunderstanding.

I meant this for the global auto-generated .c:

struct TraceEvent {
/* ... */
bool *dstate;
};

bool ___TRACE_EVENTNAME_DSTATE;

struct TraceEvent ___trace_events[] = {
{
.name = "eventname",
.sstate = 1,
.dstate = &___TRACE_EVENTNAME_DSTATE;
}
}

TraceEvent *TRACE_EVENTNAME = &___trace_events[...];

If you look at the modified macro I pasted for "trace/control-internal.h":

Quoted 8 lines

#define trace_event_get_state_dynamic_by_id(id) \
(unlikely(trace_events_enabled_count) && \
(___ ## id ## _DSTATE))

We're retaining the fast-path performance of the seggregated boolean dstate array, while the event descriptor contains a pointer to the per-event dstate global boolean variable in case you want to get/set the dstate based on an event pointer.

The various _DSTATE variables are still arbitrarily scattered in memory, as opposed to in a contiguous cache friendly array, which is one of the goals of Paolo's original change.

Quoted 5 lines

That said, I'm unclear on how much of the performance win from Paolo's change came from eliminating the struct field de-reference, vs having the contiguous array. I'm guessing most of the win is from the former, the latter only being important if we hit multiple related tracepoints on close succession.

The latter can also be achieved by packing them all together in a single section, but I don't know if that's acceptable within portable QEMU code. For example:

bool ___TRACE_EVENTNAME_DSTATE __attribute__((section("dstate_array")))

Cheers,
Lluis

#110 lore raw
Quoted 5 lines · Stefan Hajnoczi

Dan: Ping?

A few people have reviewed this series. A v2 would be appreciated. I'd like to merge it quickly and as early into the development cycle as possible.

Sorry, been focused on other series, but will try and post an update this week considering the feedback.

Regards,
Daniel

Signature · 4 lines
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|
#111 lore raw
Quoted 9 lines · Daniel P Berrange
Quoted 5 lines · Stefan Hajnoczi

Dan: Ping?

A few people have reviewed this series. A v2 would be appreciated. I'd like to merge it quickly and as early into the development cycle as possible.

Sorry, been focused on other series, but will try and post an update this week considering the feedback.

I can help in implementing the global variable approach I described, if you want.

Cheers,
Lluis

#112 lore raw
Quoted 9 lines · Lluís Vilanova
Quoted 6 lines · Daniel P Berrange
Quoted 5 lines · Stefan Hajnoczi

Dan: Ping?

A few people have reviewed this series. A v2 would be appreciated. I'd like to merge it quickly and as early into the development cycle as possible.

Quoted 5 lines
Quoted 2 lines

Sorry, been focused on other series, but will try and post an update this week considering the feedback.

I can help in implementing the global variable approach I described, if you want.

Thanks for the offer, but the series is hairy enough to rebase that trying to split the work will just create even more rebase pain than there already is.

Regards,
Daniel

Signature · 4 lines
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|
#105 lore raw
In reply to Lluís Vilanova
Quoted 9 lines · Lluís Vilanova
Quoted 2 lines · Daniel P Berrange

I previously split the global trace-events file up into one file per-subdirectory to avoid merge conflict hell.

[...]

Sorry, I could not find the message where the infrastructure is modified to provide this. But I think there's a more efficient way to provide modular auto-generated tracing code without the hierarchical indexing you proposed.

NB, the simpletrace backend requires a globally unique 32-bit integer ID to be assigned to each trace event, so even with the approach you suggest below we still need to be able to assign a global ID for each event.

So while your suggest below avoids having to pass around the dstate arrays, which is nice, we still have to assign event id offsets to each trace-event file in some manner TBD.

Quoted 42 lines

What about using global variables? Instead of the dstate array, each event could have this on the "public" header:

  /* define for static state */
  #define TRACE_EVENTNAME_ENABLED 1
  /* pointer to event descriptor */
  extern TraceEvent *TRACE_EVENTNAME;
  /* variable with dynamic state */
  extern bool ___TRACE_EVENTNAME_DSTATE;

  void trace_eventname(...) {
      if (trace_event_get_stateTRACE_EVENTNAME_ENABLED && ___trace_eventname_dstate) {
          /* ... */
      }
  }

The use of event IDs on generic code can be adapted like this:

  #define trace_event_get_state_dynamic_by_id(id) \
      (unlikely(trace_events_enabled_count) && \
       (___ ## id ## _DSTATE))

And then we can concatenate all "trace-events" files to generate the .c files:

  struct TraceEvent {
      /* ... */
      bool *dstate;
  };

bool ___TRACE_EVENTNAME_DSTATE;

  struct TraceEvent ___trace_events[] = {
      {
          .name = "eventname",
          .sstate = 1,
          .dstate = ___trace_eventname_dstate;
      }
  }

  TraceEvent *TRACE_EVENTNAME = &___trace_events[...];
Quoted 3 lines

So updating a single "trace-events" file does not force a recompile of the whole QEMU, but we retain the performance of the flat dstate array (now a per-event pointer) and the simpler flat structure for iteration based on event names.

Regards,
Daniel

Signature · 4 lines
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|
#103 lore raw
In reply to Lluís Vilanova
Quoted 10 lines · Lluís Vilanova
Quoted 9 lines

The various _DSTATE variables are still arbitrarily scattered in memory, as opposed to in a contiguous cache friendly array, which is one of the goals of Paolo's original change.

That said, I'm unclear on how much of the performance win from Paolo's change came from eliminating the struct field de-reference, vs having the contiguous array. I'm guessing most of the win is from the former, the latter only being important if we hit multiple related tracepoints on close succession.

Quoted 5 lines

The latter can also be achieved by packing them all together in a single section, but I don't know if that's acceptable within portable QEMU code. For example:

bool ___TRACE_EVENTNAME_DSTATE __attribute__((section("dstate_array")))

Acutally, it should be sufficient if we just generate all the dstate variables in one place in the .c file - the compiler isn't going to scatter a set of variables declared one after each other.

Regards,
Daniel

Signature · 4 lines
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|
#106 lore raw
In reply to Daniel P. Berrange
Quoted 11 lines · Daniel P Berrange
Quoted 9 lines · Lluís Vilanova
Quoted 2 lines · Daniel P Berrange

I previously split the global trace-events file up into one file per-subdirectory to avoid merge conflict hell.

[...]

Sorry, I could not find the message where the infrastructure is modified to provide this. But I think there's a more efficient way to provide modular auto-generated tracing code without the hierarchical indexing you proposed.

Quoted 7 lines

NB, the simpletrace backend requires a globally unique 32-bit integer ID to be assigned to each trace event, so even with the approach you suggest below we still need to be able to assign a global ID for each event.

So while your suggest below avoids having to pass around the dstate arrays, which is nice, we still have to assign event id offsets to each trace-event file in some manner TBD.

Corect me if I'm wrong, but if we only require these consecutive IDs for simpletrace, they don't need to be visible to the tracing headers (these IDs are only used in "trace/generated-tracers.c"). Therefore, we can get them from the trace-events-all file, and minimize the complexity of the changes to tracetool.

Cheers,
Lluis

#107 lore raw
Quoted 17 lines · Lluís Vilanova
Quoted 14 lines · Daniel P Berrange
Quoted 9 lines · Lluís Vilanova
Quoted 2 lines · Daniel P Berrange

I previously split the global trace-events file up into one file per-subdirectory to avoid merge conflict hell.

[...]

Sorry, I could not find the message where the infrastructure is modified to provide this. But I think there's a more efficient way to provide modular auto-generated tracing code without the hierarchical indexing you proposed.

NB, the simpletrace backend requires a globally unique 32-bit integer ID to be assigned to each trace event, so even with the approach you suggest below we still need to be able to assign a global ID for each event.

Quoted 8 lines
Quoted 3 lines

So while your suggest below avoids having to pass around the dstate arrays, which is nice, we still have to assign event id offsets to each trace-event file in some manner TBD.

Corect me if I'm wrong, but if we only require these consecutive IDs for simpletrace, they don't need to be visible to the tracing headers (these IDs are only used in "trace/generated-tracers.c"). Therefore, we can get them from the trace-events-all file, and minimize the complexity of the changes to tracetool.

The IDs need to be present in the generated tracers files which are split up.

Regards,
Daniel

Signature · 4 lines
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|
#9 lore raw

Re: [Qemu-devel] [PATCH for-2.8 v1 05/60] trace: add trace event iterator APIs

In reply to Stefan Hajnoczi
Quoted 15 lines · Stefan Hajnoczi
Quoted 14 lines · Daniel P. Berrange
trace/control.c +14 -0
+TraceEvent *trace_event_iter_next(TraceEventIter *iter)
+{
+    TraceEvent *ev;
+
+    if (iter->event >= TRACE_EVENT_COUNT) {
+        return NULL;
+    }
+
+    ev = &(trace_events[iter->event]);
+
+    do {
+        iter->event++;
+    } while (iter->event < TRACE_EVENT_COUNT &&
+             iter->pattern &&
Quoted 8 lines

trace/control.c TraceEvent *trace_event_pattern(const char *pat, TraceEvent *ev) · line 151

Quoted 5 lines
trace/control.c +5 -0
+             !pattern_glob(iter->pattern,
+                           trace_event_get_name(&(trace_events[iter->event]))));
+
+    return ev;
+}

Shouldn't ev be updated inside the while loop? Otherwise the iterator always returns &trace_events[0] the first time it's called.

Sigh, yes, well spotted.

Regards,
Daniel

Signature · 4 lines
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|
#27 lore raw

Re: [Qemu-devel] [PATCH for-2.8 v1 11/60] trace: remove use of event ID enums from APIs

In reply to Stefan Hajnoczi
Quoted 11 lines · Stefan Hajnoczi
Quoted 10 lines · Paolo Bonzini
Quoted 7 lines · Daniel P. Berrange
Quoted 7 lines
Quoted 7 lines
Quoted 5 lines

trace/control-internal.h static inline bool trace_event_is_pattern(const char *str) · line 30

Quoted 5 lines
trace/control-internal.h +1 -1
-static inline TraceEventID trace_event_get_id(TraceEvent *ev)
+static inline size_t trace_event_get_id(TraceEvent *ev)
 {
     assert(ev != NULL);
     return ev->id;

Perhaps "unsigned" is a better match than size_t?

Quoted 7 lines
Quoted 4 lines
Quoted 2 lines

I don't mind either way - I just happen to personally always use size_t for anything that ends up being used primarily as an array index.

Makes sense. I was thinking of simpletrace's 32-bit id instead.

I think unsigned is slightly clearer since it expresses the intent that the values are limited to 32 bits.

I'll switch to 'uint32_t' since that unambigously matches that simpletrace mandates.

Regards,
Daniel

Signature · 4 lines
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|
#85 lore raw

Re: [Qemu-devel] [PATCH for-2.8 v1 60/60] trace: update docs to reflect new code generation approach

In reply to Stefan Hajnoczi
Quoted 37 lines · Stefan Hajnoczi
Quoted 36 lines · Lluís Vilanova
Quoted 5 lines · Daniel P Berrange
Quoted 4 lines · Lluís Vilanova
Quoted 2 lines · Daniel P Berrange
Quoted 1 line · Lluís Vilanova

Daniel P Berrange writes:

[...]

Quoted 27 lines
Quoted 27 lines
Quoted 17 lines
Quoted 17 lines

For example, first we concatenate /trace-events, /io/trace-events and /hw/usb/trace-events into /trace-events-all to produce:

@group core
@dir /

# contents of /trace-events
@group io
@dir /io
# contents of /io/trace-events
@group hw_usb
@dir /hw/usb
# contents of /hw/usb/trace-events

Then we can use /trace-events-all to generate all the per-directory trace.h files while ensuring a perfectly flat event identifier space (a single generated-events.c is used).

Quoted 5 lines
Quoted 2 lines

This should minimize changes to tracing code and avoid further restrictions (like the "top-level vcpu" one).

That means when any individual trace file is changed, we re-generate the world, which is exactly what this series is designed to avoid.

Nope. We re-generate /trace-events-all, but each individual file generated afterwards (taken from the "@dir" directive) will change only if its new contents do (the Makefile uses cmp to check if files need updating from their corresponding timestamp file).

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

The contents will still need to change too if we have a global numbering space as your suggestion requires. The event groups are the only way to avoid that.

Aha, that's true. I didn't think of that, sorry.

Nevertheless, I agree that @id_offset() should be eliminated to avoid collisions and manual effort when trace-events files are added.

I think I have a workable solution to eliminate this. During build I'll create a file 'trace-event-file-list' which contains a list of paths to 'trace-event' files in the tree. We'll then use the line number in this file as the id offset for events. The generated $SUBDIR/trace.h file will depend on trace-event-file-list.

So we'll have fully automatic numbering for each trace-event file and will only get a full rebuild if someone adds a completely new trace-event file, which is acceptable.

Regards,
Daniel

Signature · 4 lines
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|
#104 lore raw
In reply to Daniel P. Berrange
Quoted 15 lines · Daniel P Berrange
Quoted 14 lines · Lluís Vilanova
Quoted 9 lines

The various _DSTATE variables are still arbitrarily scattered in memory, as opposed to in a contiguous cache friendly array, which is one of the goals of Paolo's original change.

That said, I'm unclear on how much of the performance win from Paolo's change came from eliminating the struct field de-reference, vs having the contiguous array. I'm guessing most of the win is from the former, the latter only being important if we hit multiple related tracepoints on close succession.

The latter can also be achieved by packing them all together in a single section, but I don't know if that's acceptable within portable QEMU code. For example:

Quoted 5 lines
Quoted 1 line

bool ___TRACE_EVENTNAME_DSTATE __attribute__((section("dstate_array")))

Acutally, it should be sufficient if we just generate all the dstate variables in one place in the .c file - the compiler isn't going to scatter a set of variables declared one after each other.

That should work.

Lluis

#108 lore raw
In reply to Daniel P. Berrange
Quoted 22 lines · Daniel P Berrange
Quoted 21 lines · Lluís Vilanova
Quoted 18 lines · Daniel P Berrange
Quoted 9 lines · Lluís Vilanova
Quoted 2 lines · Daniel P Berrange

I previously split the global trace-events file up into one file per-subdirectory to avoid merge conflict hell.

[...]

Sorry, I could not find the message where the infrastructure is modified to provide this. But I think there's a more efficient way to provide modular auto-generated tracing code without the hierarchical indexing you proposed.

NB, the simpletrace backend requires a globally unique 32-bit integer ID to be assigned to each trace event, so even with the approach you suggest below we still need to be able to assign a global ID for each event.

So while your suggest below avoids having to pass around the dstate arrays, which is nice, we still have to assign event id offsets to each trace-event file in some manner TBD.

Quoted 7 lines
Quoted 4 lines

Corect me if I'm wrong, but if we only require these consecutive IDs for simpletrace, they don't need to be visible to the tracing headers (these IDs are only used in "trace/generated-tracers.c"). Therefore, we can get them from the trace-events-all file, and minimize the complexity of the changes to tracetool.

The IDs need to be present in the generated tracers files which are split up.

I'm not sure if I'm just missing what you mean.

Changing any of the trace-events files will trigger a recompilation of the .c files specific to the simpletrace backend, but won't trigger a recompile of all QEMU files including any of the tracing headers (just the files including the "trace.h" corresponding to the modified "trace-events").

Cheers,
Lluis

#6 lore raw

Re: [Qemu-devel] [PATCH for-2.8 v1 04/60] trace: move hw/virtio/virtio-balloon.c trace points into correct file

In reply to Eric Blake
Quoted 6 lines · Eric Blake
Quoted 2 lines · Daniel P. Berrange

The trace points for hw/virtio/virtio-balloon.c were mistakenly put in the top level trace-events file, instead of util/trace-events.

Is it worth updating the commit messages to commit ids that caused that need for 1-4 in your series?

Sure, will do.

Regards,
Daniel

Signature · 4 lines
|: http://berrange.com      -o-    http://www.flickr.com/photos/dberrange/ :|
|: http://libvirt.org              -o-             http://virt-manager.org :|
|: http://autobuild.org       -o-         http://search.cpan.org/~danberr/ :|
|: http://entangle-photo.org       -o-       http://live.gnome.org/gtk-vnc :|