Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 24 Aug 2020 01:51:21 +0000 (UTC)
From:      Chuck Tuffli <chuck@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r364603 - head/usr.sbin/bhyve
Message-ID:  <202008240151.07O1pLvx025729@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: chuck
Date: Mon Aug 24 01:51:21 2020
New Revision: 364603
URL: https://svnweb.freebsd.org/changeset/base/364603

Log:
  bhyve: NVMe queue create must init head/tail
  
  The NVMe emulation code did not explicitly initialize queue head and
  tail pointers on queue creation. As these pointers are part of
  calloc()'ed memory, this only becomes a problem if the queues are
  deleted and then recreated.
  
  This error can manifest with messages about completions not matching a
  command.

Modified:
  head/usr.sbin/bhyve/pci_nvme.c

Modified: head/usr.sbin/bhyve/pci_nvme.c
==============================================================================
--- head/usr.sbin/bhyve/pci_nvme.c	Mon Aug 24 01:51:17 2020	(r364602)
+++ head/usr.sbin/bhyve/pci_nvme.c	Mon Aug 24 01:51:21 2020	(r364603)
@@ -932,6 +932,7 @@ nvme_opc_create_io_sq(struct pci_nvme_softc* sc, struc
 			    NVME_SC_MAXIMUM_QUEUE_SIZE_EXCEEDED);
 			return (1);
 		}
+		nsq->head = nsq->tail = 0;
 
 		nsq->cqid = (command->cdw11 >> 16) & 0xffff;
 		if ((nsq->cqid == 0) || (nsq->cqid > sc->num_cqueues)) {
@@ -1053,6 +1054,7 @@ nvme_opc_create_io_cq(struct pci_nvme_softc* sc, struc
 		    NVME_SC_MAXIMUM_QUEUE_SIZE_EXCEEDED);
 		return (1);
 	}
+	ncq->head = ncq->tail = 0;
 	ncq->qbase = vm_map_gpa(sc->nsc_pi->pi_vmctx,
 		     command->prp1,
 		     sizeof(struct nvme_command) * (size_t)ncq->size);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202008240151.07O1pLvx025729>