Received: by 2002:a89:288:0:b0:1f7:eeee:6653 with SMTP id j8csp385551lqh; Tue, 7 May 2024 02:04:05 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVGF0db/hI2McudstrBs7Mog1UP7Cghdn48ycKzIbrL3iESjNmlBt1bN3u/VSNxP8fag5lio5jW9JBrWTs5dhAxZtPLCjc3yymRgQi7vA== X-Google-Smtp-Source: AGHT+IH0SF4rz7aXJ3A2NMYnInIN/ROhPJIjCjbvNFMkoxKoURnZ1r5sUhM0ZXY+GmY8owF0Z3DP X-Received: by 2002:a50:ccd7:0:b0:570:388:ee0b with SMTP id b23-20020a50ccd7000000b005700388ee0bmr7312306edj.42.1715072645046; Tue, 07 May 2024 02:04:05 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715072645; cv=pass; d=google.com; s=arc-20160816; b=c+H/AaPqzy9Q4nouCQn7aCjV5m8RzS4cfbzJKLk7qWGE207LdiN0YefmmFXM7RQDYP BEWdIBTD6qCWFIkMFMYcrVLkbJCvbBW4MgFHOrwKy5HZQ68I/f7KXTvyOVHUcXDwq55c E2fADsAmSd8cKacsLO1pgcoLtpbIyEvOEPanQ4LCYo0b7VeK6grDyu4i4iabhLYbFoRq AlsiYYZRWUPT7aQ7pcRJCt2+Vw+/bltfwitDAORYKMRFuskd0J0vUT9R34RK25PQOMwq Kpe/lWAXOhDhVjWXq06/Zsc4Ch8Yt7cZ7DsRL2j5dNq2TYxfqn5F0UhXmoYNHtwYbbYb 8H1Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:references:cc:to:subject:from :user-agent:mime-version:list-unsubscribe:list-subscribe:list-id :precedence:date:message-id; bh=zt2+mZD/Ee9tNa2vHaxqWzGvvzmhQiY9eHtGB9ngIxM=; fh=Hm8HxErV2dvkphP5/8LuCxB2kHVzwFNp0yO5HjLdyZk=; b=gLICRNrIM+dvRsSvFX/fRCXN8ZRrbZVJxZAf/NXhWRH33UJD7Y+kWtz/ZGgfzdmjFK g19hdxlaiRr6HQLS7V258ev0ZlJsVuyzA4ePPMFiOEAjz0kRbeDMEU3sOzFtQeaHRVdj pHHNsWnMAaUlYYFqgGUdtn7dXapiTiDDJFrTdpo44kldTZQGwNSjB+7fKga6YuPsUgK/ vdhJPMq+U0+jyGRpvj3kjs3X2VPjS21dnjlbY+3xsaprpkNt/JrYZFCgbbAEm0u5BQsz EwAMy7+L2ltVg31YBwT+CzOzWhFiuUGYDLlz853mK8vHL7sVEhCMjPH8Ivci400T+AqA RQrQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=huaweicloud.com); spf=pass (google.com: domain of linux-kernel+bounces-170910-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-170910-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id g24-20020a50d5d8000000b00571d8dfdb52si5227228edj.83.2024.05.07.02.04.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 May 2024 02:04:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-170910-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huaweicloud.com); spf=pass (google.com: domain of linux-kernel+bounces-170910-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-170910-linux.lists.archive=gmail.com@vger.kernel.org" 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 am.mirrors.kernel.org (Postfix) with ESMTPS id C32D01F22330 for ; Tue, 7 May 2024 09:04:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 98CC414D6EE; Tue, 7 May 2024 09:03:56 +0000 (UTC) Received: from frasgout12.his.huawei.com (frasgout12.his.huawei.com [14.137.139.154]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BE22714D447; Tue, 7 May 2024 09:03:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=14.137.139.154 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715072636; cv=none; b=kRnO+236K0MjvXPimNqhJ16a1eIaqGsR5gW513235PxZu1TWny8JJUxAduXJ7ZrFEnTdbvMJjWH9ofYABKd/V2ZH4SYEkXOWeYAKaTwk934jPqKzupKoeiCIuM4StoKH/rTHgbvO4bJbYumNBdolCLD3KJZuMnSZxKoA/4v51H4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715072636; c=relaxed/simple; bh=2xnallKHSfS3jGvqNeNimXCB0bIdex0YoRsg8+jbQVg=; h=Message-ID:Date:MIME-Version:From:Subject:To:Cc:References: In-Reply-To:Content-Type; b=cymAvXR65S8Xmbi3rh0S/7vjvV4e/QxSc7/TNUlZEiQIbgOBVtH5BK02lICbKo5tQ99v3xvXA+TO4n0i1vkxCjkJhbNVxExN/zm8xiwvp2aNSOzphvHGTIYofuUV8/Mko1m1NKtvYOrRTjQKSZZrZ3Je98Z29R01EEFkgepj+UU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com; spf=pass smtp.mailfrom=huaweicloud.com; arc=none smtp.client-ip=14.137.139.154 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=huaweicloud.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huaweicloud.com Received: from mail.maildlp.com (unknown [172.18.186.29]) by frasgout12.his.huawei.com (SkyGuard) with ESMTP id 4VYWx16Pqrz9xFmK; Tue, 7 May 2024 16:42:13 +0800 (CST) Received: from mail02.huawei.com (unknown [7.182.16.27]) by mail.maildlp.com (Postfix) with ESMTP id A417E14010C; Tue, 7 May 2024 17:03:44 +0800 (CST) Received: from [10.45.158.162] (unknown [10.45.158.162]) by APP2 (Coremail) with SMTP id GxC2BwB3sSVh7jlm51OtBw--.22983S2; Tue, 07 May 2024 10:03:43 +0100 (CET) Message-ID: Date: Tue, 7 May 2024 11:03:27 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird From: Jonas Oberhauser Subject: Re: [PATCH memory-model 2/4] Documentation/litmus-tests: Demonstrate unordered failing cmpxchg To: Alan Stern , "Paul E. McKenney" Cc: linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, kernel-team@meta.com, mingo@kernel.org, parri.andrea@gmail.com, will@kernel.org, peterz@infradead.org, boqun.feng@gmail.com, npiggin@gmail.com, dhowells@redhat.com, j.alglave@ucl.ac.uk, luc.maranget@inria.fr, akiyks@gmail.com, Frederic Weisbecker , Daniel Lustig , Joel Fernandes , Mark Rutland , Jonathan Corbet , linux-doc@vger.kernel.org References: <42a43181-a431-44bd-8aff-6b305f8111ba@paulmck-laptop> <20240501232132.1785861-2-paulmck@kernel.org> <16381d02-cb70-4ae5-b24e-aa73afad9aed@huaweicloud.com> <2a695f63-6c9a-4837-ac03-f0a5c63daaaf@paulmck-laptop> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-CM-TRANSID:GxC2BwB3sSVh7jlm51OtBw--.22983S2 X-Coremail-Antispam: 1UD129KBjvJXoW7KryrCrW7tFy5Ww4DKw1rZwb_yoW8CrWfp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 2024 at 11:00:42AM -0700, Paul E. McKenney wrote: >> On Mon, May 06, 2024 at 06:30:45PM +0200, Jonas Oberhauser wrote: >>> Am 5/6/2024 um 12:05 PM schrieb Jonas Oberhauser: >>>> Am 5/2/2024 um 1:21 AM schrieb Paul E. McKenney: >>>>> This commit adds four litmus tests showing that a failing cmpxchg() >>>>> operation is unordered unless followed by an smp_mb__after_atomic() >>>>> operation. >>>> >>>> So far, my understanding was that all RMW operations without suffix >>>> (xchg(), cmpxchg(), ...) will be interpreted as F[Mb];...;F[Mb]. > > It's more accurate to say that RMW operations without a suffix that > return a value will be interpreted that way. So for example, > atomic_inc() doesn't imply any ordering, because it doesn't return a > value. > I see, thanks. >>>> barriers explicitlyinside the cat model, instead of relying on implicit >>>> conversions internal to herd. > > Don't the annotations in linux-kernel.def and linux-kernel.bell (like > "noreturn") already make this explicit? Not that I'm aware. All I can see there is that according to .bell RMW don't have an mb mode, but according to .def they do. How this mb disappears between parsing the code (.def) and interpreting it (.bell) is totally implicit. Including how noreturn affects this disappeareance. In fact most tool developers that support LKMM (Viktor, Hernan, and Luc) were at least once confused about it. And I think they read those files more carefully than I. https://github.com/herd/herdtools7/issues/384#issuecomment-1132859904 Note that while there's no explicit annotation of noreturn in the .def file, at least I can guess based on context that it should be annotated on all the functions that don't have _return and for which also a version with _return exists. have fun, jonas