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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20210216192720.75082d22@archlinux>
Date:   Tue, 16 Feb 2021 19:27:20 +0000
From:   Jonathan Cameron <jic23@...nel.org>
To:     William Breathitt Gray <vilhelm.gray@...il.com>
Cc:     kernel@...gutronix.de, linux-stm32@...md-mailman.stormreply.com,
        a.fatoum@...gutronix.de, kamel.bouhara@...tlin.com,
        gwendal@...omium.org, alexandre.belloni@...tlin.com,
        david@...hnology.com, linux-iio@...r.kernel.org,
        linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
        syednwaris@...il.com, patrick.havelange@...ensium.com,
        fabrice.gasnier@...com, mcoquelin.stm32@...il.com,
        alexandre.torgue@...com, o.rempel@...gutronix.de
Subject: Re: [PATCH v8 21/22] counter: 104-quad-8: Replace mutex with
 spinlock

On Tue, 16 Feb 2021 11:16:03 +0900
William Breathitt Gray <vilhelm.gray@...il.com> wrote:

> On Sun, Feb 14, 2021 at 06:19:46PM +0000, Jonathan Cameron wrote:
> > On Fri, 12 Feb 2021 21:13:45 +0900
> > William Breathitt Gray <vilhelm.gray@...il.com> wrote:
> >   
> > > This patch replaces the mutex I/O lock with a spinlock. This is in
> > > preparation for a subsequent patch adding IRQ support for 104-QUAD-8
> > > devices; we can't sleep in an interrupt context, so we'll need to use a
> > > spinlock instead.
> > > 
> > > Cc: Syed Nayyar Waris <syednwaris@...il.com>
> > > Signed-off-by: William Breathitt Gray <vilhelm.gray@...il.com>  
> > 
> > Why do these need to be raw_spin_locks?
> > Normally only need to do that if in code related to interrupt chips etc,
> > not their use.
> > 
> > Jonathan  
> 
> This lock can be taken in an interrupt context in a subsequent patch:
> counter_push_event() called by quad8_irq_handler() can end up calling
> the Counter component callbacks which take this lock. We can't use a
> mutex nor a regular spinlock because those can sleep on RT setups [1]

But on RT setups the interrupts become threads and are preemptable etc,
so that shouldn't matter.  There are a few corner cases that cause
trouble, but in most normal drivers you should be fine with a
spin_lock.

Jonathan


> which would result in a deadlock due to the interrupt context here -- so
> therefore we're left with using raw_spin_lock.
> 
> [1] https://lwn.net/Articles/367219/
> 
> William Breathitt Gray

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