]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
6 years agoMFC r328567:
pfg [Mon, 5 Feb 2018 15:02:35 +0000 (15:02 +0000)]
MFC r328567:
libedit: sort the Makefile in line with NetBSD's version.

NetBSD's libedit has been been cleaned-up considerably so the
non-widecharacter version is no longer an option. Re-sorting the
Makefile should make it easier for some brave soul trying to update it.

No functional change intended.

6 years agoMFC r328773:
kib [Mon, 5 Feb 2018 10:29:57 +0000 (10:29 +0000)]
MFC r328773:
On pageout, in vnode generic pager, for partially dirty page, only
clear dirty bits for completely invalid blocks.

PR: 225586

6 years agoMFC r328770:
ae [Mon, 5 Feb 2018 09:25:02 +0000 (09:25 +0000)]
MFC r328770:
  Merge r1.120 from NetBSD:
    Fix a pretty simple, yet pretty tragic typo: we should return IPPROTO_DONE,
    not IPPROTO_NONE. With IPPROTO_NONE we will keep parsing the header chain
    on an mbuf that was already freed.

  Reported by: Maxime Villard <max at m00nbsd dot net>

6 years agoMFC r323683:
eadler [Mon, 5 Feb 2018 08:20:11 +0000 (08:20 +0000)]
MFC r323683:

MFV r323678: file 5.32

6 years agoMFC r304321,304753,304754,306751,316077,316110:
kevans [Mon, 5 Feb 2018 04:00:59 +0000 (04:00 +0000)]
MFC r304321,304753,304754,306751,316077,316110:
SHA512, skein, large block support for loader zfs

MFC r304321: Add SHA512, skein, large blocks support for loader zfs.
MFC r304753: loader: zio_checksum_verify() must test spa for NULL pointer
MFC r304754: r304321 broken bhyve zvol VM bhyveload hang 100% WCPU
MFC r306751: Disable loop unrolling in skein for sys/boot
MFC r316077: Unbreak compilation with gcc 4.2.1
MFC r316110: Use `-Wno-missing-declarations` with CWARNFLAGS for skein.c

6 years agoMFC r328126: correct read-ahead calculations in vfs_bio_getpages
avg [Sun, 4 Feb 2018 14:00:38 +0000 (14:00 +0000)]
MFC r328126: correct read-ahead calculations in vfs_bio_getpages

6 years agoMFC r327775: amdsbwd: fix handling of timeout values beyond the supported range
avg [Sun, 4 Feb 2018 13:57:15 +0000 (13:57 +0000)]
MFC r327775: amdsbwd: fix handling of timeout values beyond the supported range

6 years agoMFC r327726: vmm/svm: contigmalloc of the whole svm_softc is excessive
avg [Sun, 4 Feb 2018 13:53:45 +0000 (13:53 +0000)]
MFC r327726: vmm/svm: contigmalloc of the whole svm_softc is excessive

6 years agoMFC r327911:
jhibbits [Sun, 4 Feb 2018 03:15:06 +0000 (03:15 +0000)]
MFC r327911:

  Replace the PMC class struct copy with an explicit memcpy()

6 years agoRemove now-unused variable after r328809
emaste [Sun, 4 Feb 2018 02:58:12 +0000 (02:58 +0000)]
Remove now-unused variable after r328809

6 years agoMFH r328332:
mm [Sat, 3 Feb 2018 02:17:04 +0000 (02:17 +0000)]
MFH r328332:
Sync libarchive with vendor.

Relevant vendor changes:
  PR #893: delete dead ppmd7 alloc callbacks
  PR #904: Fix archive freeing bug in bsdcat
  PR #961: Fix ZIP format names
  PR #962: Don't modify attributes for existing directories
           when ARCHIVE_EXTRACT_NO_OVERWRITE is set
  PR #964: Fix -Werror=implicit-fallthrough= for GCC 7
  PR #970: zip: Allow backslash as path separator

6 years agoMFC r328641: dtc(1): Revert WARNS change from r328173
kevans [Sat, 3 Feb 2018 01:20:01 +0000 (01:20 +0000)]
MFC r328641: dtc(1): Revert WARNS change from r328173

WARNS > 3 breaks xtoolchain builds to varying degrees. Revert it.

6 years agoMFC r328491: MFV r328490: Update libfdt to github:f1879e1
kevans [Sat, 3 Feb 2018 01:18:19 +0000 (01:18 +0000)]
MFC r328491: MFV r328490: Update libfdt to github:f1879e1

Pulls in a patch, now upstreamed, from nwhitehorn to add limited read-only
support for older (v2 and v3) FDT blobs.

6 years agoMFC r303468 (by imp):
mav [Fri, 2 Feb 2018 23:22:58 +0000 (23:22 +0000)]
MFC r303468 (by imp):
Move protocol specific stuff into a linker set object that's
per-protocol. This reduces the number scsi symbols references by
cam_xpt significantly, and eliminates all ata / nvme symbols. There's
still some NVME / ATA specific code for dealing with XPT_NVME_IO and
XPT_ATA_IO respectively, and a bunch of scsi-specific code, but this
is progress.

