Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Will Deacon <will@kernel.org>
To: Xu Yang <xu.yang_2@nxp.com>
Cc: Frank.li@nxp.com, mark.rutland@arm.com, robh+dt@kernel.org,
	krzysztof.kozlowski+dt@linaro.org, conor+dt@kernel.org,
	shawnguo@kernel.org, s.hauer@pengutronix.de,
	kernel@pengutronix.de, festevam@gmail.com,
	john.g.garry@oracle.com, jolsa@kernel.org, namhyung@kernel.org,
	irogers@google.com, linux-imx@nxp.com, mike.leach@linaro.org,
	leo.yan@linaro.org, peterz@infradead.org, mingo@redhat.com,
	acme@kernel.org, alexander.shishkin@linux.intel.com,
	adrian.hunter@intel.com, linux-arm-kernel@lists.infradead.org,
	devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-perf-users@vger.kernel.org, imx@lists.linux.dev
Subject: Re: [PATCH v4 2/6] perf: imx_perf: refactor driver for imx93
Date: Thu, 22 Feb 2024 12:18:38 +0000	[thread overview]
Message-ID: <20240222121838.GA8308@willie-the-truck> (raw)
In-Reply-To: <20240131055811.3035741-2-xu.yang_2@nxp.com>

On Wed, Jan 31, 2024 at 01:58:07PM +0800, Xu Yang wrote:
> This driver is initinally used to support imx93 Soc and now it's time to
> add support for imx95 Soc. However, some macro definitions and events are
> different on these two Socs. For preparing imx95 supports, this will
> refactor driver for imx93.
> 
> Signed-off-by: Xu Yang <xu.yang_2@nxp.com>
> 
> ---
> Changes in v4:
>  - new patch
> ---
>  drivers/perf/fsl_imx9_ddr_perf.c | 121 ++++++++++++++++++++++---------
>  1 file changed, 87 insertions(+), 34 deletions(-)

[...]

> @@ -476,12 +490,12 @@ static int ddr_perf_event_add(struct perf_event *event, int flags)
>  	hwc->idx = counter;
>  	hwc->state |= PERF_HES_STOPPED;
>  
> +	/* read trans, write trans, read beat */
> +	imx93_ddr_perf_monitor_config(pmu, cfg, cfg1, cfg2);
> +
>  	if (flags & PERF_EF_START)
>  		ddr_perf_event_start(event, flags);
>  
> -	/* read trans, write trans, read beat */
> -	ddr_perf_monitor_config(pmu, cfg, cfg1, cfg2);
> -
>  	return 0;

This change looks like more than just refactoring and should probably be a
separate patch. Is it a bug fix for the existing code?

> +static int ddr_perf_add_events(struct ddr_pmu *pmu)
> +{
> +	int i, ret;
> +	struct attribute **attrs = pmu->devtype_data->attrs;
> +	struct device *pmu_dev = pmu->pmu.dev;
> +
> +	if (!attrs)
> +		return 0;
> +
> +	for (i = 0; attrs[i]; i++) {
> +		ret = sysfs_add_file_to_group(&pmu_dev->kobj, attrs[i], "events");
> +		if (ret) {
> +			dev_warn(pmu->dev, "i.MX9 DDR Perf add events failed (%d)\n", ret);
> +			return ret;

Can you use the '.is_visible' callback in 'struct attribute_group' to avoid
having to manipulate sysfs directly like this? For example, create separate
groups for the imx93 and imx95-specific events and only make them visible
if we're on the appropriate hardware.

Will

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

  parent reply	other threads:[~2024-02-22 12:19 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-31  5:58 [PATCH v4 1/6] dt-bindings: perf: fsl-imx-ddr: Add i.MX95 compatible Xu Yang
2024-01-31  5:58 ` [PATCH v4 2/6] perf: imx_perf: refactor driver for imx93 Xu Yang
2024-01-31 15:26   ` Frank Li
2024-02-22 12:18   ` Will Deacon [this message]
2024-02-29  6:07     ` [EXT] " Xu Yang
2024-01-31  5:58 ` [PATCH v4 3/6] perf: imx_perf: add support for i.MX95 platform Xu Yang
2024-01-31 15:29   ` Frank Li
2024-02-22 12:22   ` Will Deacon
2024-02-29 10:27     ` [EXT] " Xu Yang
2024-01-31  5:58 ` [PATCH v4 4/6] perf: imx_perf: add macro definitions for parsing config attr Xu Yang
2024-02-22 12:23   ` Will Deacon
2024-02-29 10:29     ` [EXT] " Xu Yang
2024-01-31  5:58 ` [PATCH v4 5/6] perf: imx_perf: limit counter ID from user space and optimize counter usage Xu Yang
2024-02-22 12:24   ` Will Deacon
2024-02-29 10:29     ` [EXT] " Xu Yang
2024-01-31  5:58 ` [PATCH v4 6/6] perf vendor events arm64:: Add i.MX95 DDR Performane Monitor metrics Xu Yang
2024-01-31  9:46   ` John Garry
2024-02-22 12:25   ` Will Deacon
2024-02-29 10:30     ` [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=20240222121838.GA8308@willie-the-truck \
    --to=will@kernel.org \
    --cc=Frank.li@nxp.com \
    --cc=acme@kernel.org \
    --cc=adrian.hunter@intel.com \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=festevam@gmail.com \
    --cc=imx@lists.linux.dev \
    --cc=irogers@google.com \
    --cc=john.g.garry@oracle.com \
    --cc=jolsa@kernel.org \
    --cc=kernel@pengutronix.de \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=leo.yan@linaro.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-imx@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mike.leach@linaro.org \
    --cc=mingo@redhat.com \
    --cc=namhyung@kernel.org \
    --cc=peterz@infradead.org \
    --cc=robh+dt@kernel.org \
    --cc=s.hauer@pengutronix.de \
    --cc=shawnguo@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