Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp3823808ybi; Mon, 3 Jun 2019 00:28:58 -0700 (PDT) X-Google-Smtp-Source: APXvYqy5CFD1rMX4f9r2N0JEpIRhnGGPWzeDAwTCzRjdoUDxI/GQeLI3Le9/WDIP1mQC+Lssfv4c X-Received: by 2002:a63:649:: with SMTP id 70mr2124125pgg.445.1559546938443; Mon, 03 Jun 2019 00:28:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559546938; cv=none; d=google.com; s=arc-20160816; b=047N6IzhjXOoA+LXTTvCmBHc1NEuxSPX4ThvnWUWkexNEyLd/7WARsBHSklaAGibgb cVIZk03sznjr6XyDfEDsBzX51soXUIZE1Lw5apQPDxJ5l4oYoYAcJw1IqedLxldTGMH0 4kGTEp3PtNy8xodIqt3cMW4wRbVj+1AGUml8byqLJVfKi/RV5oeNhRwCXO8+cJyxmw1f gM1bIaM7l/Qb9NKbkb6vabYxMCdHZjf+173ZolAubDt+J2i7F5pz1IkISKriVwuUIKzL YT4LCyUYm7heDLxEo1WZrLfvrM/McCRXP1PA6EyFrQuzSxW0YiaSiH6uCYJzCbF33Q94 J6MA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:user-agent:in-reply-to :content-disposition:mime-version:references:reply-to:subject:cc:to :from:date; bh=JcXpZcX5AcDp0R2QSItNlHVQfcDMgvsoKkt+brg8nXc=; b=XSmjBkFq485Jf8M8RCWmnNEaxxbiQNJD9wQbislO/FOALnqvLUIUL1wu2k8Bv/9bSa yu4Erud0njFF6xhq2EEBgfS81QftVeHzmIAgwTdzR3W161Z37sLDT+Kp3xRYXryuXefO qthuhs3T4giEoQRY3GpMo2EI9oUnOr6ig524/fQmrc9/6i/YvJZ8J8kB2xe3f+oYoUXS hKW0q8fIICB6n1S/zNOoRnUCD0lMIEjBtEn/luYPhiRaJ9BW9yHBh0yQiaH+1CAhdUdd qX4zwznYaARE9E0B3S7+I9QkFHkZf/MN7cvH2H/GJjOcJduMluqpwUzO1OwSkrRg9twB dGiA== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d191si17181770pga.454.2019.06.03.00.28.41; Mon, 03 Jun 2019 00:28:58 -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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726991AbfFCHXs (ORCPT + 99 others); Mon, 3 Jun 2019 03:23:48 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:35096 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726272AbfFCHXq (ORCPT ); Mon, 3 Jun 2019 03:23:46 -0400 Received: from pps.filterd (m0098414.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x537M9Gb010554 for ; Mon, 3 Jun 2019 03:23:44 -0400 Received: from e17.ny.us.ibm.com (e17.ny.us.ibm.com [129.33.205.207]) by mx0b-001b2d01.pphosted.com with ESMTP id 2svx2vtftd-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 03 Jun 2019 03:23:44 -0400 Received: from localhost by e17.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 3 Jun 2019 08:23:43 +0100 Received: from b01cxnp22036.gho.pok.ibm.com (9.57.198.26) by e17.ny.us.ibm.com (146.89.104.204) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Mon, 3 Jun 2019 08:23:41 +0100 Received: from b01ledav003.gho.pok.ibm.com (b01ledav003.gho.pok.ibm.com [9.57.199.108]) by b01cxnp22036.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x537NehR37224950 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 3 Jun 2019 07:23:40 GMT Received: from b01ledav003.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 21EF0B205F; Mon, 3 Jun 2019 07:23:40 +0000 (GMT) Received: from b01ledav003.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id E5748B2065; Mon, 3 Jun 2019 07:23:39 +0000 (GMT) Received: from paulmck-ThinkPad-W541 (unknown [9.80.211.40]) by b01ledav003.gho.pok.ibm.com (Postfix) with ESMTP; Mon, 3 Jun 2019 07:23:39 +0000 (GMT) Received: by paulmck-ThinkPad-W541 (Postfix, from userid 1000) id 35E7316C5D9E; Mon, 3 Jun 2019 00:23:39 -0700 (PDT) Date: Mon, 3 Jun 2019 00:23:39 -0700 From: "Paul E. McKenney" To: Herbert Xu Cc: Linus Torvalds , Frederic Weisbecker , Boqun Feng , Fengguang Wu , LKP , LKML , Netdev , "David S. Miller" Subject: Re: rcu_read_lock lost its compiler barrier Reply-To: paulmck@linux.ibm.com References: <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> <20190602055607.bk5vgmwjvvt4wejd@gondor.apana.org.au> <20190603024640.2soysu4rpkwjuash@gondor.apana.org.au> <20190603034707.GG28207@linux.ibm.com> <20190603040114.st646bujtgyu7adn@gondor.apana.org.au> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190603040114.st646bujtgyu7adn@gondor.apana.org.au> User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-GCONF: 00 x-cbid: 19060307-0040-0000-0000-000004F7DBD9 X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00011207; HX=3.00000242; KW=3.00000007; PH=3.00000004; SC=3.00000286; SDB=6.01212527; UDB=6.00637217; IPR=6.00993587; MB=3.00027161; MTD=3.00000008; XFM=3.00000015; UTC=2019-06-03 07:23:43 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19060307-0041-0000-0000-00000903F8FC Message-Id: <20190603072339.GH28207@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2019-06-03_05:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=937 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1906030054 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 03, 2019 at 12:01:14PM +0800, Herbert Xu wrote: > On Sun, Jun 02, 2019 at 08:47:07PM -0700, Paul E. McKenney wrote: > > > > CPU2: if (b != 1) > > CPU2: b = 1; > > Stop right there. The kernel is full of code that assumes that > assignment to an int/long is atomic. If your compiler breaks this > assumption that we can kiss the kernel good-bye. Here you go: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=55981 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=56028 TL;DR: On x86, of you are doing a plain store of a 32-bit constant that has bits set only in the lower few bits of each 16-bit half of that constant, the compiler is plenty happy to use a pair of 16-bit store-immediate instructions to carry out that store. This is also known as "store tearing". The two bugs were filed (and after some back and forth, fixed) because someone forgot to exclude C11 atomics and volatile accesses from this store tearing. Thanx, Paul