* Re: [PATCH v1 1/2] perf sched: Avoid segv if tp_handler not set
[not found] ` <adPzEmwDaHq4SsZw@google.com>
@ 2026-05-05 21:56 ` Ian Rogers
2026-05-06 13:10 ` Arnaldo Carvalho de Melo
0 siblings, 1 reply; 5+ messages in thread
From: Ian Rogers @ 2026-05-05 21:56 UTC (permalink / raw)
To: Namhyung Kim
Cc: Peter Zijlstra, Ingo Molnar, Arnaldo Carvalho de Melo,
Alexander Shishkin, Jiri Olsa, Adrian Hunter, James Clark,
Swapnil Sapkal, linux-perf-users, linux-kernel
On Mon, Apr 6, 2026 at 10:53 AM Namhyung Kim <namhyung@kernel.org> wrote:
>
> On Fri, Apr 03, 2026 at 08:29:25AM -0700, Ian Rogers wrote:
> > On Thu, Apr 2, 2026 at 7:42 PM Namhyung Kim <namhyung@kernel.org> wrote:
> > >
> > > On Tue, Mar 31, 2026 at 10:59:52PM -0700, Ian Rogers wrote:
> > > > On Thu, Mar 26, 2026 at 4:20 PM Namhyung Kim <namhyung@kernel.org> wrote:
> > > > >
> > > > > On Fri, Mar 20, 2026 at 11:14:47PM -0700, Ian Rogers wrote:
> > > > > > Doing a `perf sched record` then `perf sched stats report` crashes as
> > > > > > the tp_handler isn't set. Add extra checks that tp_handler is set
> > > > > > before accessing through it.
> > > > >
> > > > > Oh.. unintended use case. :) Probably better to add a dummy handler
> > > > > for `perf sched stats report`.
> > > >
> > > > Perhaps. I'd prefer to land the simpler change as-is.
> > >
> > > Well.. I guess the dummy handler approach would be simpler and perform
> > > better. :)
> > >
> > > Thanks,
> > > Namhyung
> > >
> > >
> > > diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c
> > > index d083e2bb770303a4..9fb5447f9014d026 100644
> > > --- a/tools/perf/builtin-sched.c
> > > +++ b/tools/perf/builtin-sched.c
> > > @@ -4955,6 +4955,7 @@ int cmd_sched(int argc, const char **argv)
> > > .switch_event = replay_switch_event,
> > > .fork_event = replay_fork_event,
> > > };
> > > + struct trace_sched_handler stats_ops = {};
> >
> > Oh, because there's an existing null test on the function pointer we
> > don't need dummy functions, which is what I thought you were asking
> > for. I'm still not convinced this is very intention revealing, but if
> > it works for you then you can have my reviewed-by tag.
>
> Applied this and the patch 2 to perf-tools-next, thanks!
Thanks Namhyung. Did this get accidentally dropped? I'm not seeing it
in perf-tools-next.
Ian
> Best regards,
> Namhyung
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v1 1/2] perf sched: Avoid segv if tp_handler not set
2026-05-05 21:56 ` [PATCH v1 1/2] perf sched: Avoid segv if tp_handler not set Ian Rogers
@ 2026-05-06 13:10 ` Arnaldo Carvalho de Melo
2026-05-06 16:17 ` Namhyung Kim
0 siblings, 1 reply; 5+ messages in thread
From: Arnaldo Carvalho de Melo @ 2026-05-06 13:10 UTC (permalink / raw)
To: Ian Rogers
Cc: Namhyung Kim, Peter Zijlstra, Ingo Molnar, Alexander Shishkin,
Jiri Olsa, Adrian Hunter, James Clark, Swapnil Sapkal,
linux-perf-users, linux-kernel
On Tue, May 05, 2026 at 02:56:02PM -0700, Ian Rogers wrote:
> On Mon, Apr 6, 2026 at 10:53 AM Namhyung Kim <namhyung@kernel.org> wrote:
> > On Fri, Apr 03, 2026 at 08:29:25AM -0700, Ian Rogers wrote:
> > > On Thu, Apr 2, 2026 at 7:42 PM Namhyung Kim <namhyung@kernel.org> wrote:
> > > > On Tue, Mar 31, 2026 at 10:59:52PM -0700, Ian Rogers wrote:
> > > > > On Thu, Mar 26, 2026 at 4:20 PM Namhyung Kim <namhyung@kernel.org> wrote:
> > > > > > On Fri, Mar 20, 2026 at 11:14:47PM -0700, Ian Rogers wrote:
> > > > > > > Doing a `perf sched record` then `perf sched stats report` crashes as
> > > > > > > the tp_handler isn't set. Add extra checks that tp_handler is set
> > > > > > > before accessing through it.
> > > > > > Oh.. unintended use case. :) Probably better to add a dummy handler
> > > > > > for `perf sched stats report`.
> > > > > Perhaps. I'd prefer to land the simpler change as-is.
> > > > Well.. I guess the dummy handler approach would be simpler and perform
> > > > better. :)
> > > > +++ b/tools/perf/builtin-sched.c
> > > > @@ -4955,6 +4955,7 @@ int cmd_sched(int argc, const char **argv)
> > > > .switch_event = replay_switch_event,
> > > > .fork_event = replay_fork_event,
> > > > };
> > > > + struct trace_sched_handler stats_ops = {};
> > >
> > > Oh, because there's an existing null test on the function pointer we
> > > don't need dummy functions, which is what I thought you were asking
> > > for. I'm still not convinced this is very intention revealing, but if
> > > it works for you then you can have my reviewed-by tag.
> > Applied this and the patch 2 to perf-tools-next, thanks!
> Thanks Namhyung. Did this get accidentally dropped? I'm not seeing it
> in perf-tools-next.
Not applying:
⬢ [acme@toolbx perf-tools-next2]$ b4 am -ctsl --cc-trailers CAP-5=fW-H-ri3MdVv4Vh4xiyB-qpDqnO3gqXR+XyfMK+kXpHQA@mail.gmail.com
Grabbing thread from lore.kernel.org/all/CAP-5%3DfW-H-ri3MdVv4Vh4xiyB-qpDqnO3gqXR%2BXyfMK%2BkXpHQA@mail.gmail.com/t.mbox.gz
Checking for newer revisions
Grabbing search results from lore.kernel.org
Analyzing 10 messages in the thread
Analyzing 0 code-review messages
Checking attestation on all messages, may take a moment...
---
✗ [PATCH v1 1/2] perf sched: Avoid segv if tp_handler not set
+ Tested-by: Swapnil Sapkal <swapnil.sapkal@amd.com> (✓ DKIM/amd.com)
+ Link: https://lore.kernel.org/r/20260321061448.810525-1-irogers@google.com
+ Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
✗ [PATCH v1 2/2] perf tests sched stats: Write output to temp file
+ Tested-by: Swapnil Sapkal <swapnil.sapkal@amd.com> (✓ DKIM/amd.com)
+ Link: https://lore.kernel.org/r/20260321061448.810525-2-irogers@google.com
+ Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
✗ BADSIG: DKIM/google.com
---
Total patches: 2
---
Link: https://lore.kernel.org/r/20260321061448.810525-1-irogers@google.com
Base: not specified
git am ./20260320_irogers_perf_sched_avoid_segv_if_tp_handler_not_set.mbx
⬢ [acme@toolbx perf-tools-next]$ git am ./20260320_irogers_perf_sched_avoid_segv_if_tp_handler_not_set.mbx
Applying: perf sched: Avoid segv if tp_handler not set
Applying: perf tests sched stats: Write output to temp file
error: patch failed: tools/perf/tests/shell/perf_sched_stats.sh:4
error: tools/perf/tests/shell/perf_sched_stats.sh: patch does not apply
Patch failed at 0002 perf tests sched stats: Write output to temp file
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config set advice.mergeConflict false"
⬢ [acme@toolbx perf-tools-next2]$ git log --oneline -5
5a5b82a2a9bf1d3f (HEAD -> perf-tools-next) perf sched: Avoid segv if tp_handler not set
2d840126356314bf perf sched stats: Fix segmentation faults, memory leaks, and stale pointers in diff mode
8c8f2093614373ea perf build: Remove NO_GTK2 build test
53bc032892782e54 perf build: Add -fms-extensions for GEN_VMLINUX_H=1
e41cac8617a9b399 perf build: Update error message for BUILD_NONDISTRO=1
⬢ [acme@toolbx perf-tools-next]$
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v1 1/2] perf sched: Avoid segv if tp_handler not set
2026-05-06 13:10 ` Arnaldo Carvalho de Melo
@ 2026-05-06 16:17 ` Namhyung Kim
2026-05-06 17:12 ` Ian Rogers
0 siblings, 1 reply; 5+ messages in thread
From: Namhyung Kim @ 2026-05-06 16:17 UTC (permalink / raw)
To: Arnaldo Carvalho de Melo
Cc: Ian Rogers, Peter Zijlstra, Ingo Molnar, Alexander Shishkin,
Jiri Olsa, Adrian Hunter, James Clark, Swapnil Sapkal,
linux-perf-users, linux-kernel
On Wed, May 06, 2026 at 10:10:15AM -0300, Arnaldo Carvalho de Melo wrote:
> On Tue, May 05, 2026 at 02:56:02PM -0700, Ian Rogers wrote:
> > On Mon, Apr 6, 2026 at 10:53 AM Namhyung Kim <namhyung@kernel.org> wrote:
> > > On Fri, Apr 03, 2026 at 08:29:25AM -0700, Ian Rogers wrote:
> > > > On Thu, Apr 2, 2026 at 7:42 PM Namhyung Kim <namhyung@kernel.org> wrote:
> > > > > On Tue, Mar 31, 2026 at 10:59:52PM -0700, Ian Rogers wrote:
> > > > > > On Thu, Mar 26, 2026 at 4:20 PM Namhyung Kim <namhyung@kernel.org> wrote:
> > > > > > > On Fri, Mar 20, 2026 at 11:14:47PM -0700, Ian Rogers wrote:
> > > > > > > > Doing a `perf sched record` then `perf sched stats report` crashes as
> > > > > > > > the tp_handler isn't set. Add extra checks that tp_handler is set
> > > > > > > > before accessing through it.
>
> > > > > > > Oh.. unintended use case. :) Probably better to add a dummy handler
> > > > > > > for `perf sched stats report`.
>
> > > > > > Perhaps. I'd prefer to land the simpler change as-is.
>
> > > > > Well.. I guess the dummy handler approach would be simpler and perform
> > > > > better. :)
>
> > > > > +++ b/tools/perf/builtin-sched.c
> > > > > @@ -4955,6 +4955,7 @@ int cmd_sched(int argc, const char **argv)
> > > > > .switch_event = replay_switch_event,
> > > > > .fork_event = replay_fork_event,
> > > > > };
> > > > > + struct trace_sched_handler stats_ops = {};
> > > >
> > > > Oh, because there's an existing null test on the function pointer we
> > > > don't need dummy functions, which is what I thought you were asking
> > > > for. I'm still not convinced this is very intention revealing, but if
> > > > it works for you then you can have my reviewed-by tag.
>
> > > Applied this and the patch 2 to perf-tools-next, thanks!
>
> > Thanks Namhyung. Did this get accidentally dropped? I'm not seeing it
> > in perf-tools-next.
I think I've applied my approach and test fix.
Thanks,
Namhyung
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v1 1/2] perf sched: Avoid segv if tp_handler not set
2026-05-06 16:17 ` Namhyung Kim
@ 2026-05-06 17:12 ` Ian Rogers
2026-05-06 18:54 ` Namhyung Kim
0 siblings, 1 reply; 5+ messages in thread
From: Ian Rogers @ 2026-05-06 17:12 UTC (permalink / raw)
To: Namhyung Kim
Cc: Arnaldo Carvalho de Melo, Peter Zijlstra, Ingo Molnar,
Alexander Shishkin, Jiri Olsa, Adrian Hunter, James Clark,
Swapnil Sapkal, linux-perf-users, linux-kernel
On Wed, May 6, 2026 at 9:17 AM Namhyung Kim <namhyung@kernel.org> wrote:
>
> On Wed, May 06, 2026 at 10:10:15AM -0300, Arnaldo Carvalho de Melo wrote:
> > On Tue, May 05, 2026 at 02:56:02PM -0700, Ian Rogers wrote:
> > > On Mon, Apr 6, 2026 at 10:53 AM Namhyung Kim <namhyung@kernel.org> wrote:
> > > > On Fri, Apr 03, 2026 at 08:29:25AM -0700, Ian Rogers wrote:
> > > > > On Thu, Apr 2, 2026 at 7:42 PM Namhyung Kim <namhyung@kernel.org> wrote:
> > > > > > On Tue, Mar 31, 2026 at 10:59:52PM -0700, Ian Rogers wrote:
> > > > > > > On Thu, Mar 26, 2026 at 4:20 PM Namhyung Kim <namhyung@kernel.org> wrote:
> > > > > > > > On Fri, Mar 20, 2026 at 11:14:47PM -0700, Ian Rogers wrote:
> > > > > > > > > Doing a `perf sched record` then `perf sched stats report` crashes as
> > > > > > > > > the tp_handler isn't set. Add extra checks that tp_handler is set
> > > > > > > > > before accessing through it.
> >
> > > > > > > > Oh.. unintended use case. :) Probably better to add a dummy handler
> > > > > > > > for `perf sched stats report`.
> >
> > > > > > > Perhaps. I'd prefer to land the simpler change as-is.
> >
> > > > > > Well.. I guess the dummy handler approach would be simpler and perform
> > > > > > better. :)
> >
> > > > > > +++ b/tools/perf/builtin-sched.c
> > > > > > @@ -4955,6 +4955,7 @@ int cmd_sched(int argc, const char **argv)
> > > > > > .switch_event = replay_switch_event,
> > > > > > .fork_event = replay_fork_event,
> > > > > > };
> > > > > > + struct trace_sched_handler stats_ops = {};
> > > > >
> > > > > Oh, because there's an existing null test on the function pointer we
> > > > > don't need dummy functions, which is what I thought you were asking
> > > > > for. I'm still not convinced this is very intention revealing, but if
> > > > > it works for you then you can have my reviewed-by tag.
> >
> > > > Applied this and the patch 2 to perf-tools-next, thanks!
> >
> > > Thanks Namhyung. Did this get accidentally dropped? I'm not seeing it
> > > in perf-tools-next.
>
> I think I've applied my approach and test fix.
Ok, that wasn't clear. I think it is good to post such changes to the
list. For example, just sync-ing the header files prompted sashiko to
point out a bug in our beauty scripts:
https://lore.kernel.org/linux-perf-users/20260504193334.9F978C2BCB8@smtp.kernel.org/
Thanks,
Ian
> Thanks,
> Namhyung
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v1 1/2] perf sched: Avoid segv if tp_handler not set
2026-05-06 17:12 ` Ian Rogers
@ 2026-05-06 18:54 ` Namhyung Kim
0 siblings, 0 replies; 5+ messages in thread
From: Namhyung Kim @ 2026-05-06 18:54 UTC (permalink / raw)
To: Ian Rogers
Cc: Arnaldo Carvalho de Melo, Peter Zijlstra, Ingo Molnar,
Alexander Shishkin, Jiri Olsa, Adrian Hunter, James Clark,
Swapnil Sapkal, linux-perf-users, linux-kernel
On Wed, May 06, 2026 at 10:12:05AM -0700, Ian Rogers wrote:
> On Wed, May 6, 2026 at 9:17 AM Namhyung Kim <namhyung@kernel.org> wrote:
> >
> > On Wed, May 06, 2026 at 10:10:15AM -0300, Arnaldo Carvalho de Melo wrote:
> > > On Tue, May 05, 2026 at 02:56:02PM -0700, Ian Rogers wrote:
> > > > On Mon, Apr 6, 2026 at 10:53 AM Namhyung Kim <namhyung@kernel.org> wrote:
> > > > > On Fri, Apr 03, 2026 at 08:29:25AM -0700, Ian Rogers wrote:
> > > > > > On Thu, Apr 2, 2026 at 7:42 PM Namhyung Kim <namhyung@kernel.org> wrote:
> > > > > > > On Tue, Mar 31, 2026 at 10:59:52PM -0700, Ian Rogers wrote:
> > > > > > > > On Thu, Mar 26, 2026 at 4:20 PM Namhyung Kim <namhyung@kernel.org> wrote:
> > > > > > > > > On Fri, Mar 20, 2026 at 11:14:47PM -0700, Ian Rogers wrote:
> > > > > > > > > > Doing a `perf sched record` then `perf sched stats report` crashes as
> > > > > > > > > > the tp_handler isn't set. Add extra checks that tp_handler is set
> > > > > > > > > > before accessing through it.
> > >
> > > > > > > > > Oh.. unintended use case. :) Probably better to add a dummy handler
> > > > > > > > > for `perf sched stats report`.
> > >
> > > > > > > > Perhaps. I'd prefer to land the simpler change as-is.
> > >
> > > > > > > Well.. I guess the dummy handler approach would be simpler and perform
> > > > > > > better. :)
> > >
> > > > > > > +++ b/tools/perf/builtin-sched.c
> > > > > > > @@ -4955,6 +4955,7 @@ int cmd_sched(int argc, const char **argv)
> > > > > > > .switch_event = replay_switch_event,
> > > > > > > .fork_event = replay_fork_event,
> > > > > > > };
> > > > > > > + struct trace_sched_handler stats_ops = {};
> > > > > >
> > > > > > Oh, because there's an existing null test on the function pointer we
> > > > > > don't need dummy functions, which is what I thought you were asking
> > > > > > for. I'm still not convinced this is very intention revealing, but if
> > > > > > it works for you then you can have my reviewed-by tag.
> > >
> > > > > Applied this and the patch 2 to perf-tools-next, thanks!
> > >
> > > > Thanks Namhyung. Did this get accidentally dropped? I'm not seeing it
> > > > in perf-tools-next.
> >
> > I think I've applied my approach and test fix.
>
> Ok, that wasn't clear. I think it is good to post such changes to the
> list. For example, just sync-ing the header files prompted sashiko to
> point out a bug in our beauty scripts:
> https://lore.kernel.org/linux-perf-users/20260504193334.9F978C2BCB8@smtp.kernel.org/
Ok, will do but patches are there. I also plan to send out v2 for this
header sync.
Thanks,
Namhyung
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-05-06 18:54 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <20260321061448.810525-1-irogers@google.com>
[not found] ` <acW_IHQVZnxIETdd@google.com>
[not found] ` <CAP-5=fWh66OwPC0K4ZyedAWqwyXez0ya9Dz6hzbgY0AhoqMfdg@mail.gmail.com>
[not found] ` <ac8pEDUKjuMxXUS6@google.com>
[not found] ` <CAP-5=fXeBje03BM8D9q-0KsXg2KmyRa81CuphtSQfHp0isFc_w@mail.gmail.com>
[not found] ` <adPzEmwDaHq4SsZw@google.com>
2026-05-05 21:56 ` [PATCH v1 1/2] perf sched: Avoid segv if tp_handler not set Ian Rogers
2026-05-06 13:10 ` Arnaldo Carvalho de Melo
2026-05-06 16:17 ` Namhyung Kim
2026-05-06 17:12 ` Ian Rogers
2026-05-06 18:54 ` Namhyung Kim
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox