Files
linux/tools/tracing/rtla/src
Tomas Glozar 8020361d51 rtla: Define _GNU_SOURCE in timerlat_bpf.c
Newer versions of glibc include a definition of struct sched_attr in
bits/sched.h (included through sched.h which is included by rtla).
Commit 0eecee3406 ("tools/rtla: fix collision with glibc
sched_attr/sched_set_attr") has modified the definition of struct
sched_attr in utils.h, so that it is only applied with older versions of
glibc that do not define it, in order to prevent build failure.

The definition in bits/sched.h depends on _GNU_SOURCE.
timerlat_bpf.c does not define _GNU_SOURCE, making it fall back to the
definition in utils.h. The latter has two fields less, leading to
shifted offsets of struct timerlat_params in timerlat_bpf_init.

Because of the shift, timerlat_bpf_init incorrectly reads
params->entries as 0 for timerlat-hist and disables the creation of
histogram maps, causing breakage in BPF sample collection mode:

$ rtla timerlat hist -d 1s
Error pulling BPF data

Fix the issue by also defining _GNU_SOURCE in timerlat_bpf.c.

Cc: John Kacur <[email protected]>
Cc: Luis Goncalves <[email protected]>
Link: https://lore.kernel.org/[email protected]
Fixes: e34293ddce ("rtla/timerlat: Add BPF skeleton to collect samples")
Signed-off-by: Tomas Glozar <[email protected]>
Signed-off-by: Steven Rostedt (Google) <[email protected]>
2025-05-07 17:25:46 -04:00
..
2025-03-26 10:36:39 -04:00
2023-02-13 23:56:46 -05:00
2025-03-26 10:36:39 -04:00
2025-01-24 13:46:24 -05:00