6 years agoMFC r303467 (by imp):
mav [Fri, 2 Feb 2018 23:19:20 +0000 (23:19 +0000)]
MFC r303467 (by imp):
Switch to linker sets to find the xport callback object.  This
eliminates the need to special case everything in cam_xpt for new
transports. It is now a failure to not have a transport object when
registering the bus as well. You can still, however, create a
transport that's unspecified (XPT_)

6 years agoMFC geli test suite changes
asomers [Fri, 2 Feb 2018 21:57:00 +0000 (21:57 +0000)]
MFC geli test suite changes

MFC r306188, r306395, r327346-r327347, r327352-r327353, r327662, r327666, r327682-r327683, r327685

r306188 by br:
Use bsdlabel as we don't have hardlink disklabel -> bsdlabel
on some platforms.

Reviewed by: ngie
Sponsored by: DARPA, AFRL
Sponsored by: HEIF5
Differential Revision: https://reviews.freebsd.org/D7968

r306395 by br:
Increase timeouts for geli tests. It takes 2-3x more time to proceed the
tests on MIPS64EB in QEMU.

Sponsored by: DARPA, AFRL
Sponsored by: HEIF5

r327346:
Fix potential TOCTTOU bug in the geli tests

This change mostly reverts r293436, which introduced the bug due to a belief
that geli(8) would allocate md(4) devices by itself. However, that belief is
incorrect. Instead of using linear probing to find available md(4) numbers,
it's best to use the existing attach_md function.

Reviewed by: ngie
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D13666

r327347:
geli: factor out some common code in the geli tests

No functional change.

Sponsored by: Spectra Logic Corp

r327352:
Fix a harmless typo from r310786

I copy/pasted a reference to an undefined shell variable.

r327353:
geli: fix the resize test on arm64

The resize test used bsdlabel(8), which is not available on all
architectures.  Change it to use gpart(8) instead, which should be available
everywhere.

PR: 221763
Reported by: andrew

r327662:
geli: convert most tests from TAP to ATF

I'm leaving readonly_test and nokey_test alone for now. In a future commit
they should be broken up into several smaller test cases and distributed
between multiple files.

Reviewed by: ngie
Differential Revision: https://reviews.freebsd.org/D13717

r327666:
geli: fix parallel execution of tests

The trick is not to destroy an md(4) device during a test.  That can create
a "double-free" situation, because we also destroy md devices during test
cleanup.

r327682:
Fix typo from r327666

X-MFC-With: 327666

r327683:
geli: convert remaining TAP tests to ATF

r327685:
geli: optimize tests

Reduce the geli tests' runtime by about a third:

* In integrity_test:copy, use a file-backed md(4) device instead of a
  malloc'd one.  That way we can corrupt the underlying storage without
  needing to detach and reattach the geli device.

* In integrity_test:{copy, hmac, data} and onetime_test:{onetime,
  onetime_a}, move reads of /dev/random out of the loop.

6 years agoMFC r328504: stand/fdt: Consolidate overlay handling a little further
kevans [Fri, 2 Feb 2018 21:25:32 +0000 (21:25 +0000)]
MFC r328504: stand/fdt: Consolidate overlay handling a little further

[This is effectively a direct commit to stable/11 due to path restructuring
in HEAD. The diff against HEAD has simply been applied to the old path]

This should have been done as part of r327350, but due to lack of foresight
it came later. In the different places we apply overlays, we duplicate the
bits that check for fdt_overlays in the environment and supplement that with
any other places we need to check for overlays to load. These "other places"
will be loader specific and are not candidates for consolidation.

Provide an fdt_load_dtb_overlays to capture the common logic, allow passing
in an additional list of overlays to be loaded. This additional list of
overlays is used in practice for ubldr to pull in any fdt_overlays passed to
it from U-Boot environment, but it can be used for any other source of
overlays.

These additional overlays supplement loader.conf(5) fdt_overlays, rather
than replace, so that we're not restricted to specifying overlays in only
one place. This is a change from previous behavior where loader.conf(5)
supplied fdt_overlays would cause us to ignore U-Boot environment, and this
seems nonsensical- user should have sufficient control over both of these
aspects, or lack of control for good reasons.

A knob could be considered in the future to ignore U-Boot supplied overlays,
but the supplemental treatment seems like a good start.

6 years agoMFC r322894:
bdrewery [Fri, 2 Feb 2018 21:00:06 +0000 (21:00 +0000)]
MFC r322894:

  Replace makefs' hand-rolled unescaping with strunvis

Sponsored by: Dell EMC

6 years agoMFC r312293,312305,312434,312698,312759,312760,312814,312815,322672:
mav [Fri, 2 Feb 2018 18:38:29 +0000 (18:38 +0000)]
MFC r312293,312305,312434,312698,312759,312760,312814,312815,322672:
Synchronize gtaskqueue vs SMP initialization order with head.

