From owner-svn-src-head@freebsd.org Mon Dec 24 23:28:12 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EF4C7135270F; Mon, 24 Dec 2018 23:28:11 +0000 (UTC) (envelope-from mav@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) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 91A6570D98; Mon, 24 Dec 2018 23:28:11 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7C0883494; Mon, 24 Dec 2018 23:28:11 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id wBONSBVO088888; Mon, 24 Dec 2018 23:28:11 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id wBONSBuK088887; Mon, 24 Dec 2018 23:28:11 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201812242328.wBONSBuK088887@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Mon, 24 Dec 2018 23:28:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r342399 - head/sys/dev/nvme X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/sys/dev/nvme X-SVN-Commit-Revision: 342399 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 91A6570D98 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.97 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.97)[-0.972,0]; NEURAL_HAM_LONG(-1.00)[-0.999,0] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 24 Dec 2018 23:28:12 -0000 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); }