Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/xen/xen move the xen_intr_disestablish() to resume ...



details:   https://anonhg.NetBSD.org/src/rev/11c01d38b507
branches:  trunk
changeset: 972027:11c01d38b507
user:      jdolecek <jdolecek%NetBSD.org@localhost>
date:      Wed May 13 16:17:46 2020 +0000

description:
move the xen_intr_disestablish() to resume - having it in suspend
seems to cause panic in later phases of suspend

don't try to revoke grants in resume, they are all gone

add some diagnostic code in suspend to make sure the request lists are ready
for resume

part of PR port-xen/55207

diffstat:

 sys/arch/xen/xen/xbd_xenbus.c |  36 ++++++++++++++++++++++--------------
 1 files changed, 22 insertions(+), 14 deletions(-)

diffs (72 lines):

diff -r 6a5d28061b4f -r 11c01d38b507 sys/arch/xen/xen/xbd_xenbus.c
--- a/sys/arch/xen/xen/xbd_xenbus.c     Wed May 13 16:13:14 2020 +0000
+++ b/sys/arch/xen/xen/xbd_xenbus.c     Wed May 13 16:17:46 2020 +0000
@@ -1,4 +1,4 @@
-/*      $NetBSD: xbd_xenbus.c,v 1.126 2020/05/12 09:54:02 jdolecek Exp $      */
+/*      $NetBSD: xbd_xenbus.c,v 1.127 2020/05/13 16:17:46 jdolecek Exp $      */
 
 /*
  * Copyright (c) 2006 Manuel Bouyer.
@@ -50,7 +50,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: xbd_xenbus.c,v 1.126 2020/05/12 09:54:02 jdolecek Exp $");
+__KERNEL_RCSID(0, "$NetBSD: xbd_xenbus.c,v 1.127 2020/05/13 16:17:46 jdolecek Exp $");
 
 #include "opt_xen.h"
 
@@ -492,12 +492,22 @@
        hypervisor_mask_event(sc->sc_evtchn);
        sc->sc_backend_status = BLKIF_STATE_SUSPENDED;
 
-       mutex_exit(&sc->sc_lock);
+#ifdef DIAGNOSTIC
+       /* Check that all requests are finished and device ready for resume */
+       int reqcnt = 0;
+       struct xbd_req *req;
+       SLIST_FOREACH(req, &sc->sc_xbdreq_head, req_next)
+               reqcnt++;
+       KASSERT(reqcnt == __arraycount(sc->sc_reqs));
 
-       if (sc->sc_ih != NULL) {
-               xen_intr_disestablish(sc->sc_ih);
-               sc->sc_ih = NULL;
-       }
+       int incnt = 0;
+       struct xbd_indirect *in;
+       SLIST_FOREACH(in, &sc->sc_indirect_head, in_next)
+               incnt++;
+       KASSERT(incnt == __arraycount(sc->sc_indirect));
+#endif
+
+       mutex_exit(&sc->sc_lock);
 
        xenbus_device_suspend(sc->sc_xbusd);
        aprint_verbose_dev(dev, "removed event channel %d\n", sc->sc_evtchn);
@@ -517,13 +527,7 @@
 
        sc = device_private(dev);
 
-       if (sc->sc_backend_status == BLKIF_STATE_SUSPENDED) {
-               /*
-                * Device was suspended, so ensure that access associated to
-                * the block I/O ring is revoked.
-                */
-               xengnt_revoke_access(sc->sc_ring_gntref);
-       }
+       /* All grants were removed during suspend */
        sc->sc_ring_gntref = GRANT_INVALID_REF;
 
        /* Initialize ring */
@@ -561,6 +565,10 @@
        if (error)
                goto abort_resume;
 
+       if (sc->sc_ih != NULL) {
+               xen_intr_disestablish(sc->sc_ih);
+               sc->sc_ih = NULL;
+       }
        aprint_verbose_dev(dev, "using event channel %d\n",
            sc->sc_evtchn);
        sc->sc_ih = xen_intr_establish_xname(-1, &xen_pic, sc->sc_evtchn,



Home | Main Index | Thread Index | Old Index