Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 23 Jan 2019 00:54:08 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org
Subject:   svn commit: r343328 - stable/12/sys/dev/nvme
Message-ID:  <201901230054.x0N0s8Fc081949@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Wed Jan 23 00:54:08 2019
New Revision: 343328
URL: https://svnweb.freebsd.org/changeset/base/343328

Log:
  MFC r342399: Remove CAM SIM lock from NVMe SIM.
  
  CAM does not require SIM lock since FreeBSD 10.4, and NVMe code never
  required it at all, using per-queue locks instead.  This formally allows
  parallel request submission in CAM mode as much as single per-device and
  per-queue locks of CAM allow.

Modified:
  stable/12/sys/dev/nvme/nvme_sim.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/nvme/nvme_sim.c
==============================================================================
--- stable/12/sys/dev/nvme/nvme_sim.c	Tue Jan 22 22:39:46 2019	(r343327)
+++ stable/12/sys/dev/nvme/nvme_sim.c	Wed Jan 23 00:54:08 2019	(r343328)
@@ -150,8 +150,6 @@ nvme_sim_action(struct cam_sim *sim, union ccb *ccb)
 
 	ctrlr = sim2ctrlr(sim);
 
-	mtx_assert(&ctrlr->lock, MA_OWNED);
-
 	switch (ccb->ccb_h.func_code) {
 	case XPT_CALC_GEOMETRY:		/* Calculate Geometry Totally nuts ? XXX */
 		/* 
@@ -289,7 +287,7 @@ nvme_sim_new_controller(struct nvme_controller *ctrlr)
 
 	sc->s_sim = cam_sim_alloc(nvme_sim_action, nvme_sim_poll,
 	    "nvme", sc, device_get_unit(ctrlr->dev),
-	    &ctrlr->lock, max_trans, max_trans, devq);
+	    NULL, max_trans, max_trans, devq);
 	if (sc->s_sim == NULL) {
 		printf("Failed to allocate a sim\n");
 		cam_simq_free(devq);
@@ -320,11 +318,8 @@ static void *
 nvme_sim_new_ns(struct nvme_namespace *ns, void *sc_arg)
 {
 	struct nvme_sim_softc *sc = sc_arg;
-	struct nvme_controller *ctrlr = sc->s_ctrlr;
 	union ccb *ccb;
 
-	mtx_lock(&ctrlr->lock);
-
 	ccb = xpt_alloc_ccb_nowait();
 	if (ccb == NULL) {
 		printf("unable to alloc CCB for rescan\n");
@@ -340,8 +335,6 @@ nvme_sim_new_ns(struct nvme_namespace *ns, void *sc_ar
 
 	xpt_rescan(ccb);
 
-	mtx_unlock(&ctrlr->lock);
-
 	return (ns);
 }
 
@@ -349,14 +342,11 @@ static void
 nvme_sim_controller_fail(void *ctrlr_arg)
 {
 	struct nvme_sim_softc *sc = ctrlr_arg;
-	struct nvme_controller *ctrlr = sc->s_ctrlr;
 
-	mtx_lock(&ctrlr->lock);
 	xpt_async(AC_LOST_DEVICE, sc->s_path, NULL);
 	xpt_free_path(sc->s_path);
 	xpt_bus_deregister(cam_sim_path(sc->s_sim));
 	cam_sim_free(sc->s_sim, /*free_devq*/TRUE);
-	mtx_unlock(&ctrlr->lock);
 	free(sc, M_NVME);
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201901230054.x0N0s8Fc081949>