Re: [PATCH] sched/tracing: append prev_state to tp args instead

From: Steven Rostedt
Date: Tue May 10 2022 - 11:05:57 EST


On Tue, 10 May 2022 10:29:40 +0200
Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:

> On Tue, May 10, 2022 at 09:01:22AM +0200, Peter Zijlstra wrote:
> > On Mon, May 09, 2022 at 12:32:31PM -0700, Andrii Nakryiko wrote:
> > > So can this patch be applied, please, or it's a hard no?
> >
> > Sorry; I got distracted with other work. I'll grudingly apply the patch.
>
> gcc-11-i386-allmodconfig [15:35] FAILED
> | In file included from ../include/trace/define_custom_trace.h:55,
> | from ../samples/trace_events/trace_custom_sched.h:96,
> | from ../samples/trace_events/trace_custom_sched.c:24:
> | ../samples/trace_events/./trace_custom_sched.h: In function ‘ftrace_test_custom_probe_sched_switch’:
> | ../include/trace/trace_custom_events.h:178:42: error: passing argument 1 of ‘check_trace_callback_type_sched_switch’ from incompatible pointer type [-Werror=incompatible-pointer-types]
> | 178 | check_trace_callback_type_##call(trace_custom_event_raw_event_##template); \
> | | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> | | |
> | | void (*)(void *, bool, unsigned int, struct task_struct *, struct task_struct *) {aka void (*)(void *, _Bool, unsigned int, struct task_struct *, struct task_struct *)}
> | ../include/trace/trace_custom_events.h:34:9: note: in expansion of macro ‘DEFINE_CUSTOM_EVENT’
> | 34 | DEFINE_CUSTOM_EVENT(name, name, PARAMS(proto), PARAMS(args));


Yes, the custom tracepoint sample code uses the sched_switch tracepoint as
an example. That sample code needs to be updated:

In samples/trace_events/trace_custom_sched.h:

TRACE_CUSTOM_EVENT(sched_switch,

/*
* The TP_PROTO() and TP_ARGS must match the trace event
* that the custom event is using.
*/
TP_PROTO(bool preempt,
unsigned int prev_state,
struct task_struct *prev,
struct task_struct *next),

TP_ARGS(preempt, prev_state, prev, next),



The arguments need to be updated.

-- Steve