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 <[email protected]> Fixes: f3c0eba ("perf: Add a few assertions") Reported-by: Greg Thelen <[email protected]> Cc: Robin Murphy <[email protected]> Cc: Tuan Phan <[email protected]> Signed-off-by: Namhyung Kim <[email protected]> Reviewed-by: Robin Murphy <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Will Deacon <[email protected]>
1 parent b8995a1 commit a4c5a45

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

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)