From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S3000961AbdDZODQ (ORCPT ); Wed, 26 Apr 2017 10:03:16 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:53535 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S3000944AbdDZODG (ORCPT ); Wed, 26 Apr 2017 10:03:06 -0400 Date: Wed, 26 Apr 2017 07:02:57 -0700 From: "Paul E. McKenney" To: Steven Rostedt Cc: "Michael S. Tsirkin" , linux-kernel@vger.kernel.org, Josh Triplett , Mathieu Desnoyers , Lai Jiangshan , David Miller Subject: Re: [PATCH] hlist_add_tail_rcu disable sparse warning Reply-To: paulmck@linux.vnet.ibm.com References: <1486748308-16653-1-git-send-email-mst@redhat.com> <20170227202547-mutt-send-email-mst@kernel.org> <20170426091343.073af471@gandalf.local.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20170426091343.073af471@gandalf.local.home> User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-GCONF: 00 x-cbid: 17042614-0008-0000-0000-00000205A995 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00006976; HX=3.00000240; KW=3.00000007; PH=3.00000004; SC=3.00000208; SDB=6.00852750; UDB=6.00421546; IPR=6.00631588; BA=6.00005313; NDR=6.00000001; ZLA=6.00000005; ZF=6.00000009; ZB=6.00000000; ZP=6.00000000; ZH=6.00000000; ZU=6.00000002; MB=3.00015185; XFM=3.00000013; UTC=2017-04-26 14:03:04 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17042614-0009-0000-0000-000034F3D1CB Message-Id: <20170426140257.GP3956@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-04-26_10:,, 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-1703280000 definitions=main-1704260244 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 26, 2017 at 09:13:43AM -0400, Steven Rostedt wrote: > > Paul, > > Did you see this email? Yep! Michael's patch is 48ac34666ff7 ("hlist_add_tail_rcu disable sparse warning") in -rcu and now in -tip. But I do appreciate the reminder -- way too easy to miss stuff on LKML! Thanx, Paul > -- Steve > > > On Mon, 27 Feb 2017 20:26:01 +0200 > "Michael S. Tsirkin" wrote: > > > On Fri, Feb 10, 2017 at 07:39:49PM +0200, Michael S. Tsirkin wrote: > > > sparse is unhappy about this code in hlist_add_tail_rcu: > > > > > > struct hlist_node *i, *last = NULL; > > > > > > for (i = hlist_first_rcu(h); i; i = hlist_next_rcu(i)) > > > last = i; > > > > > > This is because hlist_next_rcu and hlist_next_rcu return > > > __rcu pointers. > > > > > > It's a false positive - it's a write side primitive and so > > > does not need to be called in a read side critical section. > > > > > > The following trivial patch disables the warning > > > without changing the behaviour in any way. > > > > > > Note: __hlist_for_each_rcu would also remove the warning but it would be > > > confusing since it calls rcu_derefence and is designed to run in the rcu > > > read side critical section. > > > > > > Signed-off-by: Michael S. Tsirkin > > > --- > > > > ping > > > > > changes since RFC > > > added commit log text to explain why don't we use __hlist_for_each_rcu > > > > > > include/linux/rculist.h | 2 +- > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > diff --git a/include/linux/rculist.h b/include/linux/rculist.h > > > index 4f7a956..bf578e8 100644 > > > --- a/include/linux/rculist.h > > > +++ b/include/linux/rculist.h > > > @@ -509,7 +509,7 @@ static inline void hlist_add_tail_rcu(struct hlist_node *n, > > > { > > > struct hlist_node *i, *last = NULL; > > > > > > - for (i = hlist_first_rcu(h); i; i = hlist_next_rcu(i)) > > > + for (i = h->first; i; i = i->next) > > > last = i; > > > > > > if (last) { > > > -- > > > MST >