Re: [PATCH] softirq: Provide a handshake for canceling tasklets via polling on PREEMPT_RT

From: Sebastian Andrzej Siewior
Date: Wed Aug 13 2025 - 02:37:17 EST


On 2025-08-12 09:38:50 [-1000], Tejun Heo wrote:
> Hello,
Hi Tejun,

> On Tue, Aug 12, 2025 at 04:53:59PM +0200, Sebastian Andrzej Siewior wrote:
> > Does the workqueue-BH code require the canceling from atomic context or
> > was this just added because the API for BH and non-BH work items is the
> > same and __cancel_work_sync() allows it?
> > Could we avoid the busy-waiting for BH work items and rely on the
> > wait_for_completion() below or do we need something similar to what I
> > added here for the tasklet API?
>
> The intention is to convert all BH users to workqueue-BH and remove BH
> (that's what Linus wants and why workqueue-BH came to be), so the APIs
> should be able to match up, I'm afraid. There were some attempts at pushing
> the conversion but we've only made minimal progress. If you're looking at BH
> users anyway and feel like it, please feel free to convert them.

I understand this but I am talking about legacy users:

| drivers/atm/eni.c: tasklet_disable_in_atomic(&ENI_DEV(vcc->dev)->task);
| drivers/net/wireless/ath/ath9k/beacon.c: tasklet_disable_in_atomic(&sc->bcon_tasklet);
| drivers/pci/controller/pci-hyperv.c: tasklet_disable_in_atomic(&channel->callback_event);

This is what is left. (There is also i915 but this is "special").
So we are talking about establishing an API and behaviour for those here
after we painfully managed converting everyone else away:

| git grep 'tasklet_unlock_wait([^s]' | wc -l
| 5
| git grep 'tasklet_disable([^s]' | wc -l
| 97
| git grep 'tasklet_kill([^s]' | wc -l
| 304

While I think it could be possible with upstream's help to avoid the
in-atomic bits for atk9k and hyperv I lost all hope ) for the ATM
driver.

> Thanks.

Sebastian