Re: [PATCH -next] tracepoint: ipi: don't trace IPI on offline CPUs

From: Steven Rostedt
Date: Wed Mar 09 2016 - 11:05:54 EST


On Wed, 9 Mar 2016 12:22:22 +0000
Sudeep Holla <sudeep.holla@xxxxxxx> wrote:


> Hi Steven,
>
> I observed that in "include/linux/tracepoint.h", we have
> #define __DO_TRACE(tp, proto, args, cond, prercu, postrcu)
> ...
> if (!cpu_online(raw_smp_processor_id()))
> return;
>
> if (!(cond))
> return;
> ...
>
> where !cond check seems reduntant if it's cpu_online check.
> So, does this patch handle the warning correctly or is there any better
> way ? I did see few traces with same condition, just thought of checking
> with you.
>

Bah, I forgot that we have lockdep checks for when the event isn't
enabled. Can you try this patch:

-- Steve

diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h
index acfdbf353a0b..be586c632a0c 100644
--- a/include/linux/tracepoint.h
+++ b/include/linux/tracepoint.h
@@ -134,9 +134,6 @@ extern void syscall_unregfunc(void);
void *it_func; \
void *__data; \
\
- if (!cpu_online(raw_smp_processor_id())) \
- return; \
- \
if (!(cond)) \
return; \
prercu; \
@@ -343,15 +340,19 @@ extern void syscall_unregfunc(void);
* "void *__data, proto" as the callback prototype.
*/
#define DECLARE_TRACE_NOARGS(name) \
- __DECLARE_TRACE(name, void, , 1, void *__data, __data)
+ __DECLARE_TRACE(name, void, , \
+ cpu_online(raw_smp_processor_id()), \
+ void *__data, __data)

#define DECLARE_TRACE(name, proto, args) \
- __DECLARE_TRACE(name, PARAMS(proto), PARAMS(args), 1, \
- PARAMS(void *__data, proto), \
- PARAMS(__data, args))
+ __DECLARE_TRACE(name, PARAMS(proto), PARAMS(args), \
+ cpu_online(raw_smp_processor_id()), \
+ PARAMS(void *__data, proto), \
+ PARAMS(__data, args))

#define DECLARE_TRACE_CONDITION(name, proto, args, cond) \
- __DECLARE_TRACE(name, PARAMS(proto), PARAMS(args), PARAMS(cond), \
+ __DECLARE_TRACE(name, PARAMS(proto), PARAMS(args), \
+ cpu_online(raw_smp_processor_id()) && (PARAMS(cond)), \
PARAMS(void *__data, proto), \
PARAMS(__data, args))