Re: [RFC] perf/core: allow ftrace for functions in kernel/event/core.c

From: Song Liu
Date: Fri Sep 24 2021 - 13:15:10 EST




> On Jun 5, 2020, at 3:02 PM, Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:
>
> On Fri, 5 Jun 2020 21:58:48 +0000
> Song Liu <songliubraving@xxxxxx> wrote:
>
>>
>> How does this work in your tests?
>
> I started it, but got distracted by other work. It did not crash with
> the little testing I did do. I wanted to also look at my patch that
> adds tracing to the ftrace directory too.
>
> I'll try to remember to address this some more next week. Feel free to
> ping me again then.

It looks like we dropped the ball more than a year ago.

Adding Andrii and KP, who both hit this limitation in their recent work.
I also hit this again recently. I was trying to use kernel live patch to
fix a perf issue, but realized the whole kernel/events directory is not
ftrace-able. :(


Hi Steven,

I am not sure whether you have got chance to test it more thoroughly.
Optimistically assuming it didn't crash easily :-) , what would you
suggest for our next steps?

Thanks,
Song



Attaching the original RFC/PATCH below.

From: Song Liu <songliubraving@xxxxxx>
Subject: [RFC] perf/core: allow ftrace for functions in kernel/event/core.c

It is useful to trace functions in kernel/event/core.c. Allow ftrace for
them by removing $(CC_FLAGS_FTRACE) from Makefile.

Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
Cc: Ingo Molnar <mingo@xxxxxxxxxx>
Cc: Steven Rostedt (VMware) <rostedt@xxxxxxxxxxx>
Cc: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
Cc: Masami Hiramatsu <mhiramat@xxxxxxxxxx>
Cc: Mark Rutland <mark.rutland@xxxxxxx>
Cc: Jiri Olsa <jolsa@xxxxxxxxxx>
Cc: Namhyung Kim <namhyung@xxxxxxxxxx>
Cc: Alexey Budankov <alexey.budankov@xxxxxxxxxxxxxxx>
Signed-off-by: Song Liu <songliubraving@xxxxxx>
---
kernel/events/Makefile | 5 -----
1 file changed, 5 deletions(-)

diff --git a/kernel/events/Makefile b/kernel/events/Makefile
index 3c022e33c109..8591c180b52b 100644
--- a/kernel/events/Makefile
+++ b/kernel/events/Makefile
@@ -1,10 +1,5 @@
# SPDX-License-Identifier: GPL-2.0
-ifdef CONFIG_FUNCTION_TRACER
-CFLAGS_REMOVE_core.o =3D $(CC_FLAGS_FTRACE)
-endif
-
obj-y :=3D core.o ring_buffer.o callchain.o
=20
obj-$(CONFIG_HAVE_HW_BREAKPOINT) +=3D hw_breakpoint.o
obj-$(CONFIG_UPROBES) +=3D uprobes.o
-
--=20
2.24.1