On Mon, 22 Jul 2024 11:11:42 +0100, James Clark wrote:
This will allow sessions with more than CORESIGHT_TRACE_IDS_MAX ETMs as long as there are fewer than that many ETMs connected to each sink.
Each sink owns its own trace ID map, and any Perf session connecting to that sink will allocate from it, even if the sink is currently in use by other users. This is similar to the existing behavior where the dynamic trace IDs are constant as long as there is any concurrent Perf session active. It's not completely optimal because slightly more IDs will be used than necessary, but the optimal solution involves tracking the PIDs of each session and allocating ID maps based on the session owner. This is difficult to do with the combination of per-thread and per-cpu modes and some scheduling issues. The complexity of this isn't likely to worth it because even with multiple users they'd just see a difference in the ordering of ID allocations rather than hitting any limits (unless the hardware does have too many ETMs connected to one sink).
[...]
Applied, the kernel driver changes to coresight/next. Thanks!
[09/17] coresight: Remove unused ETM Perf stubs https://git.kernel.org/coresight/c/34172002bdac [10/17] coresight: Clarify comments around the PID of the sink owner https://git.kernel.org/coresight/c/eda1d11979c0 [11/17] coresight: Move struct coresight_trace_id_map to common header https://git.kernel.org/coresight/c/acb0184fe9bc [12/17] coresight: Expose map arguments in trace ID API https://git.kernel.org/coresight/c/7e52877868ae [13/17] coresight: Make CPU id map a property of a trace ID map https://git.kernel.org/coresight/c/d53c8253c782 [14/17] coresight: Use per-sink trace ID maps for Perf sessions https://git.kernel.org/coresight/c/5ad628a76176 [15/17] coresight: Remove pending trace ID release mechanism https://git.kernel.org/coresight/c/de0029fdde86 [16/17] coresight: Emit sink ID in the HW_ID packets https://git.kernel.org/coresight/c/487eec8da80a [17/17] coresight: Make trace ID map spinlock local to the map https://git.kernel.org/coresight/c/988d40a4d4e7
Best regards,