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.

And this fix refers to the commit a476aba86d0f ("perf/arm-smmuv3: Fix lockdep
assert in ->event_init()").

Signed-off-by: Zhantao Tang <[email protected]>
---
 drivers/perf/nxp-s32cc-ddr-perf.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/drivers/perf/nxp-s32cc-ddr-perf.c 
b/drivers/perf/nxp-s32cc-ddr-perf.c
index 3428be38e7cc0..cf73c070bd2c7 100644
--- a/drivers/perf/nxp-s32cc-ddr-perf.c
+++ b/drivers/perf/nxp-s32cc-ddr-perf.c
@@ -263,6 +263,17 @@ static int ddr_perf_event_init(struct perf_event *event)
                return -EOPNOTSUPP;
        }
 
+       event->cpu = pmu->cpu;
+       hwc->idx = -1;
+
+       /*
+        * Skip group validation for group leader since it doesn't have
+        * the ctx yet during event_init(), which would trigger lockdep
+        * warning in for_each_sibling_event().
+        */
+       if (event->group_leader == event)
+               return 0;
+
        /*
         * We must NOT create groups containing mixed PMUs, although software
         * events are acceptable (for example to create a CCN group
@@ -277,9 +288,6 @@ static int ddr_perf_event_init(struct perf_event *event)
                        return -EINVAL;
        }
 
-       event->cpu = pmu->cpu;
-       hwc->idx = -1;
-
        return 0;
 }
 
-- 
2.34.1

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#16256): 
https://lists.yoctoproject.org/g/linux-yocto/message/16256
Mute This Topic: https://lists.yoctoproject.org/mt/117592700/21656
Group Owner: [email protected]
Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub 
[[email protected]]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to