This should fix panics on boot, caused by recent Linux KPI merges.

6 years agoPartial MFC of r312205 (by sbruno): Skip smp check if we're running UP
mav [Fri, 2 Feb 2018 18:12:09 +0000 (18:12 +0000)]
Partial MFC of r312205 (by sbruno): Skip smp check if we're running UP

6 years agoPartial MFC of r311039 (by sbruno):
mav [Fri, 2 Feb 2018 18:10:45 +0000 (18:10 +0000)]
Partial MFC of r311039 (by sbruno):
- add INVARIANTS debugging hooks to gtaskqueue enqueue (mmacy)

6 years agoMFC r307657 (by sbruno): Resolve whitespace diff to NextBSD.
mav [Fri, 2 Feb 2018 18:04:57 +0000 (18:04 +0000)]
MFC r307657 (by sbruno): Resolve whitespace diff to NextBSD.

Check to see that the taskqueue thread count requires us to acutally
iterate over the thread count to bind to cpus.

6 years agoMFC r307567 (by sbruno): Assert that we're assigning a non-null taskqueue.
mav [Fri, 2 Feb 2018 18:03:14 +0000 (18:03 +0000)]
MFC r307567 (by sbruno): Assert that we're assigning a non-null taskqueue.
ref: https://github.com/NextBSD/NextBSD/commit/535865d02c162e415d7436899cd6db5000a0cc7b

Fix cpu assignment by assuring stride is non-zero, assert that all tasks
have a valid taskqueue.
ref: https://github.com/NextBSD/NextBSD/commit/db398176234fe3ce9f8e8b671f56000f8276feba

Start cpu assignment from zero.
ref: https://github.com/NextBSD/NextBSD/commit/d99d39b6b6c5dfac1eb440c41e36ebf4c897198e

6 years agoMFC r307566 (by sbruno):
mav [Fri, 2 Feb 2018 18:02:06 +0000 (18:02 +0000)]
MFC r307566 (by sbruno):
Ensure that tasks with a specific cpu set prior to smp starting get
re-attached to a thread running on that cpu.

ref: https://github.com/NextBSD/NextBSD/commit/fcc20e306bc93ebbbe51f3775d1afb527970a2e9

6 years agoMFC r307561 (by sbruno): Tell gtask to what we've been bound.
mav [Fri, 2 Feb 2018 17:59:44 +0000 (17:59 +0000)]
MFC r307561 (by sbruno):  Tell gtask to what we've been bound.

ref: https://github.com/NextBSD/NextBSD/commit/54414984cfebb920bbc40aadeb601bdce448d8d7

6 years agoMFC r307041 (by sbruno):
mav [Fri, 2 Feb 2018 17:56:47 +0000 (17:56 +0000)]
MFC r307041 (by sbruno):
Fix bug where malloc(.., M_NOWAIT) return value is not checked, Change to
M_WAITOK and move outside the mutex

6 years agoMFC r328584: stand/fdt: Remove unused write-only new_fdtp, correct comment
kevans [Fri, 2 Feb 2018 14:47:25 +0000 (14:47 +0000)]
MFC r328584: stand/fdt: Remove unused write-only new_fdtp, correct comment

This is effectively a direct commit to stable/11 due to path restructuring
in HEAD. The diff against HEAD has simply been applied to the old path.

6 years agoMFC r328161:
ae [Fri, 2 Feb 2018 07:55:31 +0000 (07:55 +0000)]
MFC r328161:
  Add UDPLite support to ipfw(4).

  Now it is possible to use UDPLite's port numbers in rules,
  create dynamic states for UDPLite packets and see "UDPLite" for matched
  packets in log.

  Obtained from: Yandex LLC
  Sponsored by: Yandex LLC

6 years agoMFC r328160:
ae [Fri, 2 Feb 2018 07:48:46 +0000 (07:48 +0000)]
MFC r328160:
  Add to bsnmpd(1) ability to specify multiple community strings with
  different access rights.

  By default there are two community strings with index 1 and 2, one for
  read-only access and second for read-write access:

    begemotSnmpdCommunityString.0.1 = $(read)
    begemotSnmpdCommunityString.0.2 = $(write)

  Now it is possible to define additional community strings using different
  indexes:

    begemotSnmpdCommunityString.0.3 = "SomeString1"
    begemotSnmpdCommunityPermission.0.3 = 1
    begemotSnmpdCommunityString.0.4 = "SomeString2"
    begemotSnmpdCommunityPermission.0.4 = 2
    begemotSnmpdCommunityString.0.5 = "SomeString3"
    begemotSnmpdCommunityString.0.6 = "SomeString4"

  New attribute begemotSnmpdCommunityPermission can be used to specify access
  rights: 1 means "read-only" access, 2 means "read-write" access. If
  attribute is not specified for some index this means "read-only" rights.

  Community strings must be unique, i.e. must not be the same for different
  indexes.

  Obtained from: Yandex LLC
  Sponsored by: Yandex LLC
  Differential Revision: https://reviews.freebsd.org/D13785

