[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241125142606.GG38837@noisy.programming.kicks-ass.net>
Date: Mon, 25 Nov 2024 15:26:06 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>,
Przemek Kitszel <przemyslaw.kitszel@...el.com>,
Dmitry Torokhov <dmitry.torokhov@...il.com>,
Steven Rostedt <rostedt@...dmis.org>, linux-kernel@...r.kernel.org,
Thomas Gleixner <tglx@...utronix.de>,
Michael Jeanson <mjeanson@...icios.com>,
Masami Hiramatsu <mhiramat@...nel.org>,
Alexei Starovoitov <ast@...nel.org>, Yonghong Song <yhs@...com>,
"Paul E . McKenney" <paulmck@...nel.org>,
Ingo Molnar <mingo@...hat.com>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Namhyung Kim <namhyung@...nel.org>,
Andrii Nakryiko <andrii.nakryiko@...il.com>, bpf@...r.kernel.org,
Joel Fernandes <joel@...lfernandes.org>,
Jordan Rife <jrife@...gle.com>, linux-trace-kernel@...r.kernel.org
Subject: Re: [RFC PATCH 4/5] tracing: Remove conditional locking from
__DO_TRACE()
On Mon, Nov 25, 2024 at 09:18:18AM -0500, Mathieu Desnoyers wrote:
> On 2024-11-23 12:38, Linus Torvalds wrote:
> I tried the following alteration to the code, which triggers an
> unexpected compiler warning on master, but not on v6.12. I suspect
> this is something worth discussing:
>
> static inline void trace_##name(proto) \
> { \
> if (static_branch_unlikely(&__tracepoint_##name.key)) { \
> if (cond) \
> scoped_guard(preempt_notrace) \
> __DO_TRACE_CALL(name, TP_ARGS(args)); \
So coding style would like braces here for it being multi-line. As
opposed to C that only mandates it for multi-statement. And then the
problem doesn't occur.
> } \
> if (IS_ENABLED(CONFIG_LOCKDEP) && (cond)) { \
> WARN_ONCE(!rcu_is_watching(), \
> "RCU not watching for tracepoint"); \
> } \
> }
>
> I suspect this is caused by the "else" at the end of the __scoped_guard() macro:
>
> #define __scoped_guard(_name, _label, args...) \
> for (CLASS(_name, scope)(args); \
> __guard_ptr(_name)(&scope) || !__is_cond_ptr(_name); \
> ({ goto _label; })) \
> if (0) { \
> _label: \
> break; \
> } else
>
> #define scoped_guard(_name, args...) \
> __scoped_guard(_name, __UNIQUE_ID(label), args)
>
> AFAIU this is a new warning introduced by
>
> commit fcc22ac5baf ("cleanup: Adjust scoped_guard() macros to avoid potential warning")
Yeah,.. So strictly speaking the code is fine, but the various compilers
don't like it when that else dangles :/
Powered by blists - more mailing lists