svn commit: r295532 - head/sys/dev/nvme

Jim Harris jimharris at FreeBSD.org
Thu Feb 11 17:32:43 UTC 2016


Author: jimharris
Date: Thu Feb 11 17:32:41 2016
New Revision: 295532
URL: https://svnweb.freebsd.org/changeset/base/295532

Log:
  nvme: avoid duplicate SET_NUM_QUEUES commands
  
  nvme(4) issues a SET_NUM_QUEUES command during device
  initialization to ensure enough I/O queues exists for each
  of the MSI-X vectors we have allocated.  The SET_NUM_QUEUES
  command is then issued again during nvme_ctrlr_start(), to
  ensure that is properly set after any controller reset.
  
  At least one NVMe drive exists which fails this second
  SET_NUM_QUEUES command during device initialization.  So
  change nvme_ctrlr_start() to only issue its SET_NUM_QUEUES
  command when it is coming out of a reset - avoiding the
  duplicate SET_NUM_QUEUES during device initialization.
  
  Reported by:	gallatin
  MFC after:	3 days
  Sponsored by:	Intel

Modified:
  head/sys/dev/nvme/nvme_ctrlr.c

Modified: head/sys/dev/nvme/nvme_ctrlr.c
==============================================================================
--- head/sys/dev/nvme/nvme_ctrlr.c	Thu Feb 11 17:31:17 2016	(r295531)
+++ head/sys/dev/nvme/nvme_ctrlr.c	Thu Feb 11 17:32:41 2016	(r295532)
@@ -725,15 +725,17 @@ nvme_ctrlr_start(void *ctrlr_arg)
 	 *  explicit specify how many queues it will use.  This value should
 	 *  never change between resets, so panic if somehow that does happen.
 	 */
-	old_num_io_queues = ctrlr->num_io_queues;
-	if (nvme_ctrlr_set_num_qpairs(ctrlr) != 0) {
-		nvme_ctrlr_fail(ctrlr);
-		return;
-	}
+	if (ctrlr->is_resetting) {
+		old_num_io_queues = ctrlr->num_io_queues;
+		if (nvme_ctrlr_set_num_qpairs(ctrlr) != 0) {
+			nvme_ctrlr_fail(ctrlr);
+			return;
+		}
 
-	if (old_num_io_queues != ctrlr->num_io_queues) {
-		panic("num_io_queues changed from %u to %u", old_num_io_queues,
-		    ctrlr->num_io_queues);
+		if (old_num_io_queues != ctrlr->num_io_queues) {
+			panic("num_io_queues changed from %u to %u",
+			      old_num_io_queues, ctrlr->num_io_queues);
+		}
 	}
 
 	if (nvme_ctrlr_create_qpairs(ctrlr) != 0) {


More information about the svn-src-head mailing list