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

From: Leo Yan

Date: Thu Aug 13 2026 - 10:21:18 EST


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