Introduce an 'in_idle' argument to the path. When set to true for idle flow, it skips to touch the sink device to avoid long latency caused by the sink operations.
This is a preparation for managing the path during CPU idle.
Tested-by: James Clark james.clark@linaro.org Signed-off-by: Leo Yan leo.yan@arm.com --- drivers/hwtracing/coresight/coresight-core.c | 17 +++++++++++++---- include/linux/coresight.h | 2 ++ 2 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/drivers/hwtracing/coresight/coresight-core.c b/drivers/hwtracing/coresight/coresight-core.c index e8efb09dd8fc5d94d7a07ddd86f3270bab424f54..e3efa7c9ef9fa1bf7b2f727205abe577bfc493e3 100644 --- a/drivers/hwtracing/coresight/coresight-core.c +++ b/drivers/hwtracing/coresight/coresight-core.c @@ -494,6 +494,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 (path->in_idle && type == CORESIGHT_DEV_TYPE_SINK) + continue; + switch (type) { case CORESIGHT_DEV_TYPE_SINK: coresight_disable_sink(csdev); @@ -560,10 +564,6 @@ int coresight_enable_path(struct coresight_path *path, enum cs_mode mode) 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 @@ -575,6 +575,15 @@ int coresight_enable_path(struct coresight_path *path, enum cs_mode mode) CORESIGHT_DEV_TYPE_SINK : CORESIGHT_DEV_TYPE_LINK;
+ /* To reduce latency, CPU idle does not touch the sink */ + if (path->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, path); diff --git a/include/linux/coresight.h b/include/linux/coresight.h index 9e1edff3ace951146f1801a732105d8560fa2356..ba1bd6479230d660eaaf3cf76ab531f6dc2a6f4a 100644 --- a/include/linux/coresight.h +++ b/include/linux/coresight.h @@ -337,11 +337,13 @@ static struct coresight_dev_list (var) = { \ * @path_list: path from source to sink. * @trace_id: trace_id of the whole path. * @handle: handle of the aux_event. + * @in_idle: A flag to indicate if it is in CPU idle. */ struct coresight_path { struct list_head path_list; u8 trace_id; struct perf_output_handle *handle; + bool in_idle; };
enum cs_mode {