public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [GIT PULL] RTLA changes for v7.1
@ 2026-03-27 15:02 Tomas Glozar
  2026-03-29 16:22 ` Steven Rostedt
  0 siblings, 1 reply; 5+ messages in thread
From: Tomas Glozar @ 2026-03-27 15:02 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: Costa Shulyupin, Wander Lairson Costa, LKML, linux-trace-kernel,
	Tomas Glozar

Steven,

please pull the following changes for RTLA (more info in tag description).

Thanks,
Tomas

The following changes since commit 11439c4635edd669ae435eec308f4ab8a0804808:

  Linux 7.0-rc2 (2026-03-01 15:39:31 -0800)

are available in the Git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/tglozar/linux.git tags/rtla-v7.1

for you to fetch changes up to 82374995b63d2de21414163828a32d52610dcaf2:

  Documentation/rtla: Document SIGINT behavior (2026-03-27 10:58:30 +0100)

----------------------------------------------------------------
RTLA patches for v7.1

- Simplify option parsing

Auto-generate getopt_long() optstring for short options from long options
array, avoiding the need to specify it manually and reducing the surface
for mistakes.

- Add unit tests

Implement unit tests (make unit-tests) using libcheck, next to existing
runtime tests (make check). Currently, three functions from utils.c are
tested.

- Add --stack-format option

In addition to stopping stack pointer decoding (with -s/--stack option)
on first unresolvable pointer, allow also skipping unresolvable pointers
and displaying everything, configurable with a new option.

- Unify number of CPUs into one global variable

Use one global variable, nr_cpus, to store the number of CPUs instead of
retrieving it and passing it at multiple places.

- Fix behavior in various corner cases

Make RTLA behave correctly in several corner cases: memory allocation
failure, invalid value read from kernel side, thread creation failure,
malformed time value input, and read/write failure or interruption by
signal.

- Improve string handling

Simplify several places in the code that handle strings, including
parsing of action arguments. A few new helper functions and variables
are added for that purpose.

- Get rid of magic numbers

Few places handling paths use a magic number of 1024. Replace it with
MAX_PATH and ARRAY_SIZE() macro.

- Unify threshold handling

Code that handles response to latency threshold is duplicated between
tools, which has led to bugs in the past. Unify it into a new helper
as much as possible.

- Fix segfault on SIGINT during cleanup

The SIGINT handler touches dynamically allocated memory. Detach it
before freeing it during cleanup to prevent segmentation fault and
discarding of output buffers. Also, properly document SIGINT handling
while at it.

The tag was tested (make && make check && make unit-tests) as well as
pre-tested on top of next-20260326. There are no known conflicts.

Signed-off-by: Tomas Glozar <tglozar@redhat.com>

----------------------------------------------------------------
Costa Shulyupin (7):
      tools/rtla: Generate optstring from long options
      tools/build: Add feature test for libcheck
      tools/rtla: Add unit tests for utils.c
      tools/rtla: Consolidate nr_cpus usage across all tools
      tools/rtla: Remove unneeded nr_cpus arguments
      tools/rtla: Remove unneeded nr_cpus members
      tools/rtla: Remove unneeded nr_cpus from for_each_monitored_cpu

Tomas Glozar (4):
      rtla/timerlat: Add --stack-format option
      Documentation/rtla: Document --stack-format option
      rtla: Fix segfault on multiple SIGINTs
      Documentation/rtla: Document SIGINT behavior

Wander Lairson Costa (17):
      rtla: Exit on memory allocation failures during initialization
      rtla: Use strdup() to simplify code
      rtla/actions: Simplify argument parsing
      rtla: Introduce common_threshold_handler() helper
      rtla: Replace magic number with MAX_PATH
      rtla: Simplify code by caching string lengths
      rtla/timerlat: Add bounds check for softirq vector
      rtla: Handle pthread_create() failure properly
      rtla: Add str_has_prefix() helper function
      rtla: Use str_has_prefix() for prefix checks
      rtla: Enforce exact match for time unit suffixes
      rtla: Use str_has_prefix() for option prefix check
      rtla/timerlat: Simplify RTLA_NO_BPF environment variable check
      rtla/trace: Fix write loop in trace_event_save_hist()
      rtla/trace: Fix I/O handling in save_trace_to_file()
      rtla/utils: Fix resource leak in set_comm_sched_attr()
      rtla/utils: Fix loop condition in PID validation

 Documentation/tools/rtla/common_appendix.txt       |  21 ++++
 .../tools/rtla/common_timerlat_options.txt         |  12 +++
 tools/build/Makefile.feature                       |   3 +
 tools/build/feature/Makefile                       |   4 +
 tools/build/feature/test-libcheck.c                |   8 ++
 tools/tracing/rtla/Build                           |   1 +
 tools/tracing/rtla/Makefile                        |   5 +
 tools/tracing/rtla/Makefile.config                 |   8 ++
 tools/tracing/rtla/README.txt                      |   1 +
 tools/tracing/rtla/src/actions.c                   | 103 +++++++++++-------
 tools/tracing/rtla/src/actions.h                   |   8 +-
 tools/tracing/rtla/src/common.c                    | 120 +++++++++++++++++----
 tools/tracing/rtla/src/common.h                    |  24 ++++-
 tools/tracing/rtla/src/osnoise.c                   |  26 ++---
 tools/tracing/rtla/src/osnoise_hist.c              |  51 ++++-----
 tools/tracing/rtla/src/osnoise_top.c               |  41 ++-----
 tools/tracing/rtla/src/timerlat.c                  |  16 ++-
 tools/tracing/rtla/src/timerlat.h                  |   1 +
 tools/tracing/rtla/src/timerlat_aa.c               |  51 ++++++---
 tools/tracing/rtla/src/timerlat_aa.h               |   2 +-
 tools/tracing/rtla/src/timerlat_bpf.c              |  19 ++--
 tools/tracing/rtla/src/timerlat_bpf.h              |  12 +--
 tools/tracing/rtla/src/timerlat_hist.c             | 116 +++++++++-----------
 tools/tracing/rtla/src/timerlat_top.c              | 114 +++++++++-----------
 tools/tracing/rtla/src/timerlat_u.c                |  13 ++-
 tools/tracing/rtla/src/timerlat_u.h                |   1 +
 tools/tracing/rtla/src/trace.c                     | 102 ++++++++++--------
 tools/tracing/rtla/src/trace.h                     |   4 +-
 tools/tracing/rtla/src/utils.c                     | 113 ++++++++++++++-----
 tools/tracing/rtla/src/utils.h                     |  33 ++++++
 tools/tracing/rtla/tests/unit/Build                |   2 +
 tools/tracing/rtla/tests/unit/Makefile.unit        |  17 +++
 tools/tracing/rtla/tests/unit/unit_tests.c         | 119 ++++++++++++++++++++
 33 files changed, 769 insertions(+), 402 deletions(-)
 create mode 100644 tools/build/feature/test-libcheck.c
 create mode 100644 tools/tracing/rtla/tests/unit/Build
 create mode 100644 tools/tracing/rtla/tests/unit/Makefile.unit
 create mode 100644 tools/tracing/rtla/tests/unit/unit_tests.c


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

* Re: [GIT PULL] RTLA changes for v7.1
  2026-03-27 15:02 [GIT PULL] RTLA changes for v7.1 Tomas Glozar
@ 2026-03-29 16:22 ` Steven Rostedt
  2026-04-02 15:08   ` Tomas Glozar
  0 siblings, 1 reply; 5+ messages in thread
From: Steven Rostedt @ 2026-03-29 16:22 UTC (permalink / raw)
  To: Tomas Glozar
  Cc: Costa Shulyupin, Wander Lairson Costa, LKML, linux-trace-kernel

On Fri, 27 Mar 2026 16:02:37 +0100
Tomas Glozar <tglozar@redhat.com> wrote:

> Steven,
> 
> please pull the following changes for RTLA (more info in tag description).

I can pull this but I just noticed that starting with 7.0-rc1, it fails
to build without libbpf:

Auto-detecting system features:
...                           libtraceevent: [ on  ]
...                              libtracefs: [ on  ]
...                             libcpupower: [ OFF ]
...                                  libbpf: [ OFF ]
...                         clang-bpf-co-re: [ on  ]
...                       bpftool-skeletons: [ OFF ]

libcpupower is missing, building without --deepest-idle-state support.
Please install libcpupower-dev/kernel-tools-libs-devel
libbpf is missing, building without BPF skeleton support.
Please install libbpf-dev/libbpf-devel
bpftool is missing or not supporting skeletons, building without BPF skeleton support.
Please install bpftool
make -f /work/git/linux-trace.git/tools/build/Makefile.build dir=. obj=rtla
make[1]: Entering directory '/work/git/linux-trace.git/tools/tracing/rtla'
make[2]: Entering directory '/work/git/linux-trace.git/tools/tracing/rtla'
  CC      /work/git/linux-trace.git/tools/tracing/rtla/src/trace.o
  CC      /work/git/linux-trace.git/tools/tracing/rtla/src/utils.o
  CC      /work/git/linux-trace.git/tools/tracing/rtla/src/actions.o
  CC      /work/git/linux-trace.git/tools/tracing/rtla/src/common.o
  CC      /work/git/linux-trace.git/tools/tracing/rtla/src/osnoise.o
  CC      /work/git/linux-trace.git/tools/tracing/rtla/src/osnoise_top.o
  CC      /work/git/linux-trace.git/tools/tracing/rtla/src/osnoise_hist.o
  CC      /work/git/linux-trace.git/tools/tracing/rtla/src/timerlat.o
In file included from src/timerlat.c:18:
src/timerlat_bpf.h:15:10: fatal error: bpf/libbpf.h: No such file or directory
   15 | #include <bpf/libbpf.h>
      |          ^~~~~~~~~~~~~~
compilation terminated.
make[2]: *** [/work/git/linux-trace.git/tools/build/Makefile.build:94: /work/git/linux-trace.git/tools/tracing/rtla/src/timerlat.o] Error 1
make[2]: Leaving directory '/work/git/linux-trace.git/tools/tracing/rtla'
make[1]: *** [/work/git/linux-trace.git/tools/build/Makefile.build:156: src] Error 2
make[1]: Leaving directory '/work/git/linux-trace.git/tools/tracing/rtla'
make: *** [Makefile:104: /work/git/linux-trace.git/tools/tracing/rtla/rtla-in.o] Error 2

That should probably be fixed on top of v7.0-rcX so that it is not
broken in 7.0.

-- Steve


> 
> Thanks,
> Tomas
> 
> The following changes since commit 11439c4635edd669ae435eec308f4ab8a0804808:
> 
>   Linux 7.0-rc2 (2026-03-01 15:39:31 -0800)
> 
> are available in the Git repository at:
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/tglozar/linux.git tags/rtla-v7.1
> 
> for you to fetch changes up to 82374995b63d2de21414163828a32d52610dcaf2:
> 
>   Documentation/rtla: Document SIGINT behavior (2026-03-27 10:58:30 +0100)


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

* Re: [GIT PULL] RTLA changes for v7.1
  2026-03-29 16:22 ` Steven Rostedt
