Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp1775991ybl; Sat, 31 Aug 2019 02:02:26 -0700 (PDT) X-Google-Smtp-Source: APXvYqw8aKBIuIUvQUnaBmFjeG86s+AO9hE3cgaLurl8rF2YMvJnkylcLgnWUI8cjRMIduITJxEX X-Received: by 2002:a17:90a:f83:: with SMTP id 3mr2890087pjz.90.1567242146421; Sat, 31 Aug 2019 02:02:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1567242146; cv=none; d=google.com; s=arc-20160816; b=TSwmn45jdPso3zVZfNRYxBvaH2oJw/WOrFh3gY6XUmzIzLk9l3Te8HfKpiuvANf3XX lcCwyr3/Abel4b37fH7Wm5Bb+XIz/ETL/fmCQrX6ecaHDJ5m5CXQSC8f/AVK16FrlA+F RfmcRyhT/FXHHPWSQ2vdF/xBy6IBB5lwYXKG5seImH7pxD6Bl9ILvBX/3s7MnjaTSxgo BJn4lWRReu3S+w2sozZHcZTTJUPLenrP4REMWHz8qGunEc8UvP3AFlnjWWMV70mhuGSU 39ejb4kkii8ysh/qybipRbm15dPOFrIa+8kzxT288vhwTikSgTStyIr1Sl58vEHsXAPA F3kg== 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:dkim-signature; bh=xewVdUf11AxABQouRLx2CEX2BTZyyYycBHtYuCXEbi0=; b=GeKA1MyhXbhKzM1K3YK/fE5S2mkdkhU+ypklEVLiGnlwk5XlrcJUJsZVbmhShE4Ofk wPO8XQmvqLFrlRKW05c5UJLjys3onQF4UQV7sn83B2TW4+pEKsGtFOF055CgeqgauTDe Bm1UDxAzY6oL4QwZ2kL9eu+XG5LfbTCyEApSaFIxHVAU5d3IYk7651E9Vmdv7kVksq+X X/wZmWvS8bgKBPonjOtAGkm7AWDtxFCQiQZQLv3htItCENwAwhc1cQ2+8CWW1+/Zj3k+ L9A+sQo+HkTTUsZVcyfVyUiZvjfIc45izGS74ZZSq8laV5bD7ZjK1HlvptNn+vcuKg/0 Y6kg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=Uu5mdBXk; 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 60si6730218plb.16.2019.08.31.02.02.10; Sat, 31 Aug 2019 02:02:26 -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=fail header.i=@infradead.org header.s=merlin.20170209 header.b=Uu5mdBXk; 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 S1726679AbfHaJBW (ORCPT + 99 others); Sat, 31 Aug 2019 05:01:22 -0400 Received: from merlin.infradead.org ([205.233.59.134]:36954 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726029AbfHaJBV (ORCPT ); Sat, 31 Aug 2019 05:01:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=xewVdUf11AxABQouRLx2CEX2BTZyyYycBHtYuCXEbi0=; b=Uu5mdBXkqKUK/Ypcu6rC0Qk+u byBFetK6ZHj2DMTkbYDtyid4TNew0hBVlqJ6re++7zza3ijqLPq3YUur3QpLsbZ7t4VlTqfIjRFYX ttY33DLlPd//YziDDT2S/2cPbYAE1jYRdEVGiVraLR2ljyvhSZ8Zzdsw/rgg0DXSuHm2aZPirlZNi OoRtHP+6HSqGHx4BjWDXbi3fMKkgX991I3//IRvjj2C1p/yg32s0eK25AK27XpKT1pPAkSd64eA3E gRHmAsjAoDdzUXFENvTTwv9M2BV8OOKwAXNo0YZ+kZ1CJkffHvnRVUb0Rqm7IugLIQ8dsOZEKRe/A FPgvHEwlA==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=noisy.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.92 #3 (Red Hat Linux)) id 1i3zFk-0007T8-3v; Sat, 31 Aug 2019 09:01:00 +0000 Received: from hirez.programming.kicks-ass.net (hirez.programming.kicks-ass.net [192.168.1.225]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by noisy.programming.kicks-ass.net (Postfix) with ESMTPS id 1AF71301747; Sat, 31 Aug 2019 11:00:21 +0200 (CEST) Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 017BD29B2CD09; Sat, 31 Aug 2019 11:00:55 +0200 (CEST) Date: Sat, 31 Aug 2019 11:00:55 +0200 From: Peter Zijlstra To: stern@rowland.harvard.edu, akiyks@gmail.com, andrea.parri@amarulasolutions.com, boqun.feng@gmail.com, dlustig@nvidia.com, dhowells@redhat.com, j.alglave@ucl.ac.uk, luc.maranget@inria.fr, npiggin@gmail.com, paulmck@linux.ibm.com, will.deacon@arm.com, paul.burton@mips.com Cc: linux-kernel@vger.kernel.org, torvalds@linux-foundation.org Subject: Re: [PATCH v2 0/4] atomic: Fixes to smp_mb__{before,after}_atomic() and mips. Message-ID: <20190831090055.GH2369@hirez.programming.kicks-ass.net> References: <20190613134317.734881240@infradead.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190613134317.734881240@infradead.org> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 13, 2019 at 03:43:17PM +0200, Peter Zijlstra wrote: > Hi, > > This all started when Andrea Parri found a 'surprising' behaviour for x86: > > http://lkml.kernel.org/r/20190418125412.GA10817@andrea > > Basically we fail for: > > *x = 1; > atomic_inc(u); > smp_mb__after_atomic(); > r0 = *y; > > Because, while the atomic_inc() implies memory order, it > (surprisingly) does not provide a compiler barrier. This then allows > the compiler to re-order like so: > > atomic_inc(u); > *x = 1; > smp_mb__after_atomic(); > r0 = *y; > > Which the CPU is then allowed to re-order (under TSO rules) like: > > atomic_inc(u); > r0 = *y; > *x = 1; > > And this very much was not intended. > > This had me audit all the (strong) architectures that had weak > smp_mb__{before,after}_atomic: ia64, mips, sparc, s390, x86, xtensa. > > Of those, only x86 and mips were affected. Looking at MIPS to solve this, led > to the other MIPS patches. > > All these patches have been through 0day for quite a while. > > Paul, how do you want to route the MIPS bits? Paul; afaict the MIPS patches still apply (ie. they've not made their way into Linus' tree yet). I thought you were going to take them?