summaryrefslogtreecommitdiffstats
path: root/sys/cam
Commit message (Collapse)AuthorAgeFilesLines
* sys/cam: spelling fixes in comments.pfg2016-04-2915-26/+26
| | | | No functional change.
* sys/cam: spelling fixes.pfg2016-04-291-1/+1
| | | | | | Affects a debug message. MFC after: 2 weeks
* Small typos.pfg2016-04-281-2/+2
|
* cam: unsign some types to match their definitions and avoid overflows.pfg2016-04-272-10/+10
| | | | | | | | | | numpatterns is u_int. ctl: CTL_NUM_MODE_PAGES comes from sizeof(). In struct:ctl_scsiio, kern_sg_entries is uint32_t. MFC after: 2 weeks
* sys: extend use of the howmany() macro when available.pfg2016-04-262-8/+5
| | | | | We have a howmany() macro in the <sys/param.h> header that is convenient to re-use as it makes things easier to read.
* Yet more redundant parenthesis from r298431.pfg2016-04-211-3/+2
| | | | Mea culpa.
* sys: use our nitems() macro when param.h is available.pfg2016-04-217-40/+29
| | | | | | This should cover all the remaining cases in the kernel. Discussed in: freebsd-current
* Remove slightly used const values that can be replaced with nitems().pfg2016-04-213-14/+5
| | | | Suggested by: jhb
* Plug memory leak in ctl(4) when ctl_copyin_args() is called with a non-sbruno2016-04-191-0/+1
| | | | | | | | null terminated ASCII string. PR: 207626 Submitted by: cturt@hardenedbsd.org MFC after: 2 days
* Add the ability to read a SAS device's Target Port NAA designatorasomers2016-04-182-0/+14
| | | | | | | | | | | sys/cam/scsi/scsi_all.h sys/cam/scsi/scsi_all.c Add the scsi_devid_is_port_naa helper function Reviewed by: ken MFC after: 4 weeks Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D5975
* Fix tinderbox LINT build.delphij2016-04-181-1/+0
|
* Do the intmax_t dance for debug so CAM_NETFLIX_IOSCHED builds onimp2016-04-171-3/+3
| | | | | | i386. Sponsored by: Netflix, Inc
* Implement Auxiliary register. Add PIM_ATA_EXT flag to flag that a SIMimp2016-04-173-5/+7
| | | | | | | | | can handle it, and add the code to add it to the FIS that's sent to the drive. The mvs driver is the only other ATA driver in the system, and its hardware doesn't appear to support setting the Auxiliary register. Differential Revision: https://reviews.freebsd.org/D5598
* tag_action is not used at all in ata. It's set to 1 for orderedimp2016-04-174-14/+7
| | | | | | | | | | | | | transactions, but that value isn't used. It's bogusly used to report in devstat, due to a cut and paste error from SCSI. Mark it as unused in cam_fill_ataio. Reclaim the memory as a new ata_flags. In addition, tag_id and init_id are completely unused, so reclaim those as 'unused' now too. These were needlessly copied when ata was split from scsi. This allows us, in the future, to create structures that can communicate AUXILIARY regsiter to the SIMs, which cannot be done now. Differential Revision: https://reviews.freebsd.org/D5598
* Dell has an OEM drive from Samsung that has issues. NCQ Trim isn'timp2016-04-171-0/+9
| | | | | | broken on this drive, but it doesn't support it and the fallback logic is failing. Quirk it until those issues can be resolved in a more generic way.
* Expand CAM_IO_STATS #ifdef to logical unit.imp2016-04-152-8/+4
|
* Put function only used by CAM_NETFLIX_IOSCHED under that ifdef.imp2016-04-151-0/+4
|
* Out of an abundance of caution treatimp2016-04-151-3/+11
| | | | | | | | | | | | * Samsung 843T Series SSDs (MZ7WD*) * Samsung PM851 Series SSDs (MZ7TE*) * Samsung PM853T Series SSDs (MZ7GE*) as known having broken NCQ TRIM support as they appear to be based on the same controller technology as the 840 and 850 series. I've had at least one report of the PM853 being broken, so err on the side of caution for the above drives. The PM863/SM863 appears to be based on a newer controller, so give it the benefit of the doubt.
* Add FCCT M500 to the NCQ black list. Linux added it in 4.2 (Augustimp2016-04-151-5/+13
| | | | | | | | | | | | | | | 2015). Correct the M500 firmware versions. EU07 was the engineering test version, not the release version with the fix. MU07 is the release version. It's the only Micron firmware version to actually work. Remove support for EU07. This brings the blacklist into parity with the Linux blacklist as of 4.5, except for the Micron M500 MU07 entry. I personally tested the MU07 firmware on 12 machines running 6 drives each with no corruption in the past 6 months with Netflix production loads. Prior versions of the M500 firmware wouldn't last more than a few days. Sponsored by: Netflix, Inc.
* Use the new TUNABLE_INT64 to match the type of sbintime_t.imp2016-04-151-1/+1
|
* Fix typos (intenral -> internal) in commentsngie2016-04-151-1/+1
|
* Add a comment about why the timeout for flush was lowered to 5s.imp2016-04-141-0/+5
|
* Add in missing files from r298002.imp2016-04-142-0/+1663
|
* Add a devctl/devd notification conduit for CAM errors that happen at thescottl2016-04-141-2/+100
| | | | | | | | | | | | | | | | | | | | periph level. When a relevant error is reported to the periph, some amplifying information is gathered, and the error and information are fed to devctl with the attributes / keys system=CAM, subsystem=periph. The 'type' key will be either 'error' or 'timeout', and based on this, various other keys are also populated. The purpose of this is to provide a concise mechanism for error reporting that is less noisy than the system console but higher in resolution and fidelity than simple sysctl counters. We will be using it at Netflix to populate a structured log and database to track errors and error trends across our world-wide population of drives. Submitted by: imp, scottl Approved by: kenm MFC after: 3 days Sponsored by: Netflix Differential Revision: D5943
* New CAM I/O scheduler for FreeBSD. The default I/O scheduler is the sameimp2016-04-145-168/+597
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | as before. The common scheduling bits have moved from inline code in each of the CAM periph drivers into a library that implements the default scheduling. In addition, a number of rate-limiting and I/O preference options can be enabled by adding CAM_IOSCHED_NETFLIX to your config file. A number of extra stats are also maintained. CAM_IOSCHED_NETFLIX isn't on by default because it uses a separate BIO_READ and BIO_WRITE queue, so doesn't honor BIO_ORDERED between these two types of operations. We already didn't honor it for BIO_DELETE, and we don't depend on BIO_ORDERED between reads and writes anywhere in the system (it is currently used with BIO_FLUSH in ZFS to make sure some writes are complete before others start and as a poor-man's soft dependency in one place in UFS where we won't be issuing READs until after the operation completes). However, out of an abundance of caution, it isn't enabled by default. Plus, this also brings in NCQ TRIM support for those SSDs that support it. A black list is also provided for known rogues that use NCQ trim as an excuse to corrupt the drive. It was difficult to separate out into a separate commit. This code has run in production at Netflix for over a year now. Sponsored by: Netflix, Inc Differential Revision: https://reviews.freebsd.org/D4609
* Add sbuf variants ata_cmd_sbuf() and ata_res_sbuf(), and reimplement thescottl2016-04-133-25/+47
| | | | | | | | | | _string variants on top of this. This requires a change to the function signature of ata_res_sbuf(). Its use in the tree seems to be very limited, and the change makes it more consistent with the rest of the API. Reviewed by: imp, mav, kenm Sponsored by: Netflix Differential Revision: D5940
* Use scsi_cdb_sbuf() inside of scsi_command_string now that the temporaryscottl2016-04-131-9/+6
| | | | | | | string storage is no longer needed. MFC after: 3 days Sponsored by: Netflix
* Add scsi_cdb_sbuf() for handling CDB strings. Reimplement scsi_cdb_string()scottl2016-04-132-8/+26
| | | | | | | | | in terms of it. Reviewed by: imp, mav, ken MFC after: 3 days Sponsored by: Netflix Differential Revision: D5934
* Cleanup unnecessary semicolons from the kernel.pfg2016-04-101-1/+1
| | | | Found with devel/coccinelle.
* Add couple new constants from SPC5r08.mav2016-04-091-0/+2
|
* chdone(): Prevent returning uninitialized scalar value.pfg2016-04-071-7/+5
| | | | | | | | | | Improve over the solution in r297527: Instead of attempting to initialize all the possible cases, just move the check nearer to the case where it makes sense. CID: 1006486 Reviewed by: ken MFC after: 2 weeks
* chdone(): Prevent returning uninitialized scalar value.pfg2016-04-031-0/+1
| | | | | | | | | If there is an error different from ERESTART, there is some chance that we may end up accessing an uninitialized value. This doesn't seem likely/possible but initialize announce_buf[0], just in case. CID: 1006486
* Small typo.pfg2016-04-021-1/+1
|
* CAM: Generalize 4k quirk to all Samsung MZ7* SSDsdumbbell2016-03-292-36/+10
| | | | | | | | | | | | This adds Samsung PM851 to the list. It can be found in Lenovo Thinkpad T440 for instance. Reviewed by: Kevin Bowling <kevin.bowling@kev009.com>, Jason Wolfe <j@nitrology.com> Approved by: Kevin Bowling <kevin.bowling@kev009.com>, Jason Wolfe <j@nitrology.com> MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D5753
* Add 4k enabled cam quirks for Samsung SM863 Series SSDssbruno2016-03-242-0/+16
| | | | | | | Submitted by: Jason (j@nitrology.com) MFC after: 2 weeks Sponsored by: Limelight Networks Differential Revision: https://reviews.freebsd.org/D5711
* Make sure we check for CAM_CDB_POINTER for all drivers. Also, for theimp2016-03-151-0/+7
| | | | | | drivers I've touched, filter out CAM_CDB_PHYS. Differential Revision: https://reviews.freebsd.org/D5585
* Move to new value for XPT_GET_SIM_KNOB to avoid clash with XPT_ATA_IO.imp2016-03-103-4/+8
|
* Set bhsdi_target_transfer_tag to reserved value, which is 0xffffffff.mav2016-03-041-0/+1
| | | | This should be a purely cosmetic change.
* Remove a stray else. It isn't needed (due to the return at the end ofimp2016-02-181-1/+2
| | | | | | | | | | the if statement it pairs with). While not an error today, a careless edit in the future could cause problems (though given the nature of this specific code, the problems quite likely would be some variation of "most direct access SCSI storage devices won't attach," which is unlikely to go unnoticed). PVS-Studio: V705
* Remove stray semicolons from the iSCSI code.trasz2016-02-101-2/+2
| | | | | MFC after: 1 month Sponsored by: The FreeBSD Foundation
* Fix the SCSI Extended INQUIRY probe case when an error is returnedken2016-02-081-1/+1
| | | | | | | | | | and a retry is scheduled. Instead of leaving the device queue frozen, unfreeze the device queue so that the retry can happen. Sponsored by: Spectra Logic MFC after: 3 days
* Add defines for WRITE_UNCORRECTABLE ATA command, and improve command loggingrpokala2016-02-041-17/+43
| | | | | | | | | | | | Add #defines for ATA_WRITE_UNCORRECTABLE48 and its features. Update the decoding in ATACAM to recognize the new values. Also improve command decoding for a few other commands (SMART, NOP, SET_FEATURES). Bring the decoding in ata(4) up to parity with ATACAM. Reviewed by: mav, imp MFC after: 1 month Sponsored by: Panasas, Inc. Differential Revision: https://reviews.freebsd.org/D5181
* Clean up unused-but-set-variable spotted by gcc-4.9.araujo2016-02-012-7/+0
| | | | | | | | Reviewed by: mav Approved by: rodrigc (mentor) MFC after: 2 weeks Sponsored by: gandi.net Differential Revision: https://reviews.freebsd.org/D5109
* Hide "soconnect() error" messages under bootverbose.mav2016-01-221-1/+1
| | | | They can be too noisy.
* Convert sys/cam to use make_dev_s().kib2016-01-077-89/+129
| | | | | | | Reviewed by: hps, jhb Sponsored by: The FreeBSD Foundation MFC after: 3 weeks Differential revision: https://reviews.freebsd.org/D4746
* Fix style issues around existing SDT probes.markj2015-12-161-20/+20
| | | | | | | | | - Use SDT_PROBE<N>() instead of SDT_PROBE(). This has no functional effect at the moment, but will be needed for some future changes. - Don't hardcode the module component of the probe identifier. This is set automatically by the SDT framework. MFC after: 1 week
* Set DS flag, required for LPB log page by spec.mav2015-12-151-0/+2
| | | | MFC after: 1 week
* The ccb_xflags enumeration was removed from FreeBSD/head inken2015-12-071-3/+3
| | | | | | | | | | | | r259397 (it contained the CAM_EXTLUN_VALID bit) and I added the same type name with a different set of values back in r291716. The old ccb_xflags enumeration still exists in FreeBSD stable/10. Shift all of the new values by one bit to avoid compatibility issues when merged to stable/10. MFC after: 3 days Sponsored by: Spectra Logic
* Improve cam tracing a little by including the function code in theimp2015-12-071-2/+8
| | | | | | traces for xpt_action. Note up-calls (down-calls?) to the SIM as well. Differential Review: https://reviews.freebsd.org/D4382
* Add asynchronous command support to the pass(4) driver, and the newken2015-12-037-64/+1625
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | camdd(8) utility. CCBs may be queued to the driver via the new CAMIOQUEUE ioctl, and completed CCBs may be retrieved via the CAMIOGET ioctl. User processes can use poll(2) or kevent(2) to get notification when I/O has completed. While the existing CAMIOCOMMAND blocking ioctl interface only supports user virtual data pointers in a CCB (generally only one per CCB), the new CAMIOQUEUE ioctl supports user virtual and physical address pointers, as well as user virtual and physical scatter/gather lists. This allows user applications to have more flexibility in their data handling operations. Kernel memory for data transferred via the queued interface is allocated from the zone allocator in MAXPHYS sized chunks, and user data is copied in and out. This is likely faster than the vmapbuf()/vunmapbuf() method used by the CAMIOCOMMAND ioctl in configurations with many processors (there are more TLB shootdowns caused by the mapping/unmapping operation) but may not be as fast as running with unmapped I/O. The new memory handling model for user requests also allows applications to send CCBs with request sizes that are larger than MAXPHYS. The pass(4) driver now limits queued requests to the I/O size listed by the SIM driver in the maxio field in the Path Inquiry (XPT_PATH_INQ) CCB. There are some things things would be good to add: 1. Come up with a way to do unmapped I/O on multiple buffers. Currently the unmapped I/O interface operates on a struct bio, which includes only one address and length. It would be nice to be able to send an unmapped scatter/gather list down to busdma. This would allow eliminating the copy we currently do for data. 2. Add an ioctl to list currently outstanding CCBs in the various queues. 3. Add an ioctl to cancel a request, or use the XPT_ABORT CCB to do that. 4. Test physical address support. Virtual pointers and scatter gather lists have been tested, but I have not yet tested physical addresses or scatter/gather lists. 5. Investigate multiple queue support. At the moment there is one queue of commands per pass(4) device. If multiple processes open the device, they will submit I/O into the same queue and get events for the same completions. This is probably the right model for most applications, but it is something that could be changed later on. Also, add a new utility, camdd(8) that uses the asynchronous pass(4) driver interface. This utility is intended to be a basic data transfer/copy utility, a simple benchmark utility, and an example of how to use the asynchronous pass(4) interface. It can copy data to and from pass(4) devices using any target queue depth, starting offset and blocksize for the input and ouptut devices. It currently only supports SCSI devices, but could be easily extended to support ATA devices. It can also copy data to and from regular files, block devices, tape devices, pipes, stdin, and stdout. It does not support queueing multiple commands to any of those targets, since it uses the standard read(2)/write(2)/writev(2)/readv(2) system calls. The I/O is done by two threads, one for the reader and one for the writer. The reader thread sends completed read requests to the writer thread in strictly sequential order, even if they complete out of order. That could be modified later on for random I/O patterns or slightly out of order I/O. camdd(8) uses kqueue(2)/kevent(2) to get I/O completion events from the pass(4) driver and also to send request notifications internally. For pass(4) devcies, camdd(8) uses a single buffer (CAM_DATA_VADDR) per CAM CCB on the reading side, and a scatter/gather list (CAM_DATA_SG) on the writing side. In addition to testing both interfaces, this makes any potential reblocking of I/O easier. No data is copied between the reader and the writer, but rather the reader's buffers are split into multiple I/O requests or combined into a single I/O request depending on the input and output blocksize. For the file I/O path, camdd(8) also uses a single buffer (read(2), write(2), pread(2) or pwrite(2)) on reads, and a scatter/gather list (readv(2), writev(2), preadv(2), pwritev(2)) on writes. Things that would be nice to do for camdd(8) eventually: 1. Add support for I/O pattern generation. Patterns like all zeros, all ones, LBA-based patterns, random patterns, etc. Right Now you can always use /dev/zero, /dev/random, etc. 2. Add support for a "sink" mode, so we do only reads with no writes. Right now, you can use /dev/null. 3. Add support for automatic queue depth probing, so that we can figure out the right queue depth on the input and output side for maximum throughput. At the moment it defaults to 6. 4. Add support for SATA device passthrough I/O. 5. Add support for random LBAs and/or lengths on the input and output sides. 6. Track average per-I/O latency and busy time. The busy time and latency could also feed in to the automatic queue depth determination. sys/cam/scsi/scsi_pass.h: Define two new ioctls, CAMIOQUEUE and CAMIOGET, that queue and fetch asynchronous CAM CCBs respectively. Although these ioctls do not have a declared argument, they both take a union ccb pointer. If we declare a size here, the ioctl code in sys/kern/sys_generic.c will malloc and free a buffer for either the CCB or the CCB pointer (depending on how it is declared). Since we have to keep a copy of the CCB (which is fairly large) anyway, having the ioctl malloc and free a CCB for each call is wasteful. sys/cam/scsi/scsi_pass.c: Add asynchronous CCB support. Add two new ioctls, CAMIOQUEUE and CAMIOGET. CAMIOQUEUE adds a CCB to the incoming queue. The CCB is executed immediately (and moved to the active queue) if it is an immediate CCB, but otherwise it will be executed in passstart() when a CCB is available from the transport layer. When CCBs are completed (because they are immediate or passdone() if they are queued), they are put on the done queue. If we get the final close on the device before all pending I/O is complete, all active I/O is moved to the abandoned queue and we increment the peripheral reference count so that the peripheral driver instance doesn't go away before all pending I/O is done. The new passcreatezone() function is called on the first call to the CAMIOQUEUE ioctl on a given device to allocate the UMA zones for I/O requests and S/G list buffers. This may be good to move off to a taskqueue at some point. The new passmemsetup() function allocates memory and scatter/gather lists to hold the user's data, and copies in any data that needs to be written. For virtual pointers (CAM_DATA_VADDR), the kernel buffer is malloced from the new pass(4) driver malloc bucket. For virtual scatter/gather lists (CAM_DATA_SG), buffers are allocated from a new per-pass(9) UMA zone in MAXPHYS-sized chunks. Physical pointers are passed in unchanged. We have support for up to 16 scatter/gather segments (for the user and kernel S/G lists) in the default struct pass_io_req, so requests with longer S/G lists require an extra kernel malloc. The new passcopysglist() function copies a user scatter/gather list to a kernel scatter/gather list. The number of elements in each list may be different, but (obviously) the amount of data stored has to be identical. The new passmemdone() function copies data out for the CAM_DATA_VADDR and CAM_DATA_SG cases. The new passiocleanup() function restores data pointers in user CCBs and frees memory. Add new functions to support kqueue(2)/kevent(2): passreadfilt() tells kevent whether or not the done queue is empty. passkqfilter() adds a knote to our list. passreadfiltdetach() removes a knote from our list. Add a new function, passpoll(), for poll(2)/select(2) to use. Add devstat(9) support for the queued CCB path. sys/cam/ata/ata_da.c: Add support for the BIO_VLIST bio type. sys/cam/cam_ccb.h: Add a new enumeration for the xflags field in the CCB header. (This doesn't change the CCB header, just adds an enumeration to use.) sys/cam/cam_xpt.c: Add a new function, xpt_setup_ccb_flags(), that allows specifying CCB flags. sys/cam/cam_xpt.h: Add a prototype for xpt_setup_ccb_flags(). sys/cam/scsi/scsi_da.c: Add support for BIO_VLIST. sys/dev/md/md.c: Add BIO_VLIST support to md(4). sys/geom/geom_disk.c: Add BIO_VLIST support to the GEOM disk class. Re-factor the I/O size limiting code in g_disk_start() a bit. sys/kern/subr_bus_dma.c: Change _bus_dmamap_load_vlist() to take a starting offset and length. Add a new function, _bus_dmamap_load_pages(), that will load a list of physical pages starting at an offset. Update _bus_dmamap_load_bio() to allow loading BIO_VLIST bios. Allow unmapped I/O to start at an offset. sys/kern/subr_uio.c: Add two new functions, physcopyin_vlist() and physcopyout_vlist(). sys/pc98/include/bus.h: Guard kernel-only parts of the pc98 machine/bus.h header with #ifdef _KERNEL. This allows userland programs to include <machine/bus.h> to get the definition of bus_addr_t and bus_size_t. sys/sys/bio.h: Add a new bio flag, BIO_VLIST. sys/sys/uio.h: Add prototypes for physcopyin_vlist() and physcopyout_vlist(). share/man/man4/pass.4: Document the CAMIOQUEUE and CAMIOGET ioctls. usr.sbin/Makefile: Add camdd. usr.sbin/camdd/Makefile: Add a makefile for camdd(8). usr.sbin/camdd/camdd.8: Man page for camdd(8). usr.sbin/camdd/camdd.c: The new camdd(8) utility. Sponsored by: Spectra Logic MFC after: 1 week
OpenPOWER on IntegriCloud