From: Suzuki K Poulose <suzuki.poulose@arm.com>
To: Leo Yan <leo.yan@arm.com>, Mike Leach <mike.leach@arm.com>,
James Clark <james.clark@linaro.org>,
Yeoreum Yun <yeoreum.yun@arm.com>,
Mark Rutland <mark.rutland@arm.com>,
Will Deacon <will@kernel.org>, Yabin Cui <yabinc@google.com>,
Keita Morisaki <keyz@google.com>,
Jie Gan <jie.gan@oss.qualcomm.com>,
Yuanfang Zhang <quic_yuanfang@quicinc.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Tamas Petz <tamas.petz@arm.com>,
Thomas Gleixner <tglx@kernel.org>,
Peter Zijlstra <peterz@infradead.org>
Cc: coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v11 14/27] coresight: Move source helper disabling to coresight_disable_path()
Date: Wed, 6 May 2026 10:05:47 +0100 [thread overview]
Message-ID: <f3d3d2e6-65f8-4ea9-91d7-4b1fc3882a83@arm.com> (raw)
In-Reply-To: <20260501-arm_coresight_path_power_management_improvement-v11-14-fc7fb9d5af1c@arm.com>
On 01/05/2026 17:47, Leo Yan wrote:
> Move source helper disabling to coresight_disable_path() to pair it with
> coresight_enable_path().
>
> In coresight_enable_path(), if enabling a node fails, iterate to the
> next node (which is the last successfully enabled node) and pass it to
> coresight_disable_path() for rollback. If the failed node is the last
> node on the path, no device is actually enabled, so bail out directly.
>
> As a result, coresight_disable_source() only controls the source,
> leaving the associated helpers to be managed as part of path. Update
> the comment to reflect this change.
>
> Tested-by: Jie Gan <jie.gan@oss.qualcomm.com>
> Reviewed-by: Yeoreum Yun <yeoreum.yun@arm.com>
> Reviewed-by: James Clark <james.clark@linaro.org>
> Tested-by: James Clark <james.clark@linaro.org>
> Signed-off-by: Leo Yan <leo.yan@arm.com>
> ---
> drivers/hwtracing/coresight/coresight-core.c | 38 +++++++++++++---------------
> 1 file changed, 17 insertions(+), 21 deletions(-)
>
> diff --git a/drivers/hwtracing/coresight/coresight-core.c b/drivers/hwtracing/coresight/coresight-core.c
> index 0c11e7fff1bd5cf504b17241595d83a1d11bcf40..6ab80ae7c389e9031d4ab065d83bb676fd12160b 100644
> --- a/drivers/hwtracing/coresight/coresight-core.c
> +++ b/drivers/hwtracing/coresight/coresight-core.c
> @@ -447,19 +447,12 @@ static void coresight_disable_helpers(struct coresight_device *csdev,
> }
>
> /*
> - * Helper function to call source_ops(csdev)->disable and also disable the
> - * helpers.
> - *
> - * There is an imbalance between coresight_enable_path() and
> - * coresight_disable_path(). Enabling also enables the source's helpers as part
> - * of the path, but disabling always skips the first item in the path (which is
> - * the source), so sources and their helpers don't get disabled as part of that
> - * function and we need the extra step here.
> + * coresight_disable_source() only disables the source, but do nothing for
> + * the associated helpers, which are controlled as part of the path.
> */
> void coresight_disable_source(struct coresight_device *csdev, void *data)
> {
> source_ops(csdev)->disable(csdev, data);
> - coresight_disable_helpers(csdev, NULL);
> }
> EXPORT_SYMBOL_GPL(coresight_disable_source);
>
> @@ -486,9 +479,9 @@ int coresight_resume_source(struct coresight_device *csdev)
> EXPORT_SYMBOL_GPL(coresight_resume_source);
>
> /*
> - * coresight_disable_path_from : Disable components in the given path beyond
> - * @nd in the list. If @nd is NULL, all the components, except the SOURCE are
> - * disabled.
> + * coresight_disable_path_from : Disable components in the given path starting
> + * from @nd in the list. If @nd is NULL, all the components, except the SOURCE
> + * are disabled.
> */
> static void coresight_disable_path_from(struct coresight_path *path,
> struct coresight_node *nd)
> @@ -499,7 +492,7 @@ static void coresight_disable_path_from(struct coresight_path *path,
> if (!nd)
> nd = list_first_entry(&path->path_list, struct coresight_node, link);
>
> - list_for_each_entry_continue(nd, &path->path_list, link) {
> + list_for_each_entry_from(nd, &path->path_list, link) {
> csdev = nd->csdev;
> type = csdev->type;
>
> @@ -519,12 +512,6 @@ static void coresight_disable_path_from(struct coresight_path *path,
> coresight_disable_sink(csdev);
> break;
> case CORESIGHT_DEV_TYPE_SOURCE:
> - /*
> - * We skip the first node in the path assuming that it
> - * is the source. So we don't expect a source device in
> - * the middle of a path.
> - */
> - WARN_ON(1);
> break;
> case CORESIGHT_DEV_TYPE_LINK:
> parent = list_prev_entry(nd, link)->csdev;
--8>--
> @@ -580,12 +567,16 @@ int coresight_enable_path(struct coresight_path *path, enum cs_mode mode)
> {
> int ret = 0;
> u32 type;
> - struct coresight_node *nd;
> + struct coresight_node *nd, *last;
> struct coresight_device *csdev, *parent, *child;
> struct coresight_device *source;
>
> source = coresight_get_source(path);
> - list_for_each_entry_reverse(nd, &path->path_list, link) {
> +
> + last = list_last_entry(&path->path_list, struct coresight_node, link);
> +
> + nd = last;
> + list_for_each_entry_from_reverse(nd, &path->path_list, link) {
> csdev = nd->csdev;
> type = csdev->type;
>
> @@ -639,6 +630,11 @@ int coresight_enable_path(struct coresight_path *path, enum cs_mode mode)
> err_disable_helpers:
> coresight_disable_helpers(csdev, path);
> err_disable_path:
> + /* No device is actually enabled */
> + if (nd == last)
> + goto out;
+
This hunk seems to be different from the one described in the commit and
should be a different patch if at all we need it ?
Moreover, this looks unnecessary. We already do the check to see if we
didn't enable any device. See CORESIGHT_DEVICE_TYPE_SINK case.
Suzuki
> + nd = list_next_entry(nd, link);
> coresight_disable_path_from(path, nd);
> goto out;
> }
>
next prev parent reply other threads:[~2026-05-06 9:07 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-01 16:47 [PATCH v11 00/27] CoreSight: Refactor power management for CoreSight path Leo Yan
2026-05-01 16:47 ` [PATCH v11 01/27] coresight: Handle helper enable failure properly Leo Yan
2026-05-01 16:47 ` [PATCH v11 02/27] coresight: Extract device init into coresight_init_device() Leo Yan
2026-05-01 16:47 ` [PATCH v11 03/27] coresight: Populate CPU ID into coresight_device Leo Yan
2026-05-01 16:47 ` [PATCH v11 04/27] coresight: Remove .cpu_id() callback from source ops Leo Yan
2026-05-01 16:47 ` [PATCH v11 05/27] coresight: Take hotplug lock in enable_source_store() for Sysfs mode Leo Yan
2026-05-01 16:47 ` [PATCH v11 06/27] coresight: perf: Retrieve path and source from event data Leo Yan
2026-05-01 16:47 ` [PATCH v11 07/27] coresight: Take a reference on csdev Leo Yan
2026-05-01 16:47 ` [PATCH v11 08/27] coresight: Move per-CPU source pointer to core layer Leo Yan
2026-05-01 16:47 ` [PATCH v11 09/27] coresight: Grab per-CPU source device during AUX setup Leo Yan
2026-05-06 9:08 ` Suzuki K Poulose
2026-05-01 16:47 ` [PATCH v11 10/27] coresight: Register CPU PM notifier in core layer Leo Yan
2026-05-01 16:47 ` [PATCH v11 11/27] coresight: etm4x: Hook CPU PM callbacks Leo Yan
2026-05-01 16:47 ` [PATCH v11 12/27] coresight: etm4x: Remove redundant checks in PM save and restore Leo Yan
2026-05-01 16:47 ` [PATCH v11 13/27] coresight: syscfg: Use IRQ-safe spinlock to protect active variables Leo Yan
2026-05-01 16:47 ` [PATCH v11 14/27] coresight: Move source helper disabling to coresight_disable_path() Leo Yan
2026-05-06 9:05 ` Suzuki K Poulose [this message]
2026-05-06 9:33 ` Leo Yan
2026-05-01 16:47 ` [PATCH v11 15/27] coresight: Control path with range Leo Yan
2026-05-01 16:47 ` [PATCH v11 16/27] coresight: Use helpers to fetch first and last nodes Leo Yan
2026-05-01 16:47 ` [PATCH v11 17/27] coresight: Introduce coresight_enable_source() helper Leo Yan
2026-05-01 16:47 ` [PATCH v11 18/27] coresight: Save active path for system tracers Leo Yan
2026-05-01 16:48 ` [PATCH v11 19/27] coresight: etm4x: Set active path on target CPU Leo Yan
2026-05-01 16:48 ` [PATCH v11 20/27] coresight: etm3x: " Leo Yan
2026-05-01 16:48 ` [PATCH v11 21/27] coresight: sysfs: Use source's path pointer for path control Leo Yan
2026-05-01 16:48 ` [PATCH v11 22/27] coresight: Control path during CPU idle Leo Yan
2026-05-01 16:48 ` [PATCH v11 23/27] coresight: Add PM callbacks for sink device Leo Yan
2026-05-01 16:48 ` [PATCH v11 24/27] coresight: trbe: Save and restore state across CPU low power state Leo Yan
2026-05-01 16:48 ` [PATCH v11 25/27] coresight: sysfs: Increment refcount only for system tracers Leo Yan
2026-05-06 9:57 ` Suzuki K Poulose
2026-05-06 10:18 ` Leo Yan
2026-05-01 16:48 ` [PATCH v11 26/27] coresight: Move CPU hotplug callbacks to core layer Leo Yan
2026-05-01 16:48 ` [PATCH v11 27/27] coresight: sysfs: Validate CPU online status for per-CPU sources Leo Yan
2026-05-06 7:33 ` [PATCH v11 00/27] CoreSight: Refactor power management for CoreSight path Jie Gan
2026-05-06 9:38 ` 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=f3d3d2e6-65f8-4ea9-91d7-4b1fc3882a83@arm.com \
--to=suzuki.poulose@arm.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=coresight@lists.linaro.org \
--cc=gregkh@linuxfoundation.org \
--cc=james.clark@linaro.org \
--cc=jie.gan@oss.qualcomm.com \
--cc=keyz@google.com \
--cc=leo.yan@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=mark.rutland@arm.com \
--cc=mike.leach@arm.com \
--cc=peterz@infradead.org \
--cc=quic_yuanfang@quicinc.com \
--cc=tamas.petz@arm.com \
--cc=tglx@kernel.org \
--cc=will@kernel.org \
--cc=yabinc@google.com \
--cc=yeoreum.yun@arm.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