Skip to content

Optimize the Coresight Trace id allocation logic - #1032

Open
Jie Gan (jiegan0107) wants to merge 2 commits into
qualcomm-linux:qcom-6.18.yfrom
jiegan0107:qcom-6.18.y
Open

Optimize the Coresight Trace id allocation logic#1032
Jie Gan (jiegan0107) wants to merge 2 commits into
qualcomm-linux:qcom-6.18.yfrom
jiegan0107:qcom-6.18.y

Conversation

@jiegan0107

Copy link
Copy Markdown

Optimize the Coresight Trace id allocation logic

CRs-Fixed: 4661884

When coresight_path_assign_trace_id() cannot assign a valid trace ID,
coresight_enable_sysfs() takes the err_path goto with ret still 0,
returning success to the caller despite no trace session being started.

Change coresight_path_assign_trace_id() to return int, moving the
IS_VALID_CS_TRACE_ID() check inside it so it returns -EINVAL on failure
and 0 on success. Update both callers to propagate this return value
directly instead of inspecting path->trace_id after the call.

Fixes: d87d76d ("Coresight: Allocate trace ID after building the path")
Reviewed-by: James Clark <james.clark@linaro.org>
Reviewed-by: Richard Cheng <icheng@nvidia.com>
Signed-off-by: Jie Gan <jie.gan@oss.qualcomm.com>
Reviewed-by: Leo Yan <leo.yan@arm.com>
Signed-off-by: Suzuki K Poulose <suzuki.poulose@arm.com>
Link: https://lore.kernel.org/r/20260512-fix-trace-id-error-v4-1-eb3de789767a@oss.qualcomm.com
…n-AMBA tnoc

For a tnoc device not on the AMBA bus, atid was set to -EOPNOTSUPP.
trace_noc_id() returns this value directly to
coresight_path_assign_trace_id(), which only treats a literal 0
return as "this device has no ID, keep searching the path" -
any other value is checked against IS_VALID_CS_TRACE_ID() and
rejected. A negative atid therefore made path assignment fail with
-EINVAL instead of falling through to the next device in the path
that could supply a valid trace ID.

Use 0, the same sentinel coresight_path_assign_trace_id() already
recognizes as "not allocated", instead of -EOPNOTSUPP.

Link: https://lore.kernel.org/all/20260902-fix-trace-id-error-in-tnoc-driver-v2-1-73669a947297@oss.qualcomm.com/
Fixes: 5799dee ("coresight-tnoc: add platform driver to support Interconnect TNOC")
Signed-off-by: Jie Gan <jie.gan@oss.qualcomm.com>
@jiegan0107

Copy link
Copy Markdown
Author

The patch[1] has been posted based on latest upstream tip.

On the qli2.0 tip, the patch[1] is conflict with another ongoing patch[2]. So, rebased it on top of the conflict patch [2].

[1] FROMLIST: coresight: tnoc: fix trace ID path assignment failure on non-AMBA tnoc
[2] f9336cd

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant