From: Mike Leach <Mike.Leach@arm.com>
To: Amir Ayupov <aaupov@fb.com>, James Clark <james.clark@linaro.org>,
Leo Yan <Leo.Yan@arm.com>,
Suzuki Poulose <Suzuki.Poulose@arm.com>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Jonathan Corbet <corbet@lwn.net>,
Mathieu Poirier <mathieu.poirier@linaro.org>,
Randy Dunlap <rdunlap@infradead.org>,
Shuah Khan <skhan@linuxfoundation.org>,
"coresight@lists.linaro.org" <coresight@lists.linaro.org>,
"linux-arm-kernel@lists.infradead.org"
<linux-arm-kernel@lists.infradead.org>,
"linux-doc@vger.kernel.org" <linux-doc@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
nd <nd@arm.com>
Subject: RE: [PATCH v2 1/4] coresight: syscfg: Fail to enable a configuration not loaded on the device
Date: Tue, 10 Nov 2026 15:19:31 +0000 [thread overview]
Message-ID: <DB9PR08MB64756F200065042673030C848C722@DB9PR08MB6475.eurprd08.prod.outlook.com> (raw)
In-Reply-To: <20261012230527.750567-2-aaupov@fb.com>
Hi,
> -----Original Message-----
> From: Amir Ayupov <aaupov@fb.com>
> Sent: Tuesday, October 13, 2026 12:05 AM
> To: James Clark <james.clark@linaro.org>; Leo Yan <Leo.Yan@arm.com>;
> Suzuki Poulose <Suzuki.Poulose@arm.com>; Mike Leach
> <Mike.Leach@arm.com>; Alexander Shishkin
> <alexander.shishkin@linux.intel.com>
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>; Jonathan Corbet
> <corbet@lwn.net>; Mathieu Poirier <mathieu.poirier@linaro.org>; Randy
> Dunlap <rdunlap@infradead.org>; Shuah Khan <skhan@linuxfoundation.org>;
> coresight@lists.linaro.org; linux-arm-kernel@lists.infradead.org; linux-
> doc@vger.kernel.org; linux-kernel@vger.kernel.org
> Subject: [PATCH v2 1/4] coresight: syscfg: Fail to enable a configuration not
> loaded on the device
>
> cscfg_csdev_enable_active_config() looks up the selected configuration in
> the device's loaded configurations, and returns success when it is not
> there. A configuration is only loaded on devices that match at least one
> of its features, so a perf session or sysfs enable that selects it on any
> other device runs without the configuration, with no error.
>
> Return -EINVAL instead, so enabling the source fails on that device. The
> function is only called with a non-zero configuration hash, so sources
> enabled without a configuration are unaffected.
>
If you look at the original comments - the idea of this function is to enable a configuration on a device if it is present on that device.
Not enabling a configuration is _not_ an error. This is a generic function that can cover multiple classes of coresight device.
Moving forwards matching configurations to devices can omit certain devices from the configuration.
For example, a system will have many CTIs, but we may only want to use a specific one or two - possibly to connect etm external outputs to trigger a PE interrupt.
Thus the remaining CTIs would not be active in this configuration.
This conflicts with your purpose which I assume is to prevent perf from using ETM sources that cannot load the required configuration.
I think what is actually needed is a "can_activate" function to be run on the ETM/ETE sources at etm_setup_aux time so that none compliant devices can be filtered out of the active cpu mask at that point.
Regards
Mike
> Fixes: f8cce2ff3c04 ("coresight: syscfg: Add API to activate and enable
> configurations")
> Assisted-by: Devmate:Opus-5.5
> Signed-off-by: Amir Ayupov <aaupov@fb.com>
> ---
> .../hwtracing/coresight/coresight-syscfg.c | 53 ++++++++++---------
> 1 file changed, 28 insertions(+), 25 deletions(-)
>
> 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;
> +
> + /*
> + * Call the generic routine that will program up the internal
> + * driver structures prior to programming up the hardware.
> + * This routine takes the driver spinlock saved in the configs.
> + */
> + err = cscfg_csdev_enable_config(config_csdev_active, preset);
> + if (!err) {
> /*
> - * Call the generic routine that will program up the internal
> - * driver structures prior to programming up the hardware.
> - * This routine takes the driver spinlock saved in the configs.
> + * Successful programming. Check the active_cscfg_ctxt
> + * pointer to ensure no pre-emption disabled it via
> + * cscfg_csdev_disable_active_config() before
> + * we could start.
> + *
> + * Set enabled if OK, err if not.
> */
> - err = cscfg_csdev_enable_config(config_csdev_active, preset);
> - if (!err) {
> - /*
> - * Successful programming. Check the
> active_cscfg_ctxt
> - * pointer to ensure no pre-emption disabled it via
> - * cscfg_csdev_disable_active_config() before
> - * we could start.
> - *
> - * Set enabled if OK, err if not.
> - */
> - raw_spin_lock_irqsave(&csdev->cscfg_csdev_lock,
> flags);
> - if (csdev->active_cscfg_ctxt)
> - config_csdev_active->enabled = true;
> - else
> - err = -EBUSY;
> - raw_spin_unlock_irqrestore(&csdev-
> >cscfg_csdev_lock, flags);
> - }
> -
> - if (err)
> - cscfg_config_desc_put(config_desc);
> + raw_spin_lock_irqsave(&csdev->cscfg_csdev_lock, flags);
> + if (csdev->active_cscfg_ctxt)
> + config_csdev_active->enabled = true;
> + else
> + err = -EBUSY;
> + raw_spin_unlock_irqrestore(&csdev->cscfg_csdev_lock, flags);
> }
>
> + if (err)
> + cscfg_config_desc_put(config_desc);
> +
> return err;
> }
> EXPORT_SYMBOL_GPL(cscfg_csdev_enable_active_config);
> --
> 2.52.0
next prev parent reply other threads:[~2026-11-10 15:20 UTC|newest]
Thread overview: 49+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-12 23:05 [PATCH v2 0/4] coresight: Pulse an ETM external output for a PMU event Amir Ayupov
2026-10-12 23:05 ` [PATCH v2 1/4] coresight: syscfg: Fail to enable a configuration not loaded on the device Amir Ayupov
2026-10-21 14:09 ` Leo Yan
2026-11-10 15:19 ` Mike Leach [this message]
2026-10-12 23:05 ` [PATCH v2 2/4] coresight: syscfg: Match feature capabilities separately from device class Amir Ayupov
2026-10-21 14:39 ` Leo Yan
2026-10-25 6:21 ` Amir Ayupov
2026-10-27 11:21 ` Suzuki K Poulose
2026-10-12 23:05 ` [PATCH v2 3/4] coresight: etm4x: Report the external outputs the PMU counts Amir Ayupov
2026-10-21 16:43 ` Leo Yan
2026-10-23 9:49 ` James Clark
2026-10-23 14:00 ` Leo Yan
2026-10-26 9:22 ` James Clark
2026-10-25 6:34 ` Amir Ayupov
2026-10-23 9:57 ` James Clark
2026-11-10 15:19 ` Mike Leach
2026-10-12 23:05 ` [PATCH v2 4/4] coresight: Add pmu_pulse/extout_pulse Amir Ayupov
2026-10-13 1:09 ` Daniel Pereira
2026-10-25 6:38 ` Amir Ayupov
2026-10-26 9:36 ` James Clark
2026-10-25 6:39 ` [PATCH v3 0/7] coresight: Pulse an ETM external output for a PMU event Amir Ayupov
2026-10-25 6:39 ` [PATCH v3 1/7] coresight: etm4x: Fix event count decoding Amir Ayupov
2026-10-25 6:39 ` [PATCH v3 2/7] coresight: syscfg: Fail to enable a configuration not loaded on the device Amir Ayupov
2026-10-25 6:39 ` [PATCH v3 3/7] coresight: syscfg: Match feature capabilities separately from device class Amir Ayupov
2026-10-25 6:39 ` [PATCH v3 4/7] coresight: syscfg: Remove unused CS_CFG_MATCH_INST_ANY Amir Ayupov
2026-10-25 6:39 ` [PATCH v3 5/7] perf: arm_pmuv3: Add pmuv3_event_implemented() Amir Ayupov
2026-10-25 17:05 ` kernel test robot
2026-10-26 0:43 ` kernel test robot
2026-10-25 6:39 ` [PATCH v3 6/7] coresight: etm4x: Report whether the PMU counts the external outputs Amir Ayupov
2026-10-25 6:39 ` [PATCH v3 7/7] coresight: Add pmu_pulse/extout_pulse Amir Ayupov
2026-10-26 5:48 ` [PATCH v4 0/7] coresight: Pulse an ETM external output for a PMU event Amir Ayupov
2026-10-26 5:48 ` [PATCH v4 1/7] coresight: etm4x: Fix event count decoding Amir Ayupov
2026-10-26 9:37 ` James Clark
2026-10-26 5:48 ` [PATCH v4 2/7] coresight: syscfg: Fail to enable a configuration not loaded on the device Amir Ayupov
2026-10-26 5:48 ` [PATCH v4 3/7] coresight: syscfg: Match feature capabilities separately from device class Amir Ayupov
2026-10-26 9:45 ` James Clark
2026-11-05 12:24 ` Suzuki K Poulose
2026-10-26 5:48 ` [PATCH v4 4/7] coresight: syscfg: Remove unused CS_CFG_MATCH_INST_ANY Amir Ayupov
2026-10-26 9:45 ` James Clark
2026-10-26 5:48 ` [PATCH v4 5/7] perf: arm_pmuv3: Add pmuv3_event_implemented() Amir Ayupov
2026-10-26 9:47 ` James Clark
2026-11-05 14:54 ` Suzuki K Poulose
2026-11-05 15:10 ` James Clark
2026-10-26 5:48 ` [PATCH v4 6/7] coresight: etm4x: Report whether the PMU counts the external outputs Amir Ayupov
2026-10-26 9:49 ` James Clark
2026-11-05 12:23 ` Suzuki K Poulose
2026-10-26 5:48 ` [PATCH v4 7/7] coresight: Add pmu_pulse/extout_pulse Amir Ayupov
2026-10-26 9:50 ` James Clark
2026-11-05 11:43 ` [PATCH v4 0/7] coresight: Pulse an ETM external output for a PMU event Leo Yan
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=DB9PR08MB64756F200065042673030C848C722@DB9PR08MB6475.eurprd08.prod.outlook.com \
--to=mike.leach@arm.com \
--cc=Leo.Yan@arm.com \
--cc=Suzuki.Poulose@arm.com \
--cc=aaupov@fb.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=corbet@lwn.net \
--cc=coresight@lists.linaro.org \
--cc=gregkh@linuxfoundation.org \
--cc=james.clark@linaro.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mathieu.poirier@linaro.org \
--cc=nd@arm.com \
--cc=rdunlap@infradead.org \
--cc=skhan@linuxfoundation.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
all inboxes | Powered by JetHome®