MFC r328171:
  Rename "index" variable to "idx" since gcc complains that it shadows
  index(3) function declaration.

6 years agoMFC of 328444.
mckusick [Fri, 2 Feb 2018 00:52:29 +0000 (00:52 +0000)]
MFC of 328444.

Eliminate "fsync: giving up on dirty" messages.

6 years agoMFC small part of r325794 to fix the build.
mav [Thu, 1 Feb 2018 21:34:50 +0000 (21:34 +0000)]
MFC small part of r325794 to fix the build.

6 years agoMFC r327034 (by imp):
mav [Thu, 1 Feb 2018 21:25:56 +0000 (21:25 +0000)]
MFC r327034 (by imp):
Return domain, bus, slot, and function for the transport settings in
PATH_INQ requests for nvme.

6 years agoMFC r326937, r326940 (by imp):
mav [Thu, 1 Feb 2018 21:23:42 +0000 (21:23 +0000)]
MFC r326937, r326940 (by imp):
When we're disabling the nvme device, some drives have a controller
bug that requires 'hands off' for a period of time (2.3s) before we
check the RDY bit. Sicne this is a very odd quirk for a very limited
selection of drives, do this as a quirk. This prevented a successful
reset of the card when the card wedged.

Also, make sure that we comply with the advice from section 3.1.5 of
the 1.3 spec says that transitioning CC.EN from 0 to 1 when CSTS.RDY
is 1 or transitioning CC.EN from 1 to 0 when CSTS.RDY is 0 "has
undefined results". Short circuit when EN == RDY == desired state.

Finally, fail the reset if the disable fails. This will lead to a
failed device, which is what we want. (note: nda device needs
work for coping with a failed device).

6 years agoMFC r324978: Report only the valid slots in the firmware log page.
mav [Thu, 1 Feb 2018 21:14:54 +0000 (21:14 +0000)]
MFC r324978: Report only the valid slots in the firmware log page.

Printing the entire log page is causing confusion over available
slots. Report only those slots that are valid. In the case where the
firmware download isn't supported, assume that only the first slot is
valid (I have no hardware to test this assumption though)

6 years agoMFC r324977 (by imp):
mav [Thu, 1 Feb 2018 21:14:21 +0000 (21:14 +0000)]
MFC r324977 (by imp):
Add nvme_controller_data argument to all print functions.

It's desirable to access controler data to inform printing log pages
(such as limiting the printing to valid ranges).

6 years agoMFC r324630 (by imp): Update comment to reflect actual default timeout.
mav [Thu, 1 Feb 2018 21:12:59 +0000 (21:12 +0000)]
MFC r324630 (by imp):  Update comment to reflect actual default timeout.

6 years agoMFC r323625 (by imp): Allow multiple TRIMs to be done for nda
mav [Thu, 1 Feb 2018 21:12:09 +0000 (21:12 +0000)]
MFC r323625 (by imp):  Allow multiple TRIMs to be done for nda

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.

6 years agoMFC r322999 (by imp): Fix NVMe's use of XPT_GDEV_TYPE
mav [Thu, 1 Feb 2018 21:11:17 +0000 (21:11 +0000)]
MFC r322999 (by imp):  Fix NVMe's use of XPT_GDEV_TYPE

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.

6 years agoMFC r322992 (by imp): Print the controller's ID in identify.
mav [Thu, 1 Feb 2018 21:06:28 +0000 (21:06 +0000)]
MFC r322992 (by imp): Print the controller's ID in identify.

6 years agoMFC r320522 (by imp):
mav [Thu, 1 Feb 2018 21:04:10 +0000 (21:04 +0000)]
MFC r320522 (by imp):
Fix sign of resid and add a mostly useless cast to cope with signed vs
unsigned check warnings from traditional unix code construsts bogusly
flagged as potentially unsafe.

6 years agoMFC r320483 (by imp): Improve wdc error log pulling.
mav [Thu, 1 Feb 2018 19:48:05 +0000 (19:48 +0000)]
MFC r320483 (by imp): Improve wdc error log pulling.

After review by the WDC engineers, improve how we pull down the
so-called 'e6' logs. The 'c6' logs are obsolete and support for them
has been removed because FreeBSD needed to pull them in chunks, which
is incompatible with the 0xc6 opcode implementation. Rather than leave
the code in place that produces bad log pulls, remove it.

6 years agoMFC r320425 (by imp):
mav [Thu, 1 Feb 2018 19:47:16 +0000 (19:47 +0000)]
MFC r320425 (by imp):
Report some aspects of namespaces and namespace support in identify
command.

6 years agoMFC r320423 (by imp):
mav [Thu, 1 Feb 2018 19:46:41 +0000 (19:46 +0000)]
MFC r320423 (by imp):
Move 128-bit integer routines to util.c so they can be used by more
than just the log page code.

