Re: [PATCHSET wq/for-6.9] workqueue: Implement BH workqueue and convert several tasklet users

From: Tejun Heo
Date: Tue Jan 30 2024 - 04:22:33 EST


Oops, forgot to cc Lai.

On Mon, Jan 29, 2024 at 11:11:47PM -1000, Tejun Heo wrote:
> Hello,
>
> The only generic interface to execute asynchronously in the BH context is
> tasklet; however, it's marked deprecated and has some design flaws such as
> the execution code accessing the tasklet item after the execution is
> complete which can lead to subtle use-after-free in certain usage scenarios
> and less-developed flush and cancel mechanisms.
>
> Mikulas Patocka recently reported that dm-crypt and dm-crypt are affected by
> the access-after-completion issue and suggested adding TASKLET_STATE_ONESHOT
> flag which selectively removes post-completion access while significantly
> limiting how the tasklet can be used in the following thread:
>
> http://lkml.kernel.org/r/82b964f0-c2c8-a2c6-5b1f-f3145dc2c8e5@xxxxxxxxxx
>
> Linus didn't like the approach and suggested extending workqueue to support
> execution from atomic context:
>
> http://lkml.kernel.org/r/CAHk-=wjDW53w4-YcSmgKC5RruiRLHmJ1sXeYdp_ZgVoBw=5byA@xxxxxxxxxxxxxx
>
> As suggested, this patchset implements BH workqueues which are like regular
> workqueues but executes work items in the BH (softirq) context and converts
> several tasklet users.

Lai, the patchset is at:

http://lkml.kernel.org/r/20240130091300.2968534-1-tj@xxxxxxxxxx

I'd really appreciate if you can take a look.

Thanks.

--
tejun