Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp2120560yba; Fri, 19 Apr 2019 12:32:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqyjmyHKmk/TvThX6jniCqcS4vdu8ifLSvh5guKylD5rZxagEqdet5T1i8Fh9HP/SVhZkiU1 X-Received: by 2002:a63:2158:: with SMTP id s24mr5447895pgm.156.1555702331006; Fri, 19 Apr 2019 12:32:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555702330; cv=none; d=google.com; s=arc-20160816; b=H8l1SKMNEq6T01h+biA3wcotxJ9zcZ/iSS7IK2uwJXiyOQdGSTRVdH1Yjnn0MXy6IK vBprobSPfiGa3PS7ckqXs8SZZnTsAu9RRfDYquLN8BYRSKOdoww2DC11JlDzcbGH5zFY Q0bUQcwWTDFInprCwErkkPOOxEzms/VW3HufNqoiXAxBqKszagwiGCB+0UNRRPNnSWEN F0D84W0+o045j41bnt6KRHDNSYYvJZTqL2H+Jzf0L5rkWmzzTmdZyZJws396RsXQdcut G/QGHrfaRh4/5j8OszKBfB8LO6Spb4WcI0vuNJGCG0SL/mmcz/z5qtjMkfFgVGk+KX4N CtQQ== 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=6VWnVgCweh/i9J13ePCp1WXpskD7OICjHvPqGHw06p0=; b=Rn2X1X62NknRIM9nedZ6coAawg5Y1kbCEG/55axzMrTOkO6rFwN0C1jEidLBHF4QRX vXLsvyPDfGN0Iw/4TRWwaLpcDEez/O4NDk6kdFvzmg3zVDabSO1cJj55qaWk5tjuTR2C UWqLfyBNiwKzCKsX0MDPE93/W8A9TvpzOl1hPn6RLquTwguZjsrzqWa1JBa3o0RoUAgu jo3EooC1TOVX8Lh1FfhDeYhT/gBRvelPzDCQnPGvFM6llzq3BaE+FpqbVjsI/vdbRDoW goaJNUIw/NEgZruFZKUDCu1u/Weo7t0fC4goANl/PTGQSLpQENBLKtsJv26he94CJpUz 59iA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b="1ZDK/4JL"; 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 m17si6485304pff.130.2019.04.19.12.31.56; Fri, 19 Apr 2019 12:32:10 -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="1ZDK/4JL"; 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 S1728001AbfDSTa5 (ORCPT + 99 others); Fri, 19 Apr 2019 15:30:57 -0400 Received: from merlin.infradead.org ([205.233.59.134]:52654 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727220AbfDSTa5 (ORCPT ); Fri, 19 Apr 2019 15:30:57 -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=6VWnVgCweh/i9J13ePCp1WXpskD7OICjHvPqGHw06p0=; b=1ZDK/4JL4PFJ7ECgMePxOadtU 3iO1VjKc1QJ3XtMihHAFP6phDWMBwxN2J5Sn5JdX/KgZ4WEDpsNuEJjjq2r0oJy7jqe3+Q56+a5S0 7VzTe4BOcHBHK7sGxPTNgcztZxz4N9Ms+Bqvfxq/hV7qa22+Yh73orjOn7ThwetWkTCH7n21uQzYS 4/uhUJ/uFnFz1+UV5t2LkbNoJ1SRnYDleHcjvFG2jhVaEFxSuBP1iBfZB9B/D1hipJGw7TG23SJyD r8pIBywdaBJutJtSUtY3VQa+8c8uwzADZFTVDT7YvUXL8KN9Mv9T4fzdlNcRkNKxcolj+01tETHcG i0ub7QG5Q==; 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 1hHXoC-0006kP-UV; Fri, 19 Apr 2019 18:00:21 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id D55C229BF0C04; Fri, 19 Apr 2019 20:00:17 +0200 (CEST) Date: Fri, 19 Apr 2019 20:00:17 +0200 From: Peter Zijlstra To: Alan Stern Cc: LKMM Maintainers -- Akira Yokosawa , Andrea Parri , Boqun Feng , Daniel Lustig , David Howells , Jade Alglave , Luc Maranget , Nicholas Piggin , "Paul E. McKenney" , Will Deacon , Kernel development list Subject: Re: [PATCH] Documentation: atomic_t.txt: Explain ordering provided by smp_mb__{before,after}_atomic() Message-ID: <20190419180017.GP4038@hirez.programming.kicks-ass.net> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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 Fri, Apr 19, 2019 at 01:21:45PM -0400, Alan Stern wrote: > Index: usb-devel/Documentation/atomic_t.txt > =================================================================== > --- usb-devel.orig/Documentation/atomic_t.txt > +++ usb-devel/Documentation/atomic_t.txt > @@ -171,7 +171,10 @@ The barriers: > smp_mb__{before,after}_atomic() > > only apply to the RMW ops and can be used to augment/upgrade the ordering > -inherent to the used atomic op. These barriers provide a full smp_mb(). > +inherent to the used atomic op. Unlike normal smp_mb() barriers, they order > +only the RMW op itself against the instructions preceding the > +smp_mb__before_atomic() or following the smp_mb__after_atomic(); they do > +not order instructions on the other side of the RMW op at all. Now it is I who is confused; what? x = 1; smp_mb__before_atomic(); atomic_add(1, &a); y = 1; the stores to both x and y will be ordered as if an smp_mb() where there. There is no order between a and y otoh.