Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/pci vioscsi_req_get()/virtio_enqueue_prep() failing ...



details:   https://anonhg.NetBSD.org/src/rev/f9e18cbc28c2
branches:  trunk
changeset: 818263:f9e18cbc28c2
user:      jdolecek <jdolecek%NetBSD.org@localhost>
date:      Tue Oct 04 18:20:49 2016 +0000

description:
vioscsi_req_get()/virtio_enqueue_prep() failing is actually perfectly
normal - observed failures included 10, 27, 61 in-flight commands,
so probably depends on particular command mix; return with
XS_RESOURCE_SHORTAGE rather then panic

do vioscsi_req_put() when initial bus_dmamap_load() fails, as suggested
by the XXX; the vq_done hook is called by virtio, but in that case we never
get to commit the request to it

diffstat:

 sys/dev/pci/vioscsi.c |  16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diffs (48 lines):

diff -r 4692a1cfdf99 -r f9e18cbc28c2 sys/dev/pci/vioscsi.c
--- a/sys/dev/pci/vioscsi.c     Tue Oct 04 17:36:21 2016 +0000
+++ b/sys/dev/pci/vioscsi.c     Tue Oct 04 18:20:49 2016 +0000
@@ -1,3 +1,4 @@
+/*     $NetBSD: vioscsi.c,v 1.7 2016/10/04 18:20:49 jdolecek Exp $     */
 /*     $OpenBSD: vioscsi.c,v 1.3 2015/03/14 03:38:49 jsg Exp $ */
 
 /*
@@ -17,7 +18,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: vioscsi.c,v 1.6 2015/11/01 08:55:05 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: vioscsi.c,v 1.7 2016/10/04 18:20:49 jdolecek Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -227,16 +228,15 @@
        periph = xs->xs_periph;
 
        vr = vioscsi_req_get(sc);
-#ifdef DIAGNOSTIC
        /*
-        * This should never happen as we track the resources
-        * in the mid-layer.
+        * This can happen when we run out of queue slots.
         */
        if (vr == NULL) {
-               scsipi_printaddr(xs->xs_periph);
-               panic("%s: unable to allocate request\n", __func__);
+               xs->error = XS_RESOURCE_SHORTAGE;
+               scsipi_done(xs);
+               return;
        }
-#endif
+
        req = &vr->vr_req;
        slot = vr - sc->sc_reqs;
 
@@ -284,7 +284,7 @@
        stuffup:
                xs->error = XS_DRIVER_STUFFUP;
 nomore:
-               // XXX: free req?
+               vioscsi_req_put(sc, vr);
                scsipi_done(xs);
                return;
        }



Home | Main Index | Thread Index | Old Index