Source-Changes-HG archive

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

[src/jdolecek-ncqfixes]: src/sys/dev/ata remove AT_RST_EMERG, do the queue re...



details:   https://anonhg.NetBSD.org/src/rev/de3bb5c6e8b8
branches:  jdolecek-ncqfixes
changeset: 1025093:de3bb5c6e8b8
user:      jdolecek <jdolecek%NetBSD.org@localhost>
date:      Sat Oct 06 20:27:36 2018 +0000

description:
remove AT_RST_EMERG, do the queue reset explicitly in wd(4)

this should explicitly fix PR kern/47041 with sync during heavy
disk activity, even thought it was actually already implicitly fixed by calling
ata_thread_run() for drive reset in previous commit already, since the
function already called ata_queue_reset()

drop now unused ch_reset_flags and drive_reset_flags

diffstat:

 sys/dev/ata/ata.c    |  21 ++++-----------------
 sys/dev/ata/atavar.h |   9 +--------
 sys/dev/ata/wd.c     |  12 ++++++++----
 3 files changed, 13 insertions(+), 29 deletions(-)

diffs (151 lines):

diff -r fe48b07377c4 -r de3bb5c6e8b8 sys/dev/ata/ata.c
--- a/sys/dev/ata/ata.c Sat Oct 06 20:27:28 2018 +0000
+++ b/sys/dev/ata/ata.c Sat Oct 06 20:27:36 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: ata.c,v 1.141.6.13 2018/10/06 20:13:12 jdolecek Exp $  */
+/*     $NetBSD: ata.c,v 1.141.6.14 2018/10/06 20:27:36 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.141.6.13 2018/10/06 20:13:12 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: ata.c,v 1.141.6.14 2018/10/06 20:27:36 jdolecek Exp $");
 
 #include "opt_ata.h"
 
@@ -480,20 +480,17 @@
                }
                if (chp->ch_flags & ATACH_TH_RESET) {
                        /* this will unfreeze the channel */
-                       ata_thread_run(chp, AT_WAIT | chp->ch_reset_flags,
+                       ata_thread_run(chp, AT_WAIT,
                            ATACH_TH_RESET, ATACH_NODRIVE);
                } else if (chp->ch_flags & ATACH_TH_DRIVE_RESET) {
                        for (i = 0; i < chp->ch_ndrives; i++) {
                                struct ata_drive_datas *drvp;
-                               int drv_reset_flags;
 
                                drvp = &chp->ch_drive[i];
-                               drv_reset_flags = drvp->drive_reset_flags;
 
                                if (drvp->drive_flags & ATA_DRIVE_TH_RESET) {
                                        ata_thread_run(chp,
-                                           AT_WAIT | drv_reset_flags,
-                                           ATACH_TH_DRIVE_RESET, i);
+                                           AT_WAIT, ATACH_TH_DRIVE_RESET, i);
                                }
                        }
                        chp->ch_flags &= ~ATACH_TH_DRIVE_RESET;
@@ -1527,9 +1524,6 @@
        TAILQ_FOREACH_SAFE(xfer, &chq->active_xfers, c_activechain, xfernext) {
                xfer->ops->c_kill_xfer(xfer->c_chp, xfer, reason);
        }
-
-       if (flags & AT_RST_EMERG)
-               ata_queue_reset(chq);
 }
 
 /*
@@ -1651,7 +1645,6 @@
                                /* No need to schedule another reset */
                                return;
                        }
-                       chp->ch_reset_flags = flags & AT_RST_EMERG;
                        break;
                case ATACH_TH_DRIVE_RESET:
                        KASSERT(drive <= chp->ch_ndrives);
@@ -1662,7 +1655,6 @@
                                return;
                        }
                        drvp->drive_flags |= ATA_DRIVE_TH_RESET;
-                       drvp->drive_reset_flags = flags;
                        break;
                default:
                        panic("%s: unknown type: %x", __func__, type);
@@ -1726,11 +1718,6 @@
 
        /* Signal the thread in case there is an xfer to run */
        cv_signal(&chp->ch_thr_idle);
