Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
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>,
	 Mathieu Poirier <mathieu.poirier@linaro.org>,
	 Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	 Qi Liu <liuqi115@huawei.com>, Junhao He <hejunhao3@huawei.com>,
	 Jonathan Cameron <jic23@kernel.org>
Cc: coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org,
	 linux-kernel@vger.kernel.org,
	James Clark <james.clark@linaro.org>
Subject: [PATCH 0/4] coresight: Prevent per-thread events from sharing a sink
Date: Thu, 09 Jul 2026 11:57:22 +0100	[thread overview]
Message-ID: <20260709-james-cs-multiple-per-threads-v1-0-d384e6d477ac@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 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 everywhere the same PID checking logic was copy pasted. Then the
PIDs can be dropped from a few structs as they are now unused.

Signed-off-by: James Clark <james.clark@linaro.org>
---
James Clark (4):
      coresight: tmc-etr: Prevent per-thread events from sharing a sink
      coresight: tmc-etf: Prevent per-thread events from sharing a sink
      coresight: etb10: Prevent per-thread events from sharing a sink
      coresight: ultrasoc-smb: Prevent per-thread events from sharing a sink

 drivers/hwtracing/coresight/coresight-core.c     | 24 +++++++++++++++++++
 drivers/hwtracing/coresight/coresight-etb10.c    | 30 +++++++-----------------
 drivers/hwtracing/coresight/coresight-priv.h     |  2 --
 drivers/hwtracing/coresight/coresight-tmc-core.c |  2 --
 drivers/hwtracing/coresight/coresight-tmc-etf.c  | 23 ++++++------------
 drivers/hwtracing/coresight/coresight-tmc-etr.c  | 20 +++++-----------
 drivers/hwtracing/coresight/coresight-tmc.h      |  2 +-
 drivers/hwtracing/coresight/ultrasoc-smb.c       | 22 +++++------------
 drivers/hwtracing/coresight/ultrasoc-smb.h       |  5 ++--
 include/linux/coresight.h                        |  3 +++
 10 files changed, 57 insertions(+), 76 deletions(-)
---
base-commit: 98495b5a4d77dd22e106f462b76e1093a55b29a7
change-id: 20260708-james-cs-multiple-per-threads-ed1d25ed1734

Best regards,
-- 
James Clark <james.clark@linaro.org>



             reply	other threads:[~2026-07-09 10:57 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-09 10:57 James Clark [this message]
2026-07-09 10:57 ` [PATCH 1/4] coresight: tmc-etr: Prevent per-thread events from sharing a sink James Clark
2026-07-09 10:57 ` [PATCH 2/4] coresight: tmc-etf: " James Clark
2026-07-09 10:57 ` [PATCH 3/4] coresight: etb10: " James Clark
2026-07-09 10:57 ` [PATCH 4/4] coresight: ultrasoc-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=20260709-james-cs-multiple-per-threads-v1-0-d384e6d477ac@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=mathieu.poirier@linaro.org \
    --cc=mike.leach@arm.com \
    --cc=suzuki.poulose@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