Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp696440pxb; Wed, 29 Sep 2021 07:54:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy8V2GjZtW1it6CKR01iz2P7Fz2EMW+ZBCt1ZhI09WGzgc4y/Wj5ltZTMDH6J4ZmF3b7Dan X-Received: by 2002:a17:906:3b8e:: with SMTP id u14mr154866ejf.418.1632927245089; Wed, 29 Sep 2021 07:54:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632927245; cv=none; d=google.com; s=arc-20160816; b=zcAIclYXUDy5OFSjph0qo9KcOpYornm2mYLxG4tvmIrHdUq89Mo2T774WtMSJj4KqR NZC1N6zRoXD4kbeAF7SKsBVi/t8QuuEuY84ZvngXuZBP4Xi8TnO9ejmTLSJ4kOCVTIoc 9axIEFfam8yKq2Y8eb9Q7XOst3O8jMvLmGs9jMFbKmG/c73ueuOwCqnl1fEg0HpYomoj qvrwHl48dYJYNn7FE9dZ1izM8Ya101wSqkCfe4QX3KoxeYRoVOUM21D8ZjMC/5c3b8oT jrAqyIzphKemE9TcFW9WhmvaNpr7P0T9qNnr8REtTi8XFx6f3kabgWAB/L8jqi9GE/Gp 4gmQ== 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=LFg4AyxhOkrmj2m8GgLtBQsrwYL1m+vTuPDFyai2hnY=; b=WkPT7h+lkrbXapdikhp1mMuYzVb6NfMHWL5MqNO66j3HrjlxBQZNbkllv+eI84bTi9 c4zKaOXzw9Nox7Dn5or+hVwiQjxyHGjYWqfLaLIWXrpRMAktPbJpV6pKqZpPqEtIksj8 at64TVjQvyQawMTua/Ey7M+uwTkAi0+S+dnuVgRmdlAKjdxkSkbudm4T3sFJJ8dWwCEC b/n/txd4fbZNGEK7QPHpOJte7h048yLubrMGFezqy+4OPgoL4dkoWQL78QUqnHGd/El2 JlTfhPTbeQRVX0irCMMzamI7coRB1I0llTbxjX77YrpEIf87LfCOMdEziFJp7+26u8Hy G0/A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b="TY3qm/59"; 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 ha9si44917ejb.329.2021.09.29.07.53.40; Wed, 29 Sep 2021 07:54:05 -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="TY3qm/59"; 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 S1344577AbhI2Ot3 (ORCPT + 99 others); Wed, 29 Sep 2021 10:49:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47636 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344629AbhI2OtZ (ORCPT ); Wed, 29 Sep 2021 10:49:25 -0400 Received: from mail-lf1-x136.google.com (mail-lf1-x136.google.com [IPv6:2a00:1450:4864:20::136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 80F34C061762 for ; Wed, 29 Sep 2021 07:47:44 -0700 (PDT) Received: by mail-lf1-x136.google.com with SMTP id x27so11769672lfa.9 for ; Wed, 29 Sep 2021 07:47:44 -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=LFg4AyxhOkrmj2m8GgLtBQsrwYL1m+vTuPDFyai2hnY=; b=TY3qm/59v0pVhETMeEmyrWKW7NYyHv2byd9LPTTDbwJuw+CRiLITgNlDDc497mHhda d61B42xvJ6U8Pd7AaGSizo8l0egJjeRfPlUcf2o9aMPSFuwM0Bjbu2N2fMTQl1dE4ofc G4kTQ1xx9fokfRymsuyrGUocPFZ4ADZ9Xay2w= 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=LFg4AyxhOkrmj2m8GgLtBQsrwYL1m+vTuPDFyai2hnY=; b=xSIBOkmCwOpFS/Ot2pxB6IwGjj/+t75gNeDV7YwlnflvsV5j3LVZ2FKhxjN7ut76SI oid1LS4ZwXncovw0/8zMKIpzMeQuARjrRf0lLbFaK1pGK/u2VitSOKzHDsCF1mYieDzA H783crP4gzDS6GskGa/rR1ZfGKSEdiXnvmM2qXOeU+jk224nuuM00jxoE3MtefT/TeNC JwTJGKb+3S23A5TXGr+h7EmIWYKwlBf+yJlume8AdQHOGEGVJfLVL9m8DOaa/mwgmmd6 29UreXSJu3EVXipAlJWvyEf6PfU2/VaP5SHmb8WCgGl4QQu6UrjdbRIQoN7FDgYHtdIq 0VPA== X-Gm-Message-State: AOAM532A6Won6rfFE0epeLJvTlu7A4cUWSyvNxU9BdrmI60BL+s98LaJ 4DmT2j3TsLg0ayecBUC2sjLbzTNrxqvDcx5z X-Received: by 2002:a2e:8150:: with SMTP id t16mr284153ljg.357.1632926861085; Wed, 29 Sep 2021 07:47:41 -0700 (PDT) Received: from mail-lf1-f42.google.com (mail-lf1-f42.google.com. [209.85.167.42]) by smtp.gmail.com with ESMTPSA id e25sm13244lfn.82.2021.09.29.07.47.38 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 29 Sep 2021 07:47:39 -0700 (PDT) Received: by mail-lf1-f42.google.com with SMTP id z24so11693415lfu.13 for ; Wed, 29 Sep 2021 07:47:38 -0700 (PDT) X-Received: by 2002:a2e:a7d0:: with SMTP id x16mr309494ljp.494.1632926858377; Wed, 29 Sep 2021 07:47:38 -0700 (PDT) MIME-Version: 1.0 References: <20210928211507.20335-1-mathieu.desnoyers@efficios.com> In-Reply-To: <20210928211507.20335-1-mathieu.desnoyers@efficios.com> From: Linus Torvalds Date: Wed, 29 Sep 2021 07:47:22 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [RFC PATCH] LKMM: Add ctrl_dep() macro for control dependency To: Mathieu Desnoyers Cc: Will Deacon , "Paul E. McKenney" , Peter Zijlstra , Segher Boessenkool , Linux Kernel Mailing List , Alan Stern , Andrea Parri , Boqun Feng , Nick Piggin , David Howells , Jade Alglave , Luc Maranget , Akira Yokosawa , linux-toolchains@vger.kernel.org, linux-arch Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 28, 2021 at 2:15 PM Mathieu Desnoyers wrote: > > Introduce the ctrl_dep macro in the generic headers, and use it > everywhere it appears relevant. The control dependency is so subtle - just see our discussions - that I really think every single use of it needs to have a comment about why it's needed. Right now, that patch seems to just sprinkle them more or less randomly. That's absolutely not what I want. It will just mean that other people start sprinkling them randomly even more, and nobody will dare remove them. So I'd literally want a comment about "this needs a control dependency, because otherwise the compiler could merge the two identical stores X and Y". When you have a READ_ONCE() in the conditional, and a WRITE_ONCE() in the statement protected by the conditional, there is *no* need to randomly sprinkle noise that doesn't matter. And if there *is* need ("look, we have that same store in both the if- and the else-statement" or whatever), then say so, and state that thing. Linus