Received: by 2002:a05:7412:d1aa:b0:fc:a2b0:25d7 with SMTP id ba42csp1149099rdb; Tue, 30 Jan 2024 09:13:00 -0800 (PST) X-Google-Smtp-Source: AGHT+IEr7qsfsRQWCdzVRAwgd+99aoYZAGbEn62ToHt2vnGe9uZVd+TYiVTIOPHC0gGoq1ovLWwD X-Received: by 2002:a05:6a20:12d4:b0:19c:9105:967b with SMTP id v20-20020a056a2012d400b0019c9105967bmr8665970pzg.32.1706634780078; Tue, 30 Jan 2024 09:13:00 -0800 (PST) Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id m16-20020a6562d0000000b005d8b5aace84si6135122pgv.259.2024.01.30.09.12.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 30 Jan 2024 09:13:00 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-45022-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; arc=fail (signature failed); spf=pass (google.com: domain of linux-kernel+bounces-45022-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-45022-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 74B73285E11 for ; Tue, 30 Jan 2024 17:12:54 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 164721292DB; Tue, 30 Jan 2024 17:12:43 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AADC112BF03; Tue, 30 Jan 2024 17:12:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706634762; cv=none; b=fo8y6E9I0TJRUW6MSpSAyT1M8ltPAte01pakAIy1LwQwI4iX8D1XdPhk9nyeT9h8tCqzTR/nWLihQDZL34f38YHZez9amuBKC61GSf8D6X9IwF6TOO/PDEiN7IL5wxoUxw4nrZIkzCemG6WPTBFEnbZaxITMuzcw2PEZCVYbaTg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706634762; c=relaxed/simple; bh=HXl1FyBzCOPH2WUgPaTFyW6YIyaZ0FyPabts9TuNKKE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=hMJ1QhzC484uYTHPLMS64BnJNc5nZ3F1iCJvPCW3ZMOc5SwISEGk/Klz1CRGezwvKEr0DCXczl77z7/9WkegREEaqBseQDXpJcUvjoyj44kSFsVbtBylSZtPDEehNBqtXXKt+JRZhHnYHoqI5uS3T3ZFSt7xAPcPNvKFQTnA6Vg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 9AB14DA7; Tue, 30 Jan 2024 09:13:20 -0800 (PST) Received: from FVFF77S0Q05N (unknown [10.57.45.140]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id F3BA03F5A1; Tue, 30 Jan 2024 09:12:30 -0800 (PST) Date: Tue, 30 Jan 2024 17:12:23 +0000 From: Mark Rutland To: "Paul E. McKenney" Cc: linux-kernel@vger.kernel.org, "E."@paulmck-thinkpad-p17-gen-1.smtp.subspace.kernel.org, Alan Stern , Andrea Parri , Will Deacon , Peter Zijlstra , Boqun Feng , Nicholas Piggin , David Howells , Jade Alglave , Luc Maranget , Paul@paulmck-thinkpad-p17-gen-1.smtp.subspace.kernel.org, Akira Yokosawa , Daniel Lustig , Joel Fernandes , Jonathan Corbet , linux-arch@vger.kernel.org, linux-doc@vger.kernel.org, Anna-Maria Behnsen Subject: Re: [PATCH doc] Emphasize that failed atomic operations give no ordering Message-ID: References: <63d9d6f6-05e8-473d-9d09-ce8d3a33ca39@paulmck-laptop> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <63d9d6f6-05e8-473d-9d09-ce8d3a33ca39@paulmck-laptop> On Tue, Jan 30, 2024 at 06:53:38AM -0800, Paul E. McKenney wrote: > The ORDERING section of Documentation/atomic_t.txt can easily be read as > saying that conditional atomic RMW operations that fail are ordered when > those operations have the _acquire() or _release() prefixes. This is > not the case, therefore update this section to make it clear that failed > conditional atomic RMW operations provide no ordering. > > Reported-by: Anna-Maria Behnsen > Signed-off-by: Paul E. McKenney > Cc: Alan Stern > Cc: Andrea Parri > Cc: Will Deacon > Cc: Peter Zijlstra > Cc: Boqun Feng > Cc: Nicholas Piggin > Cc: David Howells > Cc: Jade Alglave > Cc: Luc Maranget > Cc: "Paul E. McKenney" > Cc: Akira Yokosawa > Cc: Daniel Lustig > Cc: Joel Fernandes > Cc: Mark Rutland > Cc: Jonathan Corbet > Cc: > Cc: > > diff --git a/Documentation/atomic_t.txt b/Documentation/atomic_t.txt > index d7adc6d543db4..bee3b1bca9a7b 100644 > --- a/Documentation/atomic_t.txt > +++ b/Documentation/atomic_t.txt > @@ -171,14 +171,14 @@ The rule of thumb: > - RMW operations that are conditional are unordered on FAILURE, > otherwise the above rules apply. > > -Except of course when an operation has an explicit ordering like: > +Except of course when a successful operation has an explicit ordering like: > > {}_relaxed: unordered > {}_acquire: the R of the RMW (or atomic_read) is an ACQUIRE > {}_release: the W of the RMW (or atomic_set) is a RELEASE > > Where 'unordered' is against other memory locations. Address dependencies are > -not defeated. > +not defeated. Conditional operations are still unordered on FAILURE. > > Fully ordered primitives are ordered against everything prior and everything > subsequent. Therefore a fully ordered primitive is like having an smp_mb() > FWIW: Acked-by: Mark Rutland Mark.