Skip to content

tracing/remotes: Add printk, dump_on_panic and boot parameters

Vincent Donnefort linux-trace-kernel lkml 10 versions – New

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v10 Latest19 patches 0 repliesNew
  2. v921 patches 5 repliesSuperseded
  3. v821 patches 0 repliesSuperseded
Earlier versions · 7
VersionPostedPatchesRepliesStatus
v720 patches0 repliesSuperseded
v618 patches6 repliesSuperseded
v518 patches7 repliesSuperseded
v418 patches6 repliesSuperseded
v318 patches0 repliesSuperseded
v218 patches0 repliesSuperseded
v113 patches0 repliesSuperseded

Changes in v10 from the cover letter

* Drop the already applied fixes for ring-buffer.
* Add READ_ONCE()/WRITE_ONCE() for remote->trace_buffer. (Sashiko)
* Replace smp_store_release() with WRITE_ONCE() when clearing

Patches in v10 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/19tracing/remotes: Gate tracefs files opening on trace remote registrationkernel/trace/trace_remote.c+87 -130 replies
2/19tracing/remotes: Release tracefs,eventfs on registration failurekernel/trace/trace_remote.c+93 -440 replies
3/19tracing/remotes: Use kstrtobool for boolean tracefs fileskernel/trace/trace_remote.c+6 -60 replies
4/19tracing/remotes: Initialise pos in trace_start()kernel/trace/trace_remote.c+1 -10 replies
5/19tracing/remotes: Annotate remote shared fields with READ_ONCE/WRITE_ONCEkernel/trace/trace_remote.c+11 -100 replies
6/19tracing/remotes: Use a single per-remote polling workkernel/trace/trace_remote.c+35 -160 replies
7/19tracing/simple_ring_buffer: Add support for compressed lengthinclude/linux/ring_buffer.h kernel/trace/ring_buffer.c kernel/trace/simple_ring_buffer.c+25 -70 replies
8/19tracing/remotes: Add dmesg tracefs filekernel/trace/trace_remote.c+125 -140 replies
9/19tracing/remotes: selftests: Add a test for the dmesg tracefs filetools/testing/selftests/ftrace/test.d/remotes/dmesg.tc tools/testing/selftests/ftrace/test.d/remotes/functions tools/testing/selftests/ftrace/test.d/remotes/hypervisor/dmesg.tc+103 -00 replies
10/19tracing/remotes: selftests: Prefix hypervisor foldertools/testing/selftests/ftrace/test.d/remotes/00hypervisor/buffer_size.tc tools/testing/selftests/ftrace/test.d/remotes/00hypervisor/dmesg.tc tools/testing/selftests/ftrace/test.d/remotes/00hypervisor/hotplug.tc +4 more+0 -00 replies
11/19ring-buffer: Use panic-friendly locking in ring_buffer_iter interfacekernel/trace/ring_buffer.c+18 -60 replies
12/19ring-buffer: Add kerneldoc for ring_buffer_poll_remotekernel/trace/ring_buffer.c+11 -00 replies
13/19tracing/remotes: Use ring_buffer_capacity() in trace_remote_has_cpu()kernel/trace/trace_remote.c+1 -10 replies
14/19tracing/remotes: Add dump_on_panic tracefs filekernel/trace/trace_remote.c+190 -380 replies
15/19tracing/remotes: selftests: Add a test for the dump_on_panic tracefs filetools/testing/selftests/ftrace/test.d/remotes/00hypervisor/dump_on_panic.tc tools/testing/selftests/ftrace/test.d/remotes/dump_on_panic.tc tools/testing/selftests/ftrace/test.d/remotes/functions+62 -00 replies
16/19tracing/remotes: Add poll_ms tracefs filekernel/trace/trace_remote.c+44 -00 replies
17/19tracing/remotes: Add trace_remote cmdline optionskernel/trace/trace_remote.c+145 -00 replies
18/19Documentation: tracing/remotes: Add detailed tracefs layoutDocumentation/trace/remotes.rst+62 -40 replies
19/19Documentation/kernel-parameters: Add trace_remoteDocumentation/admin-guide/kernel-parameters.txt+19 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v10 yet.

Read the v10 thread

