Re: [PATCH] fgraph: Use CPU hotplug mechanism to initialize idle shadow stacks

From: Linus Walleij
Date: Wed Dec 11 2024 - 09:23:25 EST


On Wed, Dec 11, 2024 at 12:24 AM Masami Hiramatsu <mhiramat@xxxxxxxxxx> wrote:

> > cd /sys/kernel/debug/tracing
> > cat trace
> >
> > Gives an empty trace :(
> >
> > And:
> >
> > cat current_tracer
> > function_graph
> > cat set_graph_function
> > do_idle
> > cat tracing_on
> > 1
> >
> > So all *is* set up, just not performing
> >
> > I tried to figure out why this happens but I'm not good with tracing
> > internals. Any ideas?
>
> Interesting. Does this happen only on boot-time tracing or after boot too?
> If it does not work only for boot-time, cpuhp_setup_state() may not work
> before starting boot-time function graph tracing.

If I boot without any tracing enabled from the cmdline and:

echo 0 > tracing_on
echo function_graph > current_tracer
echo do_idle > set_graph_function
echo 1 > tracing_on

I don't get any output either.

It works for other functions, such as

echo ktime_get > set_graph_function

It seems it's the set_graph_function thing that isn't working
with do_idle at all after this patch. Why just this function...
The function is clearly there:

cat available_filter_functions | grep do_idle
do_idle

I can also verify that this function is indeed getting invoked
by adding prints to it (it's invoked all the time on any normal
system). Does this have something to do with the context
where do_idle is called? It's all really confusing...

Yours,
Linus Walleij