Linux Perf Users
 help / color / mirror / Atom feed
* [PATCH v5 00/19] perf cs-etm: Per-thread mode fixes and snapshot wrap support
@ 2026-11-30 12:55 James Clark
  2026-11-30 12:55 ` [PATCH v5 01/19] perf cs-etm: Fix nVHE per-thread decoding James Clark
                   ` (19 more replies)
  0 siblings, 20 replies; 26+ messages in thread
From: James Clark @ 2026-11-30 12:55 UTC (permalink / raw)
  To: Leo Yan, Adrian Hunter
  Cc: Suzuki K Poulose, Mike Leach, Leo Yan, Will Deacon,
	Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
	Namhyung Kim, Mark Rutland, Alexander Shishkin, Jiri Olsa,
	Ian Rogers, Mathieu Poirier, Jonathan Corbet, Shuah Khan,
	Suyash Mahar, Amir Ayupov, linux-arm-kernel, coresight,
	linux-perf-users, linux-kernel, Arnaldo Carvalho de Melo,
	linux-doc, James Clark, John Garry

Fix a few issues with per-thread mode:
  - On nVHE, everything looks like guest trace instead of host
  - Tracing multiple threads didn't really work

After adding a tests for those, it turns out there were some snapshot
bugs not picked up by the other snapshot tests. That showed that the
different snapshot searches for Intel BTS and Arm SPE were inconsistent
and I think all tracers can benefit from using the same pointer fixup
logic, so that gets refactored into the common auxtrace.c. Then SPE can
just share the Intel BTS search as it was obviously copied from it
originally. IntelPT keeps the more advanced duplicate data search, but
in the future that could probably be made the common one and all tracers
would benefit from using it (except maybe BTS if it always has a very
small buffer, but I doubt the overhead of the duplicate search would be
an issue). For now this is more of a refactor rather than behavioral
change so don't do that yet.

