[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <efcd5cf4-3501-f3b6-bf47-145a9ef19a53@linux.ibm.com>
Date: Thu, 30 May 2019 14:08:46 +0530
From: Ravi Bangoria <ravi.bangoria@...ux.ibm.com>
To: Peter Zijlstra <peterz@...radead.org>
Cc: Will Deacon <will.deacon@....com>,
Young Xiao <92siuyang@...il.com>, linux@...linux.org.uk,
mark.rutland@....com, mingo@...hat.com, bp@...en8.de,
hpa@...or.com, x86@...nel.org, kan.liang@...ux.intel.com,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
ravi.bangoria@...ux.vnet.ibm.com, mpe@...erman.id.au,
acme@...hat.com, eranian@...gle.com, fweisbec@...il.com,
jolsa@...hat.com, ravi.bangoria@...ux.ibm.com
Subject: Re: [PATCH] perf: Fix oops when kthread execs user process
On 5/29/19 6:25 PM, Peter Zijlstra wrote:
> On Wed, May 29, 2019 at 11:20:22AM +0100, Will Deacon wrote:
>> Anyway, you can add my ack to your patch, but I bet we can remove that mm
>> check :D
>
> I've ended up with the below. Ravi, can you test if that does indeed
> obsolete your PPC patch?
Checking.
>
> ---
> Subject: perf: Fix perf_sample_regs_user()
> From: Peter Zijlstra <peterz@...radead.org>
> Date: Wed May 29 14:37:24 CEST 2019
>
> perf_sample_regs_user() uses 'current->mm' to test for the presence of
> userspace, but this is insufficient, consider use_mm().
>
> A better test is: '!(current->flags & PF_KTHREAD)', exec() clears
> PF_KTHREAD after it sets the new ->mm but before it drops to userspace
> for the first time.
This looks correct. I'll give it a try.
>
> Possibly obsoletes: bf05fc25f268 ("powerpc/perf: Fix oops when kthread execs user process")
>
> Reported-by: Ravi Bangoria <ravi.bangoria@...ux.vnet.ibm.com>
> Reported-by: Young Xiao <92siuyang@...il.com>
> Cc: Ravi Bangoria <ravi.bangoria@...ux.vnet.ibm.com>
> Cc: Naveen N. Rao <naveen.n.rao@...ux.vnet.ibm.com>
> Cc: Michael Ellerman <mpe@...erman.id.au>
> Cc: Jiri Olsa <jolsa@...hat.com>
> Cc: Frederic Weisbecker <fweisbec@...il.com>
> Cc: Stephane Eranian <eranian@...gle.com>
> Cc: Arnaldo Carvalho de Melo <acme@...hat.com>
> Acked-by: Will Deacon <will.deacon@....com>
> Fixes: 4018994f3d87 ("perf: Add ability to attach user level registers dump to sample")
> Signed-off-by: Peter Zijlstra (Intel) <peterz@...radead.org>
> ---
> kernel/events/core.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> --- a/kernel/events/core.c
> +++ b/kernel/events/core.c
> @@ -5923,7 +5923,7 @@ static void perf_sample_regs_user(struct
> if (user_mode(regs)) {
> regs_user->abi = perf_reg_abi(current);
> regs_user->regs = regs;
> - } else if (current->mm) {
> + } else if (!(current->flags & PF_KTHREAD)) {
> perf_get_regs_user(regs_user, regs, regs_user_copy);
> } else {
> regs_user->abi = PERF_SAMPLE_REGS_ABI_NONE;
>
Powered by blists - more mailing lists