Re: [GIT PULL] ftrace: Fixes for v6.13

From: Linus Torvalds
Date: Mon Dec 16 2024 - 13:09:52 EST


On Sun, 15 Dec 2024 at 17:24, Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:
> >
> > IOW, instead of dynamically creating a temporary buffer and adding
> > that 'x' by hand, why wasn't that just a 'sed' script and done
> > statically?
>
> I'm also OK with that. Should that be done for 6.13 or something to be
> added for 6.14?

So a scripted thing could probably be done right now, assuming it's
obvious enough. Something like

git grep -l TP_printk.*%p |
xargs sed -i '/TP_printk/s/%p\([^a-zA-Z]\)/%px\1/'

would seem to do the RightThing(tm) for at least simple cases. And I
didn't actually find any cases of people using %p with precision
modifiers or anything like that, so "simple cases" seems to be all
that exists.

What the above does *not* do is handle any multi-line cases, and there
are probably several of those.

That said, honestly, looking at the resulting diff, I really think a
lot of those %p users are mindless drivel in the first place, and I am
not convinced that the real address is even wanted or needed. I think
people have completely mindlessly added "print out address" without
any actual reason for it.

I'm seeing things like just random usb_request pointers being printed
out, and I'm not convinced that is ever really useful or a situation
where a '%px' is *any* different from a plain '%p' (ie the main thing
I suspect you can do with that value is just say "it's the same
request", and the hashed value works just fine for that).

So I am not convinced that the original reason for the mindless
(runtime) conversion of '%p' to '%px' was really even well-motivated.
I think it was a bad idea, and implemented badly.

End result: instead of doing that automated sed-script (which is
certainly easy, but noisy), I actually think it might be much better
to just remove the runtime '%p' -> '%px' conversion entirely, and see
if anybody even notices - and then when somebody has a good reason for
actually caring about a random kernel data structure address, change
it at *THAT* point.

Linus