Received: by 2002:a05:6500:1b8f:b0:1fa:5c73:8e2d with SMTP id df15csp666723lqb; Wed, 29 May 2024 07:15:55 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXXtPXSIM6AM9Zy0mcczvOoKYEvvKwj8QzrMs1copyLUr/aN3caihy+yP2qXiIrO6rqiMMOuFGLiYINIWCmiqjOODqZsjmggQVZ6xAHnA== X-Google-Smtp-Source: AGHT+IH+F6BbtUpOkV9fF10GFhMFvXzjBbPseZyIMtdb+RANYvo+d+kmFyCyTl8iNbalg9UbhL67 X-Received: by 2002:a05:6a00:35cb:b0:6f6:94e0:79ea with SMTP id d2e1a72fcca58-6f8f45e8e37mr18216812b3a.32.1716992155265; Wed, 29 May 2024 07:15:55 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716992155; cv=pass; d=google.com; s=arc-20160816; b=KZY21CCxDhaZsZp54I0Z+LevJMo9fxN2bUnnnIaNO2H1ZpYEb92o9BtpIaqSeSiSEW OUz+OH/On7B1/vGNbglSk5t+mnVv7efpPpOF2XtCJSVLL0zVvjk8BUn7hE69OHRKyezW hhCI+tmq8OCkTPsaKTlQxX8GXAoBg9qAYvnyUmXO8oU+rMWAfzdA0zwQR7VTpih5IC1O u8G1gjhq/d5gM3V/zjJKfu8mzHEPeToIClNnl5a4pSW7pM3r6+OQfxF/juyWRPdopclQ Bc1himU1f3DuVbdqRFoVRoS5tGa8UWU4x/II8n5RVzCIC0BOPHSalQ0iHRowqJ6dFd4l 9Otg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date; bh=eaa7ZRV7c+i4CF5WoQyaPsJTGRXEqslUCJs3tcYXkH4=; fh=nH33adjnN/gsJTWUmN4ptcPPT/1qvO9FCMI9KyDNvBE=; b=wJfMtw7r9HWFDLkxunshhaGetIsse3n9banNvmROJlwfl66284yW1mdMLFKOPv6Mg3 J+ewYy+erTYeGshH2Cmccu3x+H6/AFqmylVJt3GgylkmbiRu3M32hdKhFlCc4vSDYrs8 LIGylYb01OzBdWUj/wTzoyDx8t5S27//tD46sr6ly8+qFboDpCREGdqvnAsH/GfqZuo2 SrMjCkYcV3LhowXIgnscu7zwD48d80J1NzYou72yvvIVewyAj6+Fv7DIT0YHU01qtSWt K05b5ltl9PexsjhbB5raNwLzaXIxHd3cOYuuv9twNe3cpJqiMDXoShHB6cXPgz7zjkgV 0QZA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=netrider.rowland.org); spf=pass (google.com: domain of linux-kernel+bounces-194232-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-194232-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=harvard.edu Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id d2e1a72fcca58-6f8fd9efbaesi10093053b3a.369.2024.05.29.07.15.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 29 May 2024 07:15:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-194232-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=netrider.rowland.org); spf=pass (google.com: domain of linux-kernel+bounces-194232-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-194232-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=harvard.edu 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 7DB58287912 for ; Wed, 29 May 2024 14:08:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2782C1E888; Wed, 29 May 2024 14:07:53 +0000 (UTC) Received: from netrider.rowland.org (netrider.rowland.org [192.131.102.5]) by smtp.subspace.kernel.org (Postfix) with SMTP id 2DE661CFB5 for ; Wed, 29 May 2024 14:07:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=192.131.102.5 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716991672; cv=none; b=W1UP/wPq4QxT2235xGR13OFSaC6OM1uoA3K6Kaqj9NqSlmbJhi8LvK7pz4GFOczK2a3aSneF3C8wvdEK9EKDDBGsvtW6aZ7hat+tpAbW1b6v1wYMWWbjUkkKvlw2SHBYJ1mndfruLFGjGEqBmYbr8enz9X3thEV8Od77TkByS5U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716991672; c=relaxed/simple; bh=tDRMZ/xjppcv17Vv7I7IS1EiKe3ccUEx8QOpa9SHJOM=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=Nrqvq1Z/pmWYJ6ED12/QjkVZx2M2EbXPA/h0yWXBFbUVd2W5BM9icFqVAcnrpr14BoUz+e35oDxYXKgl/nT5f2/cw0LmghJmGzo6F4B0yGtqoo98MHuIJsoOeCIgWeXY9eZOSln1jssGTf2HYn2DrmQyCc4pOs8/xN6GvcMxrOA= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=rowland.harvard.edu; spf=pass smtp.mailfrom=netrider.rowland.org; arc=none smtp.client-ip=192.131.102.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=rowland.harvard.edu Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=netrider.rowland.org Received: (qmail 724132 invoked by uid 1000); 29 May 2024 10:07:44 -0400 Date: Wed, 29 May 2024 10:07:44 -0400 From: Alan Stern To: Jonas Oberhauser Cc: Boqun Feng , Andrea Parri , Hernan Ponce de Leon , will@kernel.org, peterz@infradead.org, npiggin@gmail.com, dhowells@redhat.com, j.alglave@ucl.ac.uk, luc.maranget@inria.fr, paulmck@kernel.org, akiyks@gmail.com, dlustig@nvidia.com, joel@joelfernandes.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org Subject: Re: [PATCH] tools/memory-model: Document herd7 (internal) representation Message-ID: References: <20240524151356.236071-1-parri.andrea@gmail.com> <1a3c892c-903e-8fd3-24a6-2454c2a55302@huaweicloud.com> <41bc01fa-ce02-4005-a3c2-abfabe1c6927@huaweicloud.com> <7e2963a3-d471-4593-9170-7f59aa1ce038@huaweicloud.com> 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: <7e2963a3-d471-4593-9170-7f59aa1ce038@huaweicloud.com> On Wed, May 29, 2024 at 02:37:30PM +0200, Jonas Oberhauser wrote: > > > Am 5/28/2024 um 7:58 PM schrieb Boqun Feng: > > This may not be trivial. Note that cmpxchg() is an expression (it has a > > value), so in .def, we want to define it as an expression. However, the > > C-like multiple-statement expression is not supported by herd parser, in > > other words we want: > > > > { > > __fence{mb-successful-rmw}; > > int tmp = __cmpxchg{once}(...); > > __fence{mb-successful-rmw}; > > tmp; > > } > > Oh, you're right. Then probably the rule I was violating is that > value-returning macros can not be defined with {} at all. > > Given herd's other syntactic limitations, perhaps the best way would be to > introduce these macros as > > x = cmpxchg(...) { > __fence{mb-successful-rmw}; > x = __cmpxchg{once}(...); > __fence{mb-successful-rmw}; > } > > since I think x = M(...) is the only way we are allowed to use these macros > anyways. If we did this, how would the .cat file know to ignore the fence events when the cmpxchg() fails? It doesn't look like there's anything to connect the two of them. Adding the MB tag to the cmpxchg itself seems like the only way forward. Alan