Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp60014pxb; Fri, 15 Oct 2021 00:12:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyTY2wexsiv2jd1mcmbWOFc67l/tpmbD0v3rAEZ6PuvuR53cQmehE8vA1j1v5aFWAJ2lhzN X-Received: by 2002:a17:903:124f:b0:13e:25e6:f733 with SMTP id u15-20020a170903124f00b0013e25e6f733mr9631871plh.42.1634281952649; Fri, 15 Oct 2021 00:12:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634281952; cv=none; d=google.com; s=arc-20160816; b=PjRDLqDX7xgks7HycLkH7pIgDPpRlTZL+RGxFIpbOl2A5sI/x/hfbg4bW5aR4NVeFF pIWoeo5kgz90GBrRITeCO/+YZco9ABHgwS5LUKza0VE8mPNIJCco+JUgyk+zFhgYaKhI 3zxHih4LE7+EwcDzA45HdMA+a3uQTJMGFgqdauVhTTy1pIEWbhWY5/RTaWVPv1EH0m6n oqNJFHDbQ+R4OQ9O5hQ3uCOq6Y2deIb6ZGmJg6XGoOCIGTX5HbD3k0hJBUQvqpVysgpz 2rqZd8CaCULKejR0oZpy26/Ofs/fYKvALkA6S1e7KwOgymtQzPIWMJvHbEVPHs4W2KxU dwhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=0pyARasGvzRhPKsAo10W4ky/CN5mepR4N9tKRCmj7NI=; b=j+EXhkrPuJl4+OcxA09SiqLUabow52iQngX1abvYd5BEzrnfXIN9xec0h8876yJmcR SYy3jVdq/dQp8yFvsHI9LnvJ5wO/16c+PiLlfBEENSfGboYLmlMmd/vZB7RoCg3FiuDl 21E3DomxOHTWI9I0qr2vB6o+YZyKtzQrKdZW7mxKUglRRcug4zP1ZebNYIm9oCB0rAfH 3Gm1c0nvbB7gkNzV4I76T4d/6KKEwFGJRPPh4ZKrYQI1EQLUdDUsBjKZCtT0NLicUq9j gcdRm3saB6AVVwfskcx8Q6gr4CPDjJjDxYGtEAWA/23XLX4d/JGi4VuVAiEtLPKwPr5a 3kYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=T8yj7cSo; 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=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y3si14921610pjg.164.2021.10.15.00.12.19; Fri, 15 Oct 2021 00:12:32 -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=@kernel.org header.s=k20201202 header.b=T8yj7cSo; 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=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234284AbhJNXI1 (ORCPT + 99 others); Thu, 14 Oct 2021 19:08:27 -0400 Received: from mail.kernel.org ([198.145.29.99]:43168 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234051AbhJNXIY (ORCPT ); Thu, 14 Oct 2021 19:08:24 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id D4A8061053; Thu, 14 Oct 2021 23:06:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1634252778; bh=pTt9hE/zP7h6eknt1Q7xk/zT7K9OERkXxzhqLIb9hoM=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=T8yj7cSo7Bzs2cc+LX7PbO1F+tngLHx8qp8iZaqsnsrgqfoKjb6EVhOSW80gk0fXO EcLyKiZyuaN+jSf78pbQPWVjoTaIWpAqXsj1DTomrNFyUqWMEueli/uqp3+ODyAUjp gvuZujWSrX68ztwqyn+r6esvl7eMrqGPyQ4g0hfM42OpPy32tlqDUdF+tRE66Dq2nL AE7fl3x9uTZAHdLzX0Q/cSGgKngnrV/eWR4OVPjjvyE7w7GRvAG51PQdGiLIUrPK6/ 5UXGDwz7qIQTKdb0Pqv2+3vC6iIN8PH/ph4f75y+azpnYrycSiVUkh4csi6zdkL4yj WnSM3OsopHchw== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id A33E25C0A06; Thu, 14 Oct 2021 16:06:18 -0700 (PDT) Date: Thu, 14 Oct 2021 16:06:18 -0700 From: "Paul E. McKenney" To: Akira Yokosawa Cc: linux-kernel@vger.kernel.org, "Michael S. Tsirkin" Subject: Re: data dependency naming inconsistency Message-ID: <20211014230618.GL880162@paulmck-ThinkPad-P17-Gen-1> Reply-To: paulmck@kernel.org 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> <8a9ea500-8f8c-129a-2974-4bdda65dbf64@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <8a9ea500-8f8c-129a-2974-4bdda65dbf64@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Oct 15, 2021 at 07:48:09AM +0900, Akira Yokosawa wrote: > On Thu, 14 Oct 2021 23:29:43 +0900, Akira Yokosawa wrote: > > [-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. > > This is because Michael used Paul's old email address. Indeed, my ibm.com email addresses died about two years ago. > Forwarding to his current address. > > Paul, you can see the thread at the lore archive: > https://lore.kernel.org/lkml/20211011064233-mutt-send-email-mst@kernel.org/T/ And thank you for forwarding this. > Thanks, Akira > > >>> 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. As noted by others, the difference is that the first two are about a data dependency, that is a prior load affecting the value stored by a later store. In contrast, the last one is about a data-dependency barrier, which need only affect trailing loads. Trailing stores are already covered by control dependencies. But clearer wording might be good. Suggestions? > >>>> 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". Given that we don't seem to have any more data-dependency barriers, so getting rid of remaining mentions makes a lot of sense to me. Thanx, Paul > > Thanks, Akira > > > >> > >> > >>> Paul, what is your take on the naming of "data dependency"/ > >>> "data dependency barrier"? > >>> > >>> Thanks, Akira > >>> > >>>> > >>>> Thanks, > >>>> > >>>> -- > >>>> MST > >>