NAME
nvme – NVM Express core driver
SYNOPSIS
device nvme options NVME_USE_NVD=0 options NVME_2X_RESET
In loader.conf(5): hw.nvme.per_cpu_io_queues=0 hw.nvme.min_cpus_per_ioq=⟨X⟩ hw.nvme.force_intx=1 hw.nvme.hmb_max hw.nvme.apst_enable=1 hw.nvme.apst_data hw.nvme.use_nvd=0 nvme_load="YES"
In loader.conf(5) or sysctl.conf(5): dev.nvme.0.num_cpus_per_ioq dev.nvme.0.int_coal_time dev.nvme.0.int_coal_threshold dev.nvme.0.ioq0.num_entries dev.nvme.0.ioq0.num_tr dev.nvme.0.ioq0.num_prp_list dev.nvme.0.ioq0.sq_head dev.nvme.0.ioq0.sq_tail dev.nvme.0.ioq0.cq_head dev.nvme.0.ioq0.num_cmds dev.nvme.0.ioq0.dump_debug
DESCRIPTION
The nvme driver provides support for NVM Express (NVMe) controllers, such as:
-
Hardware initialization
-
Per-CPU IO queue pairs
-
API for registering NVMe namespace consumers such as nvd(4) or nda(4)
-
API for submitting NVM commands to namespaces
-
Ioctls for controller and namespace configuration and management
The nvme driver creates controller device nodes in the format /dev/nvmeX and namespace device nodes in the format /dev/nvmeXnsY. Note that the NVM Express specification starts numbering namespaces at 1, not 0, and this driver follows that convention.
Most users will also want to enable nvd(4) or nda(4) to expose NVM Express namespaces as disk devices which can be partitioned. Note that in NVM Express terms, a namespace is roughly equivalent to a SCSI LUN.
KERNEL CONFIGURATION
The following settings can be configured at kernel compile time, see build(7):
- options NVME_2X_RESET
-
Reset controller twice upon boot. This should not be necessary.
- options NVME_USE_NVD=0
-
Use the nda(4) driver to provide a disk device instead of the default nvd(4). The nvd(4) driver performs better with smaller transactions and few TRIM commands. It sends all commands directly to the drive immediately. The nda(4) driver performs better with larger transactions and also collapses TRIM commands giving better performance. It can queue commands to the drive; combine BIO_DELETE commands into a single trip; and use the CAM I/O scheduler to bias one type of operation over another.
This value can also be set at boot time with the hw.nvme.use_nvd=0 tunable.
LOADER TUNABLES
The following settings can be configured in loader.conf(5) or at the boot loader(8) prompt during runtime:
- hw.nvme.per_cpu_io_queues=0
-
Force a single I/O queue pair shared by all CPUs. By default, nvme will create an I/O queue pair for each CPU, provided enough MSI-X vectors and NVMe queue pairs can be allocated. If not enough vectors or queue pairs are available, nvme(4) will use a smaller number of queue pairs and assign multiple CPUs per queue pair.
- hw.nvme.min_cpus_per_ioq=X
-
Assign more than one CPU per I/O queue pair, thereby reducing the number of MSI-X vectors consumed by the device.
- hw.nvme.force_intx=1
-
Force legacy interrupts for all nvme driver instances. Note that use of INTx implies disabling of per-CPU I/O queue pairs.
- hw.nvme.hmb_max
-
Control maximum amount of system RAM in bytes to use as Host Memory Buffer for capable devices. The default value is 5% of physical memory size per device.
- hw.nvme.apst_enable=1
-
Enable Autonomous Power State Transition (APST).
- hw.nvme.apst_data
-
Override default APST settings. If unset, the default vendor-provided settings, if any, will be applied. The string must contain up to 32 encoded integers, e.g. “0x6418 0 0 0x3e820”. Each value corresponds to a specific available power state starting from the lowest, and defines the target state (bits 3..7) to transition to, as well as the idle time in milliseconds (bits 8..31) to wait before that transition. Bits 0..2 must be zero.
- hw.nvme.use_nvd=0
-
The nvd(4) driver is used to provide a disk driver to the system by default. The nda(4) driver can also be used instead.
This value may also be set in the kernel config file with options NVME_USE_NVD=0.
- hw.nvme.verbose_cmd_dump=1
-
Enable verbose error messages. When there is an error, nvme prints only the most relevant information about the command by default.
SYSCTL VARIABLES
The following controller-level sysctls are currently implemented:
- dev.nvme.0.num_cpus_per_ioq
-
(R) Number of CPUs associated with each I/O queue pair.
- dev.nvme.0.int_coal_time
-
(R/W) Interrupt coalescing timer period in microseconds. Set to 0 to disable.
- dev.nvme.0.int_coal_threshold
-
(R/W) Interrupt coalescing threshold in number of command completions. Set to 0 to disable.
The following queue pair-level sysctls are currently implemented. Admin queue sysctls take the format of dev.nvme.0.adminq and I/O queue sysctls take the format of dev.nvme.0.ioq0.
- dev.nvme.0.ioq0.num_entries
-
(R) Number of entries in this queue pair's command and completion queue.
- dev.nvme.0.ioq0.num_tr
-
(R) Number of nvme_tracker structures currently allocated for this queue pair.
- dev.nvme.0.ioq0.num_prp_list
-
(R) Number of nvme_prp_list structures currently allocated for this queue pair.
- dev.nvme.0.ioq0.sq_head
-
(R) Current location of the submission queue head pointer as observed by the driver. The head pointer is incremented by the controller as it takes commands off of the submission queue.
- dev.nvme.0.ioq0.sq_tail
-
(R) Current location of the submission queue tail pointer as observed by the driver. The driver increments the tail pointer after writing a command into the submission queue to signal that a new command is ready to be processed.
- dev.nvme.0.ioq0.cq_head
-
(R) Current location of the completion queue head pointer as observed by the driver. The driver increments the head pointer after finishing with a completion entry that was posted by the controller.
- dev.nvme.0.ioq0.num_cmds
-
(R) Number of commands that have been submitted on this queue pair.
- dev.nvme.0.ioq0.dump_debug
-
(W) Writing 1 to this sysctl will dump the full contents of the submission and completion queues to the console.
In addition to the typical pci attachment, the nvme driver supports attaching to a ahci(4) device. Intel's Rapid Storage Technology (RST) hides the nvme device behind the AHCI device due to limitations in Windows. However, this effectively hides it from the FreeBSD kernel. To work around this limitation, FreeBSD detects that the AHCI device supports RST and when it is enabled. See ahci(4) for more details.
DIAGNOSTICS
- nvme%d: System interrupt issues?
-
The driver found a timed-out transaction had a pending completion record, indicating an interrupt had not been delivered. The system is either not configuring interrupts properly, or the system drops them under load. This message will appear at most once per boot per controller.
SEE ALSO
HISTORY
The nvme driver first appeared in FreeBSD 9.2.
AUTHORS
The nvme driver was developed by Intel and originally written by Jim Harris ⟨[email protected]⟩, with contributions from Joe Golio at EMC.
This man page was written by Jim Harris ⟨[email protected]⟩.