From: Leo Yan <leo.yan@arm.com>
To: Suzuki K Poulose <suzuki.poulose@arm.com>
Cc: 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>,
Yuanfang Zhang <quic_yuanfang@quicinc.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v7 14/20] coresight: Control path with range
Date: Tue, 24 Mar 2026 07:48:04 +0000 [thread overview]
Message-ID: <20260324074804.GD43072@e132581.arm.com> (raw)
In-Reply-To: <45af1506-c08d-4f7a-b07b-90666092680b@arm.com>
On Mon, Mar 23, 2026 at 10:01:52AM +0000, Suzuki K Poulose wrote:
[...]
> > +static struct coresight_node *
> > +coresight_path_last_node(struct coresight_path *path)
> > +{
> > + return list_last_entry(&path->path_list, struct coresight_node, link);
> > +}
> > +
>
> nit: This could be used for in coresight_get_sink().
Will do.
> > +static bool coresight_path_nodes_in_order(struct coresight_path *path,
> > + struct coresight_node *from,
> > + struct coresight_node *to)
>
> I am not very clear what this is supposed to do and what it is doing ?
> Are we verifying that the nodes @from and @to are in order ? As, in the
> the link is from @from to @to ? In that case what you do may not be
> sufficient ?
My purpose is that coresight_path_nodes_in_order() checks if *from and
*to are sequential on the link. This is a internal function to detect
any buggy code written in callers.
An assumption is all callers must obtain nodes from the path before
passing them in coresight_path_nodes_in_order(). Therefore, the check
is simplified to only verify that *from appears before *to.
> Rather, we should walk the path from @from and return if we find @to on the
> walk. Otherwise return false ? In any case,this need a comment on
> the top.
Sure, I will refine the walk code like this way and add a comment.
> Also I don't think this check is really needed. If we don't find the
> @to, simply disable the entire path.
If we allow @to to be NULL, we may also need to allow @from to be NULL
(e.g. in the enable path case).
Instead, callers can fetch the first and last nodes using helpers and
explicitly pass them to the enable and disable functions. Although this
introduces some duplicate code in callers, it avoids complexity in the
enable and disable functions.
> > +{
> > + struct coresight_node *nd;
> > +
> > + /* Callers must fetch nodes from the path */
> > + if (WARN_ON_ONCE(!from || !to))
> > + return false;
> > +
> > + list_for_each_entry(nd, &path->path_list, link) {
> > + if (nd == from)
> > + return true;
> > + if (nd == to)
> > + return false;
> > + }
> > +
> > + return false;
> > +}
> > +
> > /*
> > - * 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_to : Disable components in the given @path
> > + * between @from and @to.
> > + *
> > + * The range excludes @from but includes @to. @from is exclusive to handle the
> > + * case where it is the source (the first node in the path), as the source has
> > + * its own disable function.
>
> Why not break that "hack" and always include @from and let the caller now
> use this helper to disable everything after the @source ?
Will do for this and below suggestions.
Thanks,
Leo
next prev parent reply other threads:[~2026-03-24 7:48 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-20 17:42 [PATCH v7 00/20] CoreSight: Refactor power management for CoreSight path Leo Yan
2026-03-20 17:42 ` [PATCH v7 01/20] coresight: Populate CPU ID into coresight_device Leo Yan
2026-03-23 9:35 ` Suzuki K Poulose
2026-03-23 9:39 ` Suzuki K Poulose
2026-03-20 17:42 ` [PATCH v7 02/20] coresight: Remove .cpu_id() callback from source ops Leo Yan
2026-03-20 17:42 ` [PATCH v7 03/20] coresight: sysfs: Validate CPU online status for per-CPU sources Leo Yan
2026-03-20 17:42 ` [PATCH v7 04/20] coresight: Move per-CPU source pointer to core layer Leo Yan
2026-03-20 17:42 ` [PATCH v7 05/20] coresight: Register CPU PM notifier in " Leo Yan
2026-03-20 17:42 ` [PATCH v7 06/20] coresight: etm4x: Hook CPU PM callbacks Leo Yan
2026-03-20 17:42 ` [PATCH v7 07/20] coresight: etm4x: Remove redundant condition checks in save and restore Leo Yan
2026-03-20 17:42 ` [PATCH v7 08/20] coresight: syscfg: Use spinlock to protect active variables Leo Yan
2026-03-23 9:47 ` Suzuki K Poulose
2026-03-20 17:42 ` [PATCH v7 09/20] coresight: Introduce coresight_enable_source() helper Leo Yan
2026-03-20 17:42 ` [PATCH v7 10/20] coresight: Save active path for system tracers Leo Yan
2026-03-20 17:42 ` [PATCH v7 11/20] coresight: etm4x: Set active path on target CPU Leo Yan
2026-03-20 17:42 ` [PATCH v7 12/20] coresight: etm3x: " Leo Yan
2026-03-20 17:42 ` [PATCH v7 13/20] coresight: sysfs: Use source's path pointer for path control Leo Yan
2026-03-20 17:42 ` [PATCH v7 14/20] coresight: Control path with range Leo Yan
2026-03-23 10:01 ` Suzuki K Poulose
2026-03-24 7:48 ` Leo Yan [this message]
2026-03-20 17:42 ` [PATCH v7 15/20] coresight: Control path during CPU idle Leo Yan
2026-03-20 17:42 ` [PATCH v7 16/20] coresight: Add PM callbacks for sink device Leo Yan
2026-03-20 17:42 ` [PATCH v7 17/20] coresight: trbe: Save and restore state across CPU low power state Leo Yan
2026-03-20 17:43 ` [PATCH v7 18/20] coresight: sysfs: Increment refcount only for system tracers Leo Yan
2026-03-20 17:43 ` [PATCH v7 19/20] coresight: Take hotplug lock in enable_source_store() for Sysfs mode Leo Yan
2026-03-20 17:43 ` [PATCH v7 20/20] coresight: Move CPU hotplug callbacks to core layer 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=20260324074804.GD43072@e132581.arm.com \
--to=leo.yan@arm.com \
--cc=alexander.shishkin@linux.intel.com \
--cc=coresight@lists.linaro.org \
--cc=gregkh@linuxfoundation.org \
--cc=james.clark@linaro.org \
--cc=keyz@google.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=mark.rutland@arm.com \
--cc=mike.leach@arm.com \
--cc=quic_yuanfang@quicinc.com \
--cc=suzuki.poulose@arm.com \
--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