This is a note to let you know that I've just added the patch titled perf/arm-dmc620: Fix lockdep assert in ->event_init() to the 6.6-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: perf-arm-dmc620-fix-lockdep-assert-in-event_init.patch and it can be found in the queue-6.6 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. commit 84d1d3b78dc4a2426d4ea2f7ffaaf56b034ca4fc Author: Namhyung Kim <namhyung@xxxxxxxxxx> Date: Tue May 14 11:00:50 2024 -0700 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@xxxxxxx> Fixes: f3c0eba28704 ("perf: Add a few assertions") Reported-by: Greg Thelen <gthelen@xxxxxxxxxx> Cc: Robin Murphy <robin.murphy@xxxxxxx> Cc: Tuan Phan <tuanphan@xxxxxxxxxxxxxxxxxxxxxx> Signed-off-by: Namhyung Kim <namhyung@xxxxxxxxxx> Reviewed-by: Robin Murphy <robin.murphy@xxxxxxx> Link: https://lore.kernel.org/r/20240514180050.182454-1-namhyung@xxxxxxxxxx Signed-off-by: Will Deacon <will@xxxxxxxxxx> Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx> diff --git a/drivers/perf/arm_dmc620_pmu.c b/drivers/perf/arm_dmc620_pmu.c index 30cea68595747..b6a677224d682 100644 --- a/drivers/perf/arm_dmc620_pmu.c +++ b/drivers/perf/arm_dmc620_pmu.c @@ -542,12 +542,16 @@ static int dmc620_pmu_event_init(struct perf_event *event) if (event->cpu < 0) 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, * although software events are acceptable. */ - if (event->group_leader != event && - !is_software_event(event->group_leader)) + if (!is_software_event(event->group_leader)) return -EINVAL; for_each_sibling_event(sibling, event->group_leader) { @@ -556,7 +560,6 @@ static int dmc620_pmu_event_init(struct perf_event *event) return -EINVAL; } - hwc->idx = -1; return 0; }