From: Jakub Kicinski <kuba@kernel.org>
To: Allen <allen.lkml@gmail.com>
Cc: "David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Paolo Abeni <pabeni@redhat.com>,
jes@trained-monkey.org, kda@linux-powerpc.org,
cai.huoqing@linux.dev, dougmill@linux.ibm.com, npiggin@gmail.com,
christophe.leroy@csgroup.eu, aneesh.kumar@kernel.org,
naveen.n.rao@linux.ibm.com, nnac123@linux.ibm.com,
tlfalcon@linux.ibm.com, cooldavid@cooldavid.org,
marcin.s.wojtas@gmail.com, mlindner@marvell.com,
stephen@networkplumber.org, nbd@nbd.name, sean.wang@mediatek.com,
Mark-MC.Lee@mediatek.com, lorenzo@kernel.org,
matthias.bgg@gmail.com, angelogioacchino.delregno@collabora.com,
borisp@nvidia.com, bryan.whitehead@microchip.com,
UNGLinuxDriver@microchip.com, louis.peens@corigine.com,
richardcochran@gmail.com, linux-rdma@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-acenic@sunsite.dk,
linux-net-drivers@amd.com, netdev@vger.kernel.org,
Sunil Goutham <sgoutham@marvell.com>
Subject: Re: [net-next v3 05/15] net: cavium/liquidio: Convert tasklet API to new bottom half workqueue mechanism
Date: Fri, 9 Aug 2024 20:36:06 -0700 [thread overview]
Message-ID: <20240809203606.69010c5b@kernel.org> (raw)
In-Reply-To: <CAOMdWSJF3L+bj-f5yz5BULTHR1rsCV-rr_MK0bobpKgRwuM9kA@mail.gmail.com>
On Thu, 8 Aug 2024 19:31:57 -0700 Allen wrote:
> > > 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.
Hm. Let me give you an example of what I was hoping to see for this
patch (in addition to your explanation of the API difference):
The conversion for oct_priv->droq_bh_work should be safe. While
the work is per adapter, the callback (octeon_droq_bh()) walks all
queues, and for each queue checks whether the oct->io_qmask.oq mask
has a bit set. In case of spurious scheduling of the work - none of
the bits should be set, making the callback a noop.
next prev parent reply other threads:[~2024-08-10 3:36 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-07-30 18:33 [net-next v3 00/15] ethernet: Convert from tasklet to BH workqueue Allen Pais
2024-07-30 18:33 ` [net-next v3 01/15] net: alteon: Convert tasklet API to new bottom half workqueue mechanism Allen Pais
2024-07-30 18:33 ` [net-next v3 02/15] net: xgbe: " Allen Pais
2024-07-30 18:33 ` [net-next v3 03/15] net: cnic: " Allen Pais
2024-07-30 18:33 ` [net-next v3 04/15] net: macb: " Allen Pais
2024-07-30 18:33 ` [net-next v3 05/15] net: cavium/liquidio: " Allen Pais
2024-08-01 2:08 ` Jakub Kicinski
2024-08-01 22:00 ` Allen
2024-08-02 0:57 ` Jakub Kicinski
2024-08-05 17:23 ` Allen
2024-08-05 19:39 ` Jakub Kicinski
2024-08-07 3:15 ` Allen
2024-08-07 14:37 ` Jakub Kicinski
2024-08-09 2:31 ` Allen
2024-08-10 3:36 ` Jakub Kicinski [this message]
2024-08-15 16:45 ` Allen
2024-08-15 23:49 ` Jakub Kicinski
2024-08-17 16:27 ` Allen
2024-07-30 18:33 ` [net-next v3 06/15] net: octeon: " Allen Pais
2024-07-30 18:33 ` [net-next v3 07/15] net: thunderx: " Allen Pais
2024-07-30 18:33 ` [net-next v3 08/15] net: chelsio: " Allen Pais
2024-07-30 18:33 ` [net-next v3 09/15] net: sundance: " Allen Pais
2024-07-30 18:33 ` [net-next v3 10/15] net: hinic: " Allen Pais
2024-07-30 18:33 ` [net-next v3 11/15] net: ehea: " Allen Pais
2024-07-30 18:34 ` [net-next v3 12/15] net: ibmvnic: " Allen Pais
2024-07-30 18:34 ` [net-next v3 13/15] net: jme: " Allen Pais
2024-07-30 18:34 ` [net-next v3 14/15] net: marvell: " Allen Pais
2024-07-30 20:39 ` Andrew Lunn
2024-07-30 22:22 ` Russell King (Oracle)
2024-07-31 20:46 ` Allen
2024-07-31 20:41 ` Allen
2024-07-30 18:34 ` [net-next v3 15/15] net: mtk-wed: " Allen Pais
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240809203606.69010c5b@kernel.org \
--to=kuba@kernel.org \
--cc=Mark-MC.Lee@mediatek.com \
--cc=UNGLinuxDriver@microchip.com \
--cc=allen.lkml@gmail.com \
--cc=aneesh.kumar@kernel.org \
--cc=angelogioacchino.delregno@collabora.com \
--cc=borisp@nvidia.com \
--cc=bryan.whitehead@microchip.com \
--cc=cai.huoqing@linux.dev \
--cc=christophe.leroy@csgroup.eu \
--cc=cooldavid@cooldavid.org \
--cc=davem@davemloft.net \
--cc=dougmill@linux.ibm.com \
--cc=edumazet@google.com \
--cc=jes@trained-monkey.org \
--cc=kda@linux-powerpc.org \
--cc=linux-acenic@sunsite.dk \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-net-drivers@amd.com \
--cc=linux-rdma@vger.kernel.org \
--cc=lorenzo@kernel.org \
--cc=louis.peens@corigine.com \
--cc=marcin.s.wojtas@gmail.com \
--cc=matthias.bgg@gmail.com \
--cc=mlindner@marvell.com \
--cc=naveen.n.rao@linux.ibm.com \
--cc=nbd@nbd.name \
--cc=netdev@vger.kernel.org \
--cc=nnac123@linux.ibm.com \
--cc=npiggin@gmail.com \
--cc=pabeni@redhat.com \
--cc=richardcochran@gmail.com \
--cc=sean.wang@mediatek.com \
--cc=sgoutham@marvell.com \
--cc=stephen@networkplumber.org \
--cc=tlfalcon@linux.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).