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 2/7] coresight: syscfg: Fail to enable a configuration not loaded on the device
Date: Fri, 20 Nov 2026 15:36:11 +0000	[thread overview]
Message-ID: <sashiko-outbox-225472@kernel.org> (raw)
In-Reply-To: <699bb518b0f92c57227d4c73e21c58d8aadcc5a2.1795182850.git.aaupov@fb.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [High] coresight: syscfg: cscfg_csdev_enable_active_config() rejects
  unmatched csdev
--

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

coresight: syscfg: Fail to enable a configuration not loaded on the device

This commit makes cscfg_csdev_enable_active_config() return -EINVAL when
the active configuration is not loaded on the target CoreSight device.

> diff --git a/drivers/hwtracing/coresight/coresight-syscfg.c b/drivers/hwtracing/coresight/coresight-syscfg.c
> index 2bfdd7b45e49c..a816c22c87bc8 100644
> --- a/drivers/hwtracing/coresight/coresight-syscfg.c
> +++ b/drivers/hwtracing/coresight/coresight-syscfg.c
> @@ -1088,36 +1088,39 @@ int cscfg_csdev_enable_active_config(struct coresight_device *csdev,
>  	raw_spin_unlock_irqrestore(&csdev->cscfg_csdev_lock, flags);
>  
>  	/*
> -	 * If found, attempt to enable
> +	 * The configuration is active but not loaded on this device, because
> +	 * none of its features match the device. Fail rather than trace
> +	 * without it.
>  	 */
> -	if (config_csdev_active) {
> +	if (!config_csdev_active)
> +		return -EINVAL;

[Severity: High]
As reported by Mike Leach on v2 [1], should
cscfg_csdev_enable_active_config() fail when a configuration is not loaded
on csdev?

cscfg_csdev_enable_active_config() is a generic helper across CoreSight
device classes, and its kernel-doc states that it enables the configuration
only if supported on the device:

drivers/hwtracing/coresight/coresight-syscfg.c:
/**
 * cscfg_csdev_enable_active_config - Enable matching active configuration for device.
 *
 * Enables the configuration selected by @cfg_hash if the configuration is supported
 * on the device and has been activated.

For perf sessions, etm_setup_aux() activates cfg_hash globally and builds
paths for every CPU in event_data->mask without filtering out ETM sources
that do not have the configuration loaded.  Returning -EINVAL here causes
etm_setup_aux() to succeed even if some or all CPUs lack the configuration,
only for etm_event_start() -> coresight_enable_source() -> etm4_enable_perf()
to fail at schedule-in time and stop the event with PERF_HES_STOPPED.

Incompatible ETM sources should instead be filtered out of event_data->mask
during etm_setup_aux().

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

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

  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 [this message]
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
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-225472@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