Re: [PATCH] usb: dwc3: gadget: Fix BUG in RT config

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Sep 21, 2015 at 11:37:47AM -0400, Alan Stern wrote:
> On Mon, 21 Sep 2015, Felipe Balbi wrote:
> 
> > On Mon, Sep 21, 2015 at 10:50:10AM -0400, Alan Stern wrote:
> > > On Mon, 21 Sep 2015, Felipe Balbi wrote:
> > > 
> > > > On Mon, Sep 21, 2015 at 10:31:15AM -0400, Alan Stern wrote:
> > > > > On Mon, 21 Sep 2015, Roger Quadros wrote:
> > > > > 
> > > > > > Using spin_lock() in hard irq handler is pointless
> > > > > > and causes a BUG() in RT (real-time) configuration
> > > > > > so get rid of it.
> > > > > 
> > > > > Wait a minute.  Who says spin_lock is pointless in an IRQ handler?
> > > > 
> > > > in the top half IRQs are already disabled, how can this race ?
> > > 
> > > It can race with code running on a different CPU.
> > 
> > fair point.
> 
> In fact, isn't this the main purpose of spinlocks?  There's no point
> using a spinlock to protect against races occurring on a single CPU,
> because (in non-RT situations) the kernel can't schedule or preempt
> while a spinlock is held, so no race can occur.  The whole idea of
> spinlocks is to protect against cross-CPU races.
> 
> Now, maybe the spinlock usage that Roger is removing really is
> unnecessary in this top-half handler.  I don't know; I haven't looked
> at the code.  But in general, spinlocks are highly necessary in IRQ
> handlers.

this does raise some questions of what to do then ? We can't use
spin_locks when in RT because they're reimplemented as mutexes
and can sleep. Converting every single driver to raw_spin_locks
defeats the purpose of having everything and their dogs preemptable.

Difficult to say. Let's defer this patch until we can come up
with a good answer to this.

-- 
balbi

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux