Revision b6c7abd1c28a63ad633433d037ee15a1bc3023ba authored by Yafang Shao on 12 February 2023, 15:13:03 UTC, committed by Steven Rostedt (Google) on 12 February 2023, 15:23:39 UTC
After commit 3087c61ed2c4 ("tools/testing/selftests/bpf: replace open-coded 16 with TASK_COMM_LEN"),
the content of the format file under
/sys/kernel/tracing/events/task/task_newtask was changed from
  field:char comm[16];    offset:12;    size:16;    signed:0;
to
  field:char comm[TASK_COMM_LEN];    offset:12;    size:16;    signed:0;

John reported that this change breaks older versions of perfetto.
Then Mathieu pointed out that this behavioral change was caused by the
use of __stringify(_len), which happens to work on macros, but not on enum
labels. And he also gave the suggestion on how to fix it:
  :One possible solution to make this more robust would be to extend
  :struct trace_event_fields with one more field that indicates the length
  :of an array as an actual integer, without storing it in its stringified
  :form in the type, and do the formatting in f_show where it belongs.

The result as follows after this change,
$ cat /sys/kernel/tracing/events/task/task_newtask/format
        field:char comm[16];    offset:12;      size:16;        signed:0;

Link: https://lore.kernel.org/lkml/Y+QaZtz55LIirsUO@google.com/
Link: https://lore.kernel.org/linux-trace-kernel/20230210155921.4610-1-laoar.shao@gmail.com/
Link: https://lore.kernel.org/linux-trace-kernel/20230212151303.12353-1-laoar.shao@gmail.com

Cc: stable@vger.kernel.org
Cc: Alexei Starovoitov <alexei.starovoitov@gmail.com>
Cc: Kajetan Puchalski <kajetan.puchalski@arm.com>
CC: Qais Yousef <qyousef@layalina.io>
Fixes: 3087c61ed2c4 ("tools/testing/selftests/bpf: replace open-coded 16 with TASK_COMM_LEN")
Reported-by: John Stultz <jstultz@google.com>
Debugged-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Suggested-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Suggested-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Yafang Shao <laoar.shao@gmail.com>
Signed-off-by: Steven Rostedt (Google) <rostedt@goodmis.org>
1 parent 3e46d91
History
File Mode Size
Kconfig -rw-r--r-- 1003 bytes
Makefile -rw-r--r-- 483 bytes
bpf.c -rw-r--r-- 482 bytes
crypto.c -rw-r--r-- 2.4 KB
crypto_test.c -rw-r--r-- 1.7 KB
ctrl.c -rw-r--r-- 4.8 KB
diag.c -rw-r--r-- 3.0 KB
fastopen.c -rw-r--r-- 2.0 KB
mib.c -rw-r--r-- 4.0 KB
mib.h -rw-r--r-- 4.0 KB
mptcp_diag.c -rw-r--r-- 5.8 KB
options.c -rw-r--r-- 45.9 KB
pm.c -rw-r--r-- 12.8 KB
pm_netlink.c -rw-r--r-- 59.2 KB
pm_userspace.c -rw-r--r-- 10.9 KB
protocol.c -rw-r--r-- 98.5 KB
protocol.h -rw-r--r-- 31.4 KB
sockopt.c -rw-r--r-- 32.1 KB
subflow.c -rw-r--r-- 57.0 KB
syncookies.c -rw-r--r-- 3.7 KB
token.c -rw-r--r-- 10.8 KB
token_test.c -rw-r--r-- 4.0 KB

back to top