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 80489d38f690e0139c8712161c663ee63a8a7fb3..420e5a9cf38e64f133aa6780987d2d7c2804feb4 100644 --- a/drivers/hwtracing/coresight/coresight-core.c +++ b/drivers/hwtracing/coresight/coresight-core.c @@ -531,6 +531,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); @@ -597,10 +601,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 @@ -612,6 +612,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 96a1af3425a5d588fccb185a428cef5c88febdbd..5f778cd41e6bbb58393278f72feeaedabb0094d2 100644 --- a/include/linux/coresight.h +++ b/include/linux/coresight.h @@ -332,11 +332,13 @@ struct coresight_dev_list { * @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 {