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$(echo .)org \
--cc=Mark-MC.Lee@mediatek$(echo .)com \
--cc=UNGLinuxDriver@microchip$(echo .)com \
--cc=allen.lkml@gmail$(echo .)com \
--cc=aneesh.kumar@kernel$(echo .)org \
--cc=angelogioacchino.delregno@collabora$(echo .)com \
--cc=borisp@nvidia$(echo .)com \
--cc=bryan.whitehead@microchip$(echo .)com \
--cc=cai.huoqing@linux$(echo .)dev \
--cc=christophe.leroy@csgroup$(echo .)eu \
--cc=cooldavid@cooldavid$(echo .)org \
--cc=davem@davemloft$(echo .)net \
--cc=dougmill@linux$(echo .)ibm.com \
--cc=edumazet@google$(echo .)com \
--cc=jes@trained-monkey$(echo .)org \
--cc=kda@linux-powerpc$(echo .)org \
--cc=linux-acenic@sunsite$(echo .)dk \
--cc=linux-kernel@vger$(echo .)kernel.org \
--cc=linux-net-drivers@amd$(echo .)com \
--cc=linux-rdma@vger$(echo .)kernel.org \
--cc=lorenzo@kernel$(echo .)org \
--cc=louis.peens@corigine$(echo .)com \
--cc=marcin.s.wojtas@gmail$(echo .)com \
--cc=matthias.bgg@gmail$(echo .)com \
--cc=mlindner@marvell$(echo .)com \
--cc=naveen.n.rao@linux$(echo .)ibm.com \
--cc=nbd@nbd$(echo .)name \
--cc=netdev@vger$(echo .)kernel.org \
--cc=nnac123@linux$(echo .)ibm.com \
--cc=npiggin@gmail$(echo .)com \
--cc=pabeni@redhat$(echo .)com \
--cc=richardcochran@gmail$(echo .)com \
--cc=sean.wang@mediatek$(echo .)com \
--cc=sgoutham@marvell$(echo .)com \
--cc=stephen@networkplumber$(echo .)org \
--cc=tlfalcon@linux$(echo .)ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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