[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250428180253.1b1517a8@gandalf.local.home>
Date: Mon, 28 Apr 2025 18:02:53 -0400
From: Steven Rostedt <rostedt@...dmis.org>
To: Namhyung Kim <namhyung@...nel.org>
Cc: linux-kernel@...r.kernel.org, linux-trace-kernel@...r.kernel.org, Masami
Hiramatsu <mhiramat@...nel.org>, Mark Rutland <mark.rutland@....com>,
Mathieu Desnoyers <mathieu.desnoyers@...icios.com>, Andrew Morton
<akpm@...ux-foundation.org>, Josh Poimboeuf <jpoimboe@...nel.org>,
x86@...nel.org, Peter Zijlstra <peterz@...radead.org>, Ingo Molnar
<mingo@...nel.org>, Arnaldo Carvalho de Melo <acme@...nel.org>, Indu Bhagat
<indu.bhagat@...cle.com>, Alexander Shishkin
<alexander.shishkin@...ux.intel.com>, Jiri Olsa <jolsa@...nel.org>, Ian
Rogers <irogers@...gle.com>, Adrian Hunter <adrian.hunter@...el.com>,
linux-perf-users@...r.kernel.org, Mark Brown <broonie@...nel.org>,
linux-toolchains@...r.kernel.org, Jordan Rome <jordalgo@...a.com>, Sam
James <sam@...too.org>, Andrii Nakryiko <andrii.nakryiko@...il.com>, Jens
Remus <jremus@...ux.ibm.com>, Florian Weimer <fweimer@...hat.com>, Andy
Lutomirski <luto@...nel.org>, Weinan Liu <wnliu@...gle.com>, Blake Jones
<blakejones@...gle.com>, Beau Belgrave <beaub@...ux.microsoft.com>, "Jose
E. Marchesi" <jemarch@....org>
Subject: Re: [PATCH v5 13/17] perf: Support deferred user callchains
On Mon, 28 Apr 2025 13:42:15 -0700
Namhyung Kim <namhyung@...nel.org> wrote:
> >
> > Could we just not use deferred when running with "-a" for now? Or could we
> > possibly just make the deferred stacktrace its own event? Have it be
> > possible that perf just registers a signal instance with the deferred
> > unwinding logic, and then perf can handle where to write the information. I
> > don't know perf well enough to implement that.
>
> Even if it excludes per-CPU events, per-task events also can attach to a
> CPU and that's the default behavior of the perf record IIRC. In that
> case, it needs to be careful when it accesses the event since the task
> can migrate to another CPU. So I'm not sure if it's a good idea to
> track event that requested the deferred callchains.
Wait? Even for per task, it uses per cpu?
>
> Also it doesn't need to emit duplicate deferred callchains if a task
> has multiple events and they are requesting callchains. Unfortunately,
> the kernel cannot know which events are related or profiled together.
>
> Hmm.. maybe we can add a cookie to the event itself (by ioctl or
> something) in order to group events in a profiling session and then use
> that for deferred callchains? Task should maintain a list of active
> cookies (or sessions) somehow but then perf can check if the current CPU
> has events with matching cookies and emit a deferred callchain.
Could we add a callchain event? It gets woken at any request but not
triggered until the task returns. A way that there would be only a single
event for every perf instance, but it can trace any task.
It could use the cookie method that ftrace uses, where the request gets a
cookie, and can be recorded to the perf event in the interrupt. Then the
callchain would record the cookie along with the stack trace, and then perf
tool could just match up the kernel stacks with their cookies to the user
stack with its cookie.
-- Steve
Powered by blists - more mailing lists