Re: [net-next v3 05/15] net: cavium/liquidio: Convert tasklet API to new bottom half workqueue mechanism
From: Allen <hidden>
Date: 2024-08-09 02:32:09
Also in:
linux-rdma, lkml
From: Allen <hidden>
Date: 2024-08-09 02:32:09
Also in:
linux-rdma, lkml
quoted
In the context of of the driver, the conversion from tasklet_enable() to enable_and_queue_work() is correct because the callback function associated with the work item is designed to be safe even if there is no immediate work to process. The callback function can handle being invoked in such situations without causing errors or undesirable behavior. This makes the workqueue approach a suitable and safe replacement for the current tasklet mechanism, as it provides the necessary flexibility and ensures that the work item is properly scheduled and executed.Fewer words, clearer indication that you read the code would be better for the reviewer. Like actually call out what in the code makes it safe.
Okay.
Just to be clear -- conversions to enable_and_queue_work() will require manual inspection in every case.
Attempting again. The enable_and_queue_work() only schedules work if it is not already enabled, similar to how tasklet_enable() would only allow a tasklet to run if it had been previously scheduled. In the current driver, where we are attempting conversion, enable_work() checks whether the work is already enabled and only enables it if it was disabled. If no new work is queued, queue_work() won't be called. Hence, the callback is safe even if there's no work. Thanks, - Allen