Linux-ARM-Kernel Archive on lore.kernel.org
 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 v3 4/8] coresight: tmc-etr: Prevent per-thread events from sharing a sink
Date: Fri, 14 Aug 2026 10:09:01 +0100	[thread overview]
Message-ID: <dcea48bc-6a64-413b-acf5-9783f979ab6d@linaro.org> (raw)
In-Reply-To: <20260813160504.GC8904@e132581.arm.com>



On 13/08/2026 17:05, Leo Yan wrote:
> On Tue, Jul 28, 2026 at 04:00:16PM +0100, James Clark wrote:
> 
> [...]
> 
>> The identity and compatibility of a session are determined by the owning
>> process, the target process, and the inheritance settings together.
> 
> Could you elaborate a bit on the session model you are trying to support
> here?
> 
> My understanding of a legacy sink such as ETR/ETF is that it can be
> owned by only one perf session at a time. Multiple events belonging to
> that session may use the sink, but an attempt from another perf session
> should be rejected with -EBUSY.
> 
> For per-thread mode, I wonder if we could support _only_ non-inherited

non-inheritance is enforced for per-thread mode in the perf core. So we 
already don't support it.

> events. In that case, we would not need to determine compatibility based
> on the target process and inheritance settings.
> 
>  From the patch, it seems trying to support a more flexible model, where

I don't think so. It's actually less flexible than what exists 
currently. Currently we only check the PID of the owner, and all sharing 
is allowed. That means there are a lot of combinations of things that 
result in sharing that are invalid. For example PID re-use and 
incompatible per-thread events, like the original bug.

> an already active legacy sink can also be shared by another perf session

There isn't any sharing with "another perf session", unless there is a 
mistake somewhere? Checking that the owners are equivalent enforces 
this. Or do you mean another event owned by the same process?

> and also support inherit mode for child events?
> 
> Thanks,
> Leo

We need to fix the bugs but still support one process owning multiple 
PERF_ATTACH_TASK events, because that's what you get when you do this:

   perf record -e cs_etm// -- my_task

Perf doesn't do one per-thread event here, it's is still 
PERF_ATTACH_TASK, but with a separate event opened for each CPU. So we 
need a model that still supports this to not cause a regression, but 
doesn't have any sharing bugs.

I'm not sure the exact model you had in mind was that still supports 
this and fixes the bugs? The one in this change is pretty complete and 
only does 4 comparisons, which seems quite simple to me. It only has one 
shortcoming that I'm aware of, that it doesn't take into account the 
cgroup settings, but I don't see a use case where that needs to be 
solved. Even if different events with different cgroup settings should 
would follow different processes, the owning process would have to do 
something quite crazy to get there.





  reply	other threads:[~2026-08-14  9:09 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-28 15:00 [PATCH v3 0/8] coresight: Prevent per-thread events from sharing a sink James Clark
2026-07-28 15:00 ` [PATCH v3 1/8] coresight: tmc-etr: Don't stop Perf cleanup for active sysfs reads James Clark
2026-08-12 16:45   ` Leo Yan
2026-08-13  9:02     ` James Clark
2026-07-28 15:00 ` [PATCH v3 2/8] coresight: configfs: Don't assume active until cscfg_mgr is set James Clark
2026-08-13  9:09   ` Leo Yan
2026-08-13  9:24     ` James Clark
2026-07-28 15:00 ` [PATCH v3 3/8] coresight: etm-perf: Flush workqueue before unloading module James Clark
2026-08-13 14:19   ` Leo Yan
2026-08-14  8:55     ` James Clark
2026-07-28 15:00 ` [PATCH v3 4/8] coresight: tmc-etr: Prevent per-thread events from sharing a sink James Clark
2026-08-13 16:05   ` Leo Yan
2026-08-14  9:09     ` James Clark [this message]
2026-08-19  8:45       ` Leo Yan
2026-08-20 11:09         ` James Clark
2026-08-20 11:27           ` James Clark
2026-07-28 15:00 ` [PATCH v3 5/8] coresight: tmc-etr: Use session ID for buffer ownership James Clark
2026-07-28 15:00 ` [PATCH v3 6/8] coresight: tmc-etf: Prevent per-thread events from sharing a sink James Clark
2026-07-28 15:00 ` [PATCH v3 7/8] coresight: etb10: " James Clark
2026-07-28 15:00 ` [PATCH v3 8/8] 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=dcea48bc-6a64-413b-acf5-9783f979ab6d@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