[PATCH v3 01/31] coresight: Change device mode to atomic type

Leo Yan leo.yan at arm.com
Fri Oct 3 06:21:43 PDT 2025


On Fri, Oct 03, 2025 at 11:15:21AM +0100, James Clark wrote:

[...]

> Unrelated to this change, I think the complexity isn't unnecessary and
> taking the spinlock could be the very first operation for any action. That
> would do away with the atomics. We don't need to optimise for any contention
> cases, because it never happens outside of artificial stress tests.

Just record a idea for further refactoring. Ideally:

(1) Maintain a mode (atomic type) in coresight_path. Remove mode from
    all device modules. The only exception is the sink device, which
    maintains its own mode to prevent the sink from being shared in
    different modes across different paths.

(2) Driver data should use a reference count (refcnt) (for funnel,
    replicator, sink) or an enabled flag (enabled only once, e.g., for
    sources) to track state; this is protected by the driver's spinlock.

So far, we just use ETM's `mode` as a global flag for a path, this is
not conflict for the further refactoring. Later we can use a seperate
series for refactoring.

Thanks,
Leo



More information about the linux-arm-kernel mailing list