Thread (32 messages) 32 messages, 4 authors, 2024-08-17

Re: [net-next v3 05/15] net: cavium/liquidio: Convert tasklet API to new bottom half workqueue mechanism

From: Allen <hidden>
Date: 2024-08-07 03:16:03
Also in: linux-rdma, lkml

quoted
Sure, please review the explanation below and let me
know if it is clear enough:

tasklet_enable() is used to enable a tasklet, which defers
work to be executed in an interrupt context. It relies on the
tasklet mechanism for deferred execution.

enable_and_queue_work() combines enabling the work with
scheduling it on a workqueue. This approach not only enables
the work but also schedules it for execution by the workqueue
system, which is more flexible and suitable for tasks needing
process context rather than interrupt context.

enable_and_queue_work() internally calls enable_work() to enable
the work item and then uses queue_work() to add it to the workqueue.
This ensures that the work item is both enabled and explicitly
scheduled for execution within the workqueue system's context.

As mentioned, "unconditionally scheduling the work item after
enable_work() returns true should work for most users." This
ensures that the work is consistently scheduled for execution,
aligning with the typical workqueue usage pattern. Most users
expect that enabling a work item implies it will be scheduled for
execution without additional conditional logic.
This looks good for the explanation of the APIs, but you need to
add another paragraph explaining why the conversion is correct
for the given user. Basically whether the callback is safe to
be called even if there's no work.
 Okay.

how about the following:

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.

Thanks,
Allen
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help