Hi Leo
On Mon, 15 Sept 2025 at 11:34, Leo Yan leo.yan@arm.com wrote:
Introduce an in_idle argument to the path enable and disable functions. When set to true, it skips to touch the sink device. To avoid invoking sink related helpers, the condition check is moved before the enable helpers are called.
This is a preparation for managing the path during CPU idle.
Signed-off-by: Leo Yan leo.yan@arm.com
drivers/hwtracing/coresight/coresight-core.c | 29 +++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-)
diff --git a/drivers/hwtracing/coresight/coresight-core.c b/drivers/hwtracing/coresight/coresight-core.c index 904123279ee70531787feea98e5f9fc502470f88..0e8506d5eaa01d1cc4846324a64eae5f0f442da3 100644 --- a/drivers/hwtracing/coresight/coresight-core.c +++ b/drivers/hwtracing/coresight/coresight-core.c @@ -479,7 +479,8 @@ static void coresight_restore_source(struct coresight_device *csdev)
- disabled.
*/ static void coresight_disable_path_from(struct coresight_path *path,
struct coresight_node *nd)
struct coresight_node *nd,
bool in_idle)
{ u32 type; struct coresight_device *csdev, *parent, *child; @@ -502,6 +503,10 @@ static void coresight_disable_path_from(struct coresight_path *path, CORESIGHT_DEV_TYPE_SINK : CORESIGHT_DEV_TYPE_LINK;
/* To reduce latency, CPU idle does not touch the sink */
if (in_idle && type == CORESIGHT_DEV_TYPE_SINK)
continue;
Why not - if this is the last/only active path then you absolutely want to disable the sink to flush trace through the system. If it is not, then the disable sink will simply reduce the refcount by one.
Mike
switch (type) { case CORESIGHT_DEV_TYPE_SINK: coresight_disable_sink(csdev);
@@ -537,7 +542,7 @@ void coresight_disable_path(struct coresight_path *path) if (coresight_is_percpu_source(source)) per_cpu(csdev_cpu_path, source->cpu) = NULL;
coresight_disable_path_from(path, NULL);
coresight_disable_path_from(path, NULL, false);
} EXPORT_SYMBOL_GPL(coresight_disable_path);
@@ -561,7 +566,8 @@ static int coresight_enable_helpers(struct coresight_device *csdev, }
static int _coresight_enable_path(struct coresight_path *path,
enum cs_mode mode, void *sink_data)
enum cs_mode mode, void *sink_data,
bool in_idle)
{ int ret = 0; u32 type; @@ -574,10 +580,6 @@ static int _coresight_enable_path(struct coresight_path *path, csdev = nd->csdev; type = csdev->type;
/* Enable all helpers adjacent to the path first */
ret = coresight_enable_helpers(csdev, mode, path);
if (ret)
goto err_disable_path; /* * ETF devices are tricky... They can be a link or a sink, * depending on how they are configured. If an ETF has been
@@ -589,6 +591,15 @@ static int _coresight_enable_path(struct coresight_path *path, CORESIGHT_DEV_TYPE_SINK : CORESIGHT_DEV_TYPE_LINK;
/* To reduce latency, CPU idle does not touch the sink */
if (in_idle && type == CORESIGHT_DEV_TYPE_SINK)
continue;
/* Enable all helpers adjacent to the path first */
ret = coresight_enable_helpers(csdev, mode, path);
if (ret)
goto err_disable_path;
switch (type) { case CORESIGHT_DEV_TYPE_SINK: ret = coresight_enable_sink(csdev, mode, sink_data);
@@ -624,7 +635,7 @@ static int _coresight_enable_path(struct coresight_path *path, err_disable_helpers: coresight_disable_helpers(csdev, path); err_disable_path:
coresight_disable_path_from(path, nd);
coresight_disable_path_from(path, nd, false); goto out;
}
@@ -634,7 +645,7 @@ int coresight_enable_path(struct coresight_path *path, enum cs_mode mode, int ret; struct coresight_device *source;
ret = _coresight_enable_path(path, mode, sink_data);
ret = _coresight_enable_path(path, mode, sink_data, false); if (ret) return ret;
-- 2.34.1
-- Mike Leach Principal Engineer, ARM Ltd. Manchester Design Centre. UK