[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <e5497be9-85c7-42ac-925d-194b690a0eac@arm.com>
Date: Fri, 17 May 2024 13:16:16 +0100
From: Robin Murphy <robin.murphy@....com>
To: Will Deacon <will@...nel.org>, Namhyung Kim <namhyung@...nel.org>
Cc: Mark Rutland <mark.rutland@....com>, Ingo Molnar <mingo@...nel.org>,
Peter Zijlstra <peterz@...radead.org>, LKML <linux-kernel@...r.kernel.org>,
linux-arm-kernel@...ts.infradead.org, Greg Thelen <gthelen@...gle.com>,
Tuan Phan <tuanphan@...amperecomputing.com>
Subject: Re: [PATCH] perf/arm-dmc620: Fix lockdep assert in ->event_init()
On 17/05/2024 1:02 pm, Will Deacon wrote:
> On Tue, May 14, 2024 at 11:00:50AM -0700, Namhyung Kim wrote:
>> for_each_sibling_event() checks leader's ctx but it doesn't have the ctx
>> yet if it's the leader. Like in perf_event_validate_size(), we should
>> skip checking siblings in that case.
>>
>> Fixes: f3c0eba287049 ("perf: Add a few assertions")
>> Reported-by: Greg Thelen <gthelen@...gle.com>
>> Cc: Robin Murphy <robin.murphy@....com>
>> Cc: Tuan Phan <tuanphan@...amperecomputing.com>
>> Signed-off-by: Namhyung Kim <namhyung@...nel.org>
>> ---
>> drivers/perf/arm_dmc620_pmu.c | 9 ++++++---
>> 1 file changed, 6 insertions(+), 3 deletions(-)
>>
>> diff --git a/drivers/perf/arm_dmc620_pmu.c b/drivers/perf/arm_dmc620_pmu.c
>> index 8a81be2dd5ec..88c17c1d6d49 100644
>> --- a/drivers/perf/arm_dmc620_pmu.c
>> +++ b/drivers/perf/arm_dmc620_pmu.c
>> @@ -542,12 +542,16 @@ static int dmc620_pmu_event_init(struct perf_event *event)
>> if (event->cpu < 0)
>> return -EINVAL;
>>
>> + hwc->idx = -1;
>> +
>> + if (event->group_leader == event)
>> + return 0;
>> +
>> /*
>> * We can't atomically disable all HW counters so only one event allowed,
>> * although software events are acceptable.
>> */
>> - if (event->group_leader != event &&
>> - !is_software_event(event->group_leader))
>> + if (!is_software_event(event->group_leader))
>> return -EINVAL;
Oh, come to think of it, I believe we shouldn't actually need to keep
this check either, since commit bf480f938566 ("perf/core: Don't allow
grouping events from different hw pmus").
Thanks,
Robin.
>>
>> for_each_sibling_event(sibling, event->group_leader) {
>> @@ -556,7 +560,6 @@ static int dmc620_pmu_event_init(struct perf_event *event)
>> return -EINVAL;
>> }
>>
>> - hwc->idx = -1;
>> return 0;
>> }
>
> Thanks, I'll pick this up, although Mark reckoned he'd found some other
> issues over at:
>
> https://lore.kernel.org/r/Zg0l642PgQ7T3a8Z@FVFF77S0Q05N
>
> but didn't elaborate on what exactly he'd found :/
>
> Will
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel@...ts.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Powered by blists - more mailing lists