mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: James Clark <james.clark@linaro.org>
To: Leo Yan <leo.yan@arm.com>
Cc: Suzuki K Poulose <suzuki.poulose@arm.com>,
	Mike Leach <mike.leach@arm.com>, Suyash Mahar <smahar@meta.com>,
	Yeoreum Yun <yeoreum.yun@arm.com>,
	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, Jonathan Cameron <jic23@kernel.org>
Subject: Re: [PATCH v4 03/10] coresight: etm-perf: Serialize AUX topology access
Date: Wed, 18 Nov 2026 16:53:22 +0000	[thread overview]
Message-ID: <0e81b599-a2fd-40d6-85dd-841bb012f18e@linaro.org> (raw)
In-Reply-To: <20261112180920.GM9176@e132581.arm.com>



On 12/11/2026 18:09, Leo Yan wrote:
> On Fri, Oct 16, 2026 at 11:46:13AM +0100, James Clark wrote:
>> Perf AUX setup walks the CoreSight connections to select a sink, build
>> paths and acquire references to the devices and their helpers. Unlike
>> sysfs tracing, it does not hold coresight_mutex. Driver registration and
>> removal can therefore change or free connections while setup walks them.
>> Adding a CTI helper can also reallocate an existing device's output
>> connection array even when the device is already referenced by a path.
> 
> I agree that bus traversal and devices acquisition need protection.
> 
>> Hold coresight_mutex from sink selection through buffer allocation.
>> The allocation must also be protected because ETR buffers can look up a
>> connected CATU. Release the mutex before calling etm_free_aux() on error.
> 
> However, my concern is about the locking semantics. We should clearly
> identify the races that coresight_mutex is intended to protect and
> limit its usage accordingly. My understanding is that coresight_mutex
> primarily protects CoreSight bus operations.
> 
> Holding it across the entire perf AUX setup might silence AI review
> warnings, but it may abuse the lock and hide synchronization issues in
> the CoreSight core APIs. OTOH, I'd say SysFS mode should not acquire
> such a big lock as well.

Suzuki already merged this because I had to move it into the small 
sashiko fixes patch set as a dependency. I agree it might not be the 
correct fix, but it's a small change and it's likely the correct fix 
would look very similar to this. We can always undo it or re-work it in 
the future, it's pretty harmless.

> 
> BTW, I think this change is a distraction from the per-thread fixes.

Yes and no. This set adds additional traversals to the tree to determine 
if a sink is shared or not, so it increases the chance of hitting the 
issue which is why I thought it made sense to fix it.

> My understanding is that this series aims to fix multithreading with
> a shared sink, so we can address device lifetime issues separately.

  reply	other threads:[~2026-11-18 16:53 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-16 10:46 [PATCH v4 00/10] coresight: Prevent per-thread events from sharing a sink James Clark
2026-10-16 10:46 ` [PATCH v4 01/10] coresight: configfs: Don't assume active until cscfg_mgr is set James Clark
2026-10-28 10:14   ` Suzuki K Poulose
2026-10-28 13:00     ` James Clark
2026-11-12 17:10   ` Leo Yan
2026-11-18 16:58     ` James Clark
2026-10-16 10:46 ` [PATCH v4 02/10] coresight: etm-perf: Remove workqueue for freeing AUX data James Clark
2026-11-12 17:13   ` Leo Yan
2026-10-16 10:46 ` [PATCH v4 03/10] coresight: etm-perf: Serialize AUX topology access James Clark
2026-11-12 18:09   ` Leo Yan
2026-11-18 16:53     ` James Clark [this message]
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=0e81b599-a2fd-40d6-85dd-841bb012f18e@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®