Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1551645ybt; Thu, 2 Jul 2020 08:08:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzXVd8SgBRUOY45Zigfom3vIWCtVeVwyMZUPzo2bzxe6dQeM1pJmtN3HN2rMwf75iKcSvME X-Received: by 2002:a05:6402:1805:: with SMTP id g5mr25869804edy.357.1593702516814; Thu, 02 Jul 2020 08:08:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593702516; cv=none; d=google.com; s=arc-20160816; b=iOl1bhXc0Arb/OqZG7GnsPsv0y7tJ2Xee9EQSFrfiH6574JRnlfJ6b9AAHFEU+0Pq7 rYRHxW95tqb5Qsu/mfkjCQDSrx209j7XN+1tK3X6I/poerVLoJqXlCJe7QAyG2j+k5uA XZ8KQjrxv1cNj24O4YcJ8csX7glMKvKySDefQNMPH1Sx23T4CarMB6MdJ0lwMz9P9jXr eYfuQz3MO5/MxTC9L+FNdkWd0fpHly5m5e3zt5jZ7Dgn7JycxpgHkrTF/eOhPSMFevMf 0uaNNTazqNvhoNwpU6itzXhn750t8xe1AOFJPQmtQiMGq5pbpnXv98OJJOGu2xn3bF2P enWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=NwjTcE9AB3lHB1l2CsQFQTvyIOX/+r8AdYJzECU/66k=; b=y2I/skK3gmR6V54C+npZlaDMBPazhBqBFtdx/EOkspRTR2CsD1UlqAPdUz4FjP7W2V XRal/M/Sr63A15jKg3E+GmcXgRllnpO+/iWPBPl2C0Uismj1Sir++6h/Bv3NEngBF82c M/V2uCq0B336ydm00pSHoYhPZipFoQQzT7399Of2MaMU7pdnfC58T37yNMgqlMCMl7NR BDEBjNxXCiwakBo2AN2Wrr5ZJrHCkCvOkqHUD9iRhtppgNW5Xc4EK2ZpkV46oqaBi6Jw Z8ljFUgjFf9ZodSMkuBPWJIGPsC7NrrT5iUhFbjXntS9m93xf1EDQpvGst90sSRx8z7g cj+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=Qh0queby; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a14si5684664ejv.483.2020.07.02.08.08.13; Thu, 02 Jul 2020 08:08:36 -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=@google.com header.s=20161025 header.b=Qh0queby; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729952AbgGBPHe (ORCPT + 99 others); Thu, 2 Jul 2020 11:07:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53534 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729232AbgGBPHd (ORCPT ); Thu, 2 Jul 2020 11:07:33 -0400 Received: from mail-qv1-xf44.google.com (mail-qv1-xf44.google.com [IPv6:2607:f8b0:4864:20::f44]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 525C1C08C5C1 for ; Thu, 2 Jul 2020 08:07:33 -0700 (PDT) Received: by mail-qv1-xf44.google.com with SMTP id p7so12812193qvl.4 for ; Thu, 02 Jul 2020 08:07:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=NwjTcE9AB3lHB1l2CsQFQTvyIOX/+r8AdYJzECU/66k=; b=Qh0queby7v7wR84UVBBPZgmKhsMZ6EUviWjBkzPvzOaYmzkLE/7Cb48nYN1fKM1dEP RIjY37L54/+aNHRDAdX73WDl/w32GJXpjo/fftx4FoNc30PZJxAskQs2chORu7+heSI6 RtAleEaaKvIleusQYZ4sVYmv0JvkVY7zPY/7mQ2zN3oO2c/bpfb14G8CYP26ef+2a+K+ aTnup/4rU7HDxpTrSoDuqKy2t2qgjyLxn0nGQz639B2WWteBulgI5V0j0g+kuvvp9/0r EjemCobxfgkkVUe/FTgg31STbDLHABItM3gINiPEp9nA39A3I5feDcW60XE/SnQ4tOXv 9RJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=NwjTcE9AB3lHB1l2CsQFQTvyIOX/+r8AdYJzECU/66k=; b=T7XNK8f1Sj3Of3HCKr2oKyaYVMbhcejdx8UYywcsBnThyhkwWdGJF60/JCm21WNfK8 fv/9MZQGfwFerERXrEUszsTB/5pAR3UWwKxdLarQi3KLB80lpKr+8quxUblgMPmb2Q76 VwBIPKePO/+sGP+d/A9+L3t+vKrJnxyAzSOtCChW5i4UnfJGWfLrr6+zlFbYf0l4vXDD qI4p9+OvuPayxXC8ox6g2kIFG996VaKKddHmvVLMSJqksdxPRZb1LA4KNkKObIziPZ5K P7mOj9RTWKFwX58cU765xUJ42/tX5EX3pDWbmG6cNIKX86D2gZ3qUnIYIh7ELB8CvFXY ubtQ== X-Gm-Message-State: AOAM530FaZDi2Pi22BW4YGYnT/RoJVG8dJ4uD3Zqb72r89lId8u3gtWR j8/FB8RPpQjOTeZ8XwjpvRZEIeIZmEo5drAoJ2xT9w== X-Received: by 2002:a05:6214:2d2:: with SMTP id g18mr30162630qvu.215.1593702452178; Thu, 02 Jul 2020 08:07:32 -0700 (PDT) MIME-Version: 1.0 References: <20200630173734.14057-1-will@kernel.org> <20200630173734.14057-5-will@kernel.org> <20200702145532.GB16999@willie-the-truck> In-Reply-To: <20200702145532.GB16999@willie-the-truck> From: Joel Fernandes Date: Thu, 2 Jul 2020 11:07:19 -0400 Message-ID: Subject: Re: [PATCH 04/18] alpha: Override READ_ONCE() with barriered implementation To: Will Deacon Cc: LKML , Sami Tolvanen , Nick Desaulniers , Kees Cook , Marco Elver , "Paul E. McKenney" , Josh Triplett , Matt Turner , Ivan Kokshaysky , Richard Henderson , Peter Zijlstra , Alan Stern , "Michael S. Tsirkin" , Jason Wang , Arnd Bergmann , Boqun Feng , Catalin Marinas , Mark Rutland , "moderated list:ARM64 PORT (AARCH64 ARCHITECTURE)" , linux-alpha@vger.kernel.org, virtualization@lists.linux-foundation.org, "Cc: Android Kernel" , "Joel Fernandes (Google)" Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 2, 2020 at 10:55 AM Will Deacon wrote: > On Thu, Jul 02, 2020 at 10:43:55AM -0400, Joel Fernandes wrote: > > On Tue, Jun 30, 2020 at 1:38 PM Will Deacon wrote: > > > diff --git a/arch/alpha/include/asm/barrier.h b/arch/alpha/include/asm/barrier.h > > > index 92ec486a4f9e..2ecd068d91d1 100644 > > > --- a/arch/alpha/include/asm/barrier.h > > > +++ b/arch/alpha/include/asm/barrier.h > > > - * For example, the following code would force ordering (the initial > > > - * value of "a" is zero, "b" is one, and "p" is "&a"): > > > - * > > > - * > > > - * CPU 0 CPU 1 > > > - * > > > - * b = 2; > > > - * memory_barrier(); > > > - * p = &b; q = p; > > > - * read_barrier_depends(); > > > - * d = *q; > > > - * > > > - * > > > - * because the read of "*q" depends on the read of "p" and these > > > - * two reads are separated by a read_barrier_depends(). However, > > > - * the following code, with the same initial values for "a" and "b": > > > - * > > > > Would it be Ok to keep this example in the kernel sources? I think it > > serves as good documentation and highlights the issue in the Alpha > > architecture well. > > I'd _really_ like to remove it, as I think it only serves to confuse people > on a topic that is confusing enough already. Paul's perfbook [1] already has > plenty of information about this, so I don't think we need to repeat that > here. I could add a citation, perhaps? True, and also found that LKMM docs and the memory-barriers.txt talks about it, so removing it here sounds good to me. Maybe a reference here to either documentation should be Ok. > > BTW, do you know any architecture where speculative execution of > > address-dependent loads can cause similar misorderings? That would be > > pretty insane though. In Alpha's case it is not speculation but rather > > the split local cache design as the docs mention. The reason I ask > > is it is pretty amusing that control-dependent loads do have such > > misordering issues due to speculative branch execution and I wondered > > what other games the CPUs are playing. FWIW I ran into [1] which talks > > about analogy between memory dependence and control dependence. > > I think you're asking about value prediction, and the implications it would > have on address-dependent loads where the address can itself be predicted. Yes. > I'm not aware of an CPUs where that is observable architecturally. I see. > arm64 has some load instructions that do not honour address dependencies, > but I believe that's mainly to enable alternative cache designs for things > like non-temporal and large vector loads. Good to know this, thanks. - Joel