From owner-svn-src-all@FreeBSD.ORG Thu Sep 16 22:54:57 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 227D81065670; Thu, 16 Sep 2010 22:54:57 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 079CF8FC1C; Thu, 16 Sep 2010 22:54:57 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o8GMsuRN009676; Thu, 16 Sep 2010 22:54:56 GMT (envelope-from ken@svn.freebsd.org) Received: (from ken@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o8GMsuBY009674; Thu, 16 Sep 2010 22:54:56 GMT (envelope-from ken@svn.freebsd.org) Message-Id: <201009162254.o8GMsuBY009674@svn.freebsd.org> From: "Kenneth D. Merry" Date: Thu, 16 Sep 2010 22:54:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r212772 - head/sys/dev/mps X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 16 Sep 2010 22:54:57 -0000 Author: ken Date: Thu Sep 16 22:54:56 2010 New Revision: 212772 URL: http://svn.freebsd.org/changeset/base/212772 Log: MFp4 (//depot/projects/mps/...): According to the MPT2 spec, task management commands are serialized, and so no I/O should start while task management commands are active. So, to comply with that, freeze the SIM queue before we send any task management commands (abort, target reset, etc.) down to the IOC. We unfreeze the queue once the task management command completes. It isn't clear from the spec whether multiple simultaneous task management commands are supported. Right now it is possible to have multiple outstanding task management commands, especially in the abort case. Multiple outstanding aborts do complete successfully, so it may be supported. We also don't yet have any recovery mechanism (e.g. reset the IOC) if the task management command fails. Modified: head/sys/dev/mps/mps_sas.c Modified: head/sys/dev/mps/mps_sas.c ============================================================================== --- head/sys/dev/mps/mps_sas.c Thu Sep 16 22:38:27 2010 (r212771) +++ head/sys/dev/mps/mps_sas.c Thu Sep 16 22:54:56 2010 (r212772) @@ -438,6 +438,7 @@ mpssas_prepare_remove(struct mpssas_soft cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; cm->cm_complete = mpssas_remove_device; cm->cm_targ = targ; + xpt_freeze_simq(sc->sassc->sim, 1); mps_map_command(sc, cm); } @@ -453,6 +454,7 @@ mpssas_remove_device(struct mps_softc *s reply = (MPI2_SCSI_TASK_MANAGE_REPLY *)cm->cm_reply; handle = cm->cm_targ->handle; + xpt_release_simq(sc->sassc->sim, 1); if (reply->IOCStatus != MPI2_IOCSTATUS_SUCCESS) { mps_printf(sc, "Failure 0x%x reseting device 0x%04x\n", reply->IOCStatus, handle); @@ -983,6 +985,11 @@ mpssas_abort_complete(struct mps_softc * mps_printf(sc, "%s: abort request on handle %#04x SMID %d " "complete\n", __func__, req->DevHandle, req->TaskMID); + /* + * Release the SIM queue, we froze it when we sent the abort. + */ + xpt_release_simq(sc->sassc->sim, 1); + mps_free_command(sc, cm); } @@ -1013,10 +1020,19 @@ mpssas_recovery(struct mps_softc *sc, st cm->cm_data = NULL; cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; + /* + * Freeze the SIM queue while we issue the abort. According to the + * Fusion-MPT 2.0 spec, task management requests are serialized, + * and so the host should not send any I/O requests while task + * management requests are pending. + */ + xpt_freeze_simq(sc->sassc->sim, 1); + error = mps_map_command(sc, cm); if (error != 0) { mps_printf(sc, "%s: error mapping abort request!\n", __func__); + xpt_release_simq(sc->sassc->sim, 1); } #if 0 error = mpssas_reset(sc, targ, &resetcm); @@ -1361,7 +1377,13 @@ mpssas_resetdev(struct mpssas_softc *sas cm->cm_data = NULL; cm->cm_desc.Default.RequestFlags = MPI2_REQ_DESCRIPT_FLAGS_DEFAULT_TYPE; + xpt_freeze_simq(sassc->sim, 1); + error = mps_map_command(sassc->sc, cm); + + if (error != 0) + xpt_release_simq(sassc->sim, 1); + return (error); } @@ -1385,6 +1407,9 @@ mpssas_resetdev_complete(struct mps_soft ccb->ccb_h.status = CAM_REQ_CMP_ERR; mps_free_command(sc, cm); + + xpt_release_simq(sc->sassc->sim, 1); + xpt_done(ccb); }