Received: by 2002:ac0:950c:0:0:0:0:0 with SMTP id f12csp3543841imc; Wed, 13 Mar 2019 22:47:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqz48TTb7rH7j7lVeCmJ6/mYaLcaO6ajfEsoNC7Ss3On1rQnZOioqofJtfSQ7yCXvatGCv2+ X-Received: by 2002:a63:ce45:: with SMTP id r5mr10239850pgi.304.1552542436664; Wed, 13 Mar 2019 22:47:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552542436; cv=none; d=google.com; s=arc-20160816; b=QsO1mqfvKxPX4aZJjU2vOcNsjGuYa5LE0O+NWXxA6TuT9ugRf1f3XjVcIDhNP651Bz xy5lZC/Cj19XL1pIU43rzovZFC7qfWM1MR3yFiK+NHvG2eSrQkhc2nEBSHzctbnin9i4 JJbv7VILlyEfkHk9lFDMv5Iad2nsuVhFyTM6M0ifIED3/5Y3B+pkiIDKhCBGhZ4Ta5H0 8qsFaB3Bs6rqNEDKndLLAY1dIXl4ZF0EFmJEhBM95r6+HXgsMfbaf4f7+vPmCmvzHz0R ffJSuvd3PvJEQJG6i7JrOGUtmWtk7kLgENI7QnIs4L684NmXBMLSohVEZNuXEoV5X406 H5zg== 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 :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature; bh=aDIk8/hnkdKEojmbeEOk2Wak98qNGcNYj/PbnsmyxC4=; b=x7LeTibQXMbt/MlEiXFLLcSq1sIVGKSMHhBHJs3owluFe862jpWql0xle8XAmZpH0a i3OnAvli7BfiFmUhDGvuM6z/DTnDjK8ajcKY06cN/2X59DEG+kkFELtjWmtPpwTRcv+8 rXF0bjqf8GSFeZGOcoVSMDXwkTRrIbtNLVEx7y3vjtZrqzLQv+lAtlL9SYoPvxEO5mZl sWR+MgWIvvCJS51LHZ3HracNgXFQAaywaU0uotjtfrpOUYmQjyij+rBfkrinCLYAXoZh kf8kJ/wfia1f6MXiKbgk+KYZu183G80RWg8bZNAoZwfYAzE33R+YvNPPO6HsdkJ7U8qM aqmg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@c-s.fr header.s=mail header.b=pzUjqjfB; 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 g1si11224300pgs.143.2019.03.13.22.47.00; Wed, 13 Mar 2019 22:47:16 -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=@c-s.fr header.s=mail header.b=pzUjqjfB; 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 S1727109AbfCNFqS (ORCPT + 99 others); Thu, 14 Mar 2019 01:46:18 -0400 Received: from pegase1.c-s.fr ([93.17.236.30]:24816 "EHLO pegase1.c-s.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726303AbfCNFqS (ORCPT ); Thu, 14 Mar 2019 01:46:18 -0400 Received: from localhost (mailhub1-int [192.168.12.234]) by localhost (Postfix) with ESMTP id 44Kd476LHyz9tyvj; Thu, 14 Mar 2019 06:46:15 +0100 (CET) Authentication-Results: localhost; dkim=pass reason="1024-bit key; insecure key" header.d=c-s.fr header.i=@c-s.fr header.b=pzUjqjfB; dkim-adsp=pass; dkim-atps=neutral X-Virus-Scanned: Debian amavisd-new at c-s.fr Received: from pegase1.c-s.fr ([192.168.12.234]) by localhost (pegase1.c-s.fr [192.168.12.234]) (amavisd-new, port 10024) with ESMTP id QVhScbPFhy31; Thu, 14 Mar 2019 06:46:15 +0100 (CET) Received: from messagerie.si.c-s.fr (messagerie.si.c-s.fr [192.168.25.192]) by pegase1.c-s.fr (Postfix) with ESMTP id 44Kd47599hz9tyvg; Thu, 14 Mar 2019 06:46:15 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=c-s.fr; s=mail; t=1552542375; bh=aDIk8/hnkdKEojmbeEOk2Wak98qNGcNYj/PbnsmyxC4=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=pzUjqjfBozoYw+FEosznude4NAYAVL4uGSjrBy1ypISwnp/Q0/fgLab0qBgctOWcZ 0Gn3EIO4lCRgtikcX8z6xz8Q0RDG9xiaH01oKyfk6p1fWXDmJcAWY/8vTR8ovzLHYa j+RnD8FhUMvoreJgp8kK5XfBYM5zEKmqTGpnnnFk= Received: from localhost (localhost [127.0.0.1]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 7231E8B74F; Thu, 14 Mar 2019 06:46:15 +0100 (CET) X-Virus-Scanned: amavisd-new at c-s.fr Received: from messagerie.si.c-s.fr ([127.0.0.1]) by localhost (messagerie.si.c-s.fr [127.0.0.1]) (amavisd-new, port 10023) with ESMTP id 34z0MuP418fP; Thu, 14 Mar 2019 06:46:15 +0100 (CET) Received: from PO15451 (unknown [192.168.4.90]) by messagerie.si.c-s.fr (Postfix) with ESMTP id 6B7B58B781; Thu, 14 Mar 2019 06:46:14 +0100 (CET) Subject: Re: [PATCH v2] arch/powerpc: Rework local_paca to avoid LTO warnings To: Alastair D'Silva , alastair@d-silva.org Cc: Benjamin Herrenschmidt , Paul Mackerras , Michael Ellerman , Nicholas Piggin , Mahesh Salgaonkar , "Naveen N. Rao" , Andrew Morton , Michal Hocko , Mike Rapoport , linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org References: <20190313034208.13134-1-alastair@au1.ibm.com> <20190314023125.10076-1-alastair@au1.ibm.com> From: Christophe Leroy Message-ID: <38922e32-3048-e45b-203e-63704a78e7d0@c-s.fr> Date: Thu, 14 Mar 2019 06:46:13 +0100 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.5.3 MIME-Version: 1.0 In-Reply-To: <20190314023125.10076-1-alastair@au1.ibm.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: fr Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Le 14/03/2019 à 03:31, Alastair D'Silva a écrit : > 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 > ‘local_paca’ used for multiple global register variables > register struct paca_struct *local_paca asm("r13"); > ^ > ./arch/powerpc/include/asm/paca.h:37:30: note: conflicts with > ‘local_paca’ > > This patch reworks local_paca into an inline getter & setter function, > which addresses the warning. > > Changelog: > V2 > - Address whitespace issues > - keep new implementation close to where the old implementation was > > Signed-off-by: Alastair D'Silva Reviewed-by: Christophe Leroy > --- > arch/powerpc/include/asm/paca.h | 37 +++++++++++++++++++++++++-------- > arch/powerpc/kernel/paca.c | 2 +- > 2 files changed, 29 insertions(+), 10 deletions(-) > > diff --git a/arch/powerpc/include/asm/paca.h b/arch/powerpc/include/asm/paca.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 > > -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 after. > - */ > -#define get_paca() ((void) debug_smp_processor_id(), local_paca) > -#else > -#define get_paca() local_paca > #endif > > +static inline struct paca_struct *get_paca_no_preempt_check(void) > +{ > + register struct paca_struct *paca asm("r13"); > + > + return paca; > +} > + > +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 after. > + */ > + 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 = new; > +} > + > #ifdef CONFIG_PPC_PSERIES > #define get_lppaca() (get_paca()->lppaca_ptr) > #endif > 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_paca, int cpu) > void setup_paca(struct paca_struct *new_paca) > { > /* Setup r13 */ > - local_paca = new_paca; > + set_paca(new_paca); > > #ifdef CONFIG_PPC_BOOK3E > /* On Book3E, initialize the TLB miss exception frames */ >