Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp2128657lqb; Mon, 27 May 2024 08:43:45 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW/YPL/XH5ZU78FXcgetisXAXSY+eGJXgGb/XD1HuoGSR83YHhLOamtFikIEIZxzlCe+KQ4N5kuBMV17oVbY1FHJNiytCdR7MrbmE5vCQ== X-Google-Smtp-Source: AGHT+IEJBqvErSNquaiiH3jkfs/yjn7kTdzTLAfxeq420uV0edX+WG7tWlHQly9qA33lBaFRmZm7 X-Received: by 2002:a17:90b:a4f:b0:2b2:81c0:268d with SMTP id 98e67ed59e1d1-2bf5f85d8d8mr8159265a91.43.1716824625355; Mon, 27 May 2024 08:43:45 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716824625; cv=pass; d=google.com; s=arc-20160816; b=fNbDCA6Ugn1IzxLeBi+OcvR4MreAu4x47Tr3eeenKoe9i8+uPwIHHQxs3YEXfOUsur WT1loC8CexJJWSrrSC6XhnLK7iERbPhLy/rylQkU6zuopAnsytVeMQzAsd0d//OmoqsP bi7I0/JLH+jAuWgboAAuIF3sgyrC2vv2DBJIR5+x2qZT4iAFRwcun9Ici4Q7zOnMhILJ 2AvqaCIytiylBYynkfa3aVTkOG7IpBbg/iOiurbq4OVSMGfK67MRCQtUdiWB/OQvH0po FWME3JQcn8ijuq8KVVIrYijJ5n2XhfbaygrypTfxYqEZsgys0LTh24e+xI0CqzufNOzm JbCw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=jhQGfRMwmYJvU6iWRf+sLqjnNXGVeJMdV7CAguweTng=; fh=PokYFa8Et7zdczSF6n+1+UiesnJpST/3LrOOhys0ax8=; b=P09ZPSBE14TcIF0/COg53MZN/dejH7Y9RvXmAtEVSRxBSkLWpq3YXoV7Lt3LDb/1sD IWdDAYoAV5ivdwXj5e1fNy4PLp0fkXXuHkIn7/dWo0uccs9bczUqzFI9lgW4sBA5YZ/Y 0v944Pn0/T3IUF+5Xei3reZkhx+IXBf8J/lcYCggMasBp+fBLCy2tsAdGaBqs/xrG646 GRVOaZuM2ahCQOMvVnXfGN+UaVLF4NqBlQiGF/zA0kZec/N6DRt39m7pIN5SOETTp+uA m3Cb8n7WXxJ6pe6KvJ5RH8NPDK3vKdAD4Vi5tK4Pr6I/KrfKqlvxIE3T2zTNvGQWiIDb R/lg==; 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-191062-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-191062-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id 98e67ed59e1d1-2bdd9ef2998si6932386a91.60.2024.05.27.08.43.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 May 2024 08:43:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-191062-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=huaweicloud.com); spf=pass (google.com: domain of linux-kernel+bounces-191062-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-191062-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 sv.mirrors.kernel.org (Postfix) with ESMTPS id E9C5E296219 for ; Mon, 27 May 2024 15:25:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3581917E913; Mon, 27 May 2024 15:23:50 +0000 (UTC) Received: from frasgout12.his.huawei.com (frasgout12.his.huawei.com [14.137.139.154]) (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 232E617E8E0 for ; Mon, 27 May 2024 15:23:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=14.137.139.154 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716823429; cv=none; b=D9lAE/YgGxXmqam/PSY9hhKEimvRTVi4DhZFRFnoZtXO/ll22akZE/1XmPlOm9+xZgbqFmTS48/DU4Jan39QF7xP5e2KH9ft36RoLWKNit+4vph9IujpZ/5rJ1k1h9Pe9r8J7MmqkNRbcBfxxXAQw3M5VKLHKRhlR854tN0046k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716823429; c=relaxed/simple; bh=E12HbST7gVhui/vfd1239eOfyFPBo4oTSXW6Fz+MpH4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=UfH59MY3TXsyyzhGjmhMgwK5K5dLdPsOuMx3sO0dBRyPBE04vH9g9lTI/n5zCq7yN7vNQwQhydjltg3mcM3KSKyLZbSqYGYWqqCO/v5w2QGkSh67Jmwf8vfvdhRY51o0Nap5dz98kALKQc6vqifwt/GOqbzHsSeVtoJUdCJ7p+o= 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.154 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.29]) by frasgout12.his.huawei.com (SkyGuard) with ESMTP id 4VnzPb0h4Tz9v7JM for ; Mon, 27 May 2024 23:01:39 +0800 (CST) Received: from mail02.huawei.com (unknown [7.182.16.47]) by mail.maildlp.com (Postfix) with ESMTP id D1CB314040D for ; Mon, 27 May 2024 23:23:35 +0800 (CST) Received: from huaweicloud.com (unknown [10.206.133.88]) by APP1 (Coremail) with SMTP id LxC2BwAHshpgpVRmXLgGCQ--.41702S3; Mon, 27 May 2024 16:23:35 +0100 (CET) From: Jonas Oberhauser To: paulmck@kernel.org Cc: stern@rowland.harvard.edu, 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, Jonas Oberhauser Subject: [RFC][PATCH 1/4] tools/memory-model: Legitimize current use of tags in LKMM macros Date: Mon, 27 May 2024 17:22:50 +0200 Message-Id: <20240527152253.195956-2-jonas.oberhauser@huaweicloud.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240527152253.195956-1-jonas.oberhauser@huaweicloud.com> References: <20240527152253.195956-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-Transfer-Encoding: 8bit X-CM-TRANSID:LxC2BwAHshpgpVRmXLgGCQ--.41702S3 X-Coremail-Antispam: 1UD129KBjvJXoW7CF4xGr45tF4DGr43tF4ruFg_yoW8AryDpF ZrCw15GF4UXrZ8uwnrJrWUua4S9a93Jr45Gr9rta43A34YvrnFy3WqqFnF9FZ3ZrZ7uw17 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zxrxghudrp/ 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(),...*) +instructions R[Accesses] +instructions W[Accesses] +instructions RMW[Accesses] enum Barriers = 'wmb (*smp_wmb*) || 'rmb (*smp_rmb*) || -- 2.34.1