Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp382152ybt; Mon, 6 Jul 2020 11:36:21 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyD8iMNHAKTvEZGsuo4AxYPNZMSzZlhmvigTB125W3w5l+cF+y/2LlQVnyH1T9zH0lJI6eT X-Received: by 2002:a50:e387:: with SMTP id b7mr55964759edm.190.1594060581369; Mon, 06 Jul 2020 11:36:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594060581; cv=none; d=google.com; s=arc-20160816; b=bmUnRMH+G33es0kxRzS9V6A9AjRHm/Xs8CqvAknMPx0cqYbZh4IaEMZy4Hik3tT9lU 8Z3qPjMja8xyzakAPP9WuhZRoy7FjJ0bHhkE+QGX5+qxkK5Q0vGZQpOU82Ei2L/Xr+US 7efQ+ZMpb/UOrXT5/7z5j1f2wyfSMIfpM0tHBT+j6fV1WrCMwA0zp+NHQF4UZxf/RVGc 8tIZEFdRJBQ4sg2jCHZOIA4uEcMmjoHnepSSnafyClpEMDm59MjZdbzJCGjSqsydfytS gNJI+MaqVikhM+5wjMkavIxugVH5LpngSfo8zpCu+ECWJ3nJJmW/QbgO04t7yJqjT4tO Xacw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=PouVpHpW2nQZiL79zxkzpT5LqDqmhhn0IJODQhT2fk4=; b=tQIh3CA0p07jek6ecKC73S7BTflhmssCWgA4vuSF5rDNIoNK8b5Z3QX0FXkTxnPvfT 0jQAJRb1E4ihiQlqsHAT9ka9F6adntv7AuCUOwooYVYAD3PXBCGxexv95RxOSf+QlaEV aYcTUpcpKLjScy+zJYthXCuzqOqoZVJR4qmBwOE6Pnbb7Y5aSL4OJ49f86NdT6ljQCzT lp496stRhLKXerbltBpjtNKuly2DE+cjoKik4FNtPGRTfVIpCF35JKFbeh1arp/YqVsV Bu+Q2npFqONlyVP0T/r+YlJ6Q6i/pxqC5Z0mi1a56d6/BvbpQkits4FR5V9M4Q3Ejpo5 c5dw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=pihAVQPm; 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 m12si13179352ejr.298.2020.07.06.11.35.58; Mon, 06 Jul 2020 11:36:21 -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=default header.b=pihAVQPm; 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 S1729774AbgGFSfT (ORCPT + 99 others); Mon, 6 Jul 2020 14:35:19 -0400 Received: from mail.kernel.org ([198.145.29.99]:37852 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729550AbgGFSfS (ORCPT ); Mon, 6 Jul 2020 14:35:18 -0400 Received: from willie-the-truck (236.31.169.217.in-addr.arpa [217.169.31.236]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D2248206DF; Mon, 6 Jul 2020 18:35:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1594060518; bh=L1CbjDcZbuTi+ztU4KBMPGZHPbJI+hhe3kCcYygI0o0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=pihAVQPmOe+iFKvXzWEZmccOMAFXbtPUIoeXKLuLZyeXrYbyOJ6cXySu9bEogjbdh cLDn9jzGmTenZvCFTagNnHqffzlsPGhOGmvjuOt5phD9ZUcu+P3pwzmspR82n/YyNp ck5o8VKYVnNWweouqlXuNVXDuMhuL9ES7pvNRgzU= Date: Mon, 6 Jul 2020 19:35:11 +0100 From: Will Deacon To: Dave Martin Cc: linux-kernel@vger.kernel.org, Mark Rutland , "Michael S. Tsirkin" , Peter Zijlstra , Catalin Marinas , Jason Wang , virtualization@lists.linux-foundation.org, Arnd Bergmann , Alan Stern , Sami Tolvanen , Matt Turner , kernel-team@android.com, Marco Elver , Kees Cook , "Paul E. McKenney" , Boqun Feng , Josh Triplett , Ivan Kokshaysky , linux-arm-kernel@lists.infradead.org, Richard Henderson , Nick Desaulniers , linux-alpha@vger.kernel.org Subject: Re: [PATCH 18/18] arm64: lto: Strengthen READ_ONCE() to acquire when CLANG_LTO=y Message-ID: <20200706183510.GA23766@willie-the-truck> References: <20200630173734.14057-1-will@kernel.org> <20200630173734.14057-19-will@kernel.org> <20200706160820.GC10992@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200706160820.GC10992@arm.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jul 06, 2020 at 05:08:20PM +0100, Dave Martin wrote: > On Tue, Jun 30, 2020 at 06:37:34PM +0100, Will Deacon wrote: > > diff --git a/arch/arm64/include/asm/rwonce.h b/arch/arm64/include/asm/rwonce.h > > new file mode 100644 > > index 000000000000..515e360b01a1 > > --- /dev/null > > +++ b/arch/arm64/include/asm/rwonce.h > > @@ -0,0 +1,63 @@ > > +/* SPDX-License-Identifier: GPL-2.0 */ > > +/* > > + * Copyright (C) 2020 Google LLC. > > + */ > > +#ifndef __ASM_RWONCE_H > > +#define __ASM_RWONCE_H > > + > > +#ifdef CONFIG_CLANG_LTO > > + > > +#include > > +#include > > + > > +#ifndef BUILD_VDSO > > + > > +#ifdef CONFIG_AS_HAS_LDAPR > > +#define __LOAD_RCPC(sfx, regs...) \ > > + ALTERNATIVE( \ > > + "ldar" #sfx "\t" #regs, \ > > ^ Should this be here? It seems that READ_ONCE() will actually read > twice... even if that doesn't actually conflict with the required > semantics of READ_ONCE(), it looks odd. It's patched at runtime, so it's either LDAR or LDAPR. > Making a direct link between LTO and the memory model also seems highly > spurious (as discussed in the other subthread) so can we have a comment > explaining the reasoning? Sure, although like I say, this is more about helping to progress that conversation. Will