Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp4098935pxk; Tue, 8 Sep 2020 10:38:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxqS6IdRQg/Oifn+7C5FPZh8MelspmgJ9oxdvu2VVeFoyehhC5ffbM9RH6ieeCBjJ0TnBox X-Received: by 2002:a17:907:aa9:: with SMTP id bz9mr26087913ejc.421.1599586694053; Tue, 08 Sep 2020 10:38:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599586694; cv=none; d=google.com; s=arc-20160816; b=tF+wgppCmQr3658wMSNplRIUWuzyf22tVGR1FcruSQH0FVoRHKrvjF+0WUBvZEL3wV zYoibzZwo6ld+X7Cfsou5wpZKc9EllD8PM1zZmu7B+8wdcfOwwINDFb1q8wd20g0Xz9h pFJsYeZ3O5dltOJxsSQ0jce7iuV2DSfFxZkL8NhPckXqzgYGuaQot3k4fSxYRpLnyvt2 x7bqyzJO0XJwvJn+ciZT1knrZyNUXeqzw7Fyy3m+dsx/3hOc2GkcYmJNLhpYiqDukvSf vOIPc6g5vYnOZp4alHUv48v3Gb3McyrGr4LMaEhsHd00lQagXX7Qz5YVNfjfimcxR0Sz MIiw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=rxeRLUoQBUXEOAb4yrJc8nWne5hkOh6ZhDkDo/NpmTA=; b=Btj5n++SZFSWjchNb7LqdUBfaAshd3sMJZ+lpuYyoNCLcebT7XkQ1YJj4lz3EL33MJ L1JrThj/QO2Y6B0CUbur4+0R+1qYsa11yNNky8i3kckMsv2HvCVk8NMEyNqYFwG9aiWI 7qhE9xCwoWT91ogyvdz74vCJakiW5jjrY2+sUJ1Uh/S7/g7Jt0jVcexSK4hra9B4CXPx gJqSAiZwVQno7u0Po4xbdAP+3zUg/KJQ6Y8crtrgk2zOuGM1nTk662Dzx4Ud1H2OHk2U tPZsAn7PsNQdhJ64agXX5EUbi7e3M3L1lsbbwvl84cXauCiqZs3WVpnnOtZFC2B3Zrdh A3vw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=DciE04eF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id pk25si12543508ejb.746.2020.09.08.10.37.50; Tue, 08 Sep 2020 10:38:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=DciE04eF; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731841AbgIHRhA (ORCPT + 99 others); Tue, 8 Sep 2020 13:37:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:36524 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731792AbgIHRgi (ORCPT ); Tue, 8 Sep 2020 13:36:38 -0400 Received: from kicinski-fedora-PC1C0HJN.thefacebook.com (unknown [163.114.132.6]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 74EA020738; Tue, 8 Sep 2020 17:36:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1599586597; bh=humf0A3eNdO8QjtSSneT0F+BBfk0pmqd3HPslVbaHBk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DciE04eFKvHvjJ7XF6N0n3Si+qtHP9qGXwdngsUmp+sAPCiJpzZ0Lnf1LlQXuixLU emhBnuqX8+n90KJXCys2P5uVNRbfcN4s/r3deI31XhIjzLFcN65eCf2g5Kd1KJfo3b lRUvkTrPdssWJQMoaqD/rHGw2DbZC5peMFgsd3kc= From: Jakub Kicinski To: davem@davemloft.net Cc: netdev@vger.kernel.org, paulmck@kernel.org, joel@joelfernandes.org, josh@joshtriplett.org, peterz@infradead.org, christian.brauner@ubuntu.com, rcu@vger.kernel.org, linux-kernel@vger.kernel.org, nikolay@cumulusnetworks.com, sfr@canb.auug.org.au, roopa@nvidia.com, Jakub Kicinski Subject: [PATCH net-next] rcu: prevent RCU_LOCKDEP_WARN() from swallowing the condition Date: Tue, 8 Sep 2020 10:36:24 -0700 Message-Id: <20200908173624.160024-1-kuba@kernel.org> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20200908090049.7e528e7f@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> References: <20200908090049.7e528e7f@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.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. Prevent the warning by adding the condition as dead code. We need to un-hide the declaration of lockdep_tasklist_lock_is_held() and fix a bug the crept into a net/sched header. Signed-off-by: Jakub Kicinski --- include/linux/rcupdate.h | 2 +- include/linux/sched/task.h | 2 -- include/net/sch_generic.h | 2 +- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h index d15d46db61f7..cf3d3ba3f3e4 100644 --- a/include/linux/rcupdate.h +++ b/include/linux/rcupdate.h @@ -320,7 +320,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 */ diff --git a/include/linux/sched/task.h b/include/linux/sched/task.h index a98965007eef..9f943c391df9 100644 --- a/include/linux/sched/task.h +++ b/include/linux/sched/task.h @@ -47,9 +47,7 @@ extern spinlock_t mmlist_lock; extern union thread_union init_thread_union; extern struct task_struct init_task; -#ifdef CONFIG_PROVE_RCU extern int lockdep_tasklist_lock_is_held(void); -#endif /* #ifdef CONFIG_PROVE_RCU */ extern asmlinkage void schedule_tail(struct task_struct *prev); extern void init_idle(struct task_struct *idle, int cpu); diff --git a/include/net/sch_generic.h b/include/net/sch_generic.h index d60e7c39d60c..eb68cc6e4e79 100644 --- a/include/net/sch_generic.h +++ b/include/net/sch_generic.h @@ -443,7 +443,7 @@ static inline bool lockdep_tcf_proto_is_locked(struct tcf_proto *tp) return lockdep_is_held(&tp->lock); } #else -static inline bool lockdep_tcf_chain_is_locked(struct tcf_block *chain) +static inline bool lockdep_tcf_chain_is_locked(struct tcf_chain *chain) { return true; } -- 2.24.1