From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=217.140.110.172 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796401736; b=hmONNbB/lUS3Vb/rJrjP1TwMOZF0hFzjzOLI3mWEHCvg5+oErVLUeSOFHkBYMo2PD+5k kj/c1dnnEnJLniSgB2utWRmeqtM3f0Fho4L3WqXXjLnQ0PymmsKkgPRVWFxQlnMR2IlaU ZMX4sI77PCGlSJSuyeLBCzxZ+dccGdkHWB5PI6b+LmLHjHTc33XKxBMxeAOp8orpDlcbH EhHurW0AN9uLDOTZpYF5vu7GUPeBrNPMVdvac7fP3Ru9OBQT/QPOtWbhWDlChCqMcj37z DEUXbNsLum1uA4z3EG2CT0Cm6inDtPRauXt5e/Po6TUUkZH04sOR9JamIG8EGUkFTmA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796401736; h=DMARC-Filter:Received:Received:DKIM-Signature:Message-ID:Date: MIME-Version:User-Agent:Subject:To:Cc:References:From: Content-Language:In-Reply-To:Content-Type:Content-Transfer-Encoding; bh=NSQsX6+Tzr66mUJPCs8JtwKfDP9GXhEjRuj9bPQ5qzM=; b=LtwDkOMHedIoGvBOkCdqF8PRi4Xg3hOJNTEXVbn6582uFbXYlFpmt8Gsr6ONhH29rFek iGc7LgcGIlmtFpjCX7KS5JJ52v2aQQtPZG0FsougRZGOhQq+fMKKqKI9uLs+2ly3Edbm2 z7wrYQr5pG7tAjpnrKE76WfsDOtG9AhFLAbdyny58jTtCb4LhpUGL4Kplziu4LqsK9/sS ANBxIHSFw3Rg+5TOEzHul2QlTYfZKKCN0XWMIz4tEq5Z/+e9Ti1N+ZWFM+09qgS3u8KSh RrJOOEmcwqO1urAEkfKJ/nkGadT9nZ7Zy1cP2AI4qjrkTfiMPht8GGLppiEUhaLrNNw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=arm.com; spf=pass smtp.mailfrom=arm.com; dkim=pass header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=foss header.b=Yd2EfFtR; arc=none smtp.remote-ip=217.140.110.172 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 67B96606A32C for ; Fri, 4 Dec 2026 16:28:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 67B96606A32C Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=arm.com header.i=@arm.com header.a=rsa-sha256 header.s=foss header.b=Yd2EfFtR Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id E79D214BF; Fri, 4 Dec 2026 08:28:52 -0800 (PST) Received: from [10.2.212.23] (e121345-lin.cambridge.arm.com [10.2.212.23]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 4630D3F632; Fri, 4 Dec 2026 08:28:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=arm.com; s=foss; t=1796401735; bh=p8WRs+bkDuVUN0BKj0VL0HYBWRus2NEv/lJkPIWYrj4=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=Yd2EfFtRTBLSR6M8n48OQYhX1D68GZMRYOQOpJ3Yc6EfVBoGPNZu9ozISNZjVXwBp hwZ7p7nAjvWr11Le8h4tY5w5e5eW36lGMMbTleWDKP7ippHxuHnSxGBwfK5EJI5E62 VH1zw4VZ9/ljQIaiLSCx8zhgKYwBoxgHMWXxwZf8= Message-ID: <10933bc1-067f-409c-b9f6-1573e778a612@arm.com> Date: Fri, 4 Dec 2026 16:28:38 +0000 X-Mailing-List: linux-perf-users@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] perf/arm-cmn: Terminate the discovered node array To: Leo Yan , Will Deacon , Mark Rutland Cc: linux-arm-kernel@lists.infradead.org, linux-perf-users@vger.kernel.org References: <20261204-b4-arm_cmn_fix_node_sentinel-v1-1-021075ebdcd7@arm.com> From: Robin Murphy Content-Language: en-GB In-Reply-To: <20261204-b4-arm_cmn_fix_node_sentinel-v1-1-021075ebdcd7@arm.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit 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 > --- > 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,