From mboxrd@z Thu Jan 1 00:00:00 1970 From: Peter Zijlstra Subject: Re: [PATCH] treewide: remove current_text_addr Date: Mon, 27 Aug 2018 09:33:58 +0200 Message-ID: <20180827073358.GV24124@hirez.programming.kicks-ass.net> References: <20180821202900.208417-1-ndesaulniers@google.com> <207784db-4fcc-85e7-a0b2-fec26b7dab81@gmx.de> <81141365-8168-799b-f34f-da5f92efaaf9@zytor.com> <7f49eeab-a5cc-867f-58fb-abd266f9c2c9@zytor.com> <6ca8a1d3-ff95-e9f4-f003-0a5af85bcb6f@zytor.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-snps-arc" Errors-To: linux-snps-arc-bounces+gla-linux-snps-arc=m.gmane.org@lists.infradead.org To: Nick Desaulniers Cc: nicolas.pitre@linaro.org, linux-mips@linux-mips.org, linux-sh@vger.kernel.org, benh@kernel.crashing.org, Will Deacon , paulus@samba.org, mpe@ellerman.id.au, jejb@parisc-linux.org, Geert Uytterhoeven , Catalin Marinas , gor@linux.vnet.ibm.com, mattst88@gmail.com, uclinux-h8-devel@lists.sourceforge.jp, Marc Zyngier , linuxram@us.ibm.com, linux-um@lists.infradead.org, Nicholas Piggin , luto@kernel.org, shannon.nelson@oracle.com, Thomas Gleixner , alex.bennee@linaro.org, rth@twiddle.net, jkosina@suse.cz, LKML , ralf@linux-mips.org, rkuo@codeaurora.org, paul.burton@mips.com, aneesh.kumar@linux.vnet.ibm.com, Greg KH , Andrew Morton , Linus Torvalds List-Id: linux-m68k@vger.kernel.org On Sun, Aug 26, 2018 at 07:52:59PM -0700, Nick Desaulniers wrote: > On Sun, Aug 26, 2018 at 1:25 PM Linus Torvalds > > Instead, maybe we could encourage something like > > > > struct kernel_loc { const char *file; const char *fn; int line; }; > > > > #define __GEN_LOC__(n) \ > > ({ static const struct kernel_loc n = { \ > > __FILE__, __FUNCTION__, __LINE__ \ > > }; &n; }) > > > > #define _THIS_LOC_ __GEN_LOC__(__UNIQUE_ID(loc)) > > > > which is a hell of a lot nicer to use, and actually allows gcc to > > optimize things (try it: if you pass a _THIS_LOC_ off to an inline > > function, and that inline function uses the name and line number, gcc > > will pick them up directly, without the extra structure dereference. > > > > Wouldn't it be much nicer to pass these kinds of "location pointer" > > around, rather than the nasty _THIS_IP_ thing? > > > > Certainly lockdep looks like it could easily take that "const struct > > kernel_loc *" instead of "unsigned long ip". Makes it easy to print > > out the lockdep info. > This is extremely reasonable. I can follow up with the lockdep folks > to see if they really need _THIS_IP_ to solve their problem, or if > there's a simpler solution that can solve their needs. Sometimes > taking a step back and asking for clarity around the big picture > allows simpler solutions to shake out. What problem are we trying to solve? _THIS_IP_ and _RET_IP_ work fine. We're 'good' at dealing with text addresses, we use them for call stacks and all sorts. Why does this need changing?