Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp709310pxb; Thu, 9 Sep 2021 10:10:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz74bjbGVHjQAKl3SIl99Vt3sKlRBzIpDXEQG+d0cjmbskijx3PI7xTTQDiWW1XMXRd8VqS X-Received: by 2002:a5d:9355:: with SMTP id i21mr3698963ioo.12.1631207455209; Thu, 09 Sep 2021 10:10:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631207455; cv=none; d=google.com; s=arc-20160816; b=f73nVQAW4JYE9qK8y0HU9DjJUcnr9lTgDbvI8e+wpRZht0LlwQKfgscDYhIqWn6bxy QXxwIfyv9F7uqKjNW0SWzc18Q6U+JSVz+/patCSoTFeqiN7RyYXFiuIO9XAH+kJudioq 540I3ZvcqbvzF7JHwhF1kLlIZjwXt+vr5Afmm/HWFjfqa1ebEIUSoziVyPg8cXQcU9MU Vf5hW3x2LSVnD41ClQQUecW5YFkbWhFPCZj9W2YwsdATl1C1oM663J1/uVODdj+U4+Y4 YEqLt7y5CqB91TMlzkzBxJrAlKFdisqYXZpRIfEyqnSPegg/6EsU8HjNodxoan2dHir1 RLmg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=diTVsMYqliPsntfgupSiQvQMuF7KcKYQBTVusJZ/h/Y=; b=IHfnUmtYeX7YmSnMuQjbd+4KBLjBLM7SVdblADeXBgYp5oZO5uEryfC30VAA8PuCSU eOfA+JPr27WUEAOTYBqwFfv3Bl8VTZFkZ4dJAHdtU1GVH6jfOlZYGlxJpJfO3iQpxVQ0 DCO9MvcrNFsQ31oRuT3COl904yxMwwjuL+81hnt+PXufRdjdjLuO0O7JPNhLli2DbKIj JS45d3WpOijg8nLMPrY0yIQ59LrO2V7FHzlZcW6eWMDBX9Cd4WRm6ZoT6sXHvXuy3ihg /8/UXtFYKuF+DUsWXHuZX5/yj0rUyts5OwIekISD4E9JSyBBkti+Bbd0MvF+QujwUmXr zJZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=VmEctbgH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q22si2026999jae.93.2021.09.09.10.10.40; Thu, 09 Sep 2021 10:10:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=VmEctbgH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240688AbhIIRJI (ORCPT + 99 others); Thu, 9 Sep 2021 13:09:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53096 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240691AbhIIRJH (ORCPT ); Thu, 9 Sep 2021 13:09:07 -0400 Received: from mail-lj1-x230.google.com (mail-lj1-x230.google.com [IPv6:2a00:1450:4864:20::230]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CCAF2C061574 for ; Thu, 9 Sep 2021 10:07:57 -0700 (PDT) Received: by mail-lj1-x230.google.com with SMTP id r3so4085634ljc.4 for ; Thu, 09 Sep 2021 10:07:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=diTVsMYqliPsntfgupSiQvQMuF7KcKYQBTVusJZ/h/Y=; b=VmEctbgHul4P8W8T9HtRUrO/mtlYhuO6qpGs6XmtXJRlio+QOUgKC049cxIiHSNiOg djteLekmvDdQqPQ6855lV3YAT50gfrDu4zxrdCIqMc9YjrnuUc0+8CoJjrt7pKnfNz95 +qdw0ajYtXMBK2qlwtYipW05sjvaLD1bEgwoU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=diTVsMYqliPsntfgupSiQvQMuF7KcKYQBTVusJZ/h/Y=; b=oaepj6GFGBXEeAl376kk1ICf/XckVE9mbWF7xfdq7vDi3PeMiuDU/zcCgrtHe9jUDo HiXcjyKgz5ueeH5zWFmdmboJLupuOAzIXKGlvBKRbKiji2mjIb5+i9A1nZj1Otch1+Xd MQGGkQemFoKMEO9Fd5nKX3QB0z4o8ZbUkvIV5i4c2plskrZClrfB1BRymFOV2xJKB/jA zmwwMjeQqJ0eHP9PISE2wiplcUnIcUvobfkyWwvzbc3VCOywJlE/YaRNVd7A2YklgNaK N2VyPCnG0vLvGaC7x33VNOg+YQQmP6eUeF12/T+u/qATHIpxS3PDB6NkMNnIcCbRQvgF 80ww== X-Gm-Message-State: AOAM531ewRKw5u7s5lukfsqq8jGoS1/NmzDr7UXpybIT0lvr3fI/GTIz XXA3kde6Y5n3yZYhpOzhb4NZmE4a0gM5GOtHE10= X-Received: by 2002:a2e:9dca:: with SMTP id x10mr778331ljj.140.1631207275596; Thu, 09 Sep 2021 10:07:55 -0700 (PDT) Received: from mail-lf1-f43.google.com (mail-lf1-f43.google.com. [209.85.167.43]) by smtp.gmail.com with ESMTPSA id y32sm254586lfa.171.2021.09.09.10.07.55 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 09 Sep 2021 10:07:55 -0700 (PDT) Received: by mail-lf1-f43.google.com with SMTP id e23so5047974lfj.9 for ; Thu, 09 Sep 2021 10:07:55 -0700 (PDT) X-Received: by 2002:a05:6512:34c3:: with SMTP id w3mr626249lfr.173.1631206949455; Thu, 09 Sep 2021 10:02:29 -0700 (PDT) MIME-Version: 1.0 References: <20180926182920.27644-2-paulmck@linux.ibm.com> <20210908144217.GA603644@rowland.harvard.edu> <20210909133535.GA9722@willie-the-truck> In-Reply-To: <20210909133535.GA9722@willie-the-truck> From: Linus Torvalds Date: Thu, 9 Sep 2021 10:02:13 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [tip:locking/core] tools/memory-model: Add extra ordering for locks and remove it for ordinary release/acquire To: Will Deacon Cc: Peter Zijlstra , Alan Stern , Alexander Shishkin , Peter Anvin , Andrea Parri , Ingo Molnar , "Paul E. McKenney" , Vince Weaver , Thomas Gleixner , Jiri Olsa , Arnaldo Carvalho de Melo , Linux Kernel Mailing List , Stephane Eranian , linux-tip-commits@vger.kernel.org, Palmer Dabbelt , Paul Walmsley , Daniel Lustig , Michael Ellerman Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 9, 2021 at 6:35 AM Will Deacon wrote: > > I don't think we should require the accesses to the actual lockwords to > be ordered here, as it becomes pretty onerous for relaxed LL/SC > architectures where you'd end up with an extra barrier either after the > unlock() or before the lock() operation. However, I remain absolutely in > favour of strengthening the ordering of the _critical sections_ guarded by > the locks to be RCsc. Ack. The actual locking operations themselves can obviously overlap, it's what they protect that should be ordered if at all possible. Because anything else will be too confusing for words, and if we have to add memory barriers *and* locking we're just screwed. Because I think it is entirely understandable for people to expect that sequence of two locked regions to be ordered wrt each other. While memory ordering is subtle and confusing, we should strive to make our "..but I used locks" to be as straightforward and as understandable to people who really really don't want to even think about memory order as at all reasonable. I think we should have a very strong reason for accepting unordered locked regions (with "strong reason" being defined as "on this architecture that is hugely important, anything else would slow down locks enormously"). It sounds like no such architecture exists, much less is important. Linus