Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp2697740ybi; Sat, 1 Jun 2019 22:58:44 -0700 (PDT) X-Google-Smtp-Source: APXvYqx6QOyO7TJ0lw5WKcB3fib8BXKmfYGf880e3EVdAA6yKBI8AUqWpzMplE48sg8YVawbqMDs X-Received: by 2002:a63:9dcc:: with SMTP id i195mr6872940pgd.183.1559455124152; Sat, 01 Jun 2019 22:58:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559455124; cv=none; d=google.com; s=arc-20160816; b=GuPYEMOJ3EcHGR+tS4eyx4E26BxVsFvxdk49jz/Avp/MRNR1KBC5sIMvY22NsBGYPu Qfl5Po9mmuSwZYrzXDWMHEQCoSKbHLeDWa5ZTKfuNLxiy1Joz9bXYZwGVy1o+D+cl+fY 44/WRNDeyNcKTZfn4Dbt9Dvyz2CTr0oRmtNwR7SJ3NP5Vr5PlpVSf21vFZJKnLeleBgU DDX+44lbDFjGp+pt3B9q1hSAvROlbU4Dq/pZ1EUiuFS6jttHEM6kqLuvN8cfPWK7aQNv OybV4uWxeEh/uKRGkPa+6TUdbplkra2Oiq1nx84akIo/+Rvn0hcizrg2xlmA3/9Xeg1z BQ9A== 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:message-id:subject:cc :to:from:date; bh=cCY1jwyKjRGGeyCYUxAThqSS3rpFJem3CSH5hYdJISw=; b=QSGzLnu6P2WUFanX/JV1BZwB4UEYAzafP/08U8sI661g0cDdYcwj1yvbToWh5bD96W M62vSC8PCiPvqgpKzX7+NkLimLa0veG1ls8rn2koJLA37TxjldMqoYrIMAtBemZOsuse YL56ZwN2PSOdtmgZNZ+4yZD539lUDMVDdlYV8lJnxEyoeSeuNW0q+aNZLTgXbP36NtS3 E8HujqrJBAH9nKYHUQ1F8B4TJJLpvttVZqKmIr6w90esct7LujdsZBRkWOt2csj+M9pM Q3J/iIK5zNEV3KApBJ/KrDp5sg69cJDVj/B6SjV4WpStSx8sHLSSuA3amZk/WTneA2mv JTBQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g9si13671087pgq.563.2019.06.01.22.58.16; Sat, 01 Jun 2019 22:58:44 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726124AbfFBF41 (ORCPT + 99 others); Sun, 2 Jun 2019 01:56:27 -0400 Received: from helcar.hmeau.com ([216.24.177.18]:35354 "EHLO deadmen.hmeau.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725875AbfFBF41 (ORCPT ); Sun, 2 Jun 2019 01:56:27 -0400 Received: from gondobar.mordor.me.apana.org.au ([192.168.128.4] helo=gondobar) by deadmen.hmeau.com with esmtps (Exim 4.89 #2 (Debian)) id 1hXJTf-0004RN-KW; Sun, 02 Jun 2019 13:56:19 +0800 Received: from herbert by gondobar with local (Exim 4.89) (envelope-from ) id 1hXJTT-00010X-DZ; Sun, 02 Jun 2019 13:56:07 +0800 Date: Sun, 2 Jun 2019 13:56:07 +0800 From: Herbert Xu To: "Paul E. McKenney" Cc: Frederic Weisbecker , Boqun Feng , Fengguang Wu , LKP , LKML , netdev@vger.kernel.org, "David S. Miller" , Linus Torvalds Subject: rcu_read_lock lost its compiler barrier Message-ID: <20190602055607.bk5vgmwjvvt4wejd@gondor.apana.org.au> References: <20150910005708.GA23369@wfg-t540p.sh.intel.com> <20150910102513.GA1677@fixme-laptop.cn.ibm.com> <20150910171649.GE4029@linux.vnet.ibm.com> <20150911021933.GA1521@fixme-laptop.cn.ibm.com> <20150921193045.GA13674@lerouge> <20150921204327.GH4029@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150921204327.GH4029@linux.vnet.ibm.com> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Digging up an old email because I was not aware of this previously but Paul pointed me to it during another discussion. On Mon, Sep 21, 2015 at 01:43:27PM -0700, Paul E. McKenney wrote: > On Mon, Sep 21, 2015 at 09:30:49PM +0200, Frederic Weisbecker wrote: > > > > diff --git a/include/linux/rcupdate.h b/include/linux/rcupdate.h > > > index d63bb77..6c3cece 100644 > > > --- a/include/linux/rcupdate.h > > > +++ b/include/linux/rcupdate.h > > > @@ -297,12 +297,14 @@ void synchronize_rcu(void); > > > > > > static inline void __rcu_read_lock(void) > > > { > > > - preempt_disable(); > > > + if (IS_ENABLED(CONFIG_PREEMPT_COUNT)) > > > + preempt_disable(); > > > > preempt_disable() is a no-op when !CONFIG_PREEMPT_COUNT, right? > > Or rather it's a barrier(), which is anyway implied by rcu_read_lock(). > > > > So perhaps we can get rid of the IS_ENABLED() check? > > Actually, barrier() is not intended to be implied by rcu_read_lock(). > In a non-preemptible RCU implementation, it doesn't help anything > to have the compiler flush its temporaries upon rcu_read_lock() > and rcu_read_unlock(). This is seriously broken. RCU has been around for years and is used throughout the kernel while the compiler barrier existed. You can't then go and decide to remove the compiler barrier! To do that you'd need to audit every single use of rcu_read_lock in the kernel to ensure that they're not depending on the compiler barrier. This is also contrary to the definition of almost every other *_lock primitive in the kernel where the compiler barrier is included. So please revert this patch. Thanks, -- Email: Herbert Xu Home Page: http://gondor.apana.org.au/~herbert/ PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt