Received: by 2002:ab2:6d45:0:b0:1fb:d597:ff75 with SMTP id d5csp322338lqr; Wed, 5 Jun 2024 07:10:50 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVbuseRIviVE38isSEsU2BOOF/u+ufuGM2P2IE23Bz1+BVnmPtjXiAbj2/cj8dP3AorABaCVoAsPw1e7gPWEMovd05LEJcEgLiMvPTNwQ== X-Google-Smtp-Source: AGHT+IHjNIFOZ5tBGQpQwvdsRC/zqhZ4c5N1LmoHTP+loyFazzccAXmZPkccQDy0DDxOo4Gl8JAY X-Received: by 2002:a05:6602:13d0:b0:7e2:1ac2:1ce4 with SMTP id ca18e2360f4ac-7eb3c90fdebmr298542839f.13.1717596649931; Wed, 05 Jun 2024 07:10:49 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717596649; cv=pass; d=google.com; s=arc-20160816; b=ZR93PydJJDu1Wmpv/zpaIIQ1RWGRCYpv8SrDi6XGTNXeBp0Ibk+CSMQURR0Uw056FH egiVl6FwNt6xu2OBw/UMCD40abn5RLhtZlkh+U0Cfit5GvdT6O5TY8gkJKvvMnP04EEC dCqZzMF34pQmcW2km/AHKqbF2WzIiq6S84YGGcVfiYB0lCxxF95Ayglftp9wWoxt165u jQqk6Z1lf3UlMwMqKwU0EfRE0TsJr53W9PYVzs79FCEhxW5IH6Rk0PVX1diOIYYmIenM 0H3rjsuK0lygv7BNKaXDF4+j2oUHM5H8CA+CDOykVxOz7EZu40c4bTcYFBZE6FkcsXKR fppg== 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=gSZQeevF/SPRUzzgiD2BMa0ySiN0x1vb0BQBcqiFzkE=; fh=6Kyga4yVDHRhAQkc1sZZwep8awWCjRcD0oPQLmuHg0I=; b=i5jXm36wwS2q2mPOtFz7vELuf02uEhXQoPAKD+Gjm6Wt7NPpvqBn8EvXss3CDjH+BZ VIHdqKE6164mycUm2HUZlES6Cw5/+ei6l1ssg85EsuMxFM5COSfQYGp1Jrbi9ENcgfKH QggI9THuKH+gmOHy8pUhK5UC2xIemDHUCWDMlracLuSiGB4cKuJtONlkfzHMEOYlsTjI UEu5m4y/SdXuk7DgitO9iMlhEdBfRN+wg6lsljAOlkbFjBhm6mZZSCne/v9MJqlmVLYB +2muGVZFklSFD0cv8vbKcAF6y2cdxxCy9+Ybp2PvfelbgQWOiOLx2g4i1SSO1iNLwl8p nMvQ==; 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-202729-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-202729-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. [139.178.88.99]) by mx.google.com with ESMTPS id 41be03b00d2f7-6c35d59f99fsi3301834a12.847.2024.06.05.07.10.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Jun 2024 07:10:49 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-202729-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=pass (i=1 spf=pass spfdomain=netrider.rowland.org); spf=pass (google.com: domain of linux-kernel+bounces-202729-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-202729-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 E63CB2990C3 for ; Wed, 5 Jun 2024 13:52:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8F462195FC1; Wed, 5 Jun 2024 13:40:24 +0000 (UTC) Received: from netrider.rowland.org (netrider.rowland.org [192.131.102.5]) by smtp.subspace.kernel.org (Postfix) with SMTP id 21C911953AF for ; Wed, 5 Jun 2024 13:40:21 +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=1717594824; cv=none; b=WCj00FI7PfBB3/gFVJJxTcDR7v4GSjbcRUWVpFtL9eDzM9IIKyPIqshQvlWyqKsn/OJh/T7JisBe6hdRysBD2Q7z0Z55SUWq7E8uGAX81TJU85CUwFlrhfqNMwnY/mnuGfT6XaHqNXgKwQpCIolFk/G6Rk9TuK03efs/i9dF+44= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717594824; c=relaxed/simple; bh=pg3gmQ+DfMSb375BdyrwTTkQKJuMPFxzyCHhzTRTFHM=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=BB/FWS1F7ux1epeUs0pWjTCsJElbup4ru2yJURGSHCg/7+7w73HVjS3771ZJREY4U+DvBLQeay6XRiCBfZwIFadxg7SEr8a3CfASdfDcYqG3SvyPw0vMnPh7oQj/UqDtNPqUa1X5weOdCoP1DBcBetueb/KbKBkadWJbIiLHRYM= 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 196501 invoked by uid 1000); 5 Jun 2024 09:40:20 -0400 Date: Wed, 5 Jun 2024 09:40:20 -0400 From: Alan Stern To: Boqun Feng Cc: Jonas Oberhauser , paulmck@kernel.org, parri.andrea@gmail.com, will@kernel.org, peterz@infradead.org, 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, Viktor Vafeiadis Subject: Re: [PATCHv2 3/4] tools/memory-model: Define effect of Mb tags on RMWs in tools/... Message-ID: References: <20240604152922.495908-1-jonas.oberhauser@huaweicloud.com> <20240604160440.498332-1-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: On Tue, Jun 04, 2024 at 09:28:42PM -0700, Boqun Feng wrote: > On Tue, Jun 04, 2024 at 06:04:40PM +0200, Jonas Oberhauser wrote: > > --- a/tools/memory-model/linux-kernel.cat > > +++ b/tools/memory-model/linux-kernel.cat > > @@ -34,6 +34,16 @@ let R4rmb = R \ Noreturn (* Reads for which rmb works *) > > let rmb = [R4rmb] ; fencerel(Rmb) ; [R4rmb] > > let wmb = [W] ; fencerel(Wmb) ; [W] > > let mb = ([M] ; fencerel(Mb) ; [M]) | > > + (* > > + * full-barrier RMWs (successful cmpxchg(), xchg(), etc.) act as > > + * though there were enclosed by smp_mb(). > > + * The effect of these virtual smp_mb() is formalized by adding > > + * Mb tags to the read and write of the operation, and providing > > + * the same ordering as though there were additional po edges > > + * between the Mb tag and the read resp. write. > > + *) > > + ([M] ; po ; [Mb & R]) | > > + ([Mb & W] ; po ; [M]) | > > I couldn't help suggestting: > > ([M] ; po ; [Mb & domain(rmw)]) | > ([Mb & range(rmw)] ; po ; [M]) | > > , it's a bit more clear to me, but maybe the comment above is good > enough? We may want to use the patch's approach for other things besides RMW. For instance, it would be a good way to implement smp_store_mb() -- compare it to the existing implementation in the .def file. Alan