Received: by 2002:ac0:bc90:0:0:0:0:0 with SMTP id a16csp3937702img; Mon, 25 Mar 2019 22:59:41 -0700 (PDT) X-Google-Smtp-Source: APXvYqxT1bzvvxvzWJOUBqlA59alTB9nIDBMBCNRqVxcLYT+ZxYGJjC/FEJykpZao1MR76h0LjhP X-Received: by 2002:a17:902:784c:: with SMTP id e12mr29439486pln.117.1553579981537; Mon, 25 Mar 2019 22:59:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1553579981; cv=none; d=google.com; s=arc-20160816; b=dJsOiJA68tRGObv1RCZPW5b4p7YBdbgIbfdiPVBjaT9qNjyE4JTHix1bPml8xBruZ8 kPqnkUC6OKWyyRzEu6s2CJhDSybi7BVBssRWj/sst/oVgUMZZLhrAt9F3kRioZaLEHQG SlwyVc/An9LDZE+6+r1oKOuXJ37gb+D6L36kl3K628wbT54RAf/opmV7EhyNuZvFDH/T aZ5sy9IL0Gz3HFkINrMxhsZo3WcBd6tQF7OB8iq3rn0k/1itlz9eLODxhWOWDHJmk52+ vKJj+QMAWMLrdDKQy4j+z2sNr39y4p96aUl7Rj+VsW1eVHcUUTXRVTIKfhdKQhKslhE0 bA9A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:message-id :user-agent:mime-version:in-reply-to:references:cc:to:subject:from :date:dkim-signature; bh=CbYmRGUZEd1iQvum1IXYqF42ybOYTBKz3+p6mg+oYlo=; b=ddsy2qMOoPcY9rD93Lwj5nKu6Z5s4L2CuryTj0PF8C/W+pBguF0QdOvkx53BVS5CTf tN06tZZC5Ka3bvV8ou7HzQ/X+KF+4aqq+oXa9Wnk34rZXm+FMN2/rppg5BAXpBd2TJjG EL2yYR7CJwmcWe7nMjH7JvXwyk6a6Q+/Hbl0+d5qXJmYMIPRp6h71IxthCLzgVYrAWEo ecnzOiDaWZgYM5hILRWwuGHTzrWBFFQsWF/AqBhmW7psFUB92sSfE9UUXSnu6qJs8/m1 VAJkTrPXzcQGDoJHA7yc6hMv3R0xTS4cSzOPfuS7Vvb+T/+w5+g2E4Bkt5OzaTvzGr9D LF6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Ko9TC5vv; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id e1si7212138pls.228.2019.03.25.22.59.26; Mon, 25 Mar 2019 22:59:41 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Ko9TC5vv; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S1726302AbfCZF6v (ORCPT + 99 others); Tue, 26 Mar 2019 01:58:51 -0400 Received: from mail-pl1-f193.google.com ([209.85.214.193]:41527 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725766AbfCZF6v (ORCPT ); Tue, 26 Mar 2019 01:58:51 -0400 Received: by mail-pl1-f193.google.com with SMTP id y5so1112892plk.8 for ; Mon, 25 Mar 2019 22:58:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:subject:to:cc:references:in-reply-to:mime-version :user-agent:message-id:content-transfer-encoding; bh=CbYmRGUZEd1iQvum1IXYqF42ybOYTBKz3+p6mg+oYlo=; b=Ko9TC5vvEKuLwoXWFWzSAreUCqwrexYQMDa9zIoj6ql1FmP/l//6Ugs9azCRPyRu6J 3rB852ZUpel8SIRAf1eA0VXvpeRr6gGfASPseK4uV3ZnuBZcy1lEUTLBEsSL7Db9ANKd 8o8kh2cMlQR9PXoKKK3OkAnDekzGyhdfTLjBPSQi4IrHKdu48rwSnrWUESCOgx7OmYLe NuJ8h6kSYMSPTd/YeqYCrrD9iqEV3RYTRXzclPfWx8vYe19Z6xcDINB/jVaeOe8lzh2j eXmjJGFYw0Du/D5AhoU+ln+15kZ6rEM59plczL2dYyrQq/tDxtpP5uY7calONo898Fl/ 5htA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:subject:to:cc:references:in-reply-to :mime-version:user-agent:message-id:content-transfer-encoding; bh=CbYmRGUZEd1iQvum1IXYqF42ybOYTBKz3+p6mg+oYlo=; b=MTJ4NIWFCJtiujPKuBPu3Iknd+kXHPivZN7dvxwh0c26Zu4aDnYij04cIzLYzTAg7z YWIfBqMYVeIPqEaqHEuXevS9DyTSfeWAGF8DUaKF6onbaRvKbAbcDm5UqumKzWRbkwcL vUVGIcV+KPfRdjMANz7QY8n31U0mQShH8elYx6B/gXtDz5Pb0lJQ4+Xy8JPK63gY6hva 4IBo7x5Nh8rZ7YD3ZUI8CefsiIMahYh6SOBvXqDR9qJx3fh3AxuknyOOJ9jYPCeffyYy W3IfVUDbrtoa5ZMpn4kuzwHREAjo7wahQ8fckvvUiqCi7EBP7rXxDfvyXXWiWweyv+54 cBzw== X-Gm-Message-State: APjAAAU2W4y6KzNdDlbDhLLVdvSz7l0XZ2ptGwG2gCQQFgdWBz4n9G6Y 8MkZGRHrAJyWLdpeBIudTGk= X-Received: by 2002:a17:902:1008:: with SMTP id b8mr28480020pla.120.1553579930670; Mon, 25 Mar 2019 22:58:50 -0700 (PDT) Received: from localhost ([193.114.107.176]) by smtp.gmail.com with ESMTPSA id 25sm22419793pfo.96.2019.03.25.22.58.48 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 25 Mar 2019 22:58:49 -0700 (PDT) Date: Tue, 26 Mar 2019 15:58:43 +1000 From: Nicholas Piggin Subject: Re: [PATCH v2] arch/powerpc: Rework local_paca to avoid LTO warnings To: Alastair D'Silva , alastair@d-silva.org Cc: Andrew Morton , Benjamin Herrenschmidt , Christophe Leroy , linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, Mahesh Salgaonkar , Michal Hocko , Michael Ellerman , "Naveen N. Rao" , Paul Mackerras , Mike Rapoport References: <20190313034208.13134-1-alastair@au1.ibm.com> <20190314023125.10076-1-alastair@au1.ibm.com> In-Reply-To: <20190314023125.10076-1-alastair@au1.ibm.com> MIME-Version: 1.0 User-Agent: astroid/0.14.0 (https://github.com/astroidmail/astroid) Message-Id: <1553579424.0r39b9otz6.astroid@bobo.none> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Alastair D'Silva's on March 14, 2019 12:31 pm: > From: Alastair D'Silva >=20 > When building an LTO kernel, the existing code generates warnings: > ./arch/powerpc/include/asm/paca.h:37:30: warning: register of > =E2=80=98local_paca=E2=80=99 used for multiple global register va= riables > register struct paca_struct *local_paca asm("r13"); > ^ > ./arch/powerpc/include/asm/paca.h:37:30: note: conflicts with > =E2=80=98local_paca=E2=80=99 Isn't this a bogus warning? It doesn't look like there's a way to=20 define it any other way. >=20 > This patch reworks local_paca into an inline getter & setter function, > which addresses the warning. >=20 > Changelog: > V2 > - Address whitespace issues > - keep new implementation close to where the old implementation was >=20 > Signed-off-by: Alastair D'Silva > --- > arch/powerpc/include/asm/paca.h | 37 +++++++++++++++++++++++++-------- > arch/powerpc/kernel/paca.c | 2 +- > 2 files changed, 29 insertions(+), 10 deletions(-) >=20 > diff --git a/arch/powerpc/include/asm/paca.h b/arch/powerpc/include/asm/p= aca.h > index e843bc5d1a0f..2fa0b43357c9 100644 > --- a/arch/powerpc/include/asm/paca.h > +++ b/arch/powerpc/include/asm/paca.h > @@ -34,19 +34,38 @@ > #include > #include > =20 > -register struct paca_struct *local_paca asm("r13"); > - > #if defined(CONFIG_DEBUG_PREEMPT) && defined(CONFIG_SMP) > extern unsigned int debug_smp_processor_id(void); /* from linux/smp.h */ > -/* > - * Add standard checks that preemption cannot occur when using get_paca(= ): > - * otherwise the paca_struct it points to may be the wrong one just afte= r. > - */ > -#define get_paca() ((void) debug_smp_processor_id(), local_paca) > -#else > -#define get_paca() local_paca > #endif > =20 > +static inline struct paca_struct *get_paca_no_preempt_check(void) > +{ > + register struct paca_struct *paca asm("r13"); > + > + return paca; > +} Problem is it now changes the global register variable to a local=20 register variable. The compiler would presumably be within its rights to "cache" that return value or use another register for it, which is not really what we want. Thanks, Nick =