Re: [PATCH v5 06/12] coresight: etm4x: fix leaked trace id
From: Leo Yan
Date: Fri Apr 17 2026 - 04:00:52 EST
Hi Levi,
On Thu, Apr 16, 2026 at 06:06:41PM +0100, Yeoreum Yun wrote:
[...]
> > We should use paired way for allocation and release. For example:
> >
> > coresight_enable_sysfs()
> > {
> > ...
> > coresight_path_assign_trace_id(path);
> >
> > failed:
> > coresight_path_unassign_trace_id(path);
> > }
> >
> > coresight_disable_sysfs()
> > {
> > coresight_path_unassign_trace_id(path);
> > }
> >
> > But this requires broader refactoring. E.g., the STM driver currently
> > allocates system trace IDs statically during probe, we might need to
> > consolidate for all modules to use dynamic allocation.
>
> So IIUC, Do we want to "map" per "session" and save this map information
> in the "sink" driver? or just use "global" map but locate it in sink
> driver?
I prefer to save map in the sink's driver data, this is more scalable
as the trace ID is allocated within a session rather than system wide.
> I totally agree for above suggestion -- unsigned trace id
> in the coresight_XXX function -- (but we need to add another callback
> for this) but I think we don't need to sustain map per session
> and it seems enough to use current storage for trace_id not move to
> sink driver.
>
> Anyway It would be better to refactorying wiht another patchset...
Yeah, we can come back to these ideas when work on it.
Thanks,
Leo