NetBSD-Bugs archive

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

Re: kern/47097: ahcisata(4) triggers panic when disk I/O error is caused



On Sat, Oct 20, 2012 at 03:50:00PM +0000, tshiozak%bsdclub.org@localhost wrote:
> when disk I/O error is caused, ahcisata(4) seems to call tsleep() under 
> interrupt context and it triggers panic.
> 
> call trace is here:
> 
> vpanic
> kern_assert
> callout_halt
> sleepq_block
> ahci_do_reset_drive
> ahci_reset_drive
> wddone
> ahci_bio_complete
> ahci_intr_port
> ahci_intr

The attached patch should work around it. But this is going to
delay() for half a second, which is bad. Something better is needed,
so we can reset the drive from the atabus thread.

-- 
Manuel Bouyer <bouyer%antioche.eu.org@localhost>
     NetBSD: 26 ans d'experience feront toujours la difference
--
Index: ahcisata_core.c
===================================================================
RCS file: /cvsroot/src/sys/dev/ic/ahcisata_core.c,v
retrieving revision 1.44
diff -u -p -u -r1.44 ahcisata_core.c
--- ahcisata_core.c     27 Sep 2012 00:39:47 -0000      1.44
+++ ahcisata_core.c     21 Oct 2012 11:02:38 -0000
@@ -721,7 +721,10 @@ again:
                if ((((sig & AHCI_P_TFD_ST) >> AHCI_P_TFD_ST_SHIFT)
                    & WDCS_BSY) == 0)
                        break;
-               tsleep(&sc, PRIBIO, "ahcid2h", mstohz(10));
+               if (flags & AT_WAIT)
+                       tsleep(&sc, PRIBIO, "ahcid2h", mstohz(10));
+               else
+                       delay(10000);
        }
        if (i == AHCI_RST_WAIT) {
                aprint_error("%s: BSY never cleared, TD 0x%x\n",
@@ -740,7 +743,10 @@ again:
            AHCI_READ(sc, AHCI_P_CMD(chp->ch_channel))), DEBUG_PROBE);
 end:
        ahci_channel_stop(sc, chp, flags);
-       tsleep(&sc, PRIBIO, "ahcirst", mstohz(500));
+       if (flags & AT_WAIT)
+               tsleep(&sc, PRIBIO, "ahcirst", mstohz(500));
+       else
+               delay(500000);
        /* clear port interrupt register */
        AHCI_WRITE(sc, AHCI_P_IS(chp->ch_channel), 0xffffffff);
        ahci_channel_start(sc, chp, AT_WAIT,


Home | Main Index | Thread Index | Old Index