Date: Fri, 4 Sep 2020 18:29:59 +0000 (UTC) From: "Bjoern A. Zeeb" <bz@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r365335 - head/sys/dev/usb/storage Message-ID: <202009041829.084ITx6G002032@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: bz Date: Fri Sep 4 18:29:59 2020 New Revision: 365335 URL: https://svnweb.freebsd.org/changeset/base/365335 Log: umass: enhance debugging Investigating a hang I found having some more error information available would be helpful, so be more verbose and also tell cam/xpt status in case of error/panic. Reviewed by: hselasky MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D26287 Modified: head/sys/dev/usb/storage/umass.c Modified: head/sys/dev/usb/storage/umass.c ============================================================================== --- head/sys/dev/usb/storage/umass.c Fri Sep 4 18:26:35 2020 (r365334) +++ head/sys/dev/usb/storage/umass.c Fri Sep 4 18:29:59 2020 (r365335) @@ -2063,6 +2063,7 @@ static int umass_cam_attach_sim(struct umass_softc *sc) { struct cam_devq *devq; /* Per device Queue */ + cam_status status; /* * A HBA is attached to the CAM layer. @@ -2091,11 +2092,12 @@ umass_cam_attach_sim(struct umass_softc *sc) } mtx_lock(&sc->sc_mtx); - - if (xpt_bus_register(sc->sc_sim, sc->sc_dev, - sc->sc_unit) != CAM_SUCCESS) { + status = xpt_bus_register(sc->sc_sim, sc->sc_dev, sc->sc_unit); + if (status != CAM_SUCCESS) { cam_sim_free(sc->sc_sim, /* free_devq */ TRUE); mtx_unlock(&sc->sc_mtx); + printf("%s: xpt_bus_register failed with status %#x\n", + __func__, status); return (ENOMEM); } mtx_unlock(&sc->sc_mtx); @@ -2121,14 +2123,22 @@ umass_cam_attach(struct umass_softc *sc) static void umass_cam_detach_sim(struct umass_softc *sc) { + cam_status status; + if (sc->sc_sim != NULL) { - if (xpt_bus_deregister(cam_sim_path(sc->sc_sim))) { + status = xpt_bus_deregister(cam_sim_path(sc->sc_sim)); + if (status == CAM_REQ_CMP) { /* accessing the softc is not possible after this */ sc->sc_sim->softc = NULL; + DPRINTF(sc, UDMASS_SCSI, "%s: %s:%d:%d caling " + "cam_sim_free sim %p refc %u mtx %p\n", + __func__, sc->sc_name, cam_sim_path(sc->sc_sim), + sc->sc_unit, sc->sc_sim, + sc->sc_sim->refcount, sc->sc_sim->mtx); cam_sim_free(sc->sc_sim, /* free_devq */ TRUE); } else { - panic("%s: CAM layer is busy\n", - sc->sc_name); + panic("%s: %s: CAM layer is busy: %#x\n", + __func__, sc->sc_name, status); } sc->sc_sim = NULL; }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202009041829.084ITx6G002032>