-
-       if (flags & AT_RST_EMERG) {
-               /* make sure that we can use polled commands */
-               ata_queue_reset(chp->ch_queue);
-       }
 }
 
 int
diff -r fe48b07377c4 -r de3bb5c6e8b8 sys/dev/ata/atavar.h
--- a/sys/dev/ata/atavar.h      Sat Oct 06 20:27:28 2018 +0000
+++ b/sys/dev/ata/atavar.h      Sat Oct 06 20:27:36 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: atavar.h,v 1.99.2.8 2018/10/03 19:20:48 jdolecek Exp $ */
+/*     $NetBSD: atavar.h,v 1.99.2.9 2018/10/06 20:27:36 jdolecek Exp $ */
 
 /*
  * Copyright (c) 1998, 2001 Manuel Bouyer.
@@ -275,7 +275,6 @@
 #define ATA_DRIVE_NCQ          0x0200  /* drive supports NCQ feature set */
 #define ATA_DRIVE_NCQ_PRIO     0x0400  /* drive supports NCQ PRIO field */
 #define ATA_DRIVE_TH_RESET     0x0800  /* drive waits for thread drive reset */
-       int drive_reset_flags;  /* flags for drive reset via thread */
 
        uint8_t drive_type;
 #define        ATA_DRIVET_NONE         0
@@ -365,9 +364,6 @@
        int     (*ata_bio)(struct ata_drive_datas *, struct ata_xfer *);
        void    (*ata_reset_drive)(struct ata_drive_datas *, int, uint32_t *);
        void    (*ata_reset_channel)(struct ata_channel *, int);
-/* extra flags for ata_reset_*(), in addition to AT_* */
-#define AT_RST_EMERG 0x10000 /* emergency - e.g. for a dump */
-
        int     (*ata_exec_command)(struct ata_drive_datas *,
                                    struct ata_xfer *);
 
@@ -421,9 +417,6 @@
 
 #define ATACH_NODRIVE  0xff    /* no drive selected for reset */
 
-       /* for the reset callback */
-       int ch_reset_flags;
-
        /* for the timeout callout */
        struct callout c_timo_callout;  /* timeout callout handle */
 
diff -r fe48b07377c4 -r de3bb5c6e8b8 sys/dev/ata/wd.c
--- a/sys/dev/ata/wd.c  Sat Oct 06 20:27:28 2018 +0000
+++ b/sys/dev/ata/wd.c  Sat Oct 06 20:27:36 2018 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: wd.c,v 1.441.2.10 2018/10/06 19:25:43 jdolecek Exp $ */
+/*     $NetBSD: wd.c,v 1.441.2.11 2018/10/06 20:27:36 jdolecek Exp $ */
 
 /*
  * Copyright (c) 1998, 2001 Manuel Bouyer.  All rights reserved.
@@ -54,7 +54,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: wd.c,v 1.441.2.10 2018/10/06 19:25:43 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: wd.c,v 1.441.2.11 2018/10/06 20:27:36 jdolecek Exp $");
 
 #include "opt_ata.h"
 #include "opt_wd.h"
@@ -1494,10 +1494,14 @@
                wddumprecalibrated = 1;
                ata_channel_lock(wd->drvp->chnl_softc);
                /* This will directly execute the reset due to AT_POLL */
-               ata_thread_run(wd->drvp->chnl_softc, AT_POLL | AT_RST_EMERG,
+               ata_thread_run(wd->drvp->chnl_softc, AT_POLL,
                    ATACH_TH_DRIVE_RESET, wd->drvp->drive);
+
+               /* make sure that we can use polled commands */
+               ata_queue_reset(wd->drvp->chnl_softc->ch_queue);
+
+               wd->drvp->state = RESET;
                ata_channel_unlock(wd->drvp->chnl_softc);
-               wd->drvp->state = RESET;
        }
 
        memset(xfer, 0, sizeof(*xfer));



Home | Main Index | Thread Index | Old Index