Linux Perf Users
 help / color / mirror / Atom feed
* [PATCH] perf/arm-cmn: Terminate the discovered node array
@ 2026-12-04 15:47 Leo Yan
  2026-12-04 15:59 ` sashiko-bot
  2026-12-04 16:28 ` Robin Murphy
  0 siblings, 2 replies; 4+ messages in thread
From: Leo Yan @ 2026-12-04 15:47 UTC (permalink / raw)
  To: Robin Murphy, Will Deacon, Mark Rutland
  Cc: linux-arm-kernel, linux-perf-users, Leo Yan

Discovery writes a child's type into the next free entry before deciding
whether to keep it. If the last type written belongs to a skipped child,
the entry retains a nonzero type, so node walks can run past the end of
the array.

Reset the type to CMN_TYPE_INVALID when discarding a child without
supported PMU events. This restores the zero type that terminates the
array.

Fixes: da5f7d2c8019 ("perf/arm-cmn: Streamline node iteration")
Signed-off-by: Leo Yan <leo.yan@arm.com>
---
 drivers/perf/arm-cmn.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/perf/arm-cmn.c b/drivers/perf/arm-cmn.c
index 68a096c1fe6b0be793fba9a9461905e67d2d7703..5fe31310c5feb0b4b96022e7ec1d478720db792c 100644
--- a/drivers/perf/arm-cmn.c
+++ b/drivers/perf/arm-cmn.c
@@ -2751,6 +2751,8 @@ static int arm_cmn_discover(struct arm_cmn *cmn, unsigned int rgn_offset)
 			case CMN_TYPE_HNS_MPAM_S:
 			case CMN_TYPE_HNS_MPAM_NS:
 			case CMN_TYPE_APB:
+				/* This entry may be the array terminator */
+				dn->type = CMN_TYPE_INVALID;
 				break;
 			/*
 			 * Split "optimised" combination nodes into separate

---
base-commit: 007722b8211f7b34fdf21b1e6a9c32497633ea29
change-id: 20261204-b4-arm_cmn_fix_node_sentinel-40b54e3a9ff0

Best regards,
-- 
Leo Yan <leo.yan@arm.com>


^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-12-04 16:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-04 15:47 [PATCH] perf/arm-cmn: Terminate the discovered node array Leo Yan
2026-12-04 15:59 ` sashiko-bot
2026-12-04 16:28 ` Robin Murphy
2026-12-04 16:46   ` Leo Yan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox