Re: [PATCH] ftrace: Show timings of how long nop patching took

From: Steven Rostedt
Date: Tue Dec 03 2024 - 10:18:01 EST


On Tue, 3 Dec 2024 08:21:49 +0100
Christophe Leroy <christophe.leroy@xxxxxxxxxx> wrote:

> > Which should turn the above to:
> >
> > 25850 pages:14 groups: 3
> > ftrace boot update time = [Unavailable]
> > ftrace module total update time = 0 (ns)
> >
> > Which should at least make it not confusing.
>
> Well. Maybe, but at the end what we need is the measured value, if it
> only works on x86 it is just pointless, isn't it ?
>
> trace_clock_local() calls sched_clock()
>
> I don't know about other architectures, but on powerpc sched_clock() is:
>
> notrace unsigned long long sched_clock(void)
> {
> return mulhdu(get_tb() - boot_tb, tb_to_ns_scale) << tb_to_ns_shift;
> }
>
> boot_tb, tb_to_ns_scale and tb_to_ns_shift are not known before
> time_init() is called.
>
> But get_tb() returns a valid value already so it is possible to get the
> ticks and do the calculation later with tb_to_ns()

We could add code to make that work for all archs via arch_xxx() functions.

But as the merge window is already closed, I'll just submit a
"[Unavailable]" patch to Linus as a "fix" and then for the next merge
window we can have code that will allow architectures to print real timings.

-- Steve