Signed-off-by: James Clark <james.clark@linaro.org>
---
Changes in v5:
- Rebase onto tmp.perf-tools-next to resolve conflict with commit
  e48155a1bbf1 ("perf intel-bts: Free the old snapshot reference array
  after growing it"). The new shared snapshot search also has the fix.
- Drop dependency that has already been applied.
- Link to v4: https://patch.msgid.link/20261105-james-cs-unformatted-per-thread-fix-v4-0-7759e0ce2449@linaro.org

Changes in v4:
- Change test snapshot size to 128K for 64K machines
- Put patchset depencency in cover letter text
- Link to v3: https://patch.msgid.link/20261102-james-cs-unformatted-per-thread-fix-v3-0-dbcb0c281b9b@linaro.org

Changes in v3:
- Keep the find_snapshot() callback instead of adding
  snapshot_has_wrapped() and monotonic_snapshot_head boolean (Adrian)
- Add auxtrace_record__default_find_snapshot() for the simple search for
  BTS and SPE (Adrian)
- Add auxtrace_record__snapshot_fixup() for any snapshot search
  implementation to use to update the pointers (Adrian)
- Reword UINT64_MAX timestamp comment (Leo)
- Fix disassembly test after rebasing onto exception sample fixes
- Only take 'perf_guest' into account if there is no PIDFMT_CTXTID2
- Improve decoding of old files by hard coding queue 0 for per-thread
- Link to v2: https://patch.msgid.link/20260821-james-cs-unformatted-per-thread-fix-v2-0-00c4fd0701b4@linaro.org

Changes in v2:
- Remove stale "may be reset to -1 in per-thread mode" comment
- Set CPU when queueing auxtrace fragments otherwise
  auxtrace_queues__add_event() overwrites the queue's CPU
- Link to v1: https://patch.msgid.link/20260811-james-cs-unformatted-per-thread-fix-v1-0-90565318f5f8@linaro.org

---
James Clark (19):
      perf cs-etm: Fix nVHE per-thread decoding
      perf cs-etm: Warn for invalid timestamp option
      perf cs-etm: Turn on context packet timestamps in per-thread mode
      perf cs-etm: Use per-CPU queues for per-thread mode
      perf test: cs-etm: Increase window size in disassembly test
      perf cs-etm: Don't drop previous target for kernel samples
      perf python: Expose sample instruction length
      perf cs-etm: Use instruction length in disassembly script
      perf cs-etm: Increase default timestamp generation period
      perf auxtrace: Turn Intel BTS snapshot search into a generic one
      perf arm-spe: Use generic snapshot search
      perf auxtrace: intel-pt: Use common snapshot pointer fixup
      perf cs-etm: Queue partial AUX records
      perf cs-etm: Don't print missing buffers in snapshot mode
      perf auxtrace: cs-etm: Capture wrapped snapshots
      perf test: Allow infinite named_thread loops
      perf test: cs-etm: Add test for per-thread mode
      perf test: cs-etm: Test multiple per-thread threads
      perf test: cs-etm: Increase snapshot size

 tools/perf/Documentation/perf-test.txt             |   2 +-
 tools/perf/arch/arm/util/cs-etm.c                  |  34 ++++-
 tools/perf/arch/arm64/util/arm-spe.c               | 147 +--------------------
 tools/perf/arch/x86/util/intel-bts.c               | 116 +---------------
 tools/perf/arch/x86/util/intel-pt.c                |  21 +--
 tools/perf/python/arm-cs-trace-disasm.py           |  22 +--
 tools/perf/python/perf.pyi                         |   1 +
 .../perf/tests/shell/coresight/per-thread-multi.sh |  76 +++++++++++
 tools/perf/tests/shell/coresight/per-thread.sh     |  48 +++++++
 .../perf/tests/shell/coresight/raw_dump_stress.sh  |   5 -
 .../shell/coresight/test_arm_coresight_disasm.sh   |   8 +-
 tools/perf/tests/workloads/named_threads.c         |   7 +-
 tools/perf/util/auxtrace.c                         | 145 +++++++++++++++++++-
 tools/perf/util/auxtrace.h                         |  18 +++
 tools/perf/util/cs-etm.c                           | 113 +++++++++++-----
 tools/perf/util/python.c                           |   1 +
 16 files changed, 420 insertions(+), 344 deletions(-)
---
base-commit: 4a7008f739a30ee4c22d9f21af362a5128f2628d
change-id: 20260605-james-cs-unformatted-per-thread-fix-50e723aa7f0e

Best regards,
--  
James Clark <james.clark@linaro.org>


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

end of thread, other threads:[~2026-11-30 13:20 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-30 12:55 [PATCH v5 00/19] perf cs-etm: Per-thread mode fixes and snapshot wrap support James Clark
2026-11-30 12:55 ` [PATCH v5 01/19] perf cs-etm: Fix nVHE per-thread decoding James Clark
2026-11-30 13:12   ` sashiko-bot
2026-11-30 12:55 ` [PATCH v5 02/19] perf cs-etm: Warn for invalid timestamp option James Clark
2026-11-30 12:55 ` [PATCH v5 03/19] perf cs-etm: Turn on context packet timestamps in per-thread mode James Clark
2026-11-30 12:55 ` [PATCH v5 04/19] perf cs-etm: Use per-CPU queues for " James Clark
2026-11-30 13:20   ` sashiko-bot
2026-11-30 12:55 ` [PATCH v5 05/19] perf test: cs-etm: Increase window size in disassembly test James Clark
2026-11-30 12:55 ` [PATCH v5 06/19] perf cs-etm: Don't drop previous target for kernel samples James Clark
2026-11-30 12:55 ` [PATCH v5 07/19] perf python: Expose sample instruction length James Clark
2026-11-30 12:55 ` [PATCH v5 08/19] perf cs-etm: Use instruction length in disassembly script James Clark
2026-11-30 12:55 ` [PATCH v5 09/19] perf cs-etm: Increase default timestamp generation period James Clark
2026-11-30 12:55 ` [PATCH v5 10/19] perf auxtrace: Turn Intel BTS snapshot search into a generic one James Clark
2026-11-30 12:55 ` [PATCH v5 11/19] perf arm-spe: Use generic snapshot search James Clark
2026-11-30 12:55 ` [PATCH v5 12/19] perf auxtrace: intel-pt: Use common snapshot pointer fixup James Clark
2026-11-30 12:55 ` [PATCH v5 13/19] perf cs-etm: Queue partial AUX records James Clark
2026-11-30 13:14   ` sashiko-bot
2026-11-30 12:55 ` [PATCH v5 14/19] perf cs-etm: Don't print missing buffers in snapshot mode James Clark
2026-11-30 12:55 ` [PATCH v5 15/19] perf auxtrace: cs-etm: Capture wrapped snapshots James Clark
2026-11-30 12:55 ` [PATCH v5 16/19] perf test: Allow infinite named_thread loops James Clark
2026-11-30 12:55 ` [PATCH v5 17/19] perf test: cs-etm: Add test for per-thread mode James Clark
2026-11-30 12:55 ` [PATCH v5 18/19] perf test: cs-etm: Test multiple per-thread threads James Clark
2026-11-30 13:13   ` sashiko-bot
2026-11-30 12:55 ` [PATCH v5 19/19] perf test: cs-etm: Increase snapshot size James Clark
2026-11-30 13:07   ` sashiko-bot
2026-11-30 13:20 ` [PATCH v5 00/19] perf cs-etm: Per-thread mode fixes and snapshot wrap support sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox