From owner-svn-src-head@freebsd.org Mon Aug 28 23:54:22 2017 Return-Path: Delivered-To: svn-src-head@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 12B37E166DE; Mon, 28 Aug 2017 23:54:22 +0000 (UTC) (envelope-from imp@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 CFD6D6A2C1; Mon, 28 Aug 2017 23:54:21 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v7SNsLBg012832; Mon, 28 Aug 2017 23:54:21 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v7SNsKkn012829; Mon, 28 Aug 2017 23:54:20 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201708282354.v7SNsKkn012829@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Mon, 28 Aug 2017 23:54:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r322994 - head/sys/dev/nvme X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/dev/nvme X-SVN-Commit-Revision: 322994 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 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, 28 Aug 2017 23:54:22 -0000 Author: imp Date: Mon Aug 28 23:54:20 2017 New Revision: 322994 URL: https://svnweb.freebsd.org/changeset/base/322994 Log: Set the max transactions for NVMe drives better. Provided a better estimate for the number of transactions that can be pending at one time. This will be number of queues * number of trackers / 4, as suggested by Jim Harris. This gives a better estimate of the number of transactions that CAM should queue before applying back pressure. This should be revisted when we have real multi-queue support in CAM and the upper layers of the I/O stack. Sponsored by: Netflix Modified: head/sys/dev/nvme/nvme_ctrlr.c head/sys/dev/nvme/nvme_private.h head/sys/dev/nvme/nvme_sim.c Modified: head/sys/dev/nvme/nvme_ctrlr.c ============================================================================== --- head/sys/dev/nvme/nvme_ctrlr.c Mon Aug 28 23:54:16 2017 (r322993) +++ head/sys/dev/nvme/nvme_ctrlr.c Mon Aug 28 23:54:20 2017 (r322994) @@ -146,6 +146,14 @@ nvme_ctrlr_construct_io_qpairs(struct nvme_controller num_trackers = min(num_trackers, (num_entries-1)); /* + * Our best estimate for the maximum number of I/Os that we should + * noramlly have in flight at one time. This should be viewed as a hint, + * not a hard limit and will need to be revisitted when the upper layers + * of the storage system grows multi-queue support. + */ + ctrlr->max_hw_pend_io = num_trackers * ctrlr->num_io_queues / 4; + + /* * This was calculated previously when setting up interrupts, but * a controller could theoretically support fewer I/O queues than * MSI-X vectors. So calculate again here just to be safe. Modified: head/sys/dev/nvme/nvme_private.h ============================================================================== --- head/sys/dev/nvme/nvme_private.h Mon Aug 28 23:54:16 2017 (r322993) +++ head/sys/dev/nvme/nvme_private.h Mon Aug 28 23:54:20 2017 (r322994) @@ -263,6 +263,7 @@ struct nvme_controller { uint32_t num_io_queues; uint32_t num_cpus_per_ioq; + uint32_t max_hw_pend_io; /* Fields for tracking progress during controller initialization. */ struct intr_config_hook config_hook; Modified: head/sys/dev/nvme/nvme_sim.c ============================================================================== --- head/sys/dev/nvme/nvme_sim.c Mon Aug 28 23:54:16 2017 (r322993) +++ head/sys/dev/nvme/nvme_sim.c Mon Aug 28 23:54:20 2017 (r322994) @@ -253,7 +253,7 @@ nvme_sim_new_controller(struct nvme_controller *ctrlr) int unit; struct nvme_sim_softc *sc = NULL; - max_trans = ctrlr->num_io_queues; + max_trans = ctrlr->max_hw_pend_io; unit = device_get_unit(ctrlr->dev); devq = cam_simq_alloc(max_trans); if (devq == NULL)