mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 18:41:58 +09:00
perf/arm-dmc620: Fix lockdep assert in ->event_init()
[ Upstream commit a4c5a457c6107dfe9dc65a104af1634811396bac ]
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: f3c0eba287 ("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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
e9774d1531
commit
f23f182baa
@@ -513,12 +513,16 @@ static int dmc620_pmu_event_init(struct perf_event *event)
|
|||||||
if (event->cpu < 0)
|
if (event->cpu < 0)
|
||||||
return -EINVAL;
|
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,
|
* We can't atomically disable all HW counters so only one event allowed,
|
||||||
* although software events are acceptable.
|
* although software events are acceptable.
|
||||||
*/
|
*/
|
||||||
if (event->group_leader != event &&
|
if (!is_software_event(event->group_leader))
|
||||||
!is_software_event(event->group_leader))
|
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
for_each_sibling_event(sibling, event->group_leader) {
|
for_each_sibling_event(sibling, event->group_leader) {
|
||||||
@@ -527,7 +531,6 @@ static int dmc620_pmu_event_init(struct perf_event *event)
|
|||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
hwc->idx = -1;
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user