From nobody Sun Nov 21 15:59:00 2021 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id C2D0118968B2; Sun, 21 Nov 2021 15:59:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Hxw7S5D51z3hRg; Sun, 21 Nov 2021 15:59:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9315111FF8; Sun, 21 Nov 2021 15:59:00 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 1ALFx0bA081630; Sun, 21 Nov 2021 15:59:00 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 1ALFx0Jg081629; Sun, 21 Nov 2021 15:59:00 GMT (envelope-from git) Date: Sun, 21 Nov 2021 15:59:00 GMT Message-Id: <202111211559.1ALFx0Jg081629@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: a8837c77efd0 - main - mpr: fix freeze / release mismatch in timeout code List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: a8837c77efd0bb9d934657edf87a9a66baac7479 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=a8837c77efd0bb9d934657edf87a9a66baac7479 commit a8837c77efd0bb9d934657edf87a9a66baac7479 Author: Warner Losh AuthorDate: 2021-11-21 15:50:46 +0000 Commit: Warner Losh CommitDate: 2021-11-21 15:54:45 +0000 mpr: fix freeze / release mismatch in timeout code So, if we're processing a timeout, and we've sent an ABORT to the firmware for that timeout, but not yet received the response from the firmware, AND we get another timeout, we queue the timeout and freeze the queue. However, when we've finally processed them all, we only release the queue once. This causes all I/O to halt as the devq remains frozen forever. Instead, only freeze the queue when we start the process (eg set INRESET on the target). This will allow the release when all the timed out I/Os have finished ABORTing. Sponsored by: Netflix Reviewed by: mav Differential Revision: https://reviews.freebsd.org/D33054 --- sys/dev/mpr/mpr_sas.c | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/sys/dev/mpr/mpr_sas.c b/sys/dev/mpr/mpr_sas.c index aace724e16f2..a4872dcc769e 100644 --- a/sys/dev/mpr/mpr_sas.c +++ b/sys/dev/mpr/mpr_sas.c @@ -248,7 +248,8 @@ mprsas_free_tm(struct mpr_softc *sc, struct mpr_command *tm) * INRESET flag as well or scsi I/O will not work. */ if (tm->cm_ccb) { - mpr_dprint(sc, MPR_XINFO, "Unfreezing devq for target ID %d\n", + mpr_dprint(sc, MPR_XINFO | MPR_RECOVERY, + "Unfreezing devq for target ID %d\n", tm->cm_targ->tid); tm->cm_targ->flags &= ~MPRSAS_TARGET_INRESET; xpt_release_devq(tm->cm_ccb->ccb_h.path, 1, TRUE); @@ -1924,6 +1925,9 @@ mprsas_action_scsiio(struct mprsas_softc *sassc, union ccb *ccb) */ if (targ->flags & MPRSAS_TARGET_INRESET) { ccb->ccb_h.status = CAM_REQUEUE_REQ | CAM_DEV_QFRZN; + mpr_dprint(sc, MPR_XINFO | MPR_RECOVERY, + "%s: Freezing devq for target ID %d\n", + __func__, targ->tid); xpt_freeze_devq(ccb->ccb_h.path, 1); xpt_done(ccb); return; @@ -2513,8 +2517,8 @@ mprsas_scsiio_complete(struct mpr_softc *sc, struct mpr_command *cm) if ((sassc->flags & MPRSAS_QUEUE_FROZEN) == 0) { xpt_freeze_simq(sassc->sim, 1); sassc->flags |= MPRSAS_QUEUE_FROZEN; - mpr_dprint(sc, MPR_XINFO, "Error sending command, " - "freezing SIM queue\n"); + mpr_dprint(sc, MPR_XINFO | MPR_RECOVERY, + "Error sending command, freezing SIM queue\n"); } } @@ -2549,7 +2553,7 @@ mprsas_scsiio_complete(struct mpr_softc *sc, struct mpr_command *cm) if (sassc->flags & MPRSAS_QUEUE_FROZEN) { ccb->ccb_h.status |= CAM_RELEASE_SIMQ; sassc->flags &= ~MPRSAS_QUEUE_FROZEN; - mpr_dprint(sc, MPR_XINFO, + mpr_dprint(sc, MPR_XINFO | MPR_RECOVERY, "Unfreezing SIM queue\n"); } } @@ -2817,7 +2821,7 @@ mprsas_scsiio_complete(struct mpr_softc *sc, struct mpr_command *cm) if (sassc->flags & MPRSAS_QUEUE_FROZEN) { ccb->ccb_h.status |= CAM_RELEASE_SIMQ; sassc->flags &= ~MPRSAS_QUEUE_FROZEN; - mpr_dprint(sc, MPR_XINFO, "Command completed, unfreezing SIM " + mpr_dprint(sc, MPR_INFO, "Command completed, unfreezing SIM " "queue\n"); } @@ -3425,6 +3429,11 @@ mprsas_async(void *callback_arg, uint32_t code, struct cam_path *path, * the target until the reset has completed. The CCB holds the path which * is used to release the devq. The devq is released and the CCB is freed * when the TM completes. + * We only need to do this when we're entering reset, not at each time we + * need to send an abort (which will happen if multiple commands timeout + * while we're sending the abort). We do not release the queue for each + * command we complete (just at the end when we free the tm), so freezing + * it each time doesn't make sense. */ void mprsas_prepare_for_tm(struct mpr_softc *sc, struct mpr_command *tm, @@ -3440,13 +3449,15 @@ mprsas_prepare_for_tm(struct mpr_softc *sc, struct mpr_command *tm, target->tid, lun_id) != CAM_REQ_CMP) { xpt_free_ccb(ccb); } else { - mpr_dprint(sc, MPR_XINFO, - "%s: Freezing devq for target ID %d\n", - __func__, target->tid); - xpt_freeze_devq(ccb->ccb_h.path, 1); tm->cm_ccb = ccb; tm->cm_targ = target; - target->flags |= MPRSAS_TARGET_INRESET; + if ((target->flags & MPRSAS_TARGET_INRESET) == 0) { + mpr_dprint(sc, MPR_XINFO | MPR_RECOVERY, + "%s: Freezing devq for target ID %d\n", + __func__, target->tid); + xpt_freeze_devq(ccb->ccb_h.path, 1); + target->flags |= MPRSAS_TARGET_INRESET; + } } } }