Cover letter [PATCH v10 00/19] tracing/remotes: Add printk, dump_on_panic and boot parameters

This series extends the recently introduced trace remotes infrastructure, bringing useful features for developers:

* dump_on_panic: Dump the trace remote buffer on system panic.
* dmesg: Redirect remote events to dmesg.
* trace_remote=: Configure a trace_remote from the commandline.
* poll_ms: Modify the polling period.

It also brings a couple of optimisations:

* In-header compressed length support for small events.
* Single work thread for remote polling.

And some misc improvements:

* Use kstrtobool where possible
* Free resources on remote registration failure

Changelog:

v10:

* Drop the already applied fixes for ring-buffer.
* Add READ_ONCE()/WRITE_ONCE() for remote->trace_buffer. (Sashiko)
* Replace smp_store_release() with WRITE_ONCE() when clearing

    remote->dmesg in trace_remote_iter_free().

v9 (https://lore.kernel.org/all/[email protected]/):

* Check IS_ERR_OR_NULL() for eventfs_create_events_dir() in trace_remote_init_eventfs(). (Sashiko)
* Avoid reading back rb_event->type_len in simple_ring_buffer_reserve(). (Sashiko)
* Pin write_event loop to a single CPU and handle CONFIG_PRINTK_CALLER in dmesg.tc. (Sashiko)
* Replace __free(kfree) with explicit kfree() in trace_remote_apply_cmdline(). (Sashiko)
* Rebase on 7.4-rc4

v8 (https://lore.kernel.org/all/[email protected]/):

* Use trylock in rb_reader_lock() when panic_on_this_cpu(). (Sashiko)
* Drop ring_buffer_read_remote_meta_page() and use ring_buffer_capacity() in trace_remote_has_cpu().
* Avoid mixing __free(kfree) with goto in trace_remote_iter(). (Sashiko)
* Cancel and reschedule poll_work on poll_ms update. (Sashiko)
* Validate buf_size and use WRITE_ONCE() for poll_ms in cmdline parsing. (Sashiko)
* Rebase on 7.4-rc1

v7 (https://lore.kernel.org/all/[email protected]/):

* Check for printk timestamps in dmesg selftest. (Sashiko)
* Touch NMI watchdog in the panic dump loop. (Sashiko)
* Add READ_ONCE()/WRITE_ONCE() for panic_on. (Sashiko)
* Defer dmesg and tracing enabling after all cmdline options are parsed. (Sashiko)
* Guard sysrq panic trigger in dump_on_panic.tc with TRIGGER_PANIC env variable. (Sashiko)
* Rebase on 7.3-rc4

v6 (https://lore.kernel.org/all/[email protected]/):

* Replace WARN_ON with pr_warn for buf_size in cmdline parsing. (Sashiko)
* Add READ_ONCE()/WRITE_ONCE() for poll_ms (Sashiko)
* Add support for HAVE_64BIT_ALIGNED_ACCESS arch is set in simple_ring_buffer. (Sashiko)
* Add selftest tracefs file requirements, TMPDIR leak, and awk regex. (Sashiko)
* Rebase on 7.2

v5 (https://lore.kernel.org/all/[email protected]/):

* Use seq_buf_str() for safe, properly terminated trace_seq extraction. (Steven)
* Remove destructive dmesg -c from selftests and rely on timestamp matching instead. (Steven)
* Allow several trace_remote=XXX cmdline options.
* Rebase on 7.2-rc7

v4 (https://lore.kernel.org/all/[email protected]/):

* Rebase on 7.2-rc6
* Use trace_append_boot_param() to parse cmdline options.
* Fix trace_remote_iterator cleanup order for non-consuming iterators

    (Sashiko).

v3 (https://lore.kernel.org/all/[email protected]/):

* Make sure dmesg and panic handlers are using null-terminated trace_seq.
* Make struct trace_remote more compact
* Fix dump_on_panic test unloaded case (Sashiko)
* Rebase on 7.2-rc4

v2 (https://lore.kernel.org/all/[email protected]/):

Sashiko had a few spot-on comments on the v1 which forced me to heavily re-arrange the series, so I thought it'd be alright to send a v2 already including those changes.

* dump_on_oops -> dump_on_panic
* printk -> dmesg
* Allow to configure poll_ms
* Make the ring_buffer_iter functions panic-friendly
* Gate tracefs .open on remote registration (Sashiko)
* Use irqsave for reader lock (Sashiko)
* Fix iter locking for TRI_DMESG (Sashiko)
* Yield in the dmesg work (Sashiko)

v1 (https://lore.kernel.org/all/[email protected]/)

Vincent Donnefort (19):
tracing/remotes: Gate tracefs files opening on trace remote
registration
tracing/remotes: Release tracefs,eventfs on registration failure tracing/remotes: Use kstrtobool for boolean tracefs files tracing/remotes: Initialise pos in trace_start() tracing/remotes: Annotate remote shared fields with
READ_ONCE/WRITE_ONCE
tracing/remotes: Use a single per-remote polling work tracing/simple_ring_buffer: Add support for compressed length tracing/remotes: Add dmesg tracefs file
tracing/remotes: selftests: Add a test for the dmesg tracefs file tracing/remotes: selftests: Prefix hypervisor folder
ring-buffer: Use panic-friendly locking in ring_buffer_iter interface
ring-buffer: Add kerneldoc for ring_buffer_poll_remote tracing/remotes: Use ring_buffer_capacity() in trace_remote_has_cpu() tracing/remotes: Add dump_on_panic tracefs file tracing/remotes: selftests: Add a test for the dump_on_panic tracefs
file
tracing/remotes: Add poll_ms tracefs file
tracing/remotes: Add trace_remote cmdline options
Documentation: tracing/remotes: Add detailed tracefs layout Documentation/kernel-parameters: Add trace_remote

 .../admin-guide/kernel-parameters.txt         |  19 +
 Documentation/trace/remotes.rst               |  66 +-
 include/linux/ring_buffer.h                   |   5 +
 kernel/trace/ring_buffer.c                    |  39 +-
 kernel/trace/simple_ring_buffer.c             |  23 +-
 kernel/trace/trace_remote.c                   | 853 +++++++++++++++---
 .../buffer_size.tc                            |   0
 .../test.d/remotes/00hypervisor/dmesg.tc      |  11 +
 .../remotes/00hypervisor/dump_on_panic.tc     |  11 +
 .../{hypervisor => 00hypervisor}/hotplug.tc   |   0
 .../{hypervisor => 00hypervisor}/reset.tc     |   0
 .../{hypervisor => 00hypervisor}/trace.tc     |   0
 .../trace_pipe.tc                             |   0
 .../{hypervisor => 00hypervisor}/unloading.tc |   0
 .../selftests/ftrace/test.d/remotes/dmesg.tc  |  91 ++
 .../ftrace/test.d/remotes/dump_on_panic.tc    |  50 +
 .../selftests/ftrace/test.d/remotes/functions |   2 +
 17 files changed, 1024 insertions(+), 146 deletions(-)
 rename tools/testing/selftests/ftrace/test.d/remotes/{hypervisor => 00hypervisor}/buffer_size.tc (100%)
 create mode 100644 tools/testing/selftests/ftrace/test.d/remotes/00hypervisor/dmesg.tc
 create mode 100644 tools/testing/selftests/ftrace/test.d/remotes/00hypervisor/dump_on_panic.tc
 rename tools/testing/selftests/ftrace/test.d/remotes/{hypervisor => 00hypervisor}/hotplug.tc (100%)
 rename tools/testing/selftests/ftrace/test.d/remotes/{hypervisor => 00hypervisor}/reset.tc (100%)
 rename tools/testing/selftests/ftrace/test.d/remotes/{hypervisor => 00hypervisor}/trace.tc (100%)
 rename tools/testing/selftests/ftrace/test.d/remotes/{hypervisor => 00hypervisor}/trace_pipe.tc (100%)
 rename tools/testing/selftests/ftrace/test.d/remotes/{hypervisor => 00hypervisor}/unloading.tc (100%)
 create mode 100644 tools/testing/selftests/ftrace/test.d/remotes/dmesg.tc
 create mode 100644 tools/testing/selftests/ftrace/test.d/remotes/dump_on_panic.tc

base-commit: b6a9fa34ce4187cb69d3c588a4bbffc31ce5db8f

Signature · 1 line
2.56.1.915.g69d5ec7298-goog