6 years agoMFC r320412 (by imp): Namespace is 32-bits, don't cast it to 16 here
mav [Thu, 1 Feb 2018 19:46:08 +0000 (19:46 +0000)]
MFC r320412 (by imp): Namespace is 32-bits, don't cast it to 16 here

6 years agoMFC r316105 (by ngie): Don't use K&R style prototypes; ANSIfy them
mav [Thu, 1 Feb 2018 19:45:28 +0000 (19:45 +0000)]
MFC r316105 (by ngie): Don't use K&R style prototypes; ANSIfy them

This fixes several -Wold-style-definition warnings.

6 years agoMFC r314230 (by imp):
mav [Thu, 1 Feb 2018 19:44:24 +0000 (19:44 +0000)]
MFC r314230 (by imp):
Make nvmecontrol logpage -p help list known pages.

Make -p help and -v help list all the pages we know about.
Add -v to usage.
Update the man page.

6 years agoMFC r314229 (by imp):
mav [Thu, 1 Feb 2018 19:43:51 +0000 (19:43 +0000)]
MFC r314229 (by imp):
Exit with usage if argv[1] is NULL in dispatch. This fixes core dumps
when a command has subcommands, but the user doesn't give the
parameters on the command line.

6 years agoMFC r314228 (by imp): Fix typos in output.
mav [Thu, 1 Feb 2018 19:43:18 +0000 (19:43 +0000)]
MFC r314228 (by imp): Fix typos in output.

6 years agoMFC r313259 (by imp):
mav [Thu, 1 Feb 2018 19:41:46 +0000 (19:41 +0000)]
MFC r313259 (by imp):
Use ssize_t instead of uint32_t to prevent warnings about a comparison
with different signs. Due to the promotion rules, this would only
happen on 32-bit platforms.

6 years agoMFC r313258 (by imp):
mav [Thu, 1 Feb 2018 19:40:51 +0000 (19:40 +0000)]
MFC r313258 (by imp):
Add the ability to dump log pages directly in binary to stdout.
Update man page to include this flag, and an example of dumping a
vendor-specific page while I'm here.

6 years agoMFC r313257 (by imp):
mav [Thu, 1 Feb 2018 19:39:29 +0000 (19:39 +0000)]
MFC r313257 (by imp):
Add some descriptions to the man page for the supported log pages as
well as the new wdc commands. Make wdc be an alias for hgst when
specifying the vendor to use to interpret the page.

6 years agoMFC r313252 (by imp):
mav [Thu, 1 Feb 2018 19:39:00 +0000 (19:39 +0000)]
MFC r313252 (by imp):
Fix off by one error that truncated the serial number for filenames.

6 years agoMFC r313251 (by imp):
mav [Thu, 1 Feb 2018 19:38:29 +0000 (19:38 +0000)]
MFC r313251 (by imp):
Fix a typo in usage string for unimplemented command.

6 years agoMFC r313191 (by imp):
mav [Thu, 1 Feb 2018 19:37:50 +0000 (19:37 +0000)]
MFC r313191 (by imp):
Implement 5 wdc-specific nvme control options for their HGST drives:
        wdc cap-diag            Capture diagnostic data from drive
        wdc drive-log           Capture drive history data from drive
        wdc get-crash-dump      Retrieve firmware crash dump from drive

6 years agoMFC r313190 (by imp):
mav [Thu, 1 Feb 2018 19:37:18 +0000 (19:37 +0000)]
MFC r313190 (by imp):
Move the usage and command name lookup into functions.

6 years agoMFC r313188 (by imp):
mav [Thu, 1 Feb 2018 19:36:42 +0000 (19:36 +0000)]
MFC r313188 (by imp):
Put the arguments to aligned_alloc in the right order.

6 years agoMFC r313111 (by imp):
mav [Thu, 1 Feb 2018 19:35:34 +0000 (19:35 +0000)]
MFC r313111 (by imp):
Use aligned buffer for the firmware data. Otherwise, when loading a
MAXPHYS bytes of data, the I/O would require MAXPHYS + PAGE_SIZE worth
of pages to do the I/O and we'd hit an assertion in
vm_fault_quick_hold_pages unless MAXPHYS was larger than 1M +
PAGE_SIZE.

6 years agoMFC r309777 (by imp):
mav [Thu, 1 Feb 2018 19:33:51 +0000 (19:33 +0000)]
MFC r309777 (by imp):
Implement Intel's log page 0xc1 (Read Command Latency Log) and page
0xc1 (Write Command Latency Log).

6 years agoMFC r309684 (by imp): Fix Typo
mav [Thu, 1 Feb 2018 19:33:17 +0000 (19:33 +0000)]
MFC r309684 (by imp): Fix Typo

