From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755621AbcGEVcm (ORCPT ); Tue, 5 Jul 2016 17:32:42 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:36213 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1755436AbcGEVcj (ORCPT ); Tue, 5 Jul 2016 17:32:39 -0400 X-IBM-Helo: d01dlp01.pok.ibm.com X-IBM-MailFrom: paulmck@linux.vnet.ibm.com Date: Tue, 5 Jul 2016 14:32:44 -0700 From: "Paul E. McKenney" To: David Howells Cc: davem@davemloft.net, netdev@vger.kernel.org, linux-afs@lists.infradead.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH net-next 22/24] rcu: Suppress sparse warnings for rcu_dereference_raw() Reply-To: paulmck@linux.vnet.ibm.com References: <146772433082.21657.14046392058484946464.stgit@warthog.procyon.org.uk> <146772448920.21657.6989233498278959646.stgit@warthog.procyon.org.uk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <146772448920.21657.6989233498278959646.stgit@warthog.procyon.org.uk> User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16070521-0040-0000-0000-000000BC1D3C X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16070521-0041-0000-0000-000004963E48 Message-Id: <20160705213244.GA12384@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-07-05_11:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1604210000 definitions=main-1607050190 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jul 05, 2016 at 02:14:49PM +0100, David Howells wrote: > From: Paul E. McKenney > > Data structures that are used both with and without RCU protection > are difficult to write in a sparse-clean manner. If you mark the > relevant pointers with __rcu, sparse will complain about all non-RCU > uses, but if you don't mark those pointers, sparse will complain about > all RCU uses. > > This commit therefore suppresses sparse warnings for rcu_dereference_raw(), > allowing mixed-protection data structures to avoid these warnings. > > Reported-by: David Howells > Signed-off-by: Paul E. McKenney > Signed-off-by: David Howells This would normally be my cue to give an Acked-by to an RCU patch, but it already has my Signed-off-by. So this is just to confirm that I agree that keeping this patch with the other patches that depend on it is the right thing to do. ;-) Thanx, Paul > --- > > include/linux/rcupdate.h | 8 ++++++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > > diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h > index 5f1533e3d032..85830e6c797b 100644 > --- a/include/linux/rcupdate.h > +++ b/include/linux/rcupdate.h > @@ -611,6 +611,12 @@ static inline void rcu_preempt_sleep_check(void) > rcu_dereference_sparse(p, space); \ > ((typeof(*p) __force __kernel *)(p)); \ > }) > +#define rcu_dereference_raw(p) \ > +({ \ > + /* Dependency order vs. p above. */ \ > + typeof(p) ________p1 = lockless_dereference(p); \ > + ((typeof(*p) __force __kernel *)(________p1)); \ > +}) > > /** > * RCU_INITIALIZER() - statically initialize an RCU-protected global variable > @@ -729,8 +735,6 @@ static inline void rcu_preempt_sleep_check(void) > __rcu_dereference_check((p), (c) || rcu_read_lock_sched_held(), \ > __rcu) > > -#define rcu_dereference_raw(p) rcu_dereference_check(p, 1) /*@@@ needed? @@@*/ > - > /* > * The tracing infrastructure traces RCU (we want that), but unfortunately > * some of the RCU checks causes tracing to lock up the system. >