aboutsummaryrefslogtreecommitdiffstats
path: root/sys/cam/nvme/nvme_da.c
Commit message (Collapse)AuthorAgeFilesLines
* MFS r366179: Make nvmecontrol work with nda like it does with nvd, andColin Percival2020-09-281-3/+90
| | | | | | | | | | associated bits. Approved by: re (delphij) Sponsored by: https://www.patreon.com/cperciva Notes: svn path=/releng/12.2/; revision=366213
* MFC r364178: Report proper stripesize for nda(4).Alexander Motin2020-08-201-1/+5
| | | | | | | Same as for nvd(4) report NPWG if present, otherise NOIOB. Notes: svn path=/stable/12/; revision=364413
* MFC r359129:David Bright2020-03-231-2/+2
| | | | | | | | | | | | | | Fix parameter reversal potentially causing buffer overrun. Two arguments were reversed in calls to cam_strvis() in nvme_da.c. This was found by a Coverity scan of this code within Dell (Isilon). These are also marked in the FreeBSD Coverity scan as CIDs 1400526 & 1400531. Sponsored by: Dell EMC Isilon Notes: svn path=/stable/12/; revision=359236
* MFC r343755:Warner Losh2019-09-051-1/+1
| | | | | | | Regularize the Netflix copyright Notes: svn path=/stable/12/; revision=351913
* Revert r351902 ... it didn't properly exclude rack.c changesWarner Losh2019-09-051-1/+1
| | | | Notes: svn path=/stable/12/; revision=351912
* MFC r343755:Warner Losh2019-09-051-1/+1
| | | | | | | Regularize the Netflix copyright Notes: svn path=/stable/12/; revision=351902
* MFC r345817: Build NVMe CAM transport unrelated to NVMe SIM.Alexander Motin2019-08-081-6/+2
| | | | | | | | Before this I suppose it was impossible load CAM-based NVMe as module. Plus this appeared to be needed to build r345815 without NVMe driver. Notes: svn path=/stable/12/; revision=350716
* MFC r342046: nda(4) fix check for Dataset Management supportChuck Tuffli2019-01-041-1/+1
| | | | | | | | | | Reported by: yuripv@yuripv.net Reviewed by: imp Approved by: imp (mentor) Differential Revision: https://reviews.freebsd.org/D18746 Notes: svn path=/stable/12/; revision=342777
* Walk back r337554 while discussion continuesConrad Meyer2018-08-101-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | The idea was to get the uncontroversial mechanical change out of the way, then get the meatier functional changes reviewed subsequently. I had not realized that the immediately adjacent issue was addressed in a different direction in r334506 (see Warner's guidance in D15592). Discussion continues, trying to determine if there is a secondary issue still[1] and how best to fix it. With 12-related activities coming up, while that is ongoing, just take this back for now. [1]: Shutdown-time eventhandler events fire normally during panic's reboot path. Driver callbacks that attempt to issue and wait on interrupt- completed IO may never complete, hanging the system. This is particularly obnoxious in the shutdown/panic path, as the debugger cannot be entered anymore and the hang prevents reboot restoring availability. (There's nothing CAM-specific about this problem -- any shutdown event-triggered driver could do something like this during panic. But most NICs, etc. don't try to send spin-down commands at shutdown. ;-)) Discussed with: imp, markj Notes: svn path=/head/; revision=337583
* cam(4): Add an xpt-neutral flag indicating a valid panic CCBConrad Meyer2018-08-091-0/+2
| | | | | | | | | | | | | | | No functional change. Note that this change is careful to set the CCB header xflags after foo_fill_bar() routines, which generally zero existing flags. An earlier version of this patch mistakenly set the flag before the fill routines. Submitted by: Scott Ferris <sferris AT isilon.com>, jhibbits@ Reviewed by: bdrewery@, markj@, and non-committer FreeBSD contributor Anton Rang Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=337554
* We can't release the refcount outside of the periph lock.Warner Losh2018-05-241-6/+5
| | | | | | | | | | | | We're dropping the periph lock then dropping the refcount. However, that violates the locking protocol and is racy. This seems to be the cause of weird occasional panics with a bogus assert. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D15517 Notes: svn path=/head/; revision=334166
* Hold the reference count until the CCB is releasedWarner Losh2018-05-151-1/+5
| | | | | | | | | | | | | | | When a disk disappears and the periph is invalidated, any I/Os that are pending with the controller can cause a crash when they complete. Move to holding the softc reference count taken in dastart() until the I/O is complete rather than only until xpt_action() returns. (This approach was suggested by Ken Merry.) This extends the method used in da to ada, nda, and mda. Sponsored by: Netflix Submitted by: Chuck Silvers Notes: svn path=/head/; revision=333651
* Remove the 'All Rights Reserved' clause from some of the stuff I'veWarner Losh2018-05-091-1/+0
| | | | | | | done for Netflix, since I'm in the neighborhood. Notes: svn path=/head/; revision=333434
* Kill assert I shouldn't have committedWarner Losh2018-03-201-2/+0
| | | | Notes: svn path=/head/; revision=331240
* Starting LBA is a 64bit number, so use htole64 instead of htole32. TheWarner Losh2018-03-201-2/+4
| | | | | | | | | | | | | | latter casts the LBA to a 32-bit number before assigning it to the 64 bit structure entity. This works fine on the first 2TB of TRIMs, but terrible beyond that due to trucation. Also, add an assert to make sure we don't end too many DSM TRIM entries in one request. Sponsored by: Netflix Notes: svn path=/head/; revision=331239
* Make kern.cam.nda.num_trim tunable to limit the number of BIO_DELETEWarner Losh2018-03-201-3/+6
| | | | | | | | | | requests that we'll collapse into one DSM_TRIM. By default it is a 256, which is the max that will fit into a 4k page. Sponsored by: Netflix Notes: svn path=/head/; revision=331238
* Remove some redundant MPSAFE flags.Warner Losh2018-03-201-18/+13
| | | | | | | | | | This was pointed out in a code review I'm having trouble finding right now, but go ahead and eliminate these. Sponsored by: Netfix Notes: svn path=/head/; revision=331237
* Create a sysctl kern.cam.{,a,n}da.X.invalidateWarner Losh2018-03-141-1/+14
| | | | | | | | | | | | | | | | | | | kern.cam.{,a,n}da.X.invalidate=1 forces *daX to detach by calling cam_periph_invalidate on the underlying periph. This is for testing purposes only. Include only with options CAM_TEST_FAILURE and rename the former [AN]DA_TEST_FAILURE, and fix nda to compile with it set. We're using it at work to harden geom and the buffer cache to be resilient in the face of drive failure. Today, it far too often results in a panic. While much work was done on SIM initiated removal for the USB thumnb drive removal work, little has been done for periph initiated removal. This simulates what *daerror() does for some errors nicely: we get the same panics with it that we do with failing drives. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D14581 Notes: svn path=/head/; revision=330935
* Implement trim collapsing in ndaWarner Losh2018-03-141-66/+112
| | | | | | | | | | | | When multiple trims are in the queue, collapse them as much as possible. At present, this usually results in only a few trims being collapsed together, but more work on that will make it possible to do hundreds (up to some configurable max). Sponsored by: Netflix Notes: svn path=/head/; revision=330932
* nvme_da: Fix minor memory leak in error caseConrad Meyer2018-03-101-0/+1
| | | | | | | | Reported by: cppcheck Sponsored by: Dell EMC Isilon Notes: svn path=/head/; revision=330717
* NVMe: Add big-endian supportWojciech Macek2018-02-221-4/+11
| | | | | | | | | | | | | | | | Remove bitfields from defined structures as they are not portable. Instead use shift and mask macros in the driver and nvmecontrol application. NVMe is now working on powerpc64 host. Submitted by: Michal Stanek <mst@semihalf.com> Obtained from: Semihalf Reviewed by: imp, wma Sponsored by: IBM, QCM Technologies Differential revision: https://reviews.freebsd.org/D13916 Notes: svn path=/head/; revision=329824
* Backout r329818, r329816 and r329815.Warner Losh2018-02-221-48/+23
| | | | | | | | These aren't the commits I thought I was testing prior to commit. Revert until I can sort out what happened and fix it. Notes: svn path=/head/; revision=329819
* Combine BIO_DELETE requests for nda devicesWarner Losh2018-02-221-22/+46
| | | | | | | | | | | | | | | | Now that we're queueing BIO_DELETE requests in the CAM I/O scheduler, it make sense to try to combine as many as possible into a single request to send down to hardware. Hopefully, lots of larger requests like this are better than lots of individual transactions. Note for future: need to limit based on total size of the trim request. Should also collapse adjacent ranges where possible to increase the size of the max payload. Sponsored by: Netflix Notes: svn path=/head/; revision=329816
* Introduce capacity flags for periphsWarner Losh2018-02-221-1/+2
| | | | | | | | | | | | | | | | | | | Introduce flags word to describe the capacities of the peripheral. First bit will describe if the periph driver allows multiple outstanding TRIMS to be active in a device. Modify the I/O scheduler so that the nda driver can queue trims for a while after the first one arrives. We'll queue until we see a I/O scheduler tick, then we'll schedule as many TRIMs as allowed by other factors (currently this is slocts in the NVMe controller). This mariginally helps the read latency issues we see with reads, but sets the stage for the nda driver to do TRIM collapsing like the da and ada drivers do today. Sponsored by: Netflix Notes: svn path=/head/; revision=329815
* Minor formatting nits.Warner Losh2018-02-211-11/+11
| | | | Notes: svn path=/head/; revision=329764
* Fix cut and pasted comments to reflect differences in code from theWarner Losh2018-02-071-4/+10
| | | | | | | | | original source. Sponsored by: Netflix Notes: svn path=/head/; revision=328983
* Return a C errno for cam_periph_acquire().Scott Long2018-02-061-3/+3
| | | | | | | | | | | | | | There's no compelling reason to return a cam_status type for this function and doing so only creates confusion with normal C coding practices. It's technically an API change, but the periph API isn't widely used. No efffective change to operation. Reviewed by: imp, mav, ken Sponsored by: Netflix Differential Revision: D14063 Notes: svn path=/head/; revision=328918
* Fix a sleepable malloc in ndastart. We shouldn't be sleepingWarner Losh2018-01-261-1/+7
| | | | | | | | | | | | | | here. Return ENOMEM when we can't malloc a buffer for the DSM TRIM. This should fix the WITNESS warnings similar to the following: uma_zalloc_arg: zone "16" with the following non-sleepable locks held: exclusive sleep mutex CAM device lock (CAM device lock) r = 0 (0xfffff800080c34d0) locked @ /usr/src/sys/cam/nvme/nvme_da.c:351 Reviewed by: scottl@ Sponsored by: Netflix Notes: svn path=/head/; revision=328452
* SPDX: finish tagging sys/cam.Pedro F. Giffuni2018-01-161-0/+2
| | | | Notes: svn path=/head/; revision=328070
* Don't hold the periph locks during dump.Scott Long2018-01-091-6/+1
| | | | | | | Obtained from: Netflix Notes: svn path=/head/; revision=327711
* Reduce size of several on-stack string buffers.Alexander Motin2017-12-131-1/+1
| | | | | | | | Submitted by: Dmitry Luhtionov <dmitryluhtionov@gmail.com> MFC after: 2 weeks Notes: svn path=/head/; revision=326835
* Define xpt_path_inq.Warner Losh2017-12-061-4/+1
| | | | | | | | | | | This provides a nice wrarpper around the XPT_PATH_INQ ccb creation and calling. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D13387 Notes: svn path=/head/; revision=326645
* Now that cam_periph_runccb() can be called from situations where theWarner Losh2017-12-061-16/+6
| | | | | | | | | | | kernel scheduler is stopped, replace the by hand calling of xpt_polled_action() with it. Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D13388 Notes: svn path=/head/; revision=326644
* Remove unused 4th argument to match the standard error routines.Warner Losh2017-12-061-3/+3
| | | | | | | | Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D13386 Notes: svn path=/head/; revision=326606
* nvd alias has caused some problems, revert it for the moment.Warner Losh2017-10-271-1/+1
| | | | | | | Sponsored by: Netflix Notes: svn path=/head/; revision=325040
* Closer examination shows that nvme and CAM both normally zero-fillWarner Losh2017-10-151-0/+2
| | | | | | | | | | | | | allocations (for req and ccb, which ultimately contain the nvme_cmd). As such, we can micro-optimize these routines. Add a comment to this effect, and bzero the ccb used to make the requests for the nda dump rotuine so it more closely matches a ccb allocated with xpt_get_ccb(). Sponsored by: Netflix Notes: svn path=/head/; revision=324644
* Be nicer on the dump stack by allocating only a ccb_nvmeio rather thanWarner Losh2017-10-151-15/+15
| | | | | | | | | | | a full ccb. This saves a few hundre bytes, which might be important during a crash dump... Sponsored by: Netflix Suggested by: scottl@ Notes: svn path=/head/; revision=324632
* Update comment to reflect actual default timeout.Warner Losh2017-10-151-4/+4
| | | | | | | Sponsored by: Netflix Notes: svn path=/head/; revision=324630
* Allow multiple TRIMs to be done for ndaWarner Losh2017-09-151-2/+11
| | | | | | | | | | | Don't call cam_iosched_trim_done or cam_iosched_submit_trim for nda since its hardware can handle almost an arbitrary number of TRIMs and we don't have to be careful to only ever do one. Sponsored by: Netflix Notes: svn path=/head/; revision=323625
* Fix NVMe's use of XPT_GDEV_TYPEWarner Losh2017-08-291-22/+3
| | | | | | | | | | | | | | | | | | | This patch changes the way XPT_GDEV_TYPE works for NVMe. The current ccb_getdev structure includes pointers to the NVMe Identify Controller and Namespace structures, but these are kernel virtual addresses which are not accessible from user space. As an alternative, the patch changes the pointers into padding in ccb_getdev and adds two new types to ccb_dev_advinfo to retrieve the Identify Controller (CDAI_TYPE_NVME_CNTRL) and Namespace (CDAI_TYPE_NVME_NS) data structures. Reviewed By: rpokala, imp Differential Revision: https://reviews.freebsd.org/D10466 Submitted by: Chuck Tuffli Notes: svn path=/head/; revision=322999
* Add CAM/NVMe support for CAM_DATA_SGWarner Losh2017-08-291-6/+1
| | | | | | | | | | | | | This adds support in pass(4) for data to be described with a scatter-gather list (sglist) to augment the existing (single) virtual address. Differential Revision: https://reviews.freebsd.org/D11361 Submitted by: Chuck Tuffli Reviewed by: imp@, scottl@, kenm@ Notes: svn path=/head/; revision=322997
* Add comment about where we need to place this routine, and why.Warner Losh2017-08-281-0/+6
| | | | | | | Sponsored by: Netflix Notes: svn path=/head/; revision=322977
* Add nvd alias to nda ndoes.Warner Losh2017-08-071-0/+4
| | | | | | | | | | | All ndaX and ndaXpY nodes will appear as nvdX and nvdXpY as well (through symlinks in devfs via the normal disk aliasing mechanism in GEOM). Differential Revision: https://reviews.freebsd.org/D11873 Notes: svn path=/head/; revision=322199
* Namespace is 32-bits, don't cast it to 16 hereWarner Losh2017-06-271-1/+1
| | | | Notes: svn path=/head/; revision=320412
* Report random flash storage as non-rotating to GEOM_DISK.Alexander Motin2017-01-121-1/+1
| | | | | | | | | While doing it, introduce respective constants in geom_disk.h. MFC after: 1 week Notes: svn path=/head/; revision=311971
* Add label annotations to CAM sysctls.Ed Schouten2016-12-141-2/+2
| | | | | | | | | | | | | | Under kern.cam we have certain sysctls that are per-device, such as the ones under kern.cam.ada.[0-9]+.*. Add a "device_index" label annotation to such sysctls, so that the Prometheus metrics exporter will give all of those metrics the same name. The device number will be added to the metric name as the "device_index" label. Reviewed by: cem Differential Revision: https://reviews.freebsd.org/D8775 Notes: svn path=/head/; revision=310052
* New NVMe front end (nda).Warner Losh2016-06-091-0/+1152
Notes: svn path=/head/; revision=301771