Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp2088547lqb; Mon, 27 May 2024 07:32:05 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVg7v/YVj3hD/g+WNs2nnsh85ZFXYPjv51/cvL0uIhVEPpjV1vxT43p/WVkbsleg48bTHuBaYLB0Q08eFy1XcNtKDpf7D87XEYxgTZzTw== X-Google-Smtp-Source: AGHT+IHB6AVqMoLlYdSEs4jITySZDLGLqSBtNGefo1eSybBQTeXSGHCIWLa0A4YRkOpNVBELBJJh X-Received: by 2002:a17:90b:201:b0:2bd:82c9:bd40 with SMTP id 98e67ed59e1d1-2bf5f408a4amr8232763a91.48.1716820325261; Mon, 27 May 2024 07:32:05 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716820325; cv=pass; d=google.com; s=arc-20160816; b=OpOO5bKIQfzMLZdsYi2OS/jHtTmJpPHJz8xomLSYXZcKM7nJGMwZuCkVV3dQWbag9C fxk/50GzdUl8ERjxQjQrnMO0G00FdWqahlxUqOzTSG8si0h6JV23HdiD7tfSq+tpONTT l2rW6DC75o9gxa5b5MM3IvLE3KMy9mjuORXoBdcfsxv9fGkw/3MPhLA9ZpOdFEkElVgL GEE1W2jBBtKDGhyWD3YCXr00uSKzJ6xArzlY1+R74CaYc2av7RrCrHx4jDL4u43LJAQo iwvu1xcLIftg+c+oU6woOit+hjxYjLK8LLc+uBONSZO6EcphESq5KVDFiDCV3IB9CDLk ifbg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to:subject :user-agent:mime-version:list-unsubscribe:list-subscribe:list-id :precedence:date:message-id; bh=CRUiqsMJeT4tUDFRHPvDTv8HPXDZgfHwyVO5Zyid3F4=; fh=3J8lTOLkeHUilaNjx1QZrEXY/9CGwcJURLyx4fXOkwE=; b=OhFJFmdIsUjQFRcoKJznqb88PYIJd0E3f2rYxVJhrraC6L4ShtM4f0NHGfw9mpPegM my7qO0uUVQfe8DYE+iq6mWj9+ZC/Ib4czXOfQ5cv1NJ3yQDQDaVK3CX0Iq9PFJZ0XhwR L5MCRm8phm7KcRg0Oi18lZkiZMjQhu+9ObHnO0jLZaAAcp2ad+vk8fuFxrVuGwup1DPa b8SszByeuH+OvKvRI06DBU1x8+BuN7kLHRyqjD1uY9Z72zbIh/gJh4HKgMv9Rq7GPT1L 2bs/gAJf+I+4wf/U3mxz0rp2Qv26XYSStq8vJGZEzebspdk+s2vpkXed/AAWE+O/gidg lYFA==; 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-190750-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-190750-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id 98e67ed59e1d1-2bfec0e7d55si956922a91.32.2024.05.27.07.32.04 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 May 2024 07:32:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-190750-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=huaweicloud.com); spf=pass (google.com: domain of linux-kernel+bounces-190750-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-190750-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id BDB57B26709 for ; Mon, 27 May 2024 13:47:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AB6D915EFA3; Mon, 27 May 2024 13:47:49 +0000 (UTC) Received: from frasgout11.his.huawei.com (frasgout11.his.huawei.com [14.137.139.23]) (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 7024E1DDEB; Mon, 27 May 2024 13:47:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=14.137.139.23 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716817669; cv=none; b=npjo9fd4rrOciJ6cDBGOQjdJX/+ewBT2AcxxuYKIYEYEF8HLCbCMob1jzqwSeKhf4okEck8xl8+RMsPzCCWyp9Ao3T2ei+9i1uzR1jGP1i+AS0f5BGQyNKZ14Irtf/mh9n4W2nyct9tTZlbDIVOcyDRtUGXU31BkitwS1GfKXyk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716817669; c=relaxed/simple; bh=8xcCsB+EROXGp8PmzD+b1rGd0T94KqkDNPuU4A2t/a4=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=bw9OpHri7YNL2g9TQN1iWpss+eNFE88HP619jLyRXF5aboSgDU0fD7hMgPNgLzu33aoO5IemBBk8WD5d0edepv6lbM0c28KKVcBGcE4YwFKYE2565bAg1hqZjbZTKn2PP/pbZvUctVfCnJKXDMXUAf9XI2O+4jd/BsNLvItAgmg= 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.23 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.51]) by frasgout11.his.huawei.com (SkyGuard) with ESMTP id 4VnxNH6XmZz9v7Hm; Mon, 27 May 2024 21:30:23 +0800 (CST) Received: from mail02.huawei.com (unknown [7.182.16.27]) by mail.maildlp.com (Postfix) with ESMTP id 7BF971404F0; Mon, 27 May 2024 21:47:35 +0800 (CST) Received: from [10.206.134.102] (unknown [10.206.134.102]) by APP2 (Coremail) with SMTP id GxC2BwDn0ibqjlRm4I0BCQ--.41868S2; Mon, 27 May 2024 14:47:34 +0100 (CET) Message-ID: <7f5a586f-f4b6-4d70-b121-3d82daf54865@huaweicloud.com> Date: Mon, 27 May 2024 15:47:20 +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 Subject: Re: [PATCH] tools/memory-model: Document herd7 (internal) representation To: Alan Stern , Andrea Parri Cc: Hernan Ponce de Leon , 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, paulmck@kernel.org, akiyks@gmail.com, dlustig@nvidia.com, joel@joelfernandes.org, linux-kernel@vger.kernel.org, linux-arch@vger.kernel.org References: <20240524151356.236071-1-parri.andrea@gmail.com> <1a3c892c-903e-8fd3-24a6-2454c2a55302@huaweicloud.com> <79b55c10-dd06-4947-8545-20ffeb324bc6@rowland.harvard.edu> From: Jonas Oberhauser In-Reply-To: <79b55c10-dd06-4947-8545-20ffeb324bc6@rowland.harvard.edu> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-CM-TRANSID:GxC2BwDn0ibqjlRm4I0BCQ--.41868S2 X-Coremail-Antispam: 1UD129KBjvJXoWrZry7Gw1Uuw17Jw48ZrWfuFg_yoW8JrWDpF ZFga1xKw1DJay093yUGa9IvasY9an3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on, May 27, 2024 at 03:28:00PM +0200, Andrea Parri wrote: >>>> + | smp_store_mb | W[once] ->po F[mb] | >>> >>> I expect this one to be hard-coded in herd7 source code, but I cannot find >>> it. Can you give me a pointer? >> >> smp_store_mb() is currently mapped to { __store{once}(X,V); __fence{mb}; } in >> the .def file, so it's semantically equivalent to "WRITE_ONCE(); smp_mb();". > > Why don't we use this approach for all the value-returning full-barrier > RMW operations? That would immediately solve the issue of the > special-purpose code in herd7, leaving only the matter of how to > annotate failed RMW operations. I experimented with that the other day. My idea was to use a new __fence{mb-successful-rmw} which would have Mb = Mb | Mb-successful-rmw & (domain((po\(po;po));rmw) | range(rmw;(po\(po;po))) to turn only the ordering effect of fences around cmpxchg off (and the existance of these fences around unsuccessful cmpxchg would be the only difference to the current representation). Unfortunately I didn't manage to get my changes to the .def file to compile (FWIW I'm on herd 7.56+03). Maybe someone wiser with herd can figure out how to work the .def file. Best wishes, jonas