lkml.org 
[lkml]   [2023]   [Jun]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] gpio: gpiolib-cdev: Fix potential &lr->wait.lock deadlock issue
On Tue, Jun 27, 2023 at 01:47:16PM +0200, Bartosz Golaszewski wrote:
> On Tue, Jun 27, 2023 at 3:43 AM Kent Gibson <warthog618@gmail.com> wrote:
> >
> > On Mon, Jun 26, 2023 at 05:50:47PM +0200, Bartosz Golaszewski wrote:
> > > On Mon, Jun 26, 2023 at 9:23 AM Kent Gibson <warthog618@gmail.com> wrote:
> > > >
> > > >
> >
> > While we are on the subject of spin_locks, why does
> > gpio_desc_to_lineinfo() use spin_lock_irqsave()?
> > I assume the _irq is necessary as the desc could be updated at interrupt
> > level, but AFAICT gpio_desc_to_lineinfo() is only ever called from process
> > context, so why not just spin_lock_irq()?
> >
> > Cheers,
> > Kent.
>
> Didn't we use an atomic notifier before for some reason? Then it got
> changed to blocking but the lock stayed like this? It does look like
> spin_lock_irq() would be fine here. On the other hand - if something
> isn't broken... :)
>

Yeah, it was atomic before blocking, but that doesn't explain the need
for the save - interrupts are always enabled in that function.
Not a big difference either way, and irqsave is always safe, so no
problem with leaving it as is - I just thought it odd when I noticed it,
while spin locks and context were front of mind.

Cheers,
Kent.

\
 
 \ /
  Last update: 2023-06-27 13:59    [W:0.035 / U:0.236 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site