Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp2153685lqb; Mon, 27 May 2024 09:26:51 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUriNxSBtjV9fiYOf7TQ6XyjxXfgkmTb8xpnR0yG0GO+MO8zzIco5AxVIezUtbkkmRxfvIrxXn7yocWdFFvhBDih+GD71fghbHlOgUcvw== X-Google-Smtp-Source: AGHT+IGCfmsMU9oZE4Sty29nOkopZAkU8+2szxji7TbGCmLDDnr7qLhFL7qMlr9K58EFecXnT0E2 X-Received: by 2002:a17:903:192:b0:1f4:af80:7a3a with SMTP id d9443c01a7336-1f4af807c68mr20310535ad.25.1716827211184; Mon, 27 May 2024 09:26:51 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716827211; cv=pass; d=google.com; s=arc-20160816; b=Hvm3kTYj8e5puX7wAQgMCQybhDd8gbbXwjnJt7OQRbteFkevc1MJ90Iv3KKn5miWVi LFI1tS86KpQ0TX93Qy4QRCqfsd/uPB9crkHvXKra61z7B7Nv9m+fGkMWBWr3LZvUs2O1 Jvi/3fVaLxZsfUZI1GeHZGkbZniztdEmYgaEh7Uh0O7iTRMutZrux9k9Xii+nvPVXAgZ kW+tI/sfPYbYD4jFWKF/IYRWRStK6KDuFKlHKZzvsvkyN4Y/CKxw7je5ORpcvWlYEyw0 plkGaZtYyJsO2kiOsPsacdWAmpfwe1zBXhBzH9iuyM0axLsOkhGl1enPU5U+cnt38Vdk X/iw== 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=JdgLGUomB5JVNk86BIDk8BYr5jzGnjU8W8oeqcPJJ0Q=; fh=R0a5vNVEbT85ZdnMMJAnpaJPftamlY5YBzL5BPBNIKs=; b=pjj/LVNelbYAm1FjwUvi/6/sq5aJuPGVMmDCQx5J4pZJxR4vdG6PYMOgdVndMXOFlH 8szVfss9h/ng3VQC4q5r0iQlHfsUCvS0dFZ6PphVKvKAeogF8SjbQomwZzG9531Q96g3 5H9gnYjw+zo6f+RzpMSxLRdsVR0+wSo+xHIM48ozDaETgJh+UizA7sqjAXzj4rFUmseg xyBaFRvMuGdZxXJL/lggvFN8DkMPpVvpde8MNfw834cPl1XmaxnBciUkFt8svEOGZ7rB K5i5EVjyddJe4G+Fm+kdwdxqUycM4XH3CQeirJeqVCjglL7rmnDA5xjFrq6ZU6rhXO4w u52w==; 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-191172-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-191172-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 d9443c01a7336-1f44c9b98dasi64154885ad.467.2024.05.27.09.26.50 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 May 2024 09:26:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-191172-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-191172-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-191172-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 0DBF728C12D for ; Mon, 27 May 2024 16:08:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8908B15F403; Mon, 27 May 2024 15:58:04 +0000 (UTC) Received: from netrider.rowland.org (netrider.rowland.org [192.131.102.5]) by smtp.subspace.kernel.org (Postfix) with SMTP id 46B4516F0DC for ; Mon, 27 May 2024 15:58:02 +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=1716825484; cv=none; b=LTWceDW77P3adxyPhLCpXasXGhVN0WEvu2OQMRW5MC2uwOdT6sroa38n/LfOejTWyCfMqISjM0kS+D31Cu3nDwwb1aTMNqLtdq9/T5hNuJ243KM6w5U76qTDw6DvFLToH2eHORCI0ivH03cW0PK8vCfn/l41IBX/W5rEuiBRgN0= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716825484; c=relaxed/simple; bh=k6N9dn7iRJq8ZaIqt4CaMWQZbxwAmp4kdB6ZdQ6EO1I=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=UdnUZ752tsTPUmxR4EAmwWGYmvP7VJ8NV9Y3Ef0kTF9b/MCnBpYgSk++RElrDLlKhGcqZWUNB9Pm3+GneBUuGmNrvXFhhq8RTjeooEjG/Gq5y1DGMRpDB0yM/+TPmHV39p26B4+NXiI0CgVWF3mW8G00hYChkhbkxD6SU60jqAw= 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 663299 invoked by uid 1000); 27 May 2024 11:58:01 -0400 Date: Mon, 27 May 2024 11:58:01 -0400 From: Alan Stern To: Jonas Oberhauser Cc: paulmck@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, dlustig@nvidia.com, joel@joelfernandes.org, urezki@gmail.com, quic_neeraju@quicinc.com, frederic@kernel.org, linux-kernel@vger.kernel.org Subject: Re: [RFC][PATCH 1/4] tools/memory-model: Legitimize current use of tags in LKMM macros Message-ID: References: <20240527152253.195956-1-jonas.oberhauser@huaweicloud.com> <20240527152253.195956-2-jonas.oberhauser@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: <20240527152253.195956-2-jonas.oberhauser@huaweicloud.com> On Mon, May 27, 2024 at 05:22:50PM +0200, Jonas Oberhauser wrote: > The current macros in linux-kernel.def reference instructions such as > __xchg{mb} or __cmpxchg{acquire}, which are invalid combinations of tags > and instructions according to the declarations in linux-kernel.bell. > This works with current herd7 because herd7 removes these tags anyways > and does not actually enforce validity of combinations at all. > > If a future herd7 version no longer applies these hardcoded > transformations, then all currently invalid combinations will actually > appear on some instruction. > > We therefore adjust the declarations to make the resulting combinations > valid, by adding the 'mb tag to the set of Accesses and allowing all > Accesses to appear on all read, write, and RMW instructions. > > Signed-off-by: Jonas Oberhauser > --- > tools/memory-model/linux-kernel.bell | 9 +++++---- > 1 file changed, 5 insertions(+), 4 deletions(-) > > diff --git a/tools/memory-model/linux-kernel.bell b/tools/memory-model/linux-kernel.bell > index ce068700939c..1b2444cdf8d1 100644 > --- a/tools/memory-model/linux-kernel.bell > +++ b/tools/memory-model/linux-kernel.bell > @@ -16,10 +16,11 @@ > enum Accesses = 'once (*READ_ONCE,WRITE_ONCE*) || > 'release (*smp_store_release*) || > 'acquire (*smp_load_acquire*) || > - 'noreturn (* R of non-return RMW *) > -instructions R[{'once,'acquire,'noreturn}] > -instructions W[{'once,'release}] > -instructions RMW[{'once,'acquire,'release}] > + 'noreturn (* R of non-return RMW *) || > + 'mb (*xchg(),compare_exchange(),...*) It would be better to write cmpxchg() instead of compare_exchange(). Alan > +instructions R[Accesses] > +instructions W[Accesses] > +instructions RMW[Accesses] > > enum Barriers = 'wmb (*smp_wmb*) || > 'rmb (*smp_rmb*) || > -- > 2.34.1 >