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?