[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d585f337-5ce7-4a02-b890-5f3888e59ad0@amd.com>
Date: Mon, 17 Feb 2025 22:01:14 +0530
From: Ravi Bangoria <ravi.bangoria@....com>
To: Peter Zijlstra <peterz@...radead.org>
Cc: "mingo@...nel.org" <mingo@...nel.org>,
"lucas.demarchi@...el.com" <lucas.demarchi@...el.com>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"willy@...radead.org" <willy@...radead.org>,
"acme@...nel.org" <acme@...nel.org>,
"namhyung@...nel.org" <namhyung@...nel.org>,
"mark.rutland@....com" <mark.rutland@....com>,
"alexander.shishkin@...ux.intel.com" <alexander.shishkin@...ux.intel.com>,
"jolsa@...nel.org" <jolsa@...nel.org>,
"irogers@...gle.com" <irogers@...gle.com>,
"adrian.hunter@...el.com" <adrian.hunter@...el.com>,
"kan.liang@...ux.intel.com" <kan.liang@...ux.intel.com>,
Ravi Bangoria <ravi.bangoria@....com>
Subject: Re: [PATCH v2 24/24] perf: Make perf_pmu_unregister() useable
On 17-Feb-25 1:54 PM, Ravi Bangoria wrote:
> Hi Peter,
>
>>> Apparently not, it ends up with:
>>>
>>> ------------[ cut here ]------------
>>> WARNING: CPU: 145 PID: 5459 at kernel/events/core.c:281 event_function+0xd2/0xf0
>>> WARNING: CPU: 145 PID: 5459 at kernel/events/core.c:286 event_function+0xd6/0xf0
>>
>>> remote_function+0x4f/0x70
>>> generic_exec_single+0x7f/0x160
>>> smp_call_function_single+0x110/0x160
>>> event_function_call+0x98/0x1d0
>>> _perf_event_disable+0x41/0x70
>>> perf_event_for_each_child+0x40/0x90
>>> _perf_ioctl+0xac/0xb00
>>> perf_ioctl+0x45/0x80
>>
>> Took me a long while trying to blame this on the 'event->parent =
>> NULL;', but AFAICT this is a new, unrelated issue.
>>
>> What I think happens is this perf_ioctl(DISABLE) vs pmu_detach_events()
>> race, where the crux is that perf_ioctl() path does not take
>> event2->mutex which allows the following interleave:
>
> This one was only with perf_fuzzer, so pmu_detach_events() code path was
> not invoked.
I think the issue is, unaccount_event() gets called for the child event
after the child is detached. Since event->parent is NULL, unaccount_event()
abruptly corrupts the perf_sched_work.
I haven't verified it. Will do it tomorrow.
Thanks,
Ravi
Powered by blists - more mailing lists