Re: [PATCH 1/2] raid5: Use raw_spinlock for stripe management.

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

 



On Thu, Apr 27, 2017 at 06:34:07PM +0300, Alexander Gerasiov wrote:
> Hello Julia,
> 
> On Tue, 25 Apr 2017 16:09:29 -0500
> Julia Cartwright <julia@xxxxxx> wrote:
> 
> > Looking at this some more, I imagine the callpath which is problematic
> > is:
> > 
> >    <writeback kworker>
> >    ...
> >    add_stripe_bio()
> >      stripe_add_to_batch_list()
> >        lock_two_stripes()
> >          local_irq_disable()
> >          spin_lock(&sh{1,2}->stripe_lock) --> ___might_sleep() -->
> > BOOM
> > 
> > That is, it's the local_irq_disable() in lock_two_stripes() which is
> > the problem.  That's my gut feel, anyway. Can you give this patch a
> > try and see if works?  You'll probably still want the second patch in
> > your series.
> 
> Ouch, you are absolutely right, it was not atomic context this time, so
> changing spinlocks from mutex to real ones is not necessary. My fault.
> 
> Do you want me to resubmit the patch, or do it yourself?

If you can confirm that the proposed patch fixes the problem you are
seeing, I'll send a proper patch.

Thanks,
   Julia

PS. Also, interestingly, this is not an altogether uncommon problem:

   virtual report

   @r exists@
   position p1;
   position p2;
   @@

   (
   local_irq_disable@p1
   |
   local_irq_save@p1
   )(...);
   ... when != local_irq_enable(...)
       when != local_irq_restore(...)
   (
   spin_lock@p2
   |
   spin_lock_irq@p2
   |
   spin_lock_irqsave@p2
   )(...);

   @script:python depends on r && report@
   p1 << r.p1;
   p2 << r.p2;
   @@

   msg="ERROR: sleeping spinlock acquired, though interrupts disabled on line %s" % (p1[0].line)
   coccilib.report.print_report(p2[0], msg)

Reports:

   drivers/tty/serial/pch_uart.c:1672:2-11: ERROR: sleeping spinlock acquired, though interrupts disabled on line 1662
   drivers/tty/serial/st-asc.c:812:2-11: ERROR: sleeping spinlock acquired, though interrupts disabled on line 806
   drivers/tty/serial/meson_uart.c:497:2-11: ERROR: sleeping spinlock acquired, though interrupts disabled on line 491
   drivers/tty/serial/bcm63xx_uart.c:713:2-11: ERROR: sleeping spinlock acquired, though interrupts disabled on line 706
   drivers/tty/serial/ar933x_uart.c:555:2-11: ERROR: sleeping spinlock acquired, though interrupts disabled on line 548
   drivers/tty/serial/stm32-usart.c:940:2-11: ERROR: sleeping spinlock acquired, though interrupts disabled on line 934
   drivers/net/ethernet/tehuti/tehuti.c:1632:1-10: ERROR: sleeping spinlock acquired, though interrupts disabled on line 1631
   drivers/tty/serial/pxa.c:659:2-11: ERROR: sleeping spinlock acquired, though interrupts disabled on line 653
   drivers/tty/serial/lpc32xx_hs.c:153:2-11: ERROR: sleeping spinlock acquired, though interrupts disabled on line 147
   arch/x86/kernel/reboot.c:98:1-10: ERROR: sleeping spinlock acquired, though interrupts disabled on line 86
   net/core/drop_monitor.c:171:1-10: ERROR: sleeping spinlock acquired, though interrupts disabled on line 169
   drivers/tty/serial/sh-sci.c:2800:2-11: ERROR: sleeping spinlock acquired, though interrupts disabled on line 2791
   drivers/usb/gadget/udc/dummy_hcd.c:755:1-10: ERROR: sleeping spinlock acquired, though interrupts disabled on line 754
   arch/alpha/kernel/srmcons.c:81:1-10: ERROR: sleeping spinlock acquired, though interrupts disabled on line 74
   lib/dma-debug.c:946:2-11: ERROR: sleeping spinlock acquired, though interrupts disabled on line 943
   arch/mn10300/kernel/mn10300-serial.c:1594:2-11: ERROR: sleeping spinlock acquired, though interrupts disabled on line 1587
   arch/metag/kernel/smp.c:451:2-11: ERROR: sleeping spinlock acquired, though interrupts disabled on line 446

There isn't an entirely straightforward way to fix each of these; it will
require some auditing, if anyone is looking for more work to do :).

Attachment: signature.asc
Description: PGP signature


[Index of Archives]     [RT Stable]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux