perf/arm-smmuv3: Fix lockdep assert in ->event_init()
PATCH v2 1/1 perf/arm-smmuv3: Fix lockdep assert in ->event_init()
Same as
https://lore.kernel.org/all/[email protected]/,
we should skip for_each_sibling_event() for group leader since it doesn't have the ctx yet.
Fixes f3c0eba28704 ("perf: Add a few assertions")
Reported-by Greg Thelen <[email protected]>
Cc Namhyung Kim <[email protected]>
Cc Robin Murphy <[email protected]>
Cc Tuan Phan <[email protected]>
Signed-off-by Chun-Tse Shao <[email protected]>
--- drivers/perf/arm_smmuv3_pmu.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-)
drivers/perf/arm_smmuv3_pmu.c +11 -8
@@ -431,6 +431,17 @@ static int smmu_pmu_event_init(struct perf_event *event)return -EINVAL ; } +/* +* Ensure all events are on the same cpu so all events are in the +* same cpu context, to avoid races on pmu_enable etc. +*/ + event->cpu = smmu_pmu->on_cpu; + + hwc->idx =-1 ; + +if (event->group_leader == event) +return 0 ; +for_each_sibling_event (sibling, event->group_leader) {if (is_software_event (sibling))continue ;
@@ -442,14 +453,6 @@ static int smmu_pmu_event_init(struct perf_event *event)return -EINVAL ; } - hwc->idx =-1 ; - -/* -* Ensure all events are on the same cpu so all events are in the -* same cpu context, to avoid races on pmu_enable etc. -*/ - event->cpu = smmu_pmu->on_cpu; -return 0 ; }
Signature · 1 line
2.47.0.277.g8800431eea-goog
Quoted 11 lines · Chun-Tse Shao
Same as
https://lore.kernel.org/all/[email protected]/,
we should skipfor_each_sibling_event()for group leader since it doesn't have the ctx yet.Fixes f3c0eba28704 ("perf: Add a few assertions")Reported-by Greg Thelen <[email protected]>Cc Namhyung Kim <[email protected]>Cc Robin Murphy <[email protected]>Cc Tuan Phan <[email protected]>Signed-off-by Chun-Tse Shao <[email protected]>
Quoted 3 lines
--- drivers/perf/arm_smmuv3_pmu.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-)
Acked-by Will Deacon <[email protected]>
Catalin -- please can you pick this up for -rc1?
Will
Catalin Marinas
AppliedQuoted 6 lines · Chun-Tse Shao
Same as
https://lore.kernel.org/all/[email protected]/,
we should skipfor_each_sibling_event()for group leader since it doesn't have the ctx yet.
Applied to arm64 (for-next/fixes), thanks!
[1/1] perf/arm-smmuv3: Fix lockdep assert in ->event_init()
https://git.kernel.org/arm64/c/02a55f274301
Signature · 1 line
Catalin