Re: [PATCH v3 3/8] coresight: etm-perf: Flush workqueue before unloading module

From: James Clark

Date: Fri Aug 14 2026 - 04:56:21 EST




On 13/08/2026 15:19, Leo Yan wrote:
On Tue, Jul 28, 2026 at 04:00:15PM +0100, James Clark wrote:
The work queue is never flushed on module unload, so pending work items
can run after coresight-config is cleaned up or the .text section is
unloaded. The global workqueue also can't be flushed manually, so change
it to a local workqueue and flush it on exit.

Why can't we drop the workqueue if it introduces race conditions and
complexity? In particular, I don't see much benefit from deferring
the resource release.

According to the comment in __rb_free_aux(), the free_aux() callback
should never be called from atomic context. It should be safe to release
the resources directly from the free_aux() callback, without going
through a workqueue.

Thanks,
Leo

Nice catch. This was fixed in Perf core in 95ff4ca26c49, very shortly after the Coresight Perf mode was merged. I'll change this commit to drop the workqueue completely.