[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aRUMauhbs_jJ6-3P@google.com>
Date: Wed, 12 Nov 2025 14:38:34 -0800
From: Namhyung Kim <namhyung@...nel.org>
To: Jens Remus <jremus@...ux.ibm.com>
Cc: Steven Rostedt <rostedt@...dmis.org>,
Steven Rostedt <rostedt@...nel.org>, linux-kernel@...r.kernel.org,
linux-trace-kernel@...r.kernel.org, bpf@...r.kernel.org,
x86@...nel.org, Masami Hiramatsu <mhiramat@...nel.org>,
Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
Josh Poimboeuf <jpoimboe@...nel.org>,
Ingo Molnar <mingo@...nel.org>, Jiri Olsa <jolsa@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Andrii Nakryiko <andrii@...nel.org>,
Indu Bhagat <indu.bhagat@...cle.com>,
"Jose E. Marchesi" <jemarch@....org>,
Beau Belgrave <beaub@...ux.microsoft.com>,
Linus Torvalds <torvalds@...ux-foundation.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Florian Weimer <fweimer@...hat.com>, Sam James <sam@...too.org>,
Kees Cook <kees@...nel.org>, Carlos O'Donell <codonell@...hat.com>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Peter Zijlstra <peterz@...radead.org>
Subject: Re: [PATCH v16 4/4] perf tools: Merge deferred user callchains
Hello,
On Wed, Nov 12, 2025 at 11:05:59AM +0100, Jens Remus wrote:
> Hello Namhyung,
>
> could you please adapt your patches from this series to Peter's latest
> changes to unwind user and related perf support, especially his new
> version c69993ecdd4d ("perf: Support deferred user unwind") available
> at:
>
> git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git perf/core
Sure, will take a look.
Thanks,
Namhyung
>
> On 10/24/2025 3:02 PM, Peter Zijlstra wrote:
> > On Thu, Oct 02, 2025 at 01:49:38PM -0400, Steven Rostedt wrote:
> >> On Mon, 08 Sep 2025 13:53:23 -0400
> >> Steven Rostedt <rostedt@...nel.org> wrote:
> >>
> >>> +static int evlist__deliver_deferred_samples(struct evlist *evlist,
> >>> + const struct perf_tool *tool,
> >>> + union perf_event *event,
> >>> + struct perf_sample *sample,
> >>> + struct machine *machine)
> >>> +{
> >>> + struct deferred_event *de, *tmp;
> >>> + struct evsel *evsel;
> >>> + int ret = 0;
> >>> +
> >>> + if (!tool->merge_deferred_callchains) {
> >>> + evsel = evlist__id2evsel(evlist, sample->id);
> >>> + return tool->callchain_deferred(tool, event, sample,
> >>> + evsel, machine);
> >>> + }
> >>> +
> >>> + list_for_each_entry_safe(de, tmp, &evlist->deferred_samples, list) {
> >>> + struct perf_sample orig_sample;
> >>
> >> orig_sample is not initialized and can then contain junk.
> >>
> >>> +
> >>> + ret = evlist__parse_sample(evlist, de->event, &orig_sample);
> >>> + if (ret < 0) {
> >>> + pr_err("failed to parse original sample\n");
> >>> + break;
> >>> + }
> >>> +
> >>> + if (sample->tid != orig_sample.tid)
> >>> + continue;
> >>> +
> >>> + if (event->callchain_deferred.cookie == orig_sample.deferred_cookie)
> >>> + sample__merge_deferred_callchain(&orig_sample, sample);
> >>
> >> The sample__merge_deferred_callchain() initializes both
> >> orig_sample.deferred_callchain and the callchain. But now that it's not
> >> being called, it can cause the below free to happen with junk as the
> >> callchain. This needs:
> >>
> >> else
> >> orig_sample.deferred_callchain = false;
> >
> > Ah, so I saw crashes from here and just deleted both free()s and got on
> > with things ;-)
>
> This needs to be properly resolved. In the meantime I am using Steven's
> suggestion above to continue my work on unwind user sframe (s390).
>
> >
> >>> +
> >>> + evsel = evlist__id2evsel(evlist, orig_sample.id);
> >>> + ret = evlist__deliver_sample(evlist, tool, de->event,
> >>> + &orig_sample, evsel,> machine); +
> >>> + if (orig_sample.deferred_callchain)
> >>> + free(orig_sample.callchain);
> >>> +
> >>> + list_del(&de->list);
> >>> + free(de);
> >>> +
> >>> + if (ret)
> >>> + break;
> >>> + }
> >>> + return ret;
> >>> +}
> >>
> >> -- Steve
>
> Thanks and regards,
> Jens
> --
> Jens Remus
> Linux on Z Development (D3303)
> +49-7031-16-1128 Office
> jremus@...ibm.com
>
> IBM
>
> IBM Deutschland Research & Development GmbH; Vorsitzender des Aufsichtsrats: Wolfgang Wendt; Geschäftsführung: David Faller; Sitz der Gesellschaft: Böblingen; Registergericht: Amtsgericht Stuttgart, HRB 243294
> IBM Data Privacy Statement: https://www.ibm.com/privacy/
>
Powered by blists - more mailing lists