Skip to content

trace: bugfixes, cleanups and optimizations

Daniel P. Berrangé qemu-devel 4 versions – Applied

Status from this message: Thanks, applied to my tracing tree:

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest25 patches 8 repliesApplied
  2. v324 patches 8 repliesSuperseded
  3. v220 patches 1 replySuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v120 patches13 repliesSuperseded

Changes in v4 from the cover letter

* Fix hex printing in hppa trace events
* Remove more docs mentions of 'disable'

Patches in v4 Applied

#Subject and filesSizeRepliesApplied
1/25osdep: add 'ignore_value(x)' macroinclude/qemu/osdep.h+8 -00 replies
2/25trace: use 'ignore_value()' instead of a dummy variabletrace/ftrace.c trace/simple.c+5 -70 replies
3/25trace: fix handling of char** in UST backendscripts/tracetool/format/ust_events_h.py+3 -10 replies
4/25hw/xen: replace "long unsigned int" with "unsigned long " for dtracehw/xen/trace-events+2 -20 replies
5/25trace: block use of "long int" for dtracescripts/tracetool/__init__.py+5 -00 replies
6/25trace: drop unused trace_event_set_state_dynamic_init()stubs/trace-control.c trace/control-target.c trace/event-internal.h+0 -280 replies
7/25trace: remove obsolete references to vcpu propertytrace/control-target.c trace/control.c trace/control.h +1 more+0 -351 reply
8/25trace: drop 'id' from TraceEvent struct when not requiredscripts/tracetool/format/c.py tests/tracetool/dtrace.c tests/tracetool/ftrace.c +8 more+35 -20 replies
9/25trace: change "DSTATE" variables from uint16_t to uint8_tscripts/tracetool/format/c.py scripts/tracetool/format/h.py scripts/tracetool/format/rs.py +18 more+44 -440 replies
10/25trace: add testing of 'nop' trace backendtests/tracetool/meson.build tests/tracetool/nop.c tests/tracetool/nop.h +2 more+118 -10 replies
11/25trace: don't emit TraceEvent structs when 'nop' backend is usedscripts/tracetool/format/c.py scripts/tracetool/format/h.py tests/tracetool/nop.c +1 more+50 -761 reply
12/25trace: add test of generation with all backends enabledtests/tracetool/all.c tests/tracetool/all.d tests/tracetool/all.h +8 more+392 -50 replies
13/25trace: remove redundant headers from simple trace backend codescripts/tracetool/backend/simple.py tests/tracetool/all.c tests/tracetool/simple.c+1 -70 replies
14/25trace: include probe name in Rust format stringsscripts/tracetool/backend/ftrace.py scripts/tracetool/backend/syslog.py tests/tracetool/all.rs +2 more+10 -101 reply
15/25trace: add missing newline in ftrace Rust format stringscripts/tracetool/backend/ftrace.py tests/tracetool/all.rs tests/tracetool/ftrace.rs+5 -51 reply
16/25trace: eliminate dupe trace_event_get_state_dynamic_by_id() callsscripts/tracetool/backend/__init__.py scripts/tracetool/backend/ftrace.py scripts/tracetool/backend/log.py +4 more+17 -341 reply
17/25audio: remove mistaken use of trace_event_get_state()audio/audio-mixeng-be.c+1 -10 replies
18/25hw/ppc: remove mistaken use of trace_event_get_state()hw/ppc/vof.c+4 -90 replies
19/25monitor: remove mistaken use of trace_event_get_state()monitor/qmp.c+2 -20 replies
20/25trace: include qemu_loglevel_mask(LOG_TRACE) in guardscripts/tracetool/backend/log.py tests/tracetool/all.h tests/tracetool/all.rs +2 more+65 -350 replies
21/25target/hppa: use PRIx64 in trace-eventstarget/hppa/trace-events+11 -111 reply
22/25trace: remove "disable" property from trace fileshw/display/trace-events target/hppa/trace-events+15 -150 replies
23/25trace: stop tracking static disabled stateqapi/trace.json scripts/tracetool/format/c.py scripts/tracetool/format/h.py +22 more+31 -1321 reply
24/25trace: remove parsing of "disable" event propertydocs/devel/tracing.rst scripts/tracetool/__init__.py scripts/tracetool/backend/dtrace.py +9 more+39 -1000 replies
25/25trace: remove 'trace_event_get_state' wrapperscripts/tracetool/backend/__init__.py scripts/tracetool/backend/log.py scripts/tracetool/format/h.py +6 more+16 -240 replies

Reviews trailers per patch

All 25 patches have a Reviewed-by or Acked-by.

PatchMarc-André LureauEric BlakePhilippe Mathieu-Daudé
1/25R-b R-b
2/25R-b
3/25R-b
4/25R-b R-b
5/25R-b
6/25R-b
7/25R-b R-b
8/25R-b
9/25R-b
10/25R-b
11/25R-b
12/25R-b
13/25R-b
14/25R-b R-b
15/25R-b R-b
16/25R-b R-b
17/25R-b R-b
18/25R-b R-b
19/25R-b
20/25R-b
21/25R-b
22/25R-b
23/25R-b
24/25R-b
25/25R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v4 thread

Cover letter [PATCH v4 00/25] trace: bugfixes, cleanups and optimizations

This series started off with fixing some compile failures seen with dtrace and ust backends, and got somewhat out of hand as I looked more deeply at the trace code. So it ended up doing various bits of code cleanup and memory usage optimizations.

The optimizations aren't huge against each individual binaries. There are too many scenarios to show the full set, but here are some binary size examples

The current git master baseline for different enabled backends on the x86_64 emulator:

nop 88546360
dtrace 90604496
ftrace 93265944
log 93799528
syslog 93962704
simple 97064528
ust 162999944
dtrace,ftrace,log,syslog,simple,ust 174438088

'ust' has insanely high overhead in terms of binary sizes, inexplicably insane.

'ftrace/log/syslog' are all similar because their overhead is dominated by the printf() format strings which are identical in all.

'simple' is a bit worse because of the helper functions we must generated for each probe

After this series is applied the results for x86_64 are

nop 88510248
dtrace 90576160
ftrace 93156320
log 93735064
syslog 93853480
simple 97050856
ust 162957256
dtrace,ftrace,log,syslog,simple,ust 174431128

IOW, for 'dtrace', we save 28k, for 'log' we save 62k

For the aarch64 binary, we see bigger saving in some cases:

baseline dtrace 127610144
baseline log 131050320

     trace dtrace 127459264
     trace log  130998872

IOW, for 'dtrace' we save 150k, for 'log' we only save 50k. No clue why the saving is not so significant for the 'log' backend but not a big deal.

Changed in v4:

* Fix hex printing in hppa trace events
* Remove more docs mentions of 'disable'

Changed in v3:

* Include QEMU log mask check in Rust generated code too
* Eliminate duplicate state checks in DSTATE macro

Changed in v2:

* Improve some commit messages
* Updated tracing.rst docs

