From: James Clark <james.clark@linaro.org>
To: Suzuki K Poulose <suzuki.poulose@arm.com>,
Mike Leach <mike.leach@arm.com>, Leo Yan <leo.yan@arm.com>,
Suyash Mahar <smahar@meta.com>,
Yeoreum Yun <yeoreum.yun@arm.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Qi Liu <liuqi115@huawei.com>, Junhao He <hejunhao3@huawei.com>,
coresight@lists.linaro.org,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org,
James Clark <james.clark@linaro.org>,
Jonathan Cameron <jic23@kernel.org>
Subject: [PATCH v4 00/10] coresight: Prevent per-thread events from sharing a sink
Date: Fri, 16 Oct 2026 11:46:10 +0100 [thread overview]
Message-ID: <20261016-james-cs-multiple-per-threads-v4-0-dedf961aca0e@linaro.org> (raw)
Concurrent per-thread events results in a WARN on N1SDP which leads to
the realization that per-thread events shouldn't have been sharing sinks
in the first place.
This slips through because different per-thread events will have the
same PID if owned by the same process, and we only check the PID and
nothing else. That results in unexpected WARNs because it looks like we
assumed it couldn't happen (although exclusive PMU rules allow it). But
even if it was supported it would result in trace from the wrong thread
in another event's per-thread buffer, so we should disallow it.
Fix it by determining if sharing can happen at setup time. Then remove
everywhere the same PID checking logic was copy pasted in each sink.
The first three patches fix configuration initialization, AUX cleanup
and topology locking. The remaining patches enforce the sharing rules
and simplify the sink drivers.
Signed-off-by: James Clark <james.clark@linaro.org>
---
Changes in v4:
- Count CPU sources in the registered topology and retain each sink's
sharing classification until its last AUX session ends.
- Serialize AUX topology access and provide locked and locking path
release functions.
- Reject unexpected path setup errors while retaining silent skips for
missing ETMs and unreachable sinks.
- Prevent all problematic sharing cases at aux setup rather than at
runtime. (Leo)
- Drop "coresight: tmc-etr: Don't stop Perf cleanup for active sysfs
reads". It was a pre-existing bug and is even more unrelated now with
the new model.
- Remove workqueue rather than fix the lifecycle, its no longer
needed. (Leo)
- Add a getter for the config manager, cscfg_get_state(). (Leo)
- Link to v3: https://lore.kernel.org/r/20260728-james-cs-multiple-per-threads-v3-0-6aee7579f1dc@linaro.org
Changes in v3:
- Storing and accessing event owners at runtime causes problems due to
various scenarios of: events (and sibling events) exiting, children
inheriting event FDs, PID reuse, CPU affine events that also have a
target process set but different inherit settings. Fix it by creating
a session ID in etm_setup_aux() and holding the references in it for
the duration of the whole session. (Leo)
- Make the ETR buffer allocator consistent with sink sharing rules by
not doing numeric PID comparisons there either.
- Fix up some Sashiko reports that it sees after interacting with cscfg
and taking extra references to tasks and PIDs.
- Link to v2: https://lore.kernel.org/r/20260709-james-cs-multiple-per-threads-v2-0-10ac7ac6af0b@linaro.org
Changes in v2:
- Fix inherited events by following event->parent
- Link to v1: https://lore.kernel.org/r/20260709-james-cs-multiple-per-threads-v1-0-d384e6d477ac@linaro.org
---
James Clark (10):
coresight: configfs: Don't assume active until cscfg_mgr is set
coresight: etm-perf: Remove workqueue for freeing AUX data
coresight: etm-perf: Serialize AUX topology access
coresight: etm-perf: Reject event if building path fails
coresight: etm-perf: Prevent sink sharing at setup time
coresight: tmc-etr: Reflect new sharing rules in allocator
coresight: tmc-etr: Remove sharing guards from ETR
coresight: tmc-etf: Remove sharing guards from ETF
coresight: etb10: Remove sharing guards from ETB10
coresight: ultrasoc-smb: Remove sharing guards from SMB
drivers/hwtracing/coresight/coresight-core.c | 104 +++++++++++++++--
drivers/hwtracing/coresight/coresight-etb10.c | 28 +----
drivers/hwtracing/coresight/coresight-etm-perf.c | 119 ++++++++++---------
drivers/hwtracing/coresight/coresight-etm-perf.h | 2 -
drivers/hwtracing/coresight/coresight-priv.h | 4 +-
drivers/hwtracing/coresight/coresight-syscfg.c | 11 +-
drivers/hwtracing/coresight/coresight-sysfs.c | 4 +-
drivers/hwtracing/coresight/coresight-tmc-core.c | 6 +-
drivers/hwtracing/coresight/coresight-tmc-etf.c | 22 +---
drivers/hwtracing/coresight/coresight-tmc-etr.c | 142 +++++++----------------
drivers/hwtracing/coresight/coresight-tmc.h | 16 +--
drivers/hwtracing/coresight/coresight-trace-id.c | 97 ++++++++++++++--
drivers/hwtracing/coresight/coresight-trace-id.h | 26 +++--
drivers/hwtracing/coresight/ultrasoc-smb.c | 20 +---
drivers/hwtracing/coresight/ultrasoc-smb.h | 3 -
include/linux/coresight.h | 26 ++++-
16 files changed, 346 insertions(+), 284 deletions(-)
---
base-commit: 343cfcbb3ecfdb80aa576a428cfa3b65ad783842
change-id: 20260708-james-cs-multiple-per-threads-ed1d25ed1734
Best regards,
--
James Clark <james.clark@linaro.org>
next reply other threads:[~2026-10-16 10:46 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-16 10:46 James Clark [this message]
2026-10-16 10:46 ` [PATCH v4 01/10] coresight: configfs: Don't assume active until cscfg_mgr is set James Clark
2026-10-16 10:46 ` [PATCH v4 02/10] coresight: etm-perf: Remove workqueue for freeing AUX data James Clark
2026-10-16 10:46 ` [PATCH v4 03/10] coresight: etm-perf: Serialize AUX topology access James Clark
2026-10-16 10:46 ` [PATCH v4 04/10] coresight: etm-perf: Reject event if building path fails James Clark
2026-10-16 10:46 ` [PATCH v4 05/10] coresight: etm-perf: Prevent sink sharing at setup time James Clark
2026-10-16 10:46 ` [PATCH v4 06/10] coresight: tmc-etr: Reflect new sharing rules in allocator James Clark
2026-10-16 10:46 ` [PATCH v4 07/10] coresight: tmc-etr: Remove sharing guards from ETR James Clark
2026-10-16 10:46 ` [PATCH v4 08/10] coresight: tmc-etf: Remove sharing guards from ETF James Clark
2026-10-16 10:46 ` [PATCH v4 09/10] coresight: etb10: Remove sharing guards from ETB10 James Clark
2026-10-16 10:46 ` [PATCH v4 10/10] coresight: ultrasoc-smb: Remove sharing guards from SMB James Clark
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=20261016-james-cs-multiple-per-threads-v4-0-dedf961aca0e@linaro.org \
--to=james.clark@linaro.org \
--cc=coresight@lists.linaro.org \
--cc=gregkh@linuxfoundation.org \
--cc=hejunhao3@huawei.com \
--cc=jic23@kernel.org \
--cc=leo.yan@arm.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=liuqi115@huawei.com \
--cc=mike.leach@arm.com \
--cc=smahar@meta.com \
--cc=suzuki.poulose@arm.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
all inboxes | Powered by JetHome®