Hi Yafang,
After commit 3087c61ed2c4 ("tools/testing/selftests/bpf: replace open-coded 16 with TASK_COMM_LEN"), the content of the format file under /sys/kernel/debug/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/debug/tracing/events/task/task_newtask/format field:char comm[16]; offset:12; size:16; signed:0;
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 Signed-off-by: Yafang Shao laoar.shao@gmail.com Cc: Mathieu Desnoyers mathieu.desnoyers@efficios.com Cc: Alexei Starovoitov alexei.starovoitov@gmail.com Cc: Kajetan Puchalski kajetan.puchalski@arm.com Cc: Steven Rostedt rostedt@goodmis.org Cc: John Stultz jstultz@google.com Cc: stable@vger.kernel.org # v5.17+
From my testing this works the same with older Perfetto as the previous diff you sent in the older thread, ie this type of errors:
Name Value Type mismatched_sched_switch_tids 2439 error (analysis) systrace_parse_failure 3853 error (analysis)
Meaning that applying this patch on top of the old one ends up with different results than just reverting the old one so not a 100% fix but as I said before, still an improvement.
Thanks, Kajetan