Daniel P. Berrangé (25):
osdep: add 'ignore_value(x)' macro
trace: use 'ignore_value()' instead of a dummy variable
trace: fix handling of char** in UST backend
hw/xen: replace "long unsigned int" with "unsigned long " for dtrace
trace: block use of "long int" for dtrace
trace: drop unused trace_event_set_state_dynamic_init()
trace: remove obsolete references to vcpu property
trace: drop 'id' from TraceEvent struct when not required
trace: change "DSTATE" variables from uint16_t to uint8_t
trace: add testing of 'nop' trace backend
trace: don't emit TraceEvent structs when 'nop' backend is used
trace: add test of generation with all backends enabled
trace: remove redundant headers from simple trace backend code
trace: include probe name in Rust format strings
trace: add missing newline in ftrace Rust format string
trace: eliminate dupe trace_event_get_state_dynamic_by_id() calls
audio: remove mistaken use of trace_event_get_state() hw/ppc: remove mistaken use of trace_event_get_state()
monitor: remove mistaken use of trace_event_get_state()
trace: include qemu_loglevel_mask(LOG_TRACE) in guard target/hppa: use PRIx64 in trace-events
trace: remove "disable" property from trace files
trace: stop tracking static disabled state
trace: remove parsing of "disable" event property
trace: remove 'trace_event_get_state' wrapper

 audio/audio-mixeng-be.c                      |   2 +-
 docs/devel/tracing.rst                       |  27 +----
 hw/display/trace-events                      |   2 +-
 hw/ppc/vof.c                                 |  13 +--
 hw/xen/trace-events                          |   4 +-
 include/qemu/osdep.h                         |   8 ++
 monitor/qmp.c                                |   4 +-
 qapi/trace.json                              |   5 +-
 scripts/tracetool/__init__.py                |  32 ++----
 scripts/tracetool/backend/__init__.py        |   7 +-
 scripts/tracetool/backend/dtrace.py          |   2 -
 scripts/tracetool/backend/ftrace.py          |   8 +-
 scripts/tracetool/backend/log.py             |  22 ++--
 scripts/tracetool/backend/simple.py          |   9 +-
 scripts/tracetool/backend/syslog.py          |   6 +-
 scripts/tracetool/format/c.py                |  74 +++++++-------
 scripts/tracetool/format/d.py                |   3 -
 scripts/tracetool/format/h.py                |  48 ++++-----
 scripts/tracetool/format/log_stap.py         |   3 -
 scripts/tracetool/format/rs.py               |  30 +++---
 scripts/tracetool/format/simpletrace_stap.py |   3 -
 scripts/tracetool/format/stap.py             |   3 -
 scripts/tracetool/format/ust_events_c.py     |   3 -
 scripts/tracetool/format/ust_events_h.py     |   7 +-
 stubs/trace-control.c                        |   6 --
 target/hppa/trace-events                     |  28 +++---
 tests/tracetool/all.c                        |  61 +++++++++++
 tests/tracetool/all.d                        |  10 ++
 tests/tracetool/all.h                        | 100 +++++++++++++++++++
 tests/tracetool/all.log-stap                 |  15 +++
 tests/tracetool/all.rs                       |  98 ++++++++++++++++++
 tests/tracetool/all.simpletrace-stap         |  16 +++
 tests/tracetool/all.stap                     |  14 +++
 tests/tracetool/all.ust-events-c             |  14 +++
 tests/tracetool/all.ust-events-h             |  56 +++++++++++
 tests/tracetool/dtrace.c                     |  10 +-
 tests/tracetool/dtrace.h                     |   6 +-
 tests/tracetool/dtrace.rs                    |   6 +-
 tests/tracetool/ftrace.c                     |  10 +-
 tests/tracetool/ftrace.h                     |  14 ++-
 tests/tracetool/ftrace.rs                    |  10 +-
 tests/tracetool/log.c                        |  10 +-
 tests/tracetool/log.h                        |  26 +++--
 tests/tracetool/log.rs                       |  12 ++-
 tests/tracetool/meson.build                  |   4 +-
 tests/tracetool/nop.c                        |   7 ++
 tests/tracetool/nop.h                        |  25 +++++
 tests/tracetool/nop.rs                       |  51 ++++++++++
 tests/tracetool/simple.c                     |  12 +--
 tests/tracetool/simple.h                     |  10 +-
 tests/tracetool/simple.rs                    |   6 +-
 tests/tracetool/syslog.c                     |  10 +-
 tests/tracetool/syslog.h                     |  14 ++-
 tests/tracetool/syslog.rs                    |  10 +-
 tests/tracetool/tracetool-test.py            |  12 ++-
 tests/tracetool/ust.c                        |  10 +-
 tests/tracetool/ust.h                        |   6 +-
 trace/control-internal.h                     |   8 +-
 trace/control-target.c                       |  29 ------
 trace/control.c                              |  19 +---
 trace/control.h                              |  49 +--------
 trace/event-internal.h                       |  19 +---
 trace/ftrace.c                               |   3 +-
 trace/qmp.c                                  |  47 +++------
 trace/simple.c                               |   9 +-
 65 files changed, 750 insertions(+), 457 deletions(-)
 create mode 100644 tests/tracetool/all.c
 create mode 100644 tests/tracetool/all.d
 create mode 100644 tests/tracetool/all.h
 create mode 100644 tests/tracetool/all.log-stap
 create mode 100644 tests/tracetool/all.rs
 create mode 100644 tests/tracetool/all.simpletrace-stap
 create mode 100644 tests/tracetool/all.stap
 create mode 100644 tests/tracetool/all.ust-events-c
 create mode 100644 tests/tracetool/all.ust-events-h
 create mode 100644 tests/tracetool/nop.c
 create mode 100644 tests/tracetool/nop.h
 create mode 100644 tests/tracetool/nop.rs
Signature · 1 line
2.56.0