Received: by 2002:ac0:950c:0:0:0:0:0 with SMTP id f12csp3379396imc; Wed, 13 Mar 2019 16:55:39 -0700 (PDT) X-Google-Smtp-Source: APXvYqySNBuFbaHq1qL9+aBT7cB4Kz/4TGizXnywxVsAeWX3YW5FkbJpKNLKD4TkbYkSoJFObmsC X-Received: by 2002:a63:f84d:: with SMTP id v13mr42915679pgj.384.1552521338952; Wed, 13 Mar 2019 16:55:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552521338; cv=none; d=google.com; s=arc-20160816; b=aYGI8PstU2wTM780xxZrSr05K6qpR1WoDBAKwI/69DR6J1e1js3+YfRSKTx8MBLeAc utxZdd+5cKXY7ygoWPWFRrO5LoFgNCohdB8bdP8uN74qRLgSGiD7pxFh8WKb6+VRQsC3 EHQ4zKG5klOYQYOxtkZdxplpeg74fzloUzcS+6W/xcVAN57dcE/DnHgjZkUx1VwGY5hV GlxjYo1G1wZFG35Tlj5yp5/KuuQp3aowApJHwVTsndLreS7MTMtUVF1Jtn1DwFiQk5wT 2Gz1LL2Vz/JLTrCKcSz59HWvg8avxzlLO7lrxDKBtOhxUGtf6NuC8gB+/SZ90VrlcywZ dtXw== 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:mime-version :message-id:date:references:in-reply-to:subject:cc:to:from :dkim-signature; bh=4r1t1dMqNtFks28Rn2JjRV6yw+6RsCTbtKIKKd7oQmA=; b=bPNTf+DdXzM80ySlQQZjdsJMHZYeHnxOJddlkUyZd8uql22cyZLVjsuGJ02f1pU16S qGULgCfZqAVGJFjKEo5dfPyYTttSdbASBwPMAIg2llWbsKY+lRj2dl564F+AzfaXTSq5 voLc4UGZrx2XpURX8rjJSRqTQjmmJMaLHncljrF9r7AzL1nOMEDpn0sR2/E9lbJ3mmI3 XCuIC2cB7xDIYOjbqnDDBUMYd8M0JrfQjDz2UvBNNHs+kpF4rSZvGHI3FyWBX7WAt9O+ JgN9JmnjPQ1n3O0nCf2RgOPZbirmd5FUQcZjGUP6iRbLmUMPcEtfnHG+6BMmWYd63uZ/ UkYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@axtens.net header.s=google header.b=q4tx4eEs; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id gn10si11877535plb.94.2019.03.13.16.55.23; Wed, 13 Mar 2019 16:55:38 -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=@axtens.net header.s=google header.b=q4tx4eEs; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727113AbfCMXyp (ORCPT + 99 others); Wed, 13 Mar 2019 19:54:45 -0400 Received: from mail-pg1-f194.google.com ([209.85.215.194]:33322 "EHLO mail-pg1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726326AbfCMXyp (ORCPT ); Wed, 13 Mar 2019 19:54:45 -0400 Received: by mail-pg1-f194.google.com with SMTP id h11so2674653pgl.0 for ; Wed, 13 Mar 2019 16:54:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=axtens.net; s=google; h=from:to:cc:subject:in-reply-to:references:date:message-id :mime-version:content-transfer-encoding; bh=4r1t1dMqNtFks28Rn2JjRV6yw+6RsCTbtKIKKd7oQmA=; b=q4tx4eEsEbYudnlQn7kAa8a/5AEE/S3NHEv3hQ0QWs0lqGoycQ1lImoPF4WG8bskUM pDAjHTnDcv/Xc8GPNvHCU2V1zNhuroC6V39bEPgM0EWPMPsG3Vlj/Ha9VKqy6J7dQCkO /xLGd7dVxzBER1NQ73UK+aBfy7qNwnjJ+xvAg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:in-reply-to:references:date :message-id:mime-version:content-transfer-encoding; bh=4r1t1dMqNtFks28Rn2JjRV6yw+6RsCTbtKIKKd7oQmA=; b=EMvExc9UMoS/KGUvTApJ4pdiHpCXnqNHLsTuH7I+IRotVfldvSuxdKpPBhicWdNLNk xXA1GVPw3GN+OSfYx2mt4HL2Ym1J97JeAI0ooH0EsK8jxHejKJrNgFkSSbnkeWksO6jf rqPysrqwCtu4NM6o5LGokvOXbXrHO89MzGHg2rGhIOzQtb/sOXTucQpT4TlFdAGnHscw zdYB379+/AS20tzx+6K/lByQ6tBx4urqktrKSZHkPeHQVG13nU/lxRit06HfiAT3uTC/ AVHrpkUFSzxRkILwNpZsyRCb16ck/Qb7yHjM07jdiRuqgeXWAPhhb7IkhESQI2BnOvRy Wdjg== X-Gm-Message-State: APjAAAXpnbW5PupBDYSW/Ec1nWU1WPtq/HP1Y2EB2B+E6ZsWsz4H2hZB G+2aOOHTSNcRUJV5HUUctYekR6SCi1g/9Q== X-Received: by 2002:a63:1602:: with SMTP id w2mr13338023pgl.406.1552521283908; Wed, 13 Mar 2019 16:54:43 -0700 (PDT) Received: from localhost (124-171-209-25.dyn.iinet.net.au. [124.171.209.25]) by smtp.gmail.com with ESMTPSA id l184sm19982642pfc.41.2019.03.13.16.54.42 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 13 Mar 2019 16:54:42 -0700 (PDT) From: Daniel Axtens To: Alastair D'Silva Cc: Alastair D'Silva , Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Nicholas Piggin , Mahesh Salgaonkar , "Naveen N. Rao" , Christophe Leroy , Michal Hocko , Andrew Morton , Mike Rapoport , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/1] arch/powerpc: Rework local_paca to avoid LTO warnings In-Reply-To: <20190313034208.13134-1-alastair@au1.ibm.com> References: <20190313034208.13134-1-alastair@au1.ibm.com> Date: Thu, 14 Mar 2019 10:54:39 +1100 Message-ID: <87ef7atjnk.fsf@dja-thinkpad.axtens.net> MIME-Version: 1.0 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" writes: > From: Alastair D'Silva > > 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 > > This patch reworks local_paca into an inline getter & setter function, > which addresses the warning. > > Generated ASM from this patch is broadly similar (addresses have > changed and the compiler uses different GPRs in some places). Ditto to Christophe's comment; I'd love to know how to build this so I can actually see the differences. Perhaps you could bundle up all the required changes and send it as a patch series with a cover letter explaining this? > +static inline struct paca_struct *get_paca_no_preempt_check(void) > +{ > + register struct paca_struct *paca asm("r13"); > + return paca; > +} Isn't the convention to have the { on the same line as the function, or am I horrible mis-remembering things? Should these functions be __always_inline? Regards, Daniel > + > +static inline struct paca_struct *get_paca(void) > +{ > +#if defined(CONFIG_DEBUG_PREEMPT) && defined(CONFIG_SMP) > + /* > + * Add standard checks that preemption cannot occur when using get_paca= (): > + * otherwise the paca_struct it points to may be the wrong one just aft= er. > + */ > + debug_smp_processor_id(); > +#endif > + return get_paca_no_preempt_check(); > +} > + > +#define local_paca get_paca_no_preempt_check() > + > +static inline void set_paca(struct paca_struct *new) > +{ > + register struct paca_struct *paca asm("r13"); > + paca =3D new; > +} > + > + > extern void copy_mm_to_paca(struct mm_struct *mm); > extern struct paca_struct **paca_ptrs; > extern void initialise_paca(struct paca_struct *new_paca, int cpu); > diff --git a/arch/powerpc/kernel/paca.c b/arch/powerpc/kernel/paca.c > index 913bfca09c4f..ae5c243f9d5a 100644 > --- a/arch/powerpc/kernel/paca.c > +++ b/arch/powerpc/kernel/paca.c > @@ -172,7 +172,7 @@ void __init initialise_paca(struct paca_struct *new_p= aca, int cpu) > void setup_paca(struct paca_struct *new_paca) > { > /* Setup r13 */ > - local_paca =3D new_paca; > + set_paca(new_paca); >=20=20 > #ifdef CONFIG_PPC_BOOK3E > /* On Book3E, initialize the TLB miss exception frames */ > --=20 > 2.20.1