Skip to content

Commit a4c5a45

Browse files
namhyungwilldeacon
authored andcommitted
perf/arm-dmc620: Fix lockdep assert in ->event_init()
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. Acked-by: Mark Rutland <mark.rutland@arm.com> Fixes: f3c0eba ("perf: Add a few assertions") Reported-by: Greg Thelen <gthelen@google.com> Cc: Robin Murphy <robin.murphy@arm.com> Cc: Tuan Phan <tuanphan@os.amperecomputing.com> Signed-off-by: Namhyung Kim <namhyung@kernel.org> Reviewed-by: Robin Murphy <robin.murphy@arm.com> Link: https://lore.kernel.org/r/20240514180050.182454-1-namhyung@kernel.org Signed-off-by: Will Deacon <will@kernel.org>
1 parent b8995a1 commit a4c5a45

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

drivers/perf/arm_dmc620_pmu.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -542,12 +542,16 @@ static int dmc620_pmu_event_init(struct perf_event *event)
542542
if (event->cpu < 0)
543543
return -EINVAL;
544544

545+
hwc->idx = -1;
546+
547+
if (event->group_leader == event)
548+
return 0;
549+
545550
/*
546551
* We can't atomically disable all HW counters so only one event allowed,
547552
* although software events are acceptable.
548553
*/
549-
if (event->group_leader != event &&
550-
!is_software_event(event->group_leader))
554+
if (!is_software_event(event->group_leader))
551555
return -EINVAL;
552556

553557
for_each_sibling_event(sibling, event->group_leader) {
@@ -556,7 +560,6 @@ static int dmc620_pmu_event_init(struct perf_event *event)
556560
return -EINVAL;
557561
}
558562

559-
hwc->idx = -1;
560563
return 0;
561564
}
562565

0 commit comments

Comments
 (0)