aboutsummaryrefslogtreecommitdiff
path: root/sys/dev/nvd
Commit message (Collapse)AuthorAgeFilesLines
* nvme: remove now-redundant consumer interfaceWarner Losh2025-12-101-2/+0
| | | | | | | | Now that we've moved to newbus methods, we can delete this... Sponsored by: Netflix Reviewed by: dab Differential Revision: https://reviews.freebsd.org/D54095
* nvd: Connect nvme_if methodsWarner Losh2025-12-101-102/+135
| | | | | | | | Conenct methods to manage namespaces explicitly to replace the old consumer interface. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D51388
* nvd: Attach as a child of nvmeWarner Losh2025-12-101-37/+73
| | | | | | | | | | | Rather than registering as a consumer of the nvme controller, hook into the child device and use that. This is a small regression at the moment: we don't fail the device when that happens at runtime. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D51385
* nvme: Rename NVME_NS_ADDED to NVME_NS_ALIVE and _CHANGED to _DELTAWarner Losh2025-12-051-1/+1
| | | | | | | NVME_NS_ADDED will conflict with a later change, so change it here. Likewise NVME_NS_CHANGED. Sponsored by: Netflix
* nvd: handle namespace changesWanpeng Qian2025-11-181-1/+44
| | | | | | | Signal the new media size when the namespace changes size. Reviewed by: imp Differential Revision: https://reviews.freebsd.org/D33032
* sys: Automated cleanup of cdefs and other formattingWarner Losh2023-11-271-1/+0
| | | | | | | | | | | | | | | | Apply the following automated changes to try to eliminate no-longer-needed sys/cdefs.h includes as well as now-empty blank lines in a row. Remove /^#if.*\n#endif.*\n#include\s+<sys/cdefs.h>.*\n/ Remove /\n+#include\s+<sys/cdefs.h>.*\n+#if.*\n#endif.*\n+/ Remove /\n+#if.*\n#endif.*\n+/ Remove /^#if.*\n#endif.*\n/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/types.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/param.h>/ Remove /\n+#include\s+<sys/cdefs.h>\n#include\s+<sys/capsicum.h>/ Sponsored by: Netflix
* Add interface NVME to devstatAlexander Motin2023-11-161-0/+5
| | | | | This allows to list only NVMe devices in systat, iostat, vmstat, etc. Previously those were counted as OTHER.
* sys: Remove $FreeBSD$: one-line .c patternWarner Losh2023-08-161-2/+0
| | | | Remove /^[\s*]*__FBSDID\("\$FreeBSD\$"\);?\s*\n/
* spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSDWarner Losh2023-05-121-1/+1
| | | | | | | | | The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch up to that fact and revert to their recommended match of BSD-2-Clause. Discussed with: pfg MFC After: 3 days Sponsored by: Netflix
* Adjust nvd_{load,unload}() definitions to avoid clang 15 warningsDimitry Andric2022-07-201-2/+2
| | | | | | | | | | | | | | | | | | | With clang 15, the following -Werror warnings are produced: sys/dev/nvd/nvd.c:150:9: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes] nvd_load() ^ void sys/dev/nvd/nvd.c:166:11: error: a function declaration without a prototype is deprecated in all versions of C [-Werror,-Wstrict-prototypes] nvd_unload() ^ void This is because nvd_load() and nvd_unload() are declared with a (void) argument list, but defined with an empty argument list. Make the definitions match the declarations. MFC after: 3 days
* kerneldump: remove physical argument from d_dumperMitchell Horne2022-05-131-1/+1
| | | | | | | | | | | The physical address argument is essentially ignored by every dumper method. In addition, the dump routines don't actually pass a real address; every call to dump_append() passes a value of zero for physical. Reviewed by: markj MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D35173
* nvd: For AHCI attached devices, report ahci bridgeWarner Losh2021-12-061-0/+7
| | | | | | | | | | | | When an NVME device is attached via a AHCI controller, we have no access to its config space. So instead of information about the nvme drive itself, return info about the AHCI controller as the next best thing. Since the Intel Hardware RAID support looks at these values, this likely is best. Sponsored by: Netflix Reviewed by: mav Differential Revision: https://reviews.freebsd.org/D33286
* nvd: clean up empty lines in .c and .h filesMateusz Guzik2020-09-011-1/+0
| | | | Notes: svn path=/head/; revision=365190
* Report attachment for nvd same as reported for nda.Alexander Motin2020-08-121-2/+13
| | | | | | | MFC after: 1 week Notes: svn path=/head/; revision=364177
* Mark more nodes as CTLFLAG_MPSAFE or CTLFLAG_NEEDGIANT (17 of many)Pawel Biernacki2020-02-261-1/+2
| | | | | | | | | | | | | | | | | | | r357614 added CTLFLAG_NEEDGIANT to make it easier to find nodes that are still not MPSAFE (or already are but aren’t properly marked). Use it in preparation for a general review of all nodes. This is non-functional change that adds annotations to SYSCTL_NODE and SYSCTL_PROC nodes using one of the soon-to-be-required flags. Mark all obvious cases as MPSAFE. All entries that haven't been marked as MPSAFE before are by default marked as NEEDGIANT Approved by: kib (mentor, blanket) Commented by: kib, gallatin, melifaro Differential Revision: https://reviews.freebsd.org/D23718 Notes: svn path=/head/; revision=358333
* Add missing break statements in r351004.Alexander Motin2019-08-141-2/+6
| | | | | | | | | Surprisingly code still worked, but thanks imp@ for noticing it. MFC after: 1 week Notes: svn path=/head/; revision=351006
* Make nvd(4) report NGUID or EUI64 as GEOM::lunid.Alexander Motin2019-08-131-0/+43
| | | | | | | | | | | With support for multiple namespaces and multiple ports in NVMe there is now a need for reliable unique namespace identification alike to SCSI. MFC after: 1 weeks Sponsored by: iXsystems, Inc. Notes: svn path=/head/; revision=351004
* Missed part of r350523.Alexander Motin2019-08-121-8/+3
| | | | | | | MFC after: 3 days Notes: svn path=/head/; revision=350961
* Fix GCC build, failed due to false integer overflow in r343562.Alexander Motin2019-01-291-1/+1
| | | | | | | MFC after: 2 weeks Notes: svn path=/head/; revision=343563
* Reimplement BIO_ORDERED handling in nvd(4).Alexander Motin2019-01-291-41/+53
| | | | | | | | | | | | | | | | | | | | | This fixes BIO_ORDERED semantics while also improving performance by: - sleeping also before BIO_ORDERED bio, as defined, not only after; - not queueing BIO_ORDERED bio to taskqueue if no other bios running; - waking up sleeping taskqueue explicitly rather then rely on polling. On Samsung SSD 970 PRO this shows sync write latency, measured with `diskinfo -wS`, reduction from ~2ms to ~1.1ms by not sleeping without reason till next HZ tick. On the same device ZFS pool with 8 ZVOLs synchronously writing 4KB blocks shows ~950 IOPS instead of ~750 IOPS before. I suspect ZFS does not need BIO_ORDERED on BIO_FLUSH at all, but that will be next question. MFC after: 2 weeks Sponsored by: iXsystems, Inc. Notes: svn path=/head/; revision=343562
* Fix incorrectly inserted copyright in r342557.Alexander Motin2018-12-271-1/+1
| | | | | | | | Reported by: rgrimes MFC after: 1 month Notes: svn path=/head/; revision=342559
* Reimplement nvd(4) detach handling.Alexander Motin2018-12-271-89/+98
| | | | | | | | | | | | | | | Previous code typically crashed in case of NVMe device unplug or even clean detach while some I/Os are still in flight. To fix this the new code calls disk_gone() and waits for confirmation of all references gone before calling disk_destroy(), freeing other resources and allowing controller detach. While there, fix disk lists locking and reimplement unit numbers assignment. MFC after: 1 month Sponsored by: iXsystems, Inc. Notes: svn path=/head/; revision=342557
* sys/dev: further adoption of SPDX licensing ID tags.Pedro F. Giffuni2017-11-271-0/+2
| | | | | | | | | | | | | | | Mainly focus on files that use BSD 2-Clause license, however the tool I was using misidentified many licenses so this was mostly a manual - error prone - task. The Software Package Data Exchange (SPDX) group provides a specification to make it easier for automated tools to detect and summarize well known opensource licenses. We are gradually adopting the specification, noting that the tags are considered only advisory and do not, in any way, superceed or replace the license texts. Notes: svn path=/head/; revision=326255
* Make nvd vs nda choice boot-time rather than build-timeWarner Losh2017-08-041-0/+5
| | | | | | | | | | | | Introduce hw.nvme.use_nvd tunable. This tunable allows both nvd and nda to be installed in the kernel, while allowing only one of them to create devices. This is an all-or-nothing setting, and you can't change it after boot-time. However, it will allow easier A/B testing. Differential Revision: https://reviews.freebsd.org/D11825 Notes: svn path=/head/; revision=322036
* Report random flash storage as non-rotating to GEOM_DISK.Alexander Motin2017-01-121-4/+2
| | | | | | | | | While doing it, introduce respective constants in geom_disk.h. MFC after: 1 week Notes: svn path=/head/; revision=311971
* Remove unused variable from last commit.Scott Long2016-07-191-1/+0
| | | | Notes: svn path=/head/; revision=303042
* Supporting flushing the dump before returning, and simplify/combine theScott Long2016-07-191-8/+1
| | | | | | | | | | | | logic. Switch to a 5us delay since most NVME devices can easily do 200,000 iops. Submitted by: imp MFC after: 3 days Sponsored by: Netflix, Inc. Notes: svn path=/head/; revision=303040
* Implement crashdump support on NVMEScott Long2016-07-191-0/+22
| | | | | | | | MFC after: 3 days Sponsored by: Netflix, Inc. Notes: svn path=/head/; revision=303017
* Revert r292074 (by smh): Limit stripesize reported from nvd(4) to 4KAlexander Motin2016-03-101-1/+1
| | | | | | | | | | | | | | I believe that this patch handled the problem from the wrong side. Instead of making ZFS properly handle large stripe sizes, it made unrelated driver to lie in reported parameters to workaround that. Alternative solution for this problem from ZFS side was committed at r296615. Discussed with: smh Notes: svn path=/head/; revision=296617
* nvd: add hw.nvd.delete_max tunableJim Harris2016-01-281-1/+17
| | | | | | | | | | | | | | | | | | The NVMe specification does not define a maximum or optimal delete size, so technically max delete size is min(full size of namespace, 2^32 - 1 LBAs). A single delete operation for a multi-TB NVMe namespace though may take much longer to complete than the nvme(4) I/O timeout period. So choose a sensible default here that is still suitably large to minimize the number of overall delete operations. This also fixes possible uint32_t overflow on initial TRIM operation for zpool create operations for NVMe namespaces with >4G LBAs. MFC after: 3 days Sponsored by: Intel Notes: svn path=/head/; revision=295022
* nvd: submit bios directly when BIO_ORDERED not set or in flightJim Harris2016-01-071-0/+18
| | | | | | | | | | | | | This significantly improves parallelism in the most common case. The taskqueue is still used whenever BIO_ORDERED bios are in flight. This patch is based heavily on a patch from gallatin@. MFC after: 3 days Sponsored by: Intel Notes: svn path=/head/; revision=293323
* nvd: break out submission logic into separate functionJim Harris2016-01-071-12/+23
| | | | | | | | | | | This enables a future patch using this same logic to submit I/O directly bypassing the taskqueue. MFC after: 3 days Sponsored by: Intel Notes: svn path=/head/; revision=293322
* nvd: skip BIO_ORDERED logic when bio fails submissionJim Harris2016-01-071-0/+1
| | | | | | | | | | | | This ensures the bio flags are not read after biodone(). The ordering will still be enforced, after the bio is submitted successfully. MFC after: 3 days Sponsored by: Intel Notes: svn path=/head/; revision=293321
* nvd: do not wait for previous bios before submitting ordered bioJim Harris2016-01-071-13/+0
| | | | | | | | | | | Still wait until all in-flight bios (including the ordered bio) complete before processing more bios from the queue. MFC after: 3 days Sponsored by: Intel Notes: svn path=/head/; revision=293320
* nvd: set DISKFLAG_DIRECT_COMPLETIONJim Harris2016-01-071-1/+1
| | | | | | | | Submitted by: gallatin MFC after: 3 days Notes: svn path=/head/; revision=293319
* Limit stripesize reported from nvd(4) to 4KSteven Hartland2015-12-111-1/+1
| | | | | | | | | | | | | | | Intel NVMe controllers have a slow path for I/Os that span a 128KB stripe boundary but ZFS limits ashift, which is derived from d_stripesize, to 13 (8KB) so we limit the stripesize reported to geom(8) to 4KB. This may result in a small number of additional I/Os to require splitting in nvme(4), however the NVMe I/O path is very efficient so these additional I/Os will cause very minimal (if any) difference in performance or CPU utilisation. This can be controller by the new sysctl kern.nvme.max_optimal_sectorsize. MFC after: 1 week Sponsored by: Multiplay Differential Revision: https://reviews.freebsd.org/D4446 Notes: svn path=/head/; revision=292074
* nvd, nvme: report stripesize through GEOM disk layerJim Harris2015-10-301-0/+1
| | | | | | | | MFC after: 3 days Sponsored by: Intel Notes: svn path=/head/; revision=290199
* nvd: set d_delmaxsize to full capacity of NVMe namespaceJim Harris2015-07-211-0/+1
| | | | | | | | | | | | | | | | | | | The NVMe specification has no ability to specify a maximum delete size that is less than the full capacity of the namespace - so just using the namespace size is the correct value here. This fixes reported issues where ZFS trim on init looked like it was hanging the system - previously the default I/O max size (128KB on Intel NVMe controllers) was used for delete operations which worked out to only about 8MB/s. With this patch I can add an 800GB DC P3700 drive to a ZFS pool in about 15-20 seconds. Reported by: Dylan Just <dylan@techtangents.com> MFC after: 3 days Sponsored by: Intel Notes: svn path=/head/; revision=285767
* Add driver-assisted striping for upcoming Intel NVMe controllers that canJim Harris2013-10-081-11/+0
| | | | | | | | | | | | benefit from it. Sponsored by: Intel Reviewed by: kib (earlier version), carl Approved by: re (hrs) MFC after: 1 week Notes: svn path=/head/; revision=256151
* Add message when nvd disks are attached and detached.Jim Harris2013-07-191-8/+29
| | | | | | | | | | | | | | | As part of this commit, add an nvme_strvis() function which borrows heavily from cam_strvis(). This will allow stripping of leading/trailing whitespace and also handle unprintable characters in model/serial numbers. This function goes into a new nvme_util.c file which is used by both the driver and nvmecontrol. Sponsored by: Intel Reviewed by: carl MFC after: 3 days Notes: svn path=/head/; revision=253476
* Do not call disk_create() until we have completed all initialization of ourJim Harris2013-07-191-2/+2
| | | | | | | | | | | internal disk structure. Sponsored by: Intel Reviewed by: carl MFC after: 3 days Notes: svn path=/head/; revision=253473
* Define constants for the lengths of the serial number, model numberJim Harris2013-07-171-2/+6
| | | | | | | | | | | | | | and firmware revision in the controller's identify structure. Also modify consumers of these fields to ensure they only use the specified number of bytes for their respective fields. Sponsored by: Intel Reviewed by: carl MFC after: 3 days Notes: svn path=/head/; revision=253437
* Update copyright dates.Jim Harris2013-07-091-1/+1
| | | | | | | MFC after: 3 days Notes: svn path=/head/; revision=253112
* Add unmapped bio support to nvme(4) and nvd(4).Jim Harris2013-04-011-0/+5
| | | | | | | Sponsored by: Intel Notes: svn path=/head/; revision=248977
* Change a number of malloc(9) calls to use M_WAITOK instead ofJim Harris2013-03-261-2/+2
| | | | | | | | | | | M_NOWAIT. Sponsored by: Intel Suggested by: carl Reviewed by: carl Notes: svn path=/head/; revision=248770
* Add the ability to internally mark a controller as failed, if it is unable toJim Harris2013-03-261-1/+21
| | | | | | | | | | | | | | | | | | start or reset. Also add a notifier for NVMe consumers for controller fail conditions and plumb this notifier for nvd(4) to destroy the associated GEOM disks when a failure occurs. This requires a bit of work to cover the races when a consumer is sending I/O requests to a controller that is transitioning to the failed state. To help cover this condition, add a task to defer completion of I/Os submitted to a failed controller, so that the consumer will still always receive its completions in a different context than the submission. Sponsored by: Intel Reviewed by: carl Notes: svn path=/head/; revision=248767
* Have nvd(4) register for controller notifications.Jim Harris2013-03-261-17/+54
| | | | | | | | | | Also have nvd maintain controller/namespace relationships internally. Sponsored by: Intel Reviewed by: carl Notes: svn path=/head/; revision=248765
* Create struct nvme_status.Jim Harris2013-03-261-2/+2
| | | | | | | | | | | | | | | | | NVMe error log entries include status, so breaking this out into its own data structure allows it to be included in both the nvme_completion data structure as well as error log entry data structures. While here, expose nvme_completion_is_error(), and change all of the places that were explicitly looking at sc/sct bits to use this macro instead. Sponsored by: Intel Reviewed by: carl Notes: svn path=/head/; revision=248756
* Add an interface for nvme shim drivers (i.e. nvd) to register forJim Harris2013-03-261-4/+6
| | | | | | | | | notifications when new nvme controllers are added to the system. Sponsored by: Intel Notes: svn path=/head/; revision=248738
* Add ability to queue nvme_request objects if no nvme_trackers are available.Jim Harris2012-10-181-19/+3
| | | | | | | | | | | | This eliminates the need to manage queue depth at the nvd(4) level for Chatham prototype board workarounds, and also adds the ability to accept a number of requests on a single qpair that is much larger than the number of trackers allocated. Sponsored by: Intel Notes: svn path=/head/; revision=241665