6 years agoMFC r309413 (by imp):
mav [Thu, 1 Feb 2018 19:32:45 +0000 (19:32 +0000)]
MFC r309413 (by imp):
Flag the vendor specific pages as such. This allows different decoding
for the same page number as different vendors encode vendor specific
pages differently.

6 years agoMFC r308869 (by imp):
mav [Thu, 1 Feb 2018 19:31:39 +0000 (19:31 +0000)]
MFC r308869 (by imp):
i386 turns out to not have __uint128_t. So confusingly use 64-bit math
instead. Since we're little endian, we can get away with it. Also,
since the counters in quesitons would require billions of iops for
tens of billions of seconds to overflow, and since such data rates are
unlikely for people using i386 for a while, that's OK. The fastest
cards today can't do even a million IOPs.

6 years agoMFC r308856 (by imp):
mav [Thu, 1 Feb 2018 19:30:37 +0000 (19:30 +0000)]
MFC r308856 (by imp):
Decode the Intel-specific Additional SMART data page (0xca) and print
it in human readable form. Include a pointer to the public spec that
was followed to implement this in the code. Samsung also implements
page 0xca on some of their drives, but the format is slighly
different, so the code skips printing zero keys. Samsung's log page
has additional, unknown data after the end of Intel defined data which
isn't displayed.

6 years agoMFC r308848 (by imp):
mav [Thu, 1 Feb 2018 19:30:02 +0000 (19:30 +0000)]
MFC r308848 (by imp):
Remove check for valid log pages. Let the drive tell us which pages
are valid or not. While many pages are reserved in the standard, that
doesn't make them invalid and future versions of the standard may
define then.

6 years agoMFC r303315 (by imp): Remove some extraneous printfs.
mav [Thu, 1 Feb 2018 19:28:00 +0000 (19:28 +0000)]
MFC r303315 (by imp): Remove some extraneous printfs.

6 years agoMFC r303125 (by imp):
mav [Thu, 1 Feb 2018 19:27:10 +0000 (19:27 +0000)]
MFC r303125 (by imp):
Remove some bogus comments and printfs. Also, we can't
cam_periph_releaes_locked() at the end of nvme_probe_start because we
hit an assertion which may be bogus. Instead, leak a periph until we
sort it out. Since these devices don't arrive and depart often, so
this is the lessor of two evils.

6 years agoMFC r324632 (by imp):
mav [Thu, 1 Feb 2018 19:13:19 +0000 (19:13 +0000)]
MFC r324632 (by imp):
Be nicer on the dump stack by allocating only a ccb_nvmeio rather than
a full ccb. This saves a few hundre bytes, which might be important
during a crash dump...

6 years agoMFC r324644 (by imp):
mav [Thu, 1 Feb 2018 19:07:21 +0000 (19:07 +0000)]
MFC r324644 (by imp):
Closer examination shows that nvme and CAM both normally zero-fill
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().

6 years agoMFC r324634 (by imp):
mav [Thu, 1 Feb 2018 19:06:42 +0000 (19:06 +0000)]
MFC r324634 (by imp):
Use nvme_ctrlr_poll instead of nvme_ctrlr_intx_handler since it is
more general and doesn't try to access registers that may be undefined
when the card is in MSIX mode.

This change, along with r324630, r324631, r324632, makes nda crash
dumps work again. Previously, they only worked on CPU 0 when the stack
garbage was just so.

6 years agoMFC r324633 (by imp):
mav [Thu, 1 Feb 2018 19:05:48 +0000 (19:05 +0000)]
MFC r324633 (by imp):
Create general polling function for the nvme controller. Use it when
we're doing the various pin-based interrupt modes. Adjust
nvme_ctrlr_intx_handler to use nvme_ctrlr_poll.

6 years agoMFC r324631 (by imp):
mav [Thu, 1 Feb 2018 19:04:50 +0000 (19:04 +0000)]
MFC r324631 (by imp):
Explicitly set reserved fields and 'fuse' to 0. This prevents us from
acidentally sending bogus values in these fields, which some drives
may reject with an error or worse (undefined behavior).

This is especially needed for the ndadump routine which allocates the
cmd from stack garbage....

6 years agoMFC r324075 (by imp): Tweak performance of nda completions
mav [Thu, 1 Feb 2018 19:01:06 +0000 (19:01 +0000)]
MFC r324075 (by imp): Tweak performance of nda completions

Use xpt_done_direct in preference to xpt_done when completing a
successful I/O. Continue to use xpt_done when there's an error, or for
completion of the submission of a CCB. This eliminates a context
switch to the cam_doneq thread.

6 years agoMFC r323834 (by imp): Fix queue depth for nda.
mav [Thu, 1 Feb 2018 19:00:05 +0000 (19:00 +0000)]
MFC r323834 (by imp):  Fix queue depth for nda.

1/4 of the number of queues times queue entries is too limiting. It
works up to about 4k IOPS / 3.0GB/s for hardware that can do
4.4k/3.2GB/s with nvd. 3/4 works better, though it highlights issues
in the fairness of nda's choice of TRIM vs READ. That will be fixed
separately.

