From: paulmck@kernel.org
To: rcu@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, kernel-team@fb.com,
mingo@kernel.org, jiangshanlai@gmail.com,
akpm@linux-foundation.org, mathieu.desnoyers@efficios.com,
josh@joshtriplett.org, tglx@linutronix.de, peterz@infradead.org,
rostedt@goodmis.org, dhowells@redhat.com, edumazet@google.com,
fweisbec@gmail.com, oleg@redhat.com, joel@joelfernandes.org,
Jakub Kicinski <kuba@kernel.org>,
paulmck@kernel.org
Subject: [PATCH tip/core/rcu 7/7] rcu: Prevent RCU_LOCKDEP_WARN() from swallowing the condition
Date: Thu, 5 Nov 2020 15:24:54 -0800 [thread overview]
Message-ID: <20201105232454.19919-7-paulmck@kernel.org> (raw)
In-Reply-To: <20201105232345.GA19179@paulmck-ThinkPad-P72>
From: Jakub Kicinski <kuba@kernel.org>
We run into a unused variable warning in bridge code when variable is
only used inside the condition of rcu_dereference_protected().
#define mlock_dereference(X, br) \
rcu_dereference_protected(X, lockdep_is_held(&br->multicast_lock))
Since on builds with CONFIG_PROVE_RCU=n rcu_dereference_protected()
compiles to nothing the compiler doesn't see the variable use.
This commit therefore prevents this warning by adding the condition as
dead code.
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
--
CC: paulmck@kernel.org
CC: josh@joshtriplett.org
CC: rostedt@goodmis.org
CC: mathieu.desnoyers@efficios.com
CC: joel@joelfernandes.org
CC: jiangshanlai@gmail.com
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
---
include/linux/rcupdate.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h
index f9533bb..de08264 100644
--- a/include/linux/rcupdate.h
+++ b/include/linux/rcupdate.h
@@ -328,7 +328,7 @@ static inline void rcu_preempt_sleep_check(void) { }
#else /* #ifdef CONFIG_PROVE_RCU */
-#define RCU_LOCKDEP_WARN(c, s) do { } while (0)
+#define RCU_LOCKDEP_WARN(c, s) do { } while (0 && (c))
#define rcu_sleep_check() do { } while (0)
#endif /* #else #ifdef CONFIG_PROVE_RCU */
--
2.9.5
prev parent reply other threads:[~2020-11-05 23:25 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-05 23:23 [PATCH tip/core/rcu 0/7] Lockdep-RCU updates for v5.11 Paul E. McKenney
2020-11-05 23:24 ` [PATCH tip/core/rcu 1/7] sched: Un-hide lockdep_tasklist_lock_is_held() for !LOCKDEP paulmck
2020-11-05 23:24 ` [PATCH tip/core/rcu 2/7] rcu: Un-hide lockdep maps " paulmck
2020-11-05 23:24 ` [PATCH tip/core/rcu 3/7] net: Un-hide lockdep_sock_is_held() " paulmck
2020-11-05 23:24 ` [PATCH tip/core/rcu 4/7] net: sched: Remove broken definitions and un-hide " paulmck
2020-11-05 23:24 ` [PATCH tip/core/rcu 5/7] srcu: Use a more appropriate lockdep helper paulmck
2020-11-05 23:24 ` [PATCH tip/core/rcu 6/7] lockdep: Provide dummy forward declaration of *_is_held() helpers paulmck
2020-11-05 23:24 ` paulmck [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201105232454.19919-7-paulmck@kernel.org \
--to=paulmck@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=dhowells@redhat.com \
--cc=edumazet@google.com \
--cc=fweisbec@gmail.com \
--cc=jiangshanlai@gmail.com \
--cc=joel@joelfernandes.org \
--cc=josh@joshtriplett.org \
--cc=kernel-team@fb.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=mingo@kernel.org \
--cc=oleg@redhat.com \
--cc=peterz@infradead.org \
--cc=rcu@vger.kernel.org \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox