summaryrefslogtreecommitdiffstats
path: root/sys/dev/nvme/nvme_sysctl.c
diff options
context:
space:
mode:
authorjimharris <jimharris@FreeBSD.org>2016-01-07 20:32:04 +0000
committerjimharris <jimharris@FreeBSD.org>2016-01-07 20:32:04 +0000
commit94f3dfd067c77fbbb987f93fa707eedd0b2ec324 (patch)
tree1bee2433928863fd257357674f06adc088f31cb2 /sys/dev/nvme/nvme_sysctl.c
parentb96b9a614879f9b489f3d73361c78e28b696e184 (diff)
downloadFreeBSD-src-94f3dfd067c77fbbb987f93fa707eedd0b2ec324.zip
FreeBSD-src-94f3dfd067c77fbbb987f93fa707eedd0b2ec324.tar.gz
nvme: add hw.nvme.min_cpus_per_ioq tunable
Due to FreeBSD system-wide limits on number of MSI-X vectors (https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=199321), it may be desirable to allocate fewer than the maximum number of vectors for an NVMe device, in order to save vectors for other devices (usually Ethernet) that can take better advantage of them and may be probed after NVMe. This tunable is expressed in terms of minimum number of CPUs per I/O queue instead of max number of queues per controller, to allow for a more even distribution of CPUs per queue. This avoids cases where some number of CPUs have a dedicated queue, but other CPUs need to share queues. Ideally the PR referenced above will eventually be fixed and the mechanism implemented here becomes obsolete anyways. While here, fix a bug in the CPUs per I/O queue calculation to properly account for the admin queue's MSI-X vector. Reviewed by: gallatin MFC after: 3 days Sponsored by: Intel
Diffstat (limited to 'sys/dev/nvme/nvme_sysctl.c')
-rw-r--r--sys/dev/nvme/nvme_sysctl.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/sys/dev/nvme/nvme_sysctl.c b/sys/dev/nvme/nvme_sysctl.c
index 8b99111..08cd15e 100644
--- a/sys/dev/nvme/nvme_sysctl.c
+++ b/sys/dev/nvme/nvme_sysctl.c
@@ -1,5 +1,5 @@
/*-
- * Copyright (C) 2012-2013 Intel Corporation
+ * Copyright (C) 2012-2016 Intel Corporation
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -267,6 +267,10 @@ nvme_sysctl_initialize_ctrlr(struct nvme_controller *ctrlr)
ctrlr_tree = device_get_sysctl_tree(ctrlr->dev);
ctrlr_list = SYSCTL_CHILDREN(ctrlr_tree);
+ SYSCTL_ADD_UINT(ctrlr_ctx, ctrlr_list, OID_AUTO, "num_cpus_per_ioq",
+ CTLFLAG_RD, &ctrlr->num_cpus_per_ioq, 0,
+ "Number of CPUs assigned per I/O queue pair");
+
SYSCTL_ADD_PROC(ctrlr_ctx, ctrlr_list, OID_AUTO,
"int_coal_time", CTLTYPE_UINT | CTLFLAG_RW, ctrlr, 0,
nvme_sysctl_int_coal_time, "IU",
OpenPOWER on IntegriCloud