Re: [GIT PULL] tracing: Updates for v6.13

From: Steven Rostedt
Date: Fri Nov 22 2024 - 17:12:50 EST


On Fri, 22 Nov 2024 13:54:49 -0800
Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> wrote:

> And yes, it's a static conditional, but it's *STUPID*. And it makes
> the code just harder to follow, for no good reason. The difference is
> literally this magic
>
> __DO_TRACE(name, \
> TP_ARGS(args), \
> TP_CONDITION(cond), 0); \
>
> vs
>
> __DO_TRACE(name, \
> TP_ARGS(args), \
> TP_CONDITION(cond), 1); \

Hmm, if we make a __DO_TRACE_SYSCALL(), I don't think it needs to even have
that condition parameter. The TP_CONDITION() is to allow tracepoints to
check a condition within the static_branch() portion of the tracepoint so
the condition does not get called when tracepoints are disabled (and just a
nop). By default we have:

#define DECLARE_TRACE_SYSCALL(name, proto, args) \
__DECLARE_TRACE_SYSCALL(name, PARAMS(proto), PARAMS(args), \
cpu_online(raw_smp_processor_id()), \
PARAMS(void *__data, proto))


Where the tracepoint has to at least be called when the current CPU is
online. But is there every a case where a CPU is not online when a system
call is entered or exited?

And there isn't any use cases of calling the system call tracepoint with a
condition. Hence, I think the __DO_TRACE_SYSCALL() doesn't even need to
include the condition:

#define __DO_TRACE_SYSCALL(name, args) \
do { \
int __maybe_unused __idx = 0; \

Oh, also the __idx isn't used since I removed the SRCU, so we can remove
that too. Maybe make that a separate patch?

rcu_read_lock_trace(); \
\
__DO_TRACE_CALL(name, TP_ARGS(args)); \
\
rcu_read_unlock_trace(); \
} while (0)

-- Steve