6 years agoMFC r322998 (by imp):
mav [Thu, 1 Feb 2018 18:59:03 +0000 (18:59 +0000)]
MFC r322998 (by imp):
Fix a few overlooked spots where the coded uses 16-bit NSIDs. Chuck
Tuffli had submitted a more thorough patch that I was unaware of when
I did my work and this brings in the bits I missed from that patch.

6 years agoMFC r322997: Add CAM/NVMe support for CAM_DATA_SG
mav [Thu, 1 Feb 2018 18:57:10 +0000 (18:57 +0000)]
MFC r322997: Add CAM/NVMe support for CAM_DATA_SG

This adds support in pass(4) for data to be described with a
scatter-gather list (sglist) to augment the existing (single) virtual
address.

6 years agoMFC r322995 (by imp):
mav [Thu, 1 Feb 2018 16:53:08 +0000 (16:53 +0000)]
MFC r322995 (by imp):
Add new compile-time option NVME_USE_NVD that sets the default value
of the runtime hw.nvme.use_vnd tunable. We still default to nvd unless
otherwise requested.

6 years agoMFC r322994: Set the max transactions for NVMe drives better.
mav [Thu, 1 Feb 2018 16:52:03 +0000 (16:52 +0000)]
MFC r322994: Set the max transactions for NVMe drives better.

Provided a better estimate for the number of transactions that can be
pending at one time. This will be number of queues * number of
trackers / 4, as suggested by Jim Harris. This gives a better estimate
of the number of transactions that CAM should queue before applying
back pressure. This should be revisted when we have real multi-queue
support in CAM and the upper layers of the I/O stack.

6 years agoMFC r322903 (by imp):
mav [Thu, 1 Feb 2018 16:51:11 +0000 (16:51 +0000)]
MFC r322903 (by imp):
Fill in reserved areas from NVMe spec in the IDENTIFY structure
(struct nvme_controller_data) as defined in the NVM Express
specification, revsion 1.3.

6 years agoMFC r322902 (by imp):
mav [Thu, 1 Feb 2018 16:50:25 +0000 (16:50 +0000)]
MFC r322902 (by imp):
NVME Namespace ID is 32-bits, so widen interface to reflect that.

6 years agoMFC r322901 (by imp): Add feature codes from NVMe 1.3 specification:
mav [Thu, 1 Feb 2018 16:49:28 +0000 (16:49 +0000)]
MFC r322901 (by imp): Add feature codes from NVMe 1.3 specification:

o Automomous Power State Transition
o Host Memory Buffer
o Timestamp
o Keep Alive Timer
o Host Controlled Thermal Management
o Non-Operational Power State Config

Also note that feature codes 0x78-0x7f are reserved for the NVMe
Management Interface.

6 years agoMFC r322874, r322875 (by imp): Sanity check sizes
mav [Thu, 1 Feb 2018 16:48:40 +0000 (16:48 +0000)]
MFC r322874, r322875 (by imp): Sanity check sizes

Add compile time sanity checks to make sure that packed structures are
the proper size, typically as defined in the NVMe standard.

6 years agoMFC r322872 (by imp):
mav [Thu, 1 Feb 2018 16:45:44 +0000 (16:45 +0000)]
MFC r322872 (by imp):
Enable bus mastering on the device before resetting the device. The
card has to do PCIe transactions to complete the reset process, but
can't do them, per the PCIe spec, unless bus mastering is enabled.

6 years agoMFC r322443 (by nwhitehorn):
mav [Thu, 1 Feb 2018 16:45:08 +0000 (16:45 +0000)]
MFC r322443 (by nwhitehorn):
Move NVME controller shutdown from being called as part of module unloading
to being called through the newbus DEVICE_SHUTDOWN() path. This ensures that
the NVME controller gets shut down before the device and bus disappear
and prevents data corruption on shutdown on at least Samsung EVO 960 SSDs.

PR: kern/211852

6 years agoMFC r322257 (by imp): Use the correct queue depth for nda devices.
mav [Thu, 1 Feb 2018 16:44:19 +0000 (16:44 +0000)]
MFC r322257 (by imp): Use the correct queue depth for nda devices.

6 years agoMFC r322036 (by imp):
mav [Thu, 1 Feb 2018 16:40:37 +0000 (16:40 +0000)]
MFC r322036 (by imp):
Make nvd vs nda choice boot-time rather than build-time

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.

6 years agoMFC r320984 (by imp):
mav [Thu, 1 Feb 2018 16:35:40 +0000 (16:35 +0000)]
MFC r320984 (by imp):
This adds CAM pass(4) support for NVMe IO's. Applications indicate
the IO type (Admin or NVM) using XPT op-codes XPT_NVME_ADMIN or
XPT_NVME_IO.

6 years agoMFC r303123 (by imp): Fix mismerge and include the nvme support.
mav [Thu, 1 Feb 2018 16:33:15 +0000 (16:33 +0000)]
MFC r303123 (by imp): Fix mismerge and include the nvme support.
Also, print out the name of any CCB's functions that's not supported.

6 years agoMFC r320424 (by imp): Add new definitions for namespaces.
mav [Thu, 1 Feb 2018 16:27:50 +0000 (16:27 +0000)]
MFC r320424 (by imp): Add new definitions for namespaces.

6 years agoMFC r314889 (by imp):
mav [Thu, 1 Feb 2018 16:27:10 +0000 (16:27 +0000)]
MFC r314889 (by imp):
Avoid dereferencing unintialized elements in the error path.

Some drives sometimes have errors for things like setting the number
of queue entries in the submission queue. The error paths taken for
these drives ensure a panic dereferencing uninialized data.

6 years agoMFC r314884 (by imp): Make multi-namespace nvme drives more robust.
mav [Thu, 1 Feb 2018 16:26:35 +0000 (16:26 +0000)]
MFC r314884 (by imp): Make multi-namespace nvme drives more robust.

Fix assumptions about name spaces in NVME driver. First, it assumes
cdata.nn is the number of configured devices. However, it is the
number of supported name spaces. Second, it assumes that there will
never be more than 16 name spaces supported, but a certain drive I'm
testing reports 1024. It assumes that name spaces are a tightly packed
namespace, but the standard seems to indicate otherwise. Finally, it
assumes that an error would be generated when quearying an
unconfigured namespace. Instead, it succeeds but the identify data is
all zeros.

Fix these by limiting the number of name spaces we probe to 16. Remove
aborting when we find one in error. When the size of the name space is
zero, ignore it.

This is admittedly a bandaide. The long term fix will be to
participate in the enumeration and name space change protocols
definfed in the NVNe standard.

6 years agoMFC r313113 (by imp):
mav [Thu, 1 Feb 2018 16:24:03 +0000 (16:24 +0000)]
MFC r313113 (by imp):
Ensure that the passthrough request will fit in MAXPHYS bytes after it
has been rounded to full pages. This avoids a panic in
vm_fault_quick_hold_pages due to this off-by-one error passing one
page too many into vmapbuf.

6 years agoMFC r308855 (by imp):
mav [Thu, 1 Feb 2018 16:22:28 +0000 (16:22 +0000)]
MFC r308855 (by imp):
Implement HGST Log page 0xc1, as documented in the HGST SN100 and
SN150 product manuals. Subpage 0x32 is documented, but not implemented.

6 years agoMFC r308854 (by imp): Print Intel's expanded Temperature log page.
mav [Thu, 1 Feb 2018 16:21:45 +0000 (16:21 +0000)]
MFC r308854 (by imp): Print Intel's expanded Temperature log page.

6 years agoMFC r308849 (by imp):
mav [Thu, 1 Feb 2018 16:20:44 +0000 (16:20 +0000)]
MFC r308849 (by imp):
Use a table for pages we know the size of. We have a special case for
the error log since it isn't a fixed size.

6 years agoMFC r308853 (by imp):
mav [Thu, 1 Feb 2018 16:16:09 +0000 (16:16 +0000)]
MFC r308853 (by imp):
Add log pages that Intel SSDs provide. It turns out that many of these
are widely implemented beyond just Intel drives.

6 years agoMFC r308852 (by imp):
mav [Thu, 1 Feb 2018 16:15:39 +0000 (16:15 +0000)]
MFC r308852 (by imp):
Add log pages defined through NVM Express 1.2.1.

6 years agoMFC r308851 (by imp):
mav [Thu, 1 Feb 2018 16:15:03 +0000 (16:15 +0000)]
MFC r308851 (by imp):
Expand the SMART / Health Information Log Page (Page 02) printout
based on NVM Express 1.2.1 Standard.

6 years agoMFC r308850 (by imp):
mav [Thu, 1 Feb 2018 16:13:28 +0000 (16:13 +0000)]
MFC r308850 (by imp):
Print numbers instead of hex values for smart data. The full 128-bit
number is printed, even though you'd need like a billion IOPs for a 10
billion seconds to overflow the 64-bit counters (~300 years).

6 years agoMFC r308431 (by scottl):
mav [Thu, 1 Feb 2018 15:46:19 +0000 (15:46 +0000)]
MFC r308431 (by scottl):
Convert the Q-Pair and PRP list memory allocations to use BUSDMA.  Add a
bunch of safery belts and error handling in related codepaths.

6 years agoMFC r303466: Kill a few stray debug printfs.
mav [Thu, 1 Feb 2018 15:32:48 +0000 (15:32 +0000)]
MFC r303466: Kill a few stray debug printfs.

6 years agoMFC r303126 (by imp):
mav [Thu, 1 Feb 2018 15:32:14 +0000 (15:32 +0000)]
MFC r303126 (by imp):
Actually import nvme_sim so the CAM attachment for NVME (nda) actually
works.