svn commit: r342399 - head/sys/dev/nvme
Alexander Motin
mav at FreeBSD.org
Mon Dec 24 23:28:12 UTC 2018
Author: mav
Date: Mon Dec 24 23:28:11 2018
New Revision: 342399
URL: https://svnweb.freebsd.org/changeset/base/342399
Log:
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.
MFC after: 1 month
Modified:
head/sys/dev/nvme/nvme_sim.c
Modified: head/sys/dev/nvme/nvme_sim.c
==============================================================================
--- head/sys/dev/nvme/nvme_sim.c Mon Dec 24 19:37:10 2018 (r342398)
+++ head/sys/dev/nvme/nvme_sim.c Mon Dec 24 23:28:11 2018 (r342399)
@@ -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);
}
More information about the svn-src-head
mailing list