[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <2fe98d8a-1165-45ac-b539-d597dd1bbcaa@efficios.com>
Date: Thu, 24 Apr 2025 13:42:16 -0400
From: Mathieu Desnoyers <mathieu.desnoyers@...icios.com>
To: Steven Rostedt <rostedt@...dmis.org>,
Peter Zijlstra <peterz@...radead.org>
Cc: linux-kernel@...r.kernel.org, linux-trace-kernel@...r.kernel.org,
Masami Hiramatsu <mhiramat@...nel.org>, Mark Rutland <mark.rutland@....com>,
Andrew Morton <akpm@...ux-foundation.org>,
Josh Poimboeuf <jpoimboe@...nel.org>, x86@...nel.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>, Namhyung Kim <namhyung@...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 11/17] perf: Simplify get_perf_callchain() user logic
On 2025-04-24 13:28, Steven Rostedt wrote:
> On Thu, 24 Apr 2025 18:36:07 +0200
> Peter Zijlstra <peterz@...radead.org> wrote:
>
>>> +++ b/kernel/events/callchain.c
>>> @@ -246,22 +246,20 @@ get_perf_callchain(struct pt_regs *regs, bool kernel, bool user,
>>>
>>> if (user) {
>>> if (!user_mode(regs)) {
>>> - if (current->mm)
>>> - regs = task_pt_regs(current);
>>> - else
>>> - regs = NULL;
>>> + if (!current->mm)
>>> + goto exit_put;
>>> + regs = task_pt_regs(current);
>>
>> I'm thinking this might be one of those is-kthread test written as
>> has-mm, and they're broken.
>>
>> Notably things like the io-uring kthreads do have mm.
Can a kthread such as io-uring have user_mode(regs) == true ?
>
> Would there ever be a case where:
>
> current->mm == NULL && !(current->flags & PF_KTHREAD)
>
> ?
>
> That is, do we still need to check for current->mm if it's not a kernel
> thread, or can we assume it exists?
The case I'd be careful about is if the code can nest over exit_mm()
(e.g. interrupt) after it sets current->mm = NULL.
Thanks,
Mathieu
--
Mathieu Desnoyers
EfficiOS Inc.
https://www.efficios.com
Powered by blists - more mailing lists