2021-10-06 21:09:44

by Song Liu

[permalink] [raw]
Subject: [PATCH] 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.

---
We had some discussions about this last year [1]. Seems that enabling
ftrace in kernel/events won't really cause fatal recursion in the tests.
Shall we give it another try?

[1] https://www.mail-archive.com/[email protected]/msg2174018.html

Cc: Steven Rostedt (VMware) <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Andrii Nakryiko <[email protected]>
Cc: KP Singh <[email protected]>
Signed-off-by: Song Liu <[email protected]>
---
kernel/events/Makefile | 5 -----
1 file changed, 5 deletions(-)

diff --git a/kernel/events/Makefile b/kernel/events/Makefile
index 3c022e33c1091..8591c180b52b3 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 = $(CC_FLAGS_FTRACE)
-endif
-
obj-y := core.o ring_buffer.o callchain.o

obj-$(CONFIG_HAVE_HW_BREAKPOINT) += hw_breakpoint.o
obj-$(CONFIG_UPROBES) += uprobes.o
-
--
2.30.2


2021-10-12 12:44:51

by Peter Zijlstra

[permalink] [raw]
Subject: Re: [PATCH] perf/core: allow ftrace for functions in kernel/event/core.c

On Wed, Oct 06, 2021 at 02:07:32PM -0700, Song Liu wrote:
> It is useful to trace functions in kernel/event/core.c. Allow ftrace for
> them by removing $(CC_FLAGS_FTRACE) from Makefile.
>
> ---
> We had some discussions about this last year [1]. Seems that enabling
> ftrace in kernel/events won't really cause fatal recursion in the tests.
> Shall we give it another try?

I suppose we can give it a go..

2021-10-13 15:50:10

by Song Liu

[permalink] [raw]
Subject: Re: [PATCH] perf/core: allow ftrace for functions in kernel/event/core.c



> On Oct 12, 2021, at 5:42 AM, Peter Zijlstra <[email protected]> wrote:
>
> On Wed, Oct 06, 2021 at 02:07:32PM -0700, Song Liu wrote:
>> It is useful to trace functions in kernel/event/core.c. Allow ftrace for
>> them by removing $(CC_FLAGS_FTRACE) from Makefile.
>>
>> ---
>> We had some discussions about this last year [1]. Seems that enabling
>> ftrace in kernel/events won't really cause fatal recursion in the tests.
>> Shall we give it another try?
>
> I suppose we can give it a go..

Yes, please. :-) Shall we ship it with 5.16?

Thanks,
Song


2021-10-13 16:49:51

by Steven Rostedt

[permalink] [raw]
Subject: Re: [PATCH] perf/core: allow ftrace for functions in kernel/event/core.c

On Tue, 12 Oct 2021 14:42:21 +0200
Peter Zijlstra <[email protected]> wrote:

> On Wed, Oct 06, 2021 at 02:07:32PM -0700, Song Liu wrote:
> > It is useful to trace functions in kernel/event/core.c. Allow ftrace for
> > them by removing $(CC_FLAGS_FTRACE) from Makefile.
> >
> > ---
> > We had some discussions about this last year [1]. Seems that enabling
> > ftrace in kernel/events won't really cause fatal recursion in the tests.
> > Shall we give it another try?
>
> I suppose we can give it a go..

Did you want me to pull this into my tree? My tests usually stress perf
along with ftrace.

-- Steve

2021-10-13 19:17:26

by KP Singh

[permalink] [raw]
Subject: Re: [PATCH] perf/core: allow ftrace for functions in kernel/event/core.c

On Wed, Oct 13, 2021 at 5:47 PM Song Liu <[email protected]> wrote:
>
>
>
> > On Oct 12, 2021, at 5:42 AM, Peter Zijlstra <[email protected]> wrote:
> >
> > On Wed, Oct 06, 2021 at 02:07:32PM -0700, Song Liu wrote:
> >> It is useful to trace functions in kernel/event/core.c. Allow ftrace for
> >> them by removing $(CC_FLAGS_FTRACE) from Makefile.
> >>
> >> ---
> >> We had some discussions about this last year [1]. Seems that enabling
> >> ftrace in kernel/events won't really cause fatal recursion in the tests.
> >> Shall we give it another try?
> >
> > I suppose we can give it a go..
>
> Yes, please. :-) Shall we ship it with 5.16?

This would be super useful for us, perf_event_* functions are very nicely placed
for tracing events like mmap.

>
> Thanks,
> Song
>
>

2021-10-15 17:44:20

by tip-bot2 for Jacob Pan

[permalink] [raw]
Subject: [tip: perf/core] perf/core: Allow ftrace for functions in kernel/event/core.c

The following commit has been merged into the perf/core branch of tip:

Commit-ID: 79df45731da68772d2285265864a52c900b8c65f
Gitweb: https://git.kernel.org/tip/79df45731da68772d2285265864a52c900b8c65f
Author: Song Liu <[email protected]>
AuthorDate: Wed, 06 Oct 2021 14:07:32 -07:00
Committer: Peter Zijlstra <[email protected]>
CommitterDate: Fri, 15 Oct 2021 11:25:31 +02:00

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.

Signed-off-by: Song Liu <[email protected]>
Signed-off-by: Peter Zijlstra (Intel) <[email protected]>
Link: https://lkml.kernel.org/r/[email protected]
---
kernel/events/Makefile | 5 -----
1 file changed, 5 deletions(-)

diff --git a/kernel/events/Makefile b/kernel/events/Makefile
index 3c022e3..8591c18 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 = $(CC_FLAGS_FTRACE)
-endif
-
obj-y := core.o ring_buffer.o callchain.o

obj-$(CONFIG_HAVE_HW_BREAKPOINT) += hw_breakpoint.o
obj-$(CONFIG_UPROBES) += uprobes.o
-

2021-10-16 07:00:21

by Peter Zijlstra

[permalink] [raw]
Subject: Re: [PATCH] perf/core: allow ftrace for functions in kernel/event/core.c

On Wed, Oct 13, 2021 at 12:47:31PM -0400, Steven Rostedt wrote:
> On Tue, 12 Oct 2021 14:42:21 +0200
> Peter Zijlstra <[email protected]> wrote:
>
> > On Wed, Oct 06, 2021 at 02:07:32PM -0700, Song Liu wrote:
> > > It is useful to trace functions in kernel/event/core.c. Allow ftrace for
> > > them by removing $(CC_FLAGS_FTRACE) from Makefile.
> > >
> > > ---
> > > We had some discussions about this last year [1]. Seems that enabling
> > > ftrace in kernel/events won't really cause fatal recursion in the tests.
> > > Shall we give it another try?
> >
> > I suppose we can give it a go..
>
> Did you want me to pull this into my tree? My tests usually stress perf
> along with ftrace.

Hurmph, I just pushed it out, but sure, throw it in.

2021-10-16 11:00:05

by Steven Rostedt

[permalink] [raw]
Subject: Re: [PATCH] perf/core: allow ftrace for functions in kernel/event/core.c

On Fri, 15 Oct 2021 15:27:15 +0200
Peter Zijlstra <[email protected]> wrote:

> >
> > Did you want me to pull this into my tree? My tests usually stress perf
> > along with ftrace.
>
> Hurmph, I just pushed it out, but sure, throw it in.

Keep it in your tree then. I'll just run it through tests locally, and see
if it spits any crumbs out.

-- Steve