From owner-svn-src-stable-11@freebsd.org Sat Mar 25 11:44:36 2017 Return-Path: Delivered-To: svn-src-stable-11@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 460E2D1BBB9; Sat, 25 Mar 2017 11:44:36 +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 mx1.freebsd.org (Postfix) with ESMTPS id EEB8F1E4A; Sat, 25 Mar 2017 11:44:35 +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 v2PBiZdT059255; Sat, 25 Mar 2017 11:44:35 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v2PBiZHH059254; Sat, 25 Mar 2017 11:44:35 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201703251144.v2PBiZHH059254@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sat, 25 Mar 2017 11:44:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r315938 - stable/11/sys/cam/ctl X-SVN-Group: stable-11 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-stable-11@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for only the 11-stable src tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 25 Mar 2017 11:44:36 -0000 Author: mav Date: Sat Mar 25 11:44:34 2017 New Revision: 315938 URL: https://svnweb.freebsd.org/changeset/base/315938 Log: MFC r315084: Increase device openings to tagged maximum. Some SIMs report much less untagged device openings then tagged ones. Target mode devices are not handled by regular probing routines, and so there is nothing to increase queue size for them to the SIM's maximum. To fix that resize the queue explicitly on ctl periph registration. This radically improves performance of mpt(4) in target mode. Also fetch and report device queue statistics in `ctladm dumpstructs`, since regular way of `camcontrol tags` is not usable in target mode. Modified: stable/11/sys/cam/ctl/scsi_ctl.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cam/ctl/scsi_ctl.c ============================================================================== --- stable/11/sys/cam/ctl/scsi_ctl.c Sat Mar 25 11:36:06 2017 (r315937) +++ stable/11/sys/cam/ctl/scsi_ctl.c Sat Mar 25 11:44:34 2017 (r315938) @@ -457,6 +457,16 @@ ctlferegister(struct cam_periph *periph, softc->periph = periph; periph->softc = softc; + /* Increase device openings to maximum for the SIM. */ + if (bus_softc->sim->max_tagged_dev_openings > + bus_softc->sim->max_dev_openings) { + cam_release_devq(periph->path, + /*relsim_flags*/RELSIM_ADJUST_OPENINGS, + /*openings*/bus_softc->sim->max_tagged_dev_openings, + /*timeout*/0, + /*getcount_only*/1); + } + xpt_setup_ccb(&ccb.ccb_h, periph->path, CAM_PRIORITY_NONE); ccb.ccb_h.func_code = XPT_EN_LUN; ccb.cel.grp6_len = 0; @@ -1816,9 +1826,9 @@ static void ctlfe_dump_sim(struct cam_sim *sim) { - printf("%s%d: max tagged openings: %d, max dev openings: %d\n", - sim->sim_name, sim->unit_number, - sim->max_tagged_dev_openings, sim->max_dev_openings); + printf("%s%d: max dev openings: %d, max tagged dev openings: %d\n", + sim->sim_name, sim->unit_number, sim->max_dev_openings, + sim->max_tagged_dev_openings); } /* @@ -1827,11 +1837,21 @@ ctlfe_dump_sim(struct cam_sim *sim) static void ctlfe_dump_queue(struct ctlfe_lun_softc *softc) { + struct cam_periph *periph = softc->periph; struct ccb_hdr *hdr; - struct cam_periph *periph; + struct ccb_getdevstats cgds; int num_items; - periph = softc->periph; + xpt_setup_ccb(&cgds.ccb_h, periph->path, CAM_PRIORITY_NORMAL); + cgds.ccb_h.func_code = XPT_GDEV_STATS; + xpt_action((union ccb *)&cgds); + if ((cgds.ccb_h.status & CAM_STATUS_MASK) == CAM_REQ_CMP) { + xpt_print(periph->path, "devq: openings %d, active %d, " + "allocated %d, queued %d, held %d\n", + cgds.dev_openings, cgds.dev_active, cgds.allocated, + cgds.queued, cgds.held); + } + num_items = 0; STAILQ_FOREACH(hdr, &softc->work_queue, periph_links.stqe) {