Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp327735yba; Wed, 24 Apr 2019 01:46:18 -0700 (PDT) X-Google-Smtp-Source: APXvYqzYJIpfuCa2cUxthiOzYsoxqhgCwQHTt6UxyGAEysc3plcj64sRZ111Y1UL0mrlgUZNL/9g X-Received: by 2002:a65:6489:: with SMTP id e9mr28836914pgv.364.1556095578866; Wed, 24 Apr 2019 01:46:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1556095578; cv=none; d=google.com; s=arc-20160816; b=0ke/4BgQVB0l77wxNyxEQ/3C/Cw8ddW3hP2aTUXKk8GyeeOKky8oYq9TYUCEt8yvII U+jUSDQQmmUlghJhIbNyI1Vak+euLYxEiVfLxD+wJqqaMko3cAnIEdH7bGGrS+96S6n2 iu9DKDv1DU3JsPbW817jAaX49zmOICsqj6znNLA9aPBK83yvHog5wQRQwL+Fuy9gn7LC 77uUKu9HJ1dkM90HH0ObMp9LZLjhRLyXS30SmAYxC2DMMsYc52Dr0JUGc5TzpeVpvN5s uO3ggn/Q5b9km71i86GTat53xQIe8/QWK80p+sTnMuk0Zexb0Ix9vlH0C/CHS4wpI9UJ fRWA== 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=KNLwmOQKFJyn50Vn9lGxwitkF38o6fhwSXB2kO96yfY=; b=g3VC8yFa3HlfWOwmUyXkO4BA4kMj5pKlKgC7t6PKJFpOhdQNrebpxwCj9CSb9+y3he YMAh3gSwBRpl+hGQN3l5w6hSG8OEO+ojmIA2JfRzC/DIZfUaK3ceFfN0aQ2Ewp53joSs XhGWtknQRKzl6rIxKnj6S53zbAWcPWwPhhydqFH/sRm6v7bG5HJpLRF9gEy6AXffZPdB qJEdMZ+m0a3W/bIPyfeOSjPz+mwEnW2CqxWC0klZ0SNmzKLGurEXX1BxebVgf8tPbcd1 g8J4jOccyct/3G3DxoOWAj2GvElEe0jiTU7KbUMi9Hu+Mlq7bBKXC+o7AIgfSgwB0VV1 Z0xQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=ynQJ08oE; 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 a15si17335967pgd.166.2019.04.24.01.46.03; Wed, 24 Apr 2019 01:46:18 -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=ynQJ08oE; 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 S1728793AbfDXIpC (ORCPT + 99 others); Wed, 24 Apr 2019 04:45:02 -0400 Received: from merlin.infradead.org ([205.233.59.134]:59856 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726878AbfDXIpC (ORCPT ); Wed, 24 Apr 2019 04:45:02 -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=KNLwmOQKFJyn50Vn9lGxwitkF38o6fhwSXB2kO96yfY=; b=ynQJ08oEAsTTkY5QImOENcAo/ el+7t7D2yqBg5FfgiZMjyWo01DPAGp29JcJCZCedbSri3T9g6me0kDaNY/C+zZctc32wVQyLbk7K8 98ScqbrgiMG+Uf0x6bPZHuvU8MQmq3QTTah1mGG2az1TiRO2PuttW5xhNUYE0NHe0frW9VnFm6vSf sMuWHg4XXDSNykn70lSEHPUppsAcOvrcWNjMdoLbT/lryqoCpzLy2cXyMKOLEfRweGGFeD6co4GYG UGa8BCtTy5asJnF2gBaWvXoaF+fXfx7/pnXlJhjq+I1JW2KmdwkPSlKwMapyf0cku665tDPAyeemN NGVjgeP8g==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1hJDWA-0001Lt-0t; Wed, 24 Apr 2019 08:44:38 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 5C76929BBFB9A; Wed, 24 Apr 2019 10:44:34 +0200 (CEST) Date: Wed, 24 Apr 2019 10:44:34 +0200 From: Peter Zijlstra To: "Paul E. McKenney" Cc: Nicholas Piggin , LKMM Maintainers -- Akira Yokosawa , Andrea Parri , Boqun Feng , David Howells , Daniel Lustig , Jade Alglave , Kernel development list , Luc Maranget , Alan Stern , Will Deacon Subject: Re: [PATCH] Documentation: atomic_t.txt: Explain ordering provided by smp_mb__{before,after}_atomic() Message-ID: <20190424084434.GM12232@hirez.programming.kicks-ass.net> References: <20190419180017.GP4038@hirez.programming.kicks-ass.net> <20190419182620.GF14111@linux.ibm.com> <1555719429.t9n8gkf70y.astroid@bobo.none> <20190420085440.GK14111@linux.ibm.com> <20190423121715.GQ4038@hirez.programming.kicks-ass.net> <20190423132116.GJ3923@linux.ibm.com> <20190423132620.GU4038@hirez.programming.kicks-ass.net> <20190423201637.GW3923@linux.ibm.com> <20190423202831.GA4038@hirez.programming.kicks-ass.net> <20190424082948.GG3923@linux.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190424082948.GG3923@linux.ibm.com> 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 Wed, Apr 24, 2019 at 01:29:48AM -0700, Paul E. McKenney wrote: > On Tue, Apr 23, 2019 at 10:28:31PM +0200, Peter Zijlstra wrote: > > On Tue, Apr 23, 2019 at 01:16:37PM -0700, Paul E. McKenney wrote: > > > > > Agreed, but I thought that one of the ideas going forward was to get > > > rid of smp_mb__{before,after}_atomic(). > > > > It's not one I had considered.. I just wanted to get rid of this > > 'surprise' behaviour. > > Ah, good point, your patch is in fact a midpoint between those two > positions. Just to make sure I understand: > > 1. Without your patch, smp_mb__{before,after}_atomic() orders > only against the atomic itself. Right, and that was not intentional. > 2. With your patch, smp_mb__{before,after}_atomic() orders against > the atomic itself and the accesses on the other side of that > atomic. However, it does not order the atomic against the > accesses on the other side of that atomic. Right. I'll go make a more complete patch, covering all the architectures. > Putting things between the smp_mb__{before,after}_atomic() > and the atomic is in my opinion a bad idea, but in this case > they are not necessarily ordered. Agreed, that is an unsupported idiom and it would be good to have something check for this. > 3. Dispensing with smp_mb__{before,after}_atomic() would have > void RMW atomics fully ordered, but I suspect that it results > in ugly performance regressions. > > Or am I still missing something? I think we're good :-)