From: Robin Murphy <robin.murphy@arm.com>
To: Leo Yan <leo.yan@arm.com>, Will Deacon <will@kernel.org>,
Mark Rutland <mark.rutland@arm.com>
Cc: linux-arm-kernel@lists.infradead.org, linux-perf-users@vger.kernel.org
Subject: Re: [PATCH] perf/arm-cmn: Terminate the discovered node array
Date: Fri, 4 Dec 2026 16:28:38 +0000 [thread overview]
Message-ID: <10933bc1-067f-409c-b9f6-1573e778a612@arm.com> (raw)
In-Reply-To: <20261204-b4-arm_cmn_fix_node_sentinel-v1-1-021075ebdcd7@arm.com>
On 04/12/2026 3:47 pm, Leo Yan wrote:
> 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.
Oooh, subtle... :(
> Reset the type to CMN_TYPE_INVALID when discarding a child without
> supported PMU events. This restores the zero type that terminates the
> array.
I think I'd rather just explicitly clear the sentinel element after the
realloc "adds" it, that seems even more robust and obvious.
Thanks,
Robin.
> 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,
next prev parent reply other threads:[~2026-12-04 16:28 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
2026-12-04 16:46 ` Leo Yan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=10933bc1-067f-409c-b9f6-1573e778a612@arm.com \
--to=robin.murphy@arm.com \
--cc=leo.yan@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-perf-users@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=will@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox