public inbox for linux-arm-kernel@lists.infradead.org
 help / color / mirror / Atom feed
From: Mark Rutland <mark.rutland@arm.com>
To: Xu Yang <xu.yang_2@nxp.com>
Cc: frank.li@nxp.com, will@kernel.org, shawnguo@kernel.org,
	s.hauer@pengutronix.de, kernel@pengutronix.de, linux-imx@nxp.com,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v2 2/3] perf/imx_ddr: adjust counter result after read cycle counter
Date: Fri, 28 Jul 2023 14:36:31 +0100	[thread overview]
Message-ID: <ZMPEXxNO7V3rYouR@FVFF77S0Q05N> (raw)
In-Reply-To: <20230713103758.2627269-2-xu.yang_2@nxp.com>

On Thu, Jul 13, 2023 at 06:37:57PM +0800, Xu Yang wrote:
> Because we initialize CP filed to shorten counter0 overflow time, the cycle
> counter will start couting from a fixed/base value each time. We need to
> remove the base from the result too. Therefore, we could get precise result
> from cycle counter.

This means that patch 1 is incomplete; please fold this into patch 1.

> 
> Signed-off-by: Xu Yang <xu.yang_2@nxp.com>
> 
> ---
> Changes in v2:
>  - improve if condition
> ---
>  drivers/perf/fsl_imx8_ddr_perf.c | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/drivers/perf/fsl_imx8_ddr_perf.c b/drivers/perf/fsl_imx8_ddr_perf.c
> index 039069756bbc..d65200d4e96e 100644
> --- a/drivers/perf/fsl_imx8_ddr_perf.c
> +++ b/drivers/perf/fsl_imx8_ddr_perf.c
> @@ -481,6 +481,12 @@ static void ddr_perf_event_update(struct perf_event *event)
>  	int ret;
>  
>  	new_raw_count = ddr_perf_read_counter(pmu, counter);
> +	/* Workaround for i.MX8MP */
> +	if (pmu->devtype_data->quirks & DDR_CAP_AXI_ID_FILTER_ENHANCED) {
> +		if (counter == EVENT_CYCLES_COUNTER)
> +			new_raw_count -= 0xF0000000;
> +	}

I think as Frank suggested, it would be clearer to have a mask, and I think
this should have a comment:

	/*
	 * Remove the bias applied in ddr_perf_counter_enable().
	 */
	if (pmu->devtype_data->quirks & DDR_CAP_AXI_ID_FILTER_ENHANCED) {
		if (counter == EVENT_CYCLES_COUNTER)
			new_raw_count &= 0x0fffffff;
	}

Thanks,
Mark.

> +
>  	local64_add(new_raw_count, &event->count);
>  
>  	/*
> -- 
> 2.34.1
> 

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  parent reply	other threads:[~2023-07-28 13:37 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-13 10:37 [PATCH v2 1/3] perf/imx_ddr: speed up overflow frequency of cycle counter Xu Yang
2023-07-13 10:37 ` [PATCH v2 2/3] perf/imx_ddr: adjust counter result after read " Xu Yang
2023-07-13 15:36   ` Frank Li
2023-07-14  1:44     ` Xu Yang
2023-07-28 13:36   ` Mark Rutland [this message]
2023-07-29  2:08     ` [EXT] " Xu Yang
2023-07-13 10:37 ` [PATCH v2 3/3] perf/imx_ddr: don't enable counter0 if none of 4 counters are used Xu Yang
2023-07-28 13:38   ` Mark Rutland
2023-07-28 13:33 ` [PATCH v2 1/3] perf/imx_ddr: speed up overflow frequency of cycle counter Mark Rutland
2023-07-29  2:02   ` [EXT] " Xu Yang

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=ZMPEXxNO7V3rYouR@FVFF77S0Q05N \
    --to=mark.rutland@arm.com \
    --cc=frank.li@nxp.com \
    --cc=kernel@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-imx@nxp.com \
    --cc=s.hauer@pengutronix.de \
    --cc=shawnguo@kernel.org \
    --cc=will@kernel.org \
    --cc=xu.yang_2@nxp.com \
    /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