@ 2026-04-02 15:08   ` Tomas Glozar
  2026-04-02 16:26     ` Steven Rostedt
  0 siblings, 1 reply; 5+ messages in thread
From: Tomas Glozar @ 2026-04-02 15:08 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: Costa Shulyupin, Wander Lairson Costa, LKML, linux-trace-kernel

ne 29. 3. 2026 v 18:22 odesílatel Steven Rostedt <rostedt@goodmis.org> napsal:
>
> That should probably be fixed on top of v7.0-rcX so that it is not
> broken in 7.0.
>
> -- Steve
>

After merging the fix for 7.0 [1], there's now a context difference
caused by commit ea06305ff9920 (tools/rtla: Remove unneeded nr_cpus
arguments) on merging rtla-v7.1 onto the current master. The context
difference merges cleanly via three-way merge:

$ git merge rtla-v7.1
Auto-merging tools/tracing/rtla/src/timerlat_bpf.h
Merge made by the 'ort' strategy.
...

Do you prefer me to rebase this PR on top of 7.0-rc6 once it's tagged
or to leave the pull request as is and perhaps add a note to your PR
to Linus the merge difference is expected?

[1] https://lore.kernel.org/all/177490453553.1933951.12021005257041359513.pr-tracker-bot@kernel.org/

Tomas


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

* Re: [GIT PULL] RTLA changes for v7.1
  2026-04-02 15:08   ` Tomas Glozar
@ 2026-04-02 16:26     ` Steven Rostedt
  2026-04-02 16:28       ` Steven Rostedt
  0 siblings, 1 reply; 5+ messages in thread
From: Steven Rostedt @ 2026-04-02 16:26 UTC (permalink / raw)
  To: Tomas Glozar
  Cc: Costa Shulyupin, Wander Lairson Costa, LKML, linux-trace-kernel

On Thu, 2 Apr 2026 17:08:36 +0200
Tomas Glozar <tglozar@redhat.com> wrote:

> After merging the fix for 7.0 [1], there's now a context difference
> caused by commit ea06305ff9920 (tools/rtla: Remove unneeded nr_cpus
> arguments) on merging rtla-v7.1 onto the current master. The context
> difference merges cleanly via three-way merge:
> 
> $ git merge rtla-v7.1
> Auto-merging tools/tracing/rtla/src/timerlat_bpf.h
> Merge made by the 'ort' strategy.
> ...
> 
> Do you prefer me to rebase this PR on top of 7.0-rc6 once it's tagged
> or to leave the pull request as is and perhaps add a note to your PR
> to Linus the merge difference is expected?

This is fine as is. Linus is used to this. He's even OK with minor merge
conflicts. The only time you really need to tell Linus about something is
if the merge conflicts or a merge causes something to break but merges
cleanly (like removing an extra #endif)

-- Steve

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

* Re: [GIT PULL] RTLA changes for v7.1
  2026-04-02 16:26     ` Steven Rostedt
@ 2026-04-02 16:28       ` Steven Rostedt
  0 siblings, 0 replies; 5+ messages in thread
From: Steven Rostedt @ 2026-04-02 16:28 UTC (permalink / raw)
  To: Tomas Glozar
  Cc: Costa Shulyupin, Wander Lairson Costa, LKML, linux-trace-kernel

On Thu, 2 Apr 2026 12:26:34 -0400
Steven Rostedt <rostedt@goodmis.org> wrote:

> This is fine as is. Linus is used to this. He's even OK with minor merge
> conflicts. The only time you really need to tell Linus about something is
> if the merge conflicts or a merge causes something to break but merges
> cleanly (like removing an extra #endif)

In fact, Linus actually looks down at rebasing. You should only rebase if
there's something really nasty.

The code is already in linux-next. Which means it should not be rebased at
all.

-- Steve

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

end of thread, other threads:[~2026-04-02 16:27 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-27 15:02 [GIT PULL] RTLA changes for v7.1 Tomas Glozar
2026-03-29 16:22 ` Steven Rostedt
2026-04-02 15:08   ` Tomas Glozar
2026-04-02 16:26     ` Steven Rostedt
2026-04-02 16:28       ` Steven Rostedt

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