Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp2932636ybb; Mon, 30 Mar 2020 16:22:24 -0700 (PDT) X-Google-Smtp-Source: ADFU+vsjFWYUSrCy66rG4jt4eIRaPXfcPF14HLesF359Vjkje7ZpoMxY5gRBKD+S/xF5a0q7nbME X-Received: by 2002:a4a:92cd:: with SMTP id j13mr11495673ooh.96.1585610544495; Mon, 30 Mar 2020 16:22:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585610544; cv=none; d=google.com; s=arc-20160816; b=OHYwyxK1+ZFnQFQYPam97C5rNX3gpg2CxSD9SZpAL+Q3TGSIoyFHhI8HFNjGxOK29a vbPqTcWA+CG/Z+1yCiTX96qC+QPSOodtDCUdQMjvcTEue+fW5N3hBHOHRqpxK2VX0qf+ y0r//Z/jn8iRwasR0THZcQNZOTKtvaL6uuoU/PlOm1iBjW+eWjXdQcN2dSz5mYsvsXYG Fn3X5cqs1E46bxYPDtfhaTVMhscFLIIkx/nwdAaMUm2ynQKAZVvzQF4JMBBrbkwSdGF/ eTDqqlIteW3ThzFsflpK3OO3ITPrIwpHFVyXiuFWqpk+UGnmOgD045/x7QQwZi1AUoGH buCQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:reply-to:message-id :subject:cc:to:from:date:dkim-signature; bh=XHrkx9KhJE7ToPsJyfwLA/Erxq9PKhLt6qTNOwQZn7M=; b=MSSqMnt/+Ea6cDL4O/ictq+rqFf6WJw+4mOx9+cyACrpdyO1UFDjD10E6YgeLCkWkw AHYkIrldEI1IKgM+XLV3Q1uJK7gvax6fxX4szN3tNpJq1MQtLC9j1fg49EYWT9UUHucm bN8xAj1Zz/QHlcBePGih92dFEmQ9v8rzEsICQEsYIqJgeP8qzJiCs7czg/KpfDHHOaIL DLIxfx4ebJVlcgLLxL1tpKEvBWyvuTXiGUxYU8naMVQNB/s1g9CE7OCbN2gqoXxfIa/C L83iyxHqtDqVG6q4LHbis0RRGJ9ZK61qsWL6EiXNr6A3BFgTx891kAHHcRXCb/0s4Dry kRcg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=GwtNJliu; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id 4si7076456otu.74.2020.03.30.16.22.11; Mon, 30 Mar 2020 16:22:24 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=GwtNJliu; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1729422AbgC3XVP (ORCPT + 99 others); Mon, 30 Mar 2020 19:21:15 -0400 Received: from mail.kernel.org ([198.145.29.99]:35582 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728991AbgC3XVP (ORCPT ); Mon, 30 Mar 2020 19:21:15 -0400 Received: from paulmck-ThinkPad-P72.home (50-39-105-78.bvtn.or.frontiernet.net [50.39.105.78]) (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 F032020675; Mon, 30 Mar 2020 23:21:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1585610475; bh=3yuZSaQ36wyLBlKdpsQHW3thBDOr3nwmhonGyIIq6BQ=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=GwtNJliugD8mSTia+pLAwHnYuw88NISnmBDSifRCYu8M8RxiQb73Rzdx2oXlg0lzF UsUIushsMgvd5Z83F9KrAsb4kNex+24c7eBETE39ZiNuNB78geEQ6t31td7mmgg5oC tuAlci+SA49SUzt802ziva3EY7/q2NZZaR6bgx3o= Received: by paulmck-ThinkPad-P72.home (Postfix, from userid 1000) id CAF893523140; Mon, 30 Mar 2020 16:21:14 -0700 (PDT) Date: Mon, 30 Mar 2020 16:21:14 -0700 From: "Paul E. McKenney" To: Will Deacon Cc: linux-kernel@vger.kernel.org, Eric Dumazet , Jann Horn , Kees Cook , Maddie Stone , Marco Elver , Peter Zijlstra , Thomas Gleixner , kernel-team@android.com, kernel-hardening@lists.openwall.com Subject: Re: [RFC PATCH 06/21] list: Remove superfluous WRITE_ONCE() from hlist_nulls implementation Message-ID: <20200330232114.GC19865@paulmck-ThinkPad-P72> Reply-To: paulmck@kernel.org References: <20200324153643.15527-1-will@kernel.org> <20200324153643.15527-7-will@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200324153643.15527-7-will@kernel.org> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 24, 2020 at 03:36:28PM +0000, Will Deacon wrote: > Commit 860c8802ace1 ("rcu: Use WRITE_ONCE() for assignments to ->pprev > for hlist_nulls") added WRITE_ONCE() invocations to hlist_nulls_add_head() > and hlist_nulls_del(). > > Since these functions should not ordinarily run concurrently with other > list accessors, restore the plain C assignments so that KCSAN can yell > if a data race occurs. > > Cc: Eric Dumazet > Cc: Paul E. McKenney > Cc: Peter Zijlstra > Signed-off-by: Will Deacon And this means that the lockless uses of hlist_nulls_empty() need attention, correct? Thanx, Paul > --- > include/linux/list_nulls.h | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/include/linux/list_nulls.h b/include/linux/list_nulls.h > index fa51a801bf32..fd154ceb5b0d 100644 > --- a/include/linux/list_nulls.h > +++ b/include/linux/list_nulls.h > @@ -80,10 +80,10 @@ static inline void hlist_nulls_add_head(struct hlist_nulls_node *n, > struct hlist_nulls_node *first = h->first; > > n->next = first; > - WRITE_ONCE(n->pprev, &h->first); > + n->pprev = &h->first; > h->first = n; > if (!is_a_nulls(first)) > - WRITE_ONCE(first->pprev, &n->next); > + first->pprev = &n->next; > } > > static inline void __hlist_nulls_del(struct hlist_nulls_node *n) > @@ -99,7 +99,7 @@ static inline void __hlist_nulls_del(struct hlist_nulls_node *n) > static inline void hlist_nulls_del(struct hlist_nulls_node *n) > { > __hlist_nulls_del(n); > - WRITE_ONCE(n->pprev, LIST_POISON2); > + n->pprev = LIST_POISON2; > } > > /** > -- > 2.20.1 >