]> Git Repo - J-linux.git/commitdiff
perf/arm-smmuv3: Fix lockdep assert in ->event_init()
authorChun-Tse Shao <[email protected]>
Fri, 8 Nov 2024 05:08:05 +0000 (05:08 +0000)
committerCatalin Marinas <[email protected]>
Mon, 25 Nov 2024 18:52:46 +0000 (18:52 +0000)
Same as
https://lore.kernel.org/all/20240514180050[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]>
Acked-by: Will Deacon <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Catalin Marinas <[email protected]>
drivers/perf/arm_smmuv3_pmu.c

index b1510f660c7a6931823ebac8eeccbade36950d1b..621f02a7f43be364e5c260fd97aa375f5e8e3404 100644 (file)
@@ -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;
 }
 
This page took 0.050714 seconds and 4 git commands to generate.