Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp4561276pxb; Thu, 14 Oct 2021 07:39:42 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzEl8ctlci96VKEwCqxDVz4XDIjS7zJlII5nbvVlttuyttaQbNiKnJTE3WXuqxh9e+uchty X-Received: by 2002:a17:90a:1950:: with SMTP id 16mr6463064pjh.126.1634222382580; Thu, 14 Oct 2021 07:39:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634222382; cv=none; d=google.com; s=arc-20160816; b=wkWdE8ntrxy9oiQTBlBJjVJHboaoYICoY2klC7LTNeUQIWkdCmqAPrxSFIuBfjoWzg dCjz2QGDFL67YNnD+YmhLCwvRcCgLh2fpFuoryUmB1BHxG7e5yB4uvBRVD5QbPsyO0WS Uuq9ultk3IcQOQvj+KSIqI7mn+3KIUWpZplq2/JDT5lF9XtRFP/xMd24RUqZjuz/Ph0S wYVFVsnB4NvSQUIzDPl5+AI+cmejsRafpJ7Zf4gdR/8AS3rH5rrWbzvdjukWRpyydNdU 4J0wDkwVzpKxaNsvR52y997EzkL+pC1HW6+JgivM/gdjz/z9BGL84bk/YcvCAWvgwW37 M/Jw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject:dkim-signature; bh=ZscIr80ImXb4UJ7H1Vo//8G5aoS2JEIpFbKo7Ab/iiU=; b=Hkqebir4ui1h2t9PmTZkcAJfHvTWtL0xsy0viqkLU9e+k9OoqSHSZ/i8YsnH12uYt9 JSB3HxUbmfTU9g0kYhNT/gJE5EpJNSCdZChDFX5HcN8+Puza1Ye5rY1nBVsxIkZ6njaC eIS5dUAGXqcJ1ghXhVUhKHZIly5GiOmbw1VL5T1kcbTmtr76Cbs/16ffaHj4Mh6SnTbO 8MhDhG4RXE6ILhHC+O/Zrwba2PeHh3NcwxJbP6veNFhHdbsQ8avoU35ouzUtRVUrx+lT cpiZqEOgu1tyEA7puS+bpawQZNroA4dBK5D8EajwEEZ4RjjO3QtsqWz9tcmAXcpGt30C IjtA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=CZCerCfu; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id o11si3991717pgn.123.2021.10.14.07.39.29; Thu, 14 Oct 2021 07:39:42 -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=@gmail.com header.s=20210112 header.b=CZCerCfu; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231157AbhJNObw (ORCPT + 99 others); Thu, 14 Oct 2021 10:31:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40206 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230126AbhJNObw (ORCPT ); Thu, 14 Oct 2021 10:31:52 -0400 Received: from mail-pf1-x429.google.com (mail-pf1-x429.google.com [IPv6:2607:f8b0:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 599F4C061570 for ; Thu, 14 Oct 2021 07:29:47 -0700 (PDT) Received: by mail-pf1-x429.google.com with SMTP id t184so4757662pfd.0 for ; Thu, 14 Oct 2021 07:29:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=ZscIr80ImXb4UJ7H1Vo//8G5aoS2JEIpFbKo7Ab/iiU=; b=CZCerCfuvS4xkcFc84KrMnQYQZiXqC1+Z52x/58+C1KTgiKnH1+P2bzrYDJW8b6rpR 3PcRGjSgieALgMd2Uu9UsGoxDqtiBTa6bVTgZTzqc/76MAgB4hq0/xndawrXcotmoysZ Ruiwe9BEdfYFq2u543Uj7bc43tFf+TECsEBKMNEuKNe2v1bq2m67oFVJXji+DfkEJQgB h5yWeMrh+5gOZZUUy/btvngHtOdIy81sl79Nh81pBD9Dl3Rt2gIC2uOPl9ySNOcesk7F heLy7yh2CRQdcWLBqM6QjF9+FmPWy6wG+dCvpG9L+Z8/1KEMHzvdT8P108UBixuauWEV AaBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=ZscIr80ImXb4UJ7H1Vo//8G5aoS2JEIpFbKo7Ab/iiU=; b=EkYaSsD2TJyi0e40axMLXsKaRv0qVzrbY7ygciKBhxGejyPhCpRD2t1GbRPIt2/LK4 emPs8kZv74yTCTKHG5Qv8huXBWbv2XDA5lk/nExJ1tJ26Y9ENxfLlROnH8fua88yqCYx QZ/vSKdaed5PtjNaXRGEMrl5fzy4fxgeCYxkXy2EKk/N/R5iusr8naF3NSJwvD4x7KiD E4e9EXkPYrQ0SjXlU3g4iJ2QsnS/Cv7ZBQ5eED9GXp5uo4dqtb+AzYZ87MS2EyMjaJXA ttNyqXv+N2R8D0bfllyZqNawAFceibdjwXGSnarbMVe+Irm8iTjswpCgALcL4nkbgxLN 0YAg== X-Gm-Message-State: AOAM531Zc3Rzwk+xJleSZOxYYPeiWhbFqKwDD5exEVyvv5Poua3P2S/u VHpATBu6LlBwOiB6cW0c6m4= X-Received: by 2002:a63:d30e:: with SMTP id b14mr4458950pgg.454.1634221786807; Thu, 14 Oct 2021 07:29:46 -0700 (PDT) Received: from [192.168.11.5] (KD106167171201.ppp-bb.dion.ne.jp. [106.167.171.201]) by smtp.gmail.com with ESMTPSA id nu16sm2944747pjb.56.2021.10.14.07.29.45 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 14 Oct 2021 07:29:46 -0700 (PDT) Subject: Re: data dependency naming inconsistency To: "Michael S. Tsirkin" Cc: linux-kernel@vger.kernel.org, paulmck@linux.ibm.com, Akira Yokosawa References: <20211011064233-mutt-send-email-mst@kernel.org> <6c362de5-1d79-512c-37d0-81aaf5d335d1@qa2.so-net.ne.jp> <20211014013156-mutt-send-email-mst@kernel.org> From: Akira Yokosawa Message-ID: Date: Thu, 14 Oct 2021 23:29:43 +0900 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: <20211014013156-mutt-send-email-mst@kernel.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [-CC akys: my 2nd address] On Thu, 14 Oct 2021 01:37:17 -0400, Michael S. Tsirkin wrote: > On Thu, Oct 14, 2021 at 01:43:24PM +0900, Akira Yokosawa wrote: >> On Mon, 11 Oct 2021 07:07:08 -0400, Michael S. Tsirkin wrote: >>> Hello Paul, all! >> >> Hello Michael, >> >> I thought Paul would respond soon, but looks like he has not >> done so. >> So, I'm trying to give some hint to your findings. >> >>> I've been reading with interest Paul's posts about Rust interactions with LKMM >>> https://paulmck.livejournal.com/63316.html >>> and in particular it states: >>> A data dependency involves a load whose return value directly or >>> indirectly determine the value stored by a later store, which results in >>> the load being ordered before the store. >>> >>> This matches the perf book: >>> A data dependency occurs when the value returned by >>> a load instruction is used to compute the data stored by >>> a later store instruction. >> >> You might likely be aware, but these concern "data dependency", >> not a _barrier_. >> >>> >>> however, memory-barriers.txt states: >>> >>> A data dependency barrier is a partial ordering on interdependent loads >>> only; it is not required to have any effect on stores, independent loads >>> or overlapping loads. >>> >>> It also says: >>> A data-dependency barrier is not required to order dependent writes >>> because the CPUs that the Linux kernel supports don't do writes >>> until they are certain (1) that the write will actually happen, (2) >>> of the location of the write, and (3) of the value to be written. >> >> These concern the historic "data-dependency barrier", or >> [smp_]read_barrier_depends(), which existed until Linux kernel v4.14. Ah... I should have said ", which existed prior to Linux kernel v4.15". This invited off-by-one error below... >> >>> >>> so the result it the same: writes are ordered without a barrier, >>> reads are ordered by a barrier. >>> >>> However, it would seem that a bit more consistency in naming won't >>> hurt. >> >> So, I don't think the historic term of "data-dependency barrier" >> can be changed. >> >> I guess the right approach would be to further de-emphasize >> "data-dependency barrier"/"data dependency barrier" in >> memory-barriers.txt. >> >> Rewrite by commit 8ca924aeb4f2 ("Documentation/barriers: Remove >> references to [smp_]read_barrier_depends()") did some of such >> changes, but it failed to update the introductory section of >> "VARIETIES OF MEMORY BARRIER". >> The part Michael quoted above belongs to it. >> I don't think it has any merit keeping it around. >> >> Also, there remain a couple of ascii-art diagrams concerning >> in the first part of "EXAMPLES OF MEMORY >> BARRIER SEQUENCES" section, which, I think, can be removed as well. >> >> Hope this helps clarify the circumstances. > > It does, thanks! It might be worth adding a sentence along the lines of > > "NB: a data dependency barrier is distinct from a data dependency: it's > a barrier that used to be required in the presence of a data dependency. > Since v4.14 Linux no longer offers an API for a data dependency barrier. Since v4.15 > Instead, using READ_ONCE is sufficient for ordering in the presence of a > data dependency". Maybe. But I'm more inclined to get rid of remaining contents related to the "data dependency barrier". Thanks, Akira > > >> Paul, what is your take on the naming of "data dependency"/ >> "data dependency barrier"? >> >> Thanks, Akira >> >>> >>> Thanks, >>> >>> -- >>> MST >