Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp578117lqb; Fri, 24 May 2024 07:14:37 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCU5zfdVzW73uotUtbJNs9R6nV85BqQlvMVAo3Y5lDrQ1ycTB6vs4+1s6cuDzGTxN9iKOT56fokid0qdQzxEbPVX5ByEXhWYQazuivrnDg== X-Google-Smtp-Source: AGHT+IHY1kWnfNxg2KGKv5HwIELt9wK0R/dP1VeZxhy8aKD1slZDwRux7b870Y7w0hSogXRjP74R X-Received: by 2002:a50:cc0b:0:b0:578:357d:682 with SMTP id 4fb4d7f45d1cf-57851999161mr1625987a12.18.1716560077044; Fri, 24 May 2024 07:14:37 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716560077; cv=pass; d=google.com; s=arc-20160816; b=ovgo2Yweh5WWkZf/vETRyiCjXnWJMVqYKhBxDrchO8wjHwqCjdDr8mAQ6ajWUpf3nw reFm92hKu3P2MrjKcLcWeWDzxgtQ9Jfve/8vfY15b8Z798vD04FcEH/99PCLXMMsyndb L5CHhdQLLpt09a/NVk/U7E2IcfE4ojVslPeaXw2HzIpbXPWZrF/PidHM+tWK1g5MQ9zX gR2H67En49gI6Mznfj3Arq4OtJLeSdJWLXz5Nup9SGB5+EZC3heL6lwZi5kwdx3cTayZ ZM2PNtRkmpKUNAaoCD31VEbRXCMnBIUg7JwwhyCPJ6ZtF3SBXsRrTLFenERbit8evOCm Bgag== 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=hICr4KeEzj3UUEA+uB0Wh7QgNnfbFBuESQFQdGuqwf4=; fh=hWAM0tpRcbCF3gkq2PE9I2CgLpDPXPypUYnSfPtWbkY=; b=DH5hat6CNhkf7dAaWVimhSkue9MpI++6rXZ9LOdRHVp8zam34O0gkyub277uVtcRSD QHmciLlMXWEbc+WIcQmHpi41Ov0B4MuMER29fhEzd1I+vFnmfeIeVykJdl1fqtEFYmlT kZYRWsW2n3TwDVQzAzu2LHtVK97/MxtYU+1oWpunuPAQ0LweS7QHKLWd/Vl0lPt1u4zv py3HIdazPqVu0Awvec7vFgVMx2WzhrlzXEqCadkTL6Ov8NBMGzls87Uw02rujDjLB4fl p7MpCuCZQqhD2uhJ1ON6AGCwfS39T1i9Eiyd+DiykYC6pjGv5fPkDvoX5BMubrcBZblT z60w==; 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-188777-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-188777-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=harvard.edu Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id 4fb4d7f45d1cf-5785a3291desi701540a12.489.2024.05.24.07.14.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 24 May 2024 07:14:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-188777-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=netrider.rowland.org); spf=pass (google.com: domain of linux-kernel+bounces-188777-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-188777-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 am.mirrors.kernel.org (Postfix) with ESMTPS id C47D81F217B4 for ; Fri, 24 May 2024 14:14:36 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F250212C486; Fri, 24 May 2024 14:14:29 +0000 (UTC) Received: from netrider.rowland.org (netrider.rowland.org [192.131.102.5]) by smtp.subspace.kernel.org (Postfix) with SMTP id 4FC1F12C47B for ; Fri, 24 May 2024 14:14:27 +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=1716560069; cv=none; b=sgIE1/fiQ1nhjaYnK/vckTQ0Z5Lk6D/VVBUigI80KJUtKIS1WOi5X1M0iRFEp6hcOhoKHHZYvanp10XFJ20CyoeXz4SqqaaY0lnN4V81qyPUQlPITWWP8R5g0IlFOlK03kRQn2Pb6yxjzSrEIbfpE+zsBukNRahuHhRKAGSRQx4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716560069; c=relaxed/simple; bh=W/QFZgZjVK4PgDuIaqIeI+JhOty3H64BskYsUZZh49w=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=g6+cueFHtfm0TMYjUN/oTTPa6Ko5AqYpKyd6KqVMrQj879pXsmVgykmgTXSr5v0UcKNWz8+gK1xNltYhN2S05zJtJrKztHYyjRsSyAHywlt7ZP04490MkD+9TKS+rkvyOtFpMqmnaAfDEyYonBpIJxq1MF+9Cx+XEH06z7ypL0w= 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 575113 invoked by uid 1000); 24 May 2024 10:14:25 -0400 Date: Fri, 24 May 2024 10:14:25 -0400 From: Alan Stern To: Boqun Feng Cc: Hernan Ponce de Leon , Jonas Oberhauser , "Paul E. McKenney" , linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org, kernel-team@meta.com, parri.andrea@gmail.com, j.alglave@ucl.ac.uk, luc.maranget@inria.fr, Joel Fernandes Subject: Re: LKMM: Making RMW barriers explicit Message-ID: <9256f95a-858b-435f-b40a-a4508a1096c9@rowland.harvard.edu> References: <0c309dd3-f8c1-4945-b8f1-154b2a775216@huaweicloud.com> <4286e5b2-5954-4c77-a815-c1c2735d9509@rowland.harvard.edu> <58042cf3-e515-4e5f-ab48-1d0d6123c9e9@huaweicloud.com> <6174fd09-b287-49ae-b117-c3a36ef3800a@rowland.harvard.edu> <7bd31eca-3cf3-4377-a747-ec224262bd2e@huaweicloud.com> <35b3fd07-fa85-4244-b9cb-50ea54d9de6a@rowland.harvard.edu> 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 Thu, May 23, 2024 at 07:50:11PM -0700, Boqun Feng wrote: > On Thu, May 23, 2024 at 09:38:05PM -0400, Alan Stern wrote: > > On Thu, May 23, 2024 at 08:14:38AM -0700, Boqun Feng wrote: > > > Besides, I'm not sure this is a good idea. Because the "{mb}, {once}, > > > etc" part is a syntax thing, you write a cmpxchg(), it should be > > > translated to a cmpxchg event with MB tag on. As to failed cmpxchg() > > > doesn't provide ordering, it's a semantics thing, as Jonas showed that > > > it can be represent in cat file. As long as it's a semanitc thing and we > > > can represent in cat file, I don't think we want herd to give a special > > > treatment. > > > > I don't really understand the distinction you're making between > > syntactic things and semantic things. For most instructions there's no > > Syntax is how the code is written, and semantic is how the code is > executed (in each execution candidate). So if we write a cmpxchg{mb}(), > and in execution candiates, it could generates a read{MB} event and a > write{MB} event (succeed case), or a read{MB} event (fail case), "{MB}" > here doesn't mean it's a full barrier, it only means the event comes > from a no suffix API. Here "{MB}" only has syntactic meaning (no > semantic meaning). Okay, I get it. Then you might agree that it probably would be better to use a different tag here, because the mb tag is already in use with other instructions (like smp_mb()) where it does always mean there's a full barrier. > Not really, RMW events contains all events generated from > read-modify-write primitives, if there is an R event without a rmw > relation (i.e there is no corresponding write event), it's a failed RWM > by definition: it cannot be anything else. Not true. An R event without an rmw relation could be a READ_ONCE(). Or a plain read. The memory model uses the tag to distinguish these cases. > > that it would work is merely an artifact of herd7's internal actions. I > > think it would be much cleaner if herd7 represented these events in some > > other way, particularly if we can tell it how. > > > > After all, herd7 already does generate different sets of events for > > successful (both R and W) and failed (only R) RMWs. It's not such a big > > stretch to make the R events it generates different in the two cases. > > > > I thought we want to simplify the herd internal processing by avoid > adding mb events in cmpxchg() cases, in the same spirit, if syntactic > tagging is already good enough, why do we want to make herd complicate? Herd7 already is complicated by the fact that it needs to handle cmpxchg() instructions in two ways: success and failure. This complication is unavoidable. Adding one extra layer (different tags for the different ways) is an insignificant increase in the complication, IMO. And it's a net reduction when you compare it to the amount of complication currently in the herd7 code. Also what about cmpxchg_acquire()? If it fails, it will generate an R event with an acquire tag not in the rmw relation. There is no way to tell such events apart from a normal smp_load_acquire(), and so the .cat file would have no way to know that the event should not have acquire semantics. I guess we would have to rename this tag, as well. Alan