Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp1403448ybt; Thu, 2 Jul 2020 04:41:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJySAcIJNzEsZksd15CNUJjeKGZyKmTEX2O/9qfxfBo6zFKTZadJNaR2J8iY/FwRN2wy3CPS X-Received: by 2002:a05:6402:1d14:: with SMTP id dg20mr19331957edb.23.1593690077199; Thu, 02 Jul 2020 04:41:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593690077; cv=none; d=google.com; s=arc-20160816; b=z1b5cIuj/9DhgxiJTt4YE9CtV1N3NlAtV3bKrglY13neTCBkY4cxy18tlhqjxH021p HqdZ146kAD+UUEfWkPhu6UctzR9NPq5FYaJ5FjaATc901KJwHq05wLVUc6eRlb/t4+cg t9xSjM3AuZHrpLX6vA2FAVWcNeHoh6UPYQNQOW3+HEpPf02u8+gTXi/JgVxOmTXU8h49 o+yUtTgEvAd0miGcy9mnTK5ntwTf11aD0Xu2q3zPkziIEvjfg1/tbvH8p8M2cLcnoyGj +5xezrWXuzBOf/JPmn/nQQtJrl3dGOeRedmZxPO9nG7SS6utm+QT6TUWDH9qdsEjuwM6 KRmQ== 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; bh=h1oin6pPG3RxfaAfq5w+sZ+I/ZnTsn1u3Thyi5rvsHA=; b=XcPKJ9zsYLOcvILmNbOBTMWFodAhNJAS3Y2EYdF+O6q0ckVYNK32K0jKcQ/s2qzsLK ++p8DBykWF1EXWjBOgma6Qgl0tcZjTEtAufja6GtWQSLfMhNJWXAtWrLi3sQe6M/X2t2 se63qcQ5YVSH2WxLlHiUyFPDdPGysUg4s1dHMEyvK57W3K29pltWIh//XPTsFsMAqhbB 6+b5MTkq88qUclOCI25nX/nQLeC7rzpemJhOdGBgXEV+RoBAXUftJd9wMm8P5m0m2xVK F6zuyM3d30xLDimN1+dzw9yNHwHIHqQWt9OcGNROfdBAb8MwaVKRO47ni62U4DUxjMRW DR3w== ARC-Authentication-Results: i=1; mx.google.com; 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 bt10si5790836edb.146.2020.07.02.04.40.54; Thu, 02 Jul 2020 04:41:17 -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; 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 S1728669AbgGBLja (ORCPT + 99 others); Thu, 2 Jul 2020 07:39:30 -0400 Received: from mout.kundenserver.de ([212.227.126.130]:34081 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727016AbgGBLj3 (ORCPT ); Thu, 2 Jul 2020 07:39:29 -0400 Received: from mail-qk1-f176.google.com ([209.85.222.176]) by mrelayeu.kundenserver.de (mreue010 [212.227.15.129]) with ESMTPSA (Nemesis) id 1MyJx6-1isHMh3GRg-00ykb7; Thu, 02 Jul 2020 13:39:27 +0200 Received: by mail-qk1-f176.google.com with SMTP id e13so25256271qkg.5; Thu, 02 Jul 2020 04:39:27 -0700 (PDT) X-Gm-Message-State: AOAM532z0IHA9N1mAsG65XlCWqo+0pwbShicaHgYkplIDL+zOJ4B9Fdd Gx0V0WAJRgyl1kE6Xf/FAxj82S5DvTjR08HdYBs= X-Received: by 2002:a37:9dd6:: with SMTP id g205mr30820571qke.352.1593689966522; Thu, 02 Jul 2020 04:39:26 -0700 (PDT) MIME-Version: 1.0 References: <20200630173734.14057-1-will@kernel.org> <20200630173734.14057-5-will@kernel.org> <20200702093239.GA15391@C02TD0UTHF1T.local> <20200702094833.GA16248@willie-the-truck> <20200702111832.GC16418@willie-the-truck> In-Reply-To: <20200702111832.GC16418@willie-the-truck> From: Arnd Bergmann Date: Thu, 2 Jul 2020 13:39:10 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 04/18] alpha: Override READ_ONCE() with barriered implementation To: Will Deacon Cc: Mark Rutland , "linux-kernel@vger.kernel.org" , 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 , Boqun Feng , Catalin Marinas , Linux ARM , alpha , virtualization@lists.linux-foundation.org, Android Kernel Team Content-Type: text/plain; charset="UTF-8" X-Provags-ID: V03:K1:Z8zyvq6vDbeYzAhJCb6eVc2WB9OLAma8FkNnVfzP5LIPHoG/zM3 H+stHIIcLhAOQVdPGVb+yvmXZS6bZvAlPlPGAb7K3XN/Yf/9tiD+LfyrHyrF2jie4hgS9KZ irhd23yNkSatHVfb8y2fRt4J+qOAfrpIFB+YlKB8CPwZ0m5soww1dXiL+e4/fBrJvO0u51V FIQm29ysC2PM1GqgInKpw== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:MVQPFMqFHCg=:Mc/Fzv3M0wGaJGNRmiZWUe KhM7kbvbSIBkOSpRLKpn2mQuHZQiboCZGmj68hm2SMimxXdnYI3wYcK7GopZhk+JR3aBa1wbc b1yaKMwUqylhcFZNngxpMvDzlTF1PvFIjy1TTaAhiTRUB9+xeBPFgbS05UWQRwSmi2JAp+DOb w9PpjmmcLdJhOqQzTTiFB20BJKu26jnzomBTvGHtCKhc9ykIackRn29iZzaFfpnZvSRmnkvtQ nRB1TJtCrCSzEq2cuZ3HgSGJM0VJ7lBsDmQcm5XEh8rI8t/0TOOtezYCP2qeHZMi2E7wldego 58hv1Ra6Ath2DLPfjcT9qJbkmo/521T0VPquIdh/1enx7hnlCBxsv8gxG2QnI8BYnZ3fTUTbQ qR3eaMFvTbbNBLDZTj2gNWGUbSrcyEqWPBu76Rmq+UU/d+W1zne8vnaUNyNjsJuIZAAqqnG2b UU8wfrD4HFvkfBctfr/Fi7vwMMXIF3BMSoOp78QP8Qj4tJwVoeCI1Sd1EBvtrBR2wQPmOrS68 eREemZPiU1odDD2L1M3yLfpnjayDnchDXD/nZlp6QVeA6t0OqPfXZm0BQaUv98iolzQP8HxjA 9XW1RGsmMsY/mMjUh2fyz5dymegWy+bpNe76EEzhw7+laAeDZEGO3I15Mx6eE0MRiuUjwffdQ 5It73uUIRMFuiNK89mNjqT2VH+pSxQ4tl28Zqogpjw/CBt72jxVvhtO+89/7RLoZEz1l6X7Gy hdJ0rZ5ohsb3nY2vodf3TGVAKZyMGgO9S+QpihT/Ypet1XCDCqkCdn6XMwIkInXyR4v4dvNJm Y3SqJsvXjFHzffKoa+nDO8VFyuSx0FcmDugZDFctFRy2lf2Cw4= 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 1:18 PM Will Deacon wrote: > On Thu, Jul 02, 2020 at 12:08:41PM +0200, Arnd Bergmann wrote: > > On Thu, Jul 2, 2020 at 11:48 AM Will Deacon wrote: > > > On Thu, Jul 02, 2020 at 10:32:39AM +0100, Mark Rutland wrote: > Not sure I follow you here, but I can confirm that what you're worried > about doesn't happen for the usual case of a pointer-to-volatile scalar. > > For example, ignoring dependency ordering: > > unsigned long foo(volatile unsigned long *p) > { > return smp_load_acquire(p) + 1; > } > > Ends up looking like: > > unsigned long ___p1 = *(const volatile unsigned long *)p; > smp_mb(); > (volatile unsigned long)___p1; > > My understanding is that casting a non-pointer type to volatile doesn't > do anything, so we're good. Right, I mixed up the correct (typeof(*p))___p; with the incorrect *typeof(p)&___p; which would dereference a volatile pointer and cause the problem. The code is all fine then. Arnd