lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240809203606.69010c5b@kernel.org>
Date: Fri, 9 Aug 2024 20:36:06 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Allen <allen.lkml@...il.com>
Cc: "David S. Miller" <davem@...emloft.net>, Eric Dumazet
 <edumazet@...gle.com>, Paolo Abeni <pabeni@...hat.com>,
 jes@...ined-monkey.org, kda@...ux-powerpc.org, cai.huoqing@...ux.dev,
 dougmill@...ux.ibm.com, npiggin@...il.com, christophe.leroy@...roup.eu,
 aneesh.kumar@...nel.org, naveen.n.rao@...ux.ibm.com, nnac123@...ux.ibm.com,
 tlfalcon@...ux.ibm.com, cooldavid@...ldavid.org, marcin.s.wojtas@...il.com,
 mlindner@...vell.com, stephen@...workplumber.org, nbd@....name,
 sean.wang@...iatek.com, Mark-MC.Lee@...iatek.com, lorenzo@...nel.org,
 matthias.bgg@...il.com, angelogioacchino.delregno@...labora.com,
 borisp@...dia.com, bryan.whitehead@...rochip.com,
 UNGLinuxDriver@...rochip.com, louis.peens@...igine.com,
 richardcochran@...il.com, linux-rdma@...r.kernel.org,
 linux-kernel@...r.kernel.org, linux-acenic@...site.dk,
 linux-net-drivers@....com, netdev@...r.kernel.org, Sunil Goutham
 <sgoutham@...vell.com>
Subject: Re: [net-next v3 05/15] net: cavium/liquidio: Convert tasklet API
 to new bottom half workqueue mechanism

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.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