Source-Changes-HG archive

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

[src/jdolecek-ncq]: src/sys/dev/ata fix regression in atabus_thread() when it...



details:   https://anonhg.NetBSD.org/src/rev/37cb78945a3a
branches:  jdolecek-ncq
changeset: 352761:37cb78945a3a
user:      jdolecek <jdolecek%NetBSD.org@localhost>
date:      Sun Sep 10 19:22:56 2017 +0000

description:
fix regression in atabus_thread() when it was converted from spl to mutex -
the reset and c_start() routines expect to run on splbio; wrap the calls
insite splbio/splx() again for now, since we can't hold the mutex while calling
them

fixes problem experienced by Jonathan, where drive setup triggered
an spurious interrupt and panic due to state < READY

diffstat:

 sys/dev/ata/ata.c |  10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diffs (47 lines):

diff -r f24b594c70ba -r 37cb78945a3a sys/dev/ata/ata.c
--- a/sys/dev/ata/ata.c Sun Sep 10 18:37:21 2017 +0000
+++ b/sys/dev/ata/ata.c Sun Sep 10 19:22:56 2017 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ata.c,v 1.132.8.29 2017/08/15 11:21:32 jdolecek Exp $  */
+/*     $NetBSD: ata.c,v 1.132.8.30 2017/09/10 19:22:56 jdolecek Exp $  */
 
 /*
  * Copyright (c) 1998, 2001 Manuel Bouyer.  All rights reserved.
@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: ata.c,v 1.132.8.29 2017/08/15 11:21:32 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ata.c,v 1.132.8.30 2017/09/10 19:22:56 jdolecek Exp $");
 
 #include "opt_ata.h"
 
@@ -586,7 +586,7 @@
        struct ata_channel *chp = sc->sc_chan;
        struct ata_queue *chq = chp->ch_queue;
        struct ata_xfer *xfer;
-       int i;
+       int i, s;
 
        mutex_enter(&chp->ch_lock);
        chp->ch_flags |= ATACH_TH_RUN;
@@ -630,7 +630,9 @@
                         */
                        mutex_exit(&chp->ch_lock);
                        ata_channel_thaw(chp);
+                       s = splbio();
                        ata_reset_channel(chp, AT_WAIT | chp->ch_reset_flags);
+                       splx(s);
                        mutex_enter(&chp->ch_lock);
                } else if (chq->queue_active > 0 && chq->queue_freeze == 1) {
                        /*
@@ -644,7 +646,9 @@
                        ata_channel_thaw(chp);
                        xfer = ata_queue_get_active_xfer(chp);
                        KASSERT(xfer != NULL);
+                       s = splbio();
                        (*xfer->c_start)(xfer->c_chp, xfer);
+                       splx(s);
                        mutex_enter(&chp->ch_lock);
                } else if (chq->queue_freeze > 1)
                        panic("%s: queue_freeze", __func__);



Home | Main Index | Thread Index | Old Index