Source-Changes-HG archive

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

[src/netbsd-8]: src/sys/dev/pci Pull up following revision(s) (requested by b...



details:   https://anonhg.NetBSD.org/src/rev/3d600105a3b0
branches:  netbsd-8
changeset: 450824:3d600105a3b0
user:      martin <martin%NetBSD.org@localhost>
date:      Fri Apr 26 19:04:19 2019 +0000

description:
Pull up following revision(s) (requested by bouyer in ticket #1247):

        sys/dev/pci/mfii.c: revision 1.4

Clean up timeout logic. Now the system survives to a ccb timeout; before
the filesystem would stall because one I/O did never completes.

diffstat:

 sys/dev/pci/mfii.c |  36 +++++++++++++-----------------------
 1 files changed, 13 insertions(+), 23 deletions(-)

diffs (108 lines):

diff -r d221f1aa9d97 -r 3d600105a3b0 sys/dev/pci/mfii.c
--- a/sys/dev/pci/mfii.c        Tue Apr 23 18:27:38 2019 +0000
+++ b/sys/dev/pci/mfii.c        Fri Apr 26 19:04:19 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mfii.c,v 1.3.2.3 2018/12/08 12:17:13 martin Exp $ */
+/* $NetBSD: mfii.c,v 1.3.2.4 2019/04/26 19:04:19 martin Exp $ */
 /* $OpenBSD: mfii.c,v 1.58 2018/08/14 05:22:21 jmatthew Exp $ */
 
 /*
@@ -18,7 +18,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: mfii.c,v 1.3.2.3 2018/12/08 12:17:13 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: mfii.c,v 1.3.2.4 2019/04/26 19:04:19 martin Exp $");
 
 #include "bio.h"
 
@@ -264,7 +264,6 @@
        u_int32_t               ccb_flags;
 #define MFI_CCB_F_ERR                  (1<<0)
        u_int                   ccb_smid;
-       u_int                   ccb_refcnt;
        SIMPLEQ_ENTRY(mfii_ccb) ccb_link;
 };
 SIMPLEQ_HEAD(mfii_ccb_list, mfii_ccb);
@@ -2159,7 +2158,6 @@
                return;
        }
 
-       ccb->ccb_refcnt = 2; /* one for the chip, one for the timeout */
        mfii_start(sc, ccb);
 
        return;
@@ -2176,10 +2174,9 @@
        struct scsipi_xfer *xs = ccb->ccb_cookie;
        struct mpii_msg_scsi_io *io = ccb->ccb_request;
        struct mfii_raid_context *ctx = (struct mfii_raid_context *)(io + 1);
-       u_int refs = 2;
 
        if (callout_stop(&xs->xs_callout) != 0)
-               refs = 1;
+               return;
 
        switch (ctx->status) {
        case MFI_STAT_OK:
@@ -2201,10 +2198,8 @@
                break;
        }
 
-       if (atomic_add_int_nv(&ccb->ccb_refcnt, -refs) == 0) {
-               scsipi_done(xs);
-               mfii_put_ccb(sc, ccb);
-       }
+       scsipi_done(xs);
+       mfii_put_ccb(sc, ccb);
 }
 
 int
@@ -2343,7 +2338,6 @@
                return;
        }
 
-       ccb->ccb_refcnt = 2; /* one for the chip, one for the timeout */
        // XXX timeout_add_msec(&xs->stimeout, xs->timeout);
        mfii_start(sc, ccb);
 
@@ -2543,10 +2537,9 @@
 
                if (!sc->sc_ld[periph->periph_target].ld_present) {
                        /* device is gone */
-                       if (atomic_dec_uint_nv(&ccb->ccb_refcnt) == 0) {
-                               scsipi_done(xs);
-                               mfii_put_ccb(sc, ccb);
-                       }
+                       xs->error = XS_SELTIMEOUT;
+                       scsipi_done(xs);
+                       mfii_put_ccb(sc, ccb);
                        continue;
                }
 
@@ -2591,12 +2584,11 @@
        /* XXX check accb completion? */
 
        mfii_put_ccb(sc, accb);
-
-       if (atomic_dec_uint_nv(&ccb->ccb_refcnt) == 0) {
-               xs->error = XS_TIMEOUT;
-               scsipi_done(xs);
-               mfii_put_ccb(sc, ccb);
-       }
+       printf("%s: cmd aborted ccb %p\n", DEVNAME(sc), ccb);
+
+       xs->error = XS_TIMEOUT;
+       scsipi_done(xs);
+       mfii_put_ccb(sc, ccb);
 }
 
 struct mfii_ccb *
@@ -2627,8 +2619,6 @@
        ccb->ccb_dma64 = false;
        ccb->ccb_len = 0;
        ccb->ccb_sgl_len = 0;
-       ccb->ccb_refcnt = 1;
-
        memset(&ccb->ccb_req, 0, sizeof(ccb->ccb_req));
        memset(ccb->ccb_request, 0, MFII_REQUEST_SIZE);
        memset(ccb->ccb_mfi, 0, MFI_FRAME_SIZE);



Home | Main Index | Thread Index | Old Index