public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: Mark Rutland <mark.rutland@arm.com>
To: Robin Murphy <robin.murphy@arm.com>
Cc: will@kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, ilkka@os.amperecomputing.com
Subject: Re: [PATCH 2/8] perf/arm-cmn: Fix CCLA register offset
Date: Fri, 16 Aug 2024 11:00:06 +0100	[thread overview]
Message-ID: <Zr8jJq3l9sfvJuil@J2N7QTR9R3> (raw)
In-Reply-To: <e73b31da42a7840d4247fc8a4a3cea805c2ab618.1723229941.git.robin.murphy@arm.com>

On Fri, Aug 09, 2024 at 08:15:41PM +0100, Robin Murphy wrote:
> Apparently pmu_event_sel is offset by 8 for all CCLA nodes, not just
> the CCLA_RNI combination type.

Was there some reason we used to think that was specific to CCLA_RNI
nodes, or was that just an oversight?

Looking at the CMN-700 TRM and scanning for pmu_event_sel, we have:

	16'h2000	por_ccg_ha_pmu_event_sel
	16'h2000	por_ccg_ra_pmu_event_sel
	16'h2008	por_ccla_pmu_event_sel
	16'h2000	por_dn_pmu_event_sel
	16'h2000	cmn_hns_pmu_event_sel
	16'h2000	por_hni_pmu_event_sel
	16'h2008	por_hnp_pmu_event_sel
	16'h2000	por_mxp_pmu_event_sel
	16'h2000	por_rnd_pmu_event_sel
	16'h2000	por_rni_pmu_event_sel
	16'h2000	por_sbsx_pmu_event_sel

> Fixes: 23760a014417 ("perf/arm-cmn: Add CMN-700 support")
> Signed-off-by: Robin Murphy <robin.murphy@arm.com>
> ---
>  drivers/perf/arm-cmn.c | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/perf/arm-cmn.c b/drivers/perf/arm-cmn.c
> index fd2122a37f22..0e2e12e2f4fb 100644
> --- a/drivers/perf/arm-cmn.c
> +++ b/drivers/perf/arm-cmn.c
> @@ -2393,10 +2393,13 @@ static int arm_cmn_discover(struct arm_cmn *cmn, unsigned int rgn_offset)
>  			case CMN_TYPE_CXHA:
>  			case CMN_TYPE_CCRA:
>  			case CMN_TYPE_CCHA:
> -			case CMN_TYPE_CCLA:
>  			case CMN_TYPE_HNS:
>  				dn++;
>  				break;
> +			case CMN_TYPE_CCLA:
> +				dn->pmu_base += CMN_HNP_PMU_EVENT_SEL;
> +				dn++;
> +				break;

When reading this for the first time, it looks like a copy-paste error
since CMN_HNP_PMU_EVENT_SEL doesn't have any obvious relationship with
CCLA nodes.

I reckon it'd be worth adding CMN_CCLA_PMU_EVENT_SEL, and replacing the
existing comment above the definition of CMN_HNP_PMU_EVENT_SEL, e.g.

/*
 * Some nodes place common registers at different offsets from most
 * other nodes.
 */
#define CMN_HNP_PMU_EVENT_SEL		0x008
#define CMN_CCLA_PMU_EVENT_SEL		0x008

That way the switch looks less suspicious, and the comment is a bit more
helpful to anyone trying to figure out what's going on here.

With that:

Acked-by: Mark Rutland <mark.rutland@arm.com>

Mark.

>  			/* Nothing to see here */
>  			case CMN_TYPE_MPAM_S:
>  			case CMN_TYPE_MPAM_NS:
> -- 
> 2.39.2.101.g768bb238c484.dirty
> 


  reply	other threads:[~2024-08-16 10:01 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-09 19:15 [PATCH 0/8] perf/arm-cmn: Fixes and updates Robin Murphy
2024-08-09 19:15 ` [PATCH 1/8] perf/arm-cmn: Refactor node ID handling. Again Robin Murphy
2024-08-16  9:33   ` Mark Rutland
2024-08-16 11:56     ` Robin Murphy
2024-08-16 12:45       ` Mark Rutland
2024-08-16 13:21         ` Robin Murphy
2024-08-24  1:00   ` Ilkka Koskinen
2024-08-27 13:51     ` Robin Murphy
2024-08-09 19:15 ` [PATCH 2/8] perf/arm-cmn: Fix CCLA register offset Robin Murphy
2024-08-16 10:00   ` Mark Rutland [this message]
2024-08-16 18:33     ` Robin Murphy
2024-08-23 23:18       ` Ilkka Koskinen
2024-08-09 19:15 ` [PATCH 3/8] perf/arm-cmn: Ensure dtm_idx is big enough Robin Murphy
2024-08-16 10:14   ` Mark Rutland
2024-08-19 15:00     ` Robin Murphy
2024-08-20  9:27       ` Mark Rutland
2024-08-23 23:58       ` Ilkka Koskinen
2024-08-09 19:15 ` [PATCH 4/8] perf/arm-cmn: Improve build-time assertions Robin Murphy
2024-08-16 10:20   ` Mark Rutland
2024-08-09 19:15 ` [PATCH 5/8] perf/arm-cmn: Make cycle counts less surprising Robin Murphy
2024-08-16 10:25   ` Mark Rutland
2024-08-19 16:35     ` Robin Murphy
2024-08-09 19:15 ` [PATCH 6/8] perf/arm-cmn: Refactor DTC PMU register access Robin Murphy
2024-08-16 10:29   ` Mark Rutland
2024-08-19 16:41     ` Robin Murphy
2024-08-20  9:23       ` Mark Rutland
2024-08-23 23:46         ` Ilkka Koskinen
2024-08-09 19:15 ` [PATCH 7/8] dt-bindings: perf: arm-cmn: Add CMN S3 Robin Murphy
2024-08-15 15:20   ` Rob Herring (Arm)
2024-08-09 19:15 ` [PATCH 8/8] perf/arm-cmn: Support " Robin Murphy
2024-08-16 10:32   ` Mark Rutland
2024-08-23 23:38   ` Ilkka Koskinen

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=Zr8jJq3l9sfvJuil@J2N7QTR9R3 \
    --to=mark.rutland@arm.com \
    --cc=ilkka@os.amperecomputing.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=robin.murphy@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