Linux Perf Users
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Amir Ayupov" <aaupov@fb.com>
Cc: linux-perf-users@vger.kernel.org
Subject: Re: [PATCH v5 6/7] coresight: etm4x: Report whether the PMU counts the external outputs
Date: Fri, 20 Nov 2026 15:36:00 +0000	[thread overview]
Message-ID: <sashiko-outbox-225471@kernel.org> (raw)
In-Reply-To: <d9c953867b9ff40c20c8ddd52771bada2fa8a4b9.1795182850.git.aaupov@fb.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] coresight: etm4x: PMU coupling and 1-event match in
  etm4_pmu_counts_extout()
--

commit f0c882070427fa54aeaa9ce26f43db28f9511f4e
Author: Amir Ayupov <aaupov@fb.com>

coresight: etm4x: Report whether the PMU counts the external outputs

This commit checks at probe whether an ETE trace unit's CPU PMU implements
the TRCEXTOUTn events corresponding to its external outputs and exposes
the CS_CFG_MATCH_CAP_ETE_TRCEXTOUT capability match flag to CoreSight
system configuration.

> diff --git a/drivers/hwtracing/coresight/coresight-etm4x-core.c b/drivers/hwtracing/coresight/coresight-etm4x-core.c
> index af017bd8a5477..ecf2a6c945cf0 100644
> --- a/drivers/hwtracing/coresight/coresight-etm4x-core.c
> +++ b/drivers/hwtracing/coresight/coresight-etm4x-core.c
[ ... ]
> @@ -1399,6 +1401,29 @@ static void etm4_fixup_wrong_ccitmin(struct etmv4_caps *caps)
>  	}
>  }
>  
> +/*
> + * Whether the PMU counts each external output of this trace unit as
> + * TRCEXTOUTn. The trace unit has an external output for each of its events.
> + * Only ETE is checked: per its specification, an implemented TRCEXTOUTn event
> + * counts external output n.
> + *
> + * Must run on the CPU that owns the trace unit.
> + */
> +static bool etm4_pmu_counts_extout(struct etmv4_drvdata *drvdata)
> +{
> +	int n;
> +
> +	if (!etm4x_is_ete(drvdata) || !drvdata->caps.nr_event)
> +		return false;
> +
> +	for (n = 0; n < drvdata->caps.nr_event; n++) {
> +		if (!pmuv3_event_implemented(ARMV8_PMUV3_PERFCTR_TRCEXTOUT0 + n))
> +			return false;
> +	}
> +
> +	return true;
> +}

[Severity: Medium]
As reported by Mike Leach on v2 [1], should ETM/ETE configuration matching
depend on the trace unit's own event resource registers (TRCIDR0 and
TRCIDR4) rather than querying CPU PMU TRCEXTOUTn support inside the ETMv4
driver?  Counting external outputs is a PMU feature that the PMU driver
validates when a trcextoutN event is opened, whereas coupling it into a
single ETM capability flag here still returns true when
drvdata->caps.nr_event == 1 and only TRCEXTOUT0 exists.  On such an ETE,
event 1 (TRCEVENTCTL0R bits [15:8], driving external output 1) is RES0 and
TRCEXTOUT1 is not checked, yet a feature like extout_pulse in commit
"coresight: Add pmu_pulse/extout_pulse" that matches
CS_CFG_MATCH_CAP_ETE_TRCEXTOUT and unconditionally programs event 1 will
still match and load.

[1] https://lore.kernel.org/r/DB9PR08MB64752311F395D91F4FCBD0CB8C722@DB9PR08MB6475.eurprd08.prod.outlook.com

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1795182850.git.aaupov@fb.com?part=6

  reply	other threads:[~2026-11-20 15:36 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-20 15:21 [PATCH v5 0/7] coresight: Pulse an ETM external output for a PMU event Amir Ayupov
2026-11-20 15:21 ` [PATCH v5 1/7] coresight: etm4x: Fix event count decoding Amir Ayupov
2026-11-20 15:30   ` sashiko-bot
2026-11-20 15:21 ` [PATCH v5 2/7] coresight: syscfg: Fail to enable a configuration not loaded on the device Amir Ayupov
2026-11-20 15:36   ` sashiko-bot
2026-11-20 15:21 ` [PATCH v5 3/7] coresight: syscfg: Match feature capabilities separately from device class Amir Ayupov
2026-11-20 15:29   ` sashiko-bot
2026-11-20 15:21 ` [PATCH v5 4/7] coresight: syscfg: Remove unused CS_CFG_MATCH_INST_ANY Amir Ayupov
2026-11-20 15:30   ` sashiko-bot
2026-11-20 15:21 ` [PATCH v5 5/7] perf: arm_pmuv3: Add pmuv3_event_implemented() Amir Ayupov
2026-11-20 15:39   ` sashiko-bot
2026-11-20 15:21 ` [PATCH v5 6/7] coresight: etm4x: Report whether the PMU counts the external outputs Amir Ayupov
2026-11-20 15:36   ` sashiko-bot [this message]
2026-11-20 15:21 ` [PATCH v5 7/7] coresight: Add pmu_pulse/extout_pulse Amir Ayupov
2026-11-20 15:41   ` sashiko-bot

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=sashiko-outbox-225471@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=aaupov@fb.com \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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