Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 823BFC54E94 for ; Thu, 26 Jan 2023 13:42:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231496AbjAZNmb (ORCPT ); Thu, 26 Jan 2023 08:42:31 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54722 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232386AbjAZNmV (ORCPT ); Thu, 26 Jan 2023 08:42:21 -0500 Received: from frasgout12.his.huawei.com (frasgout12.his.huawei.com [14.137.139.154]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 94EA6457FE for ; Thu, 26 Jan 2023 05:42:08 -0800 (PST) Received: from mail02.huawei.com (unknown [172.18.147.227]) by frasgout12.his.huawei.com (SkyGuard) with ESMTP id 4P2hWC2Nsmz9v7Y4 for ; Thu, 26 Jan 2023 21:33:59 +0800 (CST) Received: from huaweicloud.com (unknown [10.206.133.88]) by APP2 (Coremail) with SMTP id GxC2BwBnOWAOg9JjSrPJAA--.522S2; Thu, 26 Jan 2023 14:41:44 +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: [PATCH v2 0/2] Streamlining treatment of smp_mb__after_unlock_lock Date: Thu, 26 Jan 2023 14:46:02 +0100 Message-Id: <20230126134604.2160-1-jonas.oberhauser@huaweicloud.com>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VFxhVjvjDU0xZFpf9x0J UAxhLUUUUU= X-CM-SenderInfo: 5mrqt2oorev25kdx2v3u6k3tpzhluzxrxghudrp/ X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi all, This patchset first makes smp_mb__after_unlock_lock use po-unlock-lock-po to express its ordering property on UNLOCK+LOCK pairs in a more uniform way with the rest of the model. This does not affect the guarantees provided by it, but if the solution proposed here is unsatisfactory, there are two alternatives that spring to mind: 1) one could think about rephrasing the guarantee of this fence to more obviously match the code 2) one could redefine po-unlock-lock-po to more obviously match the definition of UNLOCK+LOCK pair in rcupdate.h (note: I haven't yet checked every use of po-unlock-lock-po, so that would need to be checked) It then makes ppo a subset of po by moving the extended fence behaviors of this fence (which covers events of two threads) out of ppo. I'm also not sure how to correctly credit the helpful comments of the reviewers on the first iteration of the patch. Changes since the last patch proposal: 1) As suggested by Andrea Parri, the patches no longer introduce a new relation and instead rely purely on strong-fence. Unlike his suggestion these patches do not redefine strong-fence but instead use mb | gp directly in the case where the extended fence is to be excluded. 2) Following another suggestion by Andrea Parri, the patches no longer update any documentation since there are no new relations. 3) We split the patch logically into two steps as mentioned above. 4) As suggested by Alan Stern, we explain in the model why the mismatch between the UNLOCK+LOCK definition in rcupdate.h and the definition of the semantics of the fence in the model is not causing any difference in behavior. Jonas Oberhauser (2): tools/memory-model: Unify UNLOCK+LOCK pairings to po-unlock-lock-po tools/memory-model: Make ppo a subrelation of po tools/memory-model/linux-kernel.cat | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) -- 2.17.1