[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c70b4864-737b-4604-a32e-38e0b087917d@intel.com>
Date: Mon, 25 Nov 2024 16:35:35 +0100
From: Przemek Kitszel <przemyslaw.kitszel@...el.com>
To: Peter Zijlstra <peterz@...radead.org>, Mathieu Desnoyers
<mathieu.desnoyers@...icios.com>
CC: Linus Torvalds <torvalds@...ux-foundation.org>, 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 11/25/24 15:26, Peter Zijlstra wrote:
> 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 :/
At one point I had a version that did:
if (0)
label: ;
else
for (....)
but it is goto-jumping back in the code
https://lore.kernel.org/netdev/20241001145718.8962-1-przemyslaw.kitszel@intel.com/#t
I could switch to it again to reduce noise like this problem, but such
change would be to essentially allow bad formatting
Powered by blists - more mailing lists