]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
6 years agoRemove redundant integer cast in ibcore. The "ref_count" field already
Hans Petter Selasky [Mon, 19 Mar 2018 13:51:33 +0000 (13:51 +0000)]
Remove redundant integer cast in ibcore. The "ref_count" field already
has integer type.

MFC after: 1 week
Sponsored by: Mellanox Technologies

6 years agoRemove note that `fwd tablearg` is supported only by IPv4. IPv6 is
Andrey V. Elsukov [Mon, 19 Mar 2018 10:50:27 +0000 (10:50 +0000)]
Remove note that `fwd tablearg` is supported only by IPv4. IPv6 is
supported too.

MFC after: 1 week

6 years agoPlug a possible memory leak.
Xin LI [Mon, 19 Mar 2018 05:49:26 +0000 (05:49 +0000)]
Plug a possible memory leak.

MFC after: 2 weeks

6 years agoUpdate my calendar entry to be more specific now that UTF8 turns out to be fine
Mateusz Guzik [Mon, 19 Mar 2018 00:25:10 +0000 (00:25 +0000)]
Update my calendar entry to be more specific now that UTF8 turns out to be fine

6 years agoThe gids argument can be declared as const.
Mariusz Zaborski [Sun, 18 Mar 2018 19:50:32 +0000 (19:50 +0000)]
The gids argument can be declared as const.
We don't modified it in this function.

6 years agoAdd the device/chip type to the disk d_descr field, and print more info
Ian Lepore [Sun, 18 Mar 2018 18:58:47 +0000 (18:58 +0000)]
Add the device/chip type to the disk d_descr field, and print more info
about the chip including the erase block size at attach time.

Also add myself to the copyrights since at this point svn blame would point
to me as the culprit for much of this.

6 years agoDon't add links or cleanfiles for NO_OBJ case, in addition to not
Warner Losh [Sun, 18 Mar 2018 18:50:48 +0000 (18:50 +0000)]
Don't add links or cleanfiles for NO_OBJ case, in addition to not
creating them. Move them under the if after the all: target.  They are
just defines, so it doesn't really matter where we have them.

MFC After: 3 days

6 years agoAdd support for 4K and 32K erase block sizes. Many of the supported chips
Ian Lepore [Sun, 18 Mar 2018 18:37:47 +0000 (18:37 +0000)]
Add support for 4K and 32K erase block sizes.  Many of the supported chips
have these flags set in the ident table, but there was no code to support
using the smaller erase sizes.

6 years agoMake all internal routines return an int error status, and check the
Ian Lepore [Sun, 18 Mar 2018 17:47:57 +0000 (17:47 +0000)]
Make all internal routines return an int error status, and check the
status at all call points.  Combine the get_status and wait_for_ready
routines, since waiting for ready is the only reason to ever get status.

6 years agoFix reference to man page in Makefile.
Mariusz Zaborski [Sun, 18 Mar 2018 17:27:37 +0000 (17:27 +0000)]
Fix reference to man page in Makefile.
I broke it in r331120.

6 years agoAdd sc_parent to the softc and use it in place of device_get_parent() calls
Ian Lepore [Sun, 18 Mar 2018 17:25:23 +0000 (17:25 +0000)]
Add sc_parent to the softc and use it in place of device_get_parent() calls
all over the place.  Also pass the softc as the arg to all the internal
functions instead of passing a device_t and calling device_get_softc() in
each function.

6 years agoUse __syscall(2) rather than syscall(2) in syscall/tst.args.c.
Mark Johnston [Sun, 18 Mar 2018 17:03:26 +0000 (17:03 +0000)]
Use __syscall(2) rather than syscall(2) in syscall/tst.args.c.

Some of mmap(2)'s arguments are 64 bits wide.

MFC after: 3 days

6 years agoFix an access of an uninitialized variable in dtrace_probe().
Mark Johnston [Sun, 18 Mar 2018 17:01:50 +0000 (17:01 +0000)]
Fix an access of an uninitialized variable in dtrace_probe().

Reported by: Coverity, via cem
MFC after: 3 days

6 years agoBugfix: wait for writes/erases to complete after starting them, instead of
Ian Lepore [Sun, 18 Mar 2018 16:52:31 +0000 (16:52 +0000)]
Bugfix: wait for writes/erases to complete after starting them, instead of
before starting them.

Using the wait-before logic would make sense if there was useful time-
consuming work that could be done between the end of one write and the
beginning of the next, but it also requires doing the wait-for-ready before
reading, because a prior write or erase could still be in progress.  Reading
is the far more common case, so adding a whole extra bus transaction to
check for ready before each read would soak up any small gains that might be
had from doing async writes.

6 years agoAvoid dequeuing the fault page during a soft fault.
Mark Johnston [Sun, 18 Mar 2018 16:49:30 +0000 (16:49 +0000)]
Avoid dequeuing the fault page during a soft fault.

Such pages are re-enqueued at the end of the fault handler, preserving
LRU. Rather than performing two separate operations per fault, simply
requeue the page at the end of the fault (or bump its activation count
if it resides in PQ_ACTIVE, avoiding the page queue lock entirely).
This elides some page lock and page queue lock operations in common
cases, e.g., CoW faults.

Note that we must still dequeue the source page for "optimized" CoW
faults since the page may not remain enqueued while it is moved to
another object.

Reviewed by: alc, kib
Tested by: pho
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D14625

6 years agoHave vm_page_{deactivate,launder}() requeue already-queued pages.
Mark Johnston [Sun, 18 Mar 2018 16:40:56 +0000 (16:40 +0000)]
Have vm_page_{deactivate,launder}() requeue already-queued pages.

In many cases the page is not enqueued so the change will have no
effect. However, the change is needed to support an optimization in
the fault handler and in some cases (sendfile, the buffer cache) it
was being emulated by the caller anyway.

Reviewed by: alc
Tested by: pho
MFC after: 2 weeks
X-Differential Revision: https://reviews.freebsd.org/D14625

6 years agoEliminate some unneeded intermediate variables. Eliminate some redundant
Ian Lepore [Sun, 18 Mar 2018 16:36:14 +0000 (16:36 +0000)]
Eliminate some unneeded intermediate variables.  Eliminate some redundant
parens in shift-and-mask expressions.  Reword and reflow some comments.

6 years agoHave vm_page_replace() assert that the new page is not enqueued.
Mark Johnston [Sun, 18 Mar 2018 16:35:40 +0000 (16:35 +0000)]
Have vm_page_replace() assert that the new page is not enqueued.

The new page does not belong to a VM object, but the page daemon does
not expect to encounter such pages.

Reviewed by: alc, kib
Tested by: pho
MFC after: 1 week
X-Differential Revision: https://reviews.freebsd.org/D14625

6 years agoFix typo.
Edward Tomasz Napierala [Sun, 18 Mar 2018 16:24:11 +0000 (16:24 +0000)]
Fix typo.

MFC after: 2 weeks

6 years agoRemove a pointless KASSERT and reword a comment a bit. The KASSERT tested
Ian Lepore [Sun, 18 Mar 2018 16:10:14 +0000 (16:10 +0000)]
Remove a pointless KASSERT and reword a comment a bit.  The KASSERT tested
for the same condition that the preceeding lines checked for and would have
returned EIO, so the assert could never possibly trigger (sc_sectorsize must
inherently be an integer multiple of FLASH_PAGE_SIZE).

6 years agoFix similar typos to r331124.
Mariusz Zaborski [Sun, 18 Mar 2018 16:06:35 +0000 (16:06 +0000)]
Fix similar typos to r331124.

6 years agoFix typo.
Mariusz Zaborski [Sun, 18 Mar 2018 16:02:41 +0000 (16:02 +0000)]
Fix typo.

Submitted by: Trond Endrestøl <Trond.Endrestol@ximalas.info>

6 years agoDo not overwrite the contents of BIO_WRITE buffers. SPI inherently
Ian Lepore [Sun, 18 Mar 2018 15:56:10 +0000 (15:56 +0000)]
Do not overwrite the contents of BIO_WRITE buffers.  SPI inherently
transfers data in both directions at once.  When writing to the device,
use a dummy buffer for the incoming data, not the same buffer as the
outgoing data.  Writes are done in FLASH_PAGE_SIZE chunks, which is only
256 bytes, so just put the dummy buffer into the softc.

6 years agoHere's the new development(7), which removes information that's
Edward Tomasz Napierala [Sun, 18 Mar 2018 15:44:07 +0000 (15:44 +0000)]
Here's the new development(7), which removes information that's
no longer relevant (read: most of what was there) and adds some
quick links to point newcomers in the right direction.

Reviewed by: imp@
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D14680

6 years agoUpdate libcasper references to all new man pages.
Mariusz Zaborski [Sun, 18 Mar 2018 15:24:45 +0000 (15:24 +0000)]
Update libcasper references to all new man pages.
Remove obsolete example. All services has they own example.
This example also show old type of limiting method which is
not recommended to use.

Reviewed by: bcr@
Differential Revision: https://reviews.freebsd.org/D14607

6 years agoDocument the sysctl Casper service.
Mariusz Zaborski [Sun, 18 Mar 2018 15:16:47 +0000 (15:16 +0000)]
Document the sysctl Casper service.

PR: 226102
Reviewed by: bcr@
Differential Revision: https://reviews.freebsd.org/D14606

6 years agoDocument the pwd Casper service.
Mariusz Zaborski [Sun, 18 Mar 2018 15:13:37 +0000 (15:13 +0000)]
Document the pwd Casper service.

PR: 226102
Reviewed by: bcr@
Differential Revision: https://reviews.freebsd.org/D14605

6 years agoRemove unneeded variable which was introduced in r328472.
Mariusz Zaborski [Sun, 18 Mar 2018 15:09:55 +0000 (15:09 +0000)]
Remove unneeded variable which was introduced in r328472.

Pointed out by: pjd@

6 years agolib(private)zstd: Fix riscv build
Conrad Meyer [Sun, 18 Mar 2018 03:42:57 +0000 (03:42 +0000)]
lib(private)zstd: Fix riscv build

Link __bswap[ds]i2() intrinsics in to libzstd for riscv, where the C runtime
apparently lacks such intrinsics.

Broken in r330894.

Reported by: asomers
Sponsored by: Dell EMC Isilon

6 years agoXr crashinfo(8) from savecore(8).
Edward Tomasz Napierala [Sat, 17 Mar 2018 21:58:41 +0000 (21:58 +0000)]
Xr crashinfo(8) from savecore(8).

MFC after: 2 weeks

6 years agolocks: slightly depessimize lockstat
Mateusz Guzik [Sat, 17 Mar 2018 19:26:33 +0000 (19:26 +0000)]
locks: slightly depessimize lockstat

The slow path is always taken when lockstat is enabled. This induces
rdtsc (or other) calls to get the cycle count even when there was no
contention.

Still go to the slow path to not mess with the fast path, but avoid
the heavy lifting unless necessary.

This reduces sys and real time during -j 80 buildkernel:
before: 3651.84s user 1105.59s system 5394% cpu 1:28.18 total
after: 3685.99s user 975.74s system 5450% cpu 1:25.53 total
disabled: 3697.96s user 411.13s system 5261% cpu 1:18.10 total

So note this is still a significant hit.

LOCK_PROFILING results are not affected.

6 years agoMove the dirty queues inside the per-domain structure. This resolves a bug
Jeff Roberson [Sat, 17 Mar 2018 18:14:49 +0000 (18:14 +0000)]
Move the dirty queues inside the per-domain structure.  This resolves a bug
where we had not hit global dirty limits but a single queue was starved
for space by dirty buffers.  A single buf_daemon is maintained for now.

Add a bd_speedup() when we are low on bufspace.  This can happen due to SUJ
keeping many bufs locked until a cg block is written.  Document this with
a comment.

Fix sysctls to work with per-domain variables.  Add more ddb debugging.

Reported by: pho
Reviewed by: kib
Tested by: pho
Sponsored by: Netflix, Dell/EMC Isilon
Differential Revision: https://reviews.freebsd.org/D14705

6 years agoaudit(4): fix a typo in a comment
Alan Somers [Sat, 17 Mar 2018 17:56:08 +0000 (17:56 +0000)]
audit(4): fix a typo in a comment

no functional change

6 years agoaio_kqueue_test: fix the build when DEBUG=1
Alan Somers [Sat, 17 Mar 2018 17:52:47 +0000 (17:52 +0000)]
aio_kqueue_test: fix the build when DEBUG=1

Also, make the debug output more verbose

6 years agoaio: add an ATF test case for aio_fsync error conditions
Alan Somers [Sat, 17 Mar 2018 17:48:21 +0000 (17:48 +0000)]
aio: add an ATF test case for aio_fsync error conditions

6 years agoUse kern.opts.mk instead of bsd.own.mk (which includes src.opts.mk)
Warner Losh [Sat, 17 Mar 2018 17:18:46 +0000 (17:18 +0000)]
Use kern.opts.mk instead of bsd.own.mk (which includes src.opts.mk)
here.

6 years agoUse FreeBSD-current conventions for building options rather than
Warner Losh [Sat, 17 Mar 2018 17:18:41 +0000 (17:18 +0000)]
Use FreeBSD-current conventions for building options rather than
FreeBSD 10 conventions: inlude kern.opts.mk.

6 years agoRemove commented out code to generate opt_inet*.h. That's handled
Warner Losh [Sat, 17 Mar 2018 17:18:37 +0000 (17:18 +0000)]
Remove commented out code to generate opt_inet*.h. That's handled
automatically by kern.opts.mk now. Include that instead.

6 years agoAdd EFI to kernel options.
Warner Losh [Sat, 17 Mar 2018 17:18:29 +0000 (17:18 +0000)]
Add EFI to kernel options.

Some parts of MI modules will soon depend on whether EFI is available
or not. Add EFI to the list of kernel options so we can use it in
the modules build.

6 years agoFix outgoing TCP/UDP packet drop on arp/ndp entry expiration.
Alexander V. Chernikov [Sat, 17 Mar 2018 17:05:48 +0000 (17:05 +0000)]
Fix outgoing TCP/UDP packet drop on arp/ndp entry expiration.

Current arp/nd code relies on the feedback from the datapath indicating
 that the entry is still used. This mechanism is incorporated into the
 arpresolve()/nd6_resolve() routines. After the inpcb route cache
 introduction, the packet path for the locally-originated packets changed,
 passing cached lle pointer to the ether_output() directly. This resulted
 in the arp/ndp entry expire each time exactly after the configured max_age
 interval. During the small window between the ARP/NDP request and reply
 from the router, most of the packets got lost.

Fix this behaviour by plugging datapath notification code to the packet
 path used by route cache. Unify the notification code by using single
 inlined function with the per-AF callbacks.

Reported by: sthaug at nethelp.no
Reviewed by: ae
MFC after: 2 weeks

6 years agoOnly take out the periph lock when we're modifying the flags of the
Warner Losh [Sat, 17 Mar 2018 16:04:06 +0000 (16:04 +0000)]
Only take out the periph lock when we're modifying the flags of the
softc for an async unit attention. CAM locks, sometimes, the periph
lock and other times does not. We were taking the lock always and
running into lock recursion issues on a non-recursive lock. Now we
take it selectively. It's not clear why xpt takes the lock selectively
before calling us, though, and that's still under investigation.

Reported by: avg
PR: 226510 (same panic, differnt circumstances)
Sponsored by: Netflix

6 years agoMove assym.s to DPSRCS in vmbus module
Ed Maste [Sat, 17 Mar 2018 14:50:20 +0000 (14:50 +0000)]
Move assym.s to DPSRCS in vmbus module

assym.s is only to be included by other .s files, and should not
actually be assembled by itself.

6 years agoRevert r313780 (UFS_ prefix)
Ed Maste [Sat, 17 Mar 2018 12:59:55 +0000 (12:59 +0000)]
Revert r313780 (UFS_ prefix)

6 years agoFix formatting errors that resulted in apropos(1) output looking weird.
Edward Tomasz Napierala [Sat, 17 Mar 2018 11:41:06 +0000 (11:41 +0000)]
Fix formatting errors that resulted in apropos(1) output looking weird.

MFC after: 2 weeks

6 years agoPrefix UFS symbols with UFS_ to reduce namespace pollution
Ed Maste [Sat, 17 Mar 2018 01:48:27 +0000 (01:48 +0000)]
Prefix UFS symbols with UFS_ to reduce namespace pollution

Followup to r313780.  Also prefix ext2's and nandfs's versions with
EXT2_ and NANDFS_.

Reported by: kib
Reviewed by: kib, mckusick
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D9623

6 years agoANSIfy sys/x86
Ed Maste [Sat, 17 Mar 2018 01:40:09 +0000 (01:40 +0000)]
ANSIfy sys/x86

6 years agoelftoolchain nm(1): Initialize allocated memory before use
Conrad Meyer [Fri, 16 Mar 2018 22:25:33 +0000 (22:25 +0000)]
elftoolchain nm(1): Initialize allocated memory before use

In out of memory scenarios (where one of these allocations failed but
other(s) did not), nm(1) could reference the uninitialized value of these
allocations (undefined behavior).

Always initialize any successful allocations as the most expedient
resolution of the issue.  However, I would encourage upstream elftoolchain
contributors to clean up the error path to just abort immediately, rather
than proceeding sloppily when one allocation fails.

Reported by: Coverity
Sponsored by: Dell EMC Isilon

6 years agoAdd _IOC_NEWLEN() and _IOC_NEWTYPE() macros.
Brooks Davis [Fri, 16 Mar 2018 22:23:04 +0000 (22:23 +0000)]
Add _IOC_NEWLEN() and _IOC_NEWTYPE() macros.

These macros take an existing ioctl(2) command and replace the length
with the specified length or length of the specified type respectively.
These can be used to define commands for 32-bit compatibility with fewer
opportunities for cut-and-paste errors then a whole new definition.

Reviewed by: cem, kib
Obtained from: CheriBSD
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D14706

6 years agolibdtrace: Fix another uninitialized dtt_flags UB
Conrad Meyer [Fri, 16 Mar 2018 21:10:36 +0000 (21:10 +0000)]
libdtrace: Fix another uninitialized dtt_flags UB

Like r331073, eliminate a UB by fully initializing the struct with a designated
initializer.  Note that the similar src_dtt is not fully used, so a similar
treatment was not absolutely required.  I chose to leave it alone.  It
wouldn't hurt to do the same thing, though.

Reported by: Coverity
Sponsored by: Dell EMC Isilon

6 years agoAdd myself to committers-ports.dot
Devin Teske [Fri, 16 Mar 2018 21:03:54 +0000 (21:03 +0000)]
Add myself to committers-ports.dot

Reviewed by: imp
Approved by: imp (mentor)
Differential Revision: https://reviews.freebsd.org/D14688

6 years agotelnetd(8): Fix dereference of uninitialized value 'IF'
Conrad Meyer [Fri, 16 Mar 2018 20:59:56 +0000 (20:59 +0000)]
telnetd(8): Fix dereference of uninitialized value 'IF'

Reported by: Coverity
Sponsored by: Dell EMC Isilon

6 years agolibdtrace: Eliminate a minor UB by fully initializing parameter struct
Conrad Meyer [Fri, 16 Mar 2018 20:43:40 +0000 (20:43 +0000)]
libdtrace: Eliminate a minor UB by fully initializing parameter struct

The dtt_flags value is dereferenced by dt_type_pointer() and must be
initialized first.

Reported by: Coverity
Sponsored by: Dell EMC Isilon

6 years agorandom(4): Poll for signals during large reads
Conrad Meyer [Fri, 16 Mar 2018 18:50:26 +0000 (18:50 +0000)]
random(4): Poll for signals during large reads

Occasionally poll for signals during large reads of the /dev/u?random
devices.  This allows cancellation via SIGINT of accidental invocations of
very large reads.  (A 2GB /dev/random read, which takes about 10 seconds on
my 2017 AMD Zen processor, can be aborted.)

I believe this behavior was intended since 2014 (r273997), just not fully
implemented.

This is motivated by a potential getrandom(2) interface that may not
explicitly forbid extremely large reads on 64-bit platforms -- even larger
than the 2GB limit imposed on devfs I/O by default.  Such reads, if they are
to be allowed, should be cancellable by the user or administrator.

Reviewed by: delphij
Approved by: secteam (delphij)
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D14684

6 years agoMake not getting BootOrder a warning, not a fatal error when printing.
Warner Losh [Fri, 16 Mar 2018 18:16:31 +0000 (18:16 +0000)]
Make not getting BootOrder a warning, not a fatal error when printing.

Sponsored by: Netflix

6 years agoUse EFI RTC capabilities info when registering, add bootverbose diagnostics.
Ian Lepore [Fri, 16 Mar 2018 18:16:27 +0000 (18:16 +0000)]
Use EFI RTC capabilities info when registering, add bootverbose diagnostics.

Make some small improvements to the efirtc driver by obtaining the clock
capabilities (resolution and whether the sub-second counters are reset) and
using the info when registering the clock. When the hardware zeroes out the
subsecond info on clock-set, schedule clock updates to happen just before
top-of-second, so that the RTC time is closely in-sync with kernel time.

Also, in the identify() routine, always add the driver if EFI runtime
services are available, then decide in probe() whether to attach the driver
or not. If not attaching and bootverbose is on, say why. All of this is
basically to avoid "silent failure" -- if someone thinks there should be an
efi rtc and it's not attaching, at least they can set bootverbose and maybe
get a clue from the output.

Differential Revision: https://reviews.freebsd.org/D14565 (timed out)

6 years agoOnly print boot order / boot current if we can get the variables from
Warner Losh [Fri, 16 Mar 2018 18:12:50 +0000 (18:12 +0000)]
Only print boot order / boot current if we can get the variables from
the loader. Some UEFI implementations don't return all of them.

Sponsored by: Netflix

6 years agoPull in r321999 from upstream clang trunk (by Ivan A. Kosarev):
Dimitry Andric [Fri, 16 Mar 2018 18:04:13 +0000 (18:04 +0000)]
Pull in r321999 from upstream clang trunk (by Ivan A. Kosarev):

  [CodeGen] Fix TBAA info for accesses to members of base classes

  Resolves:
  Bug 35724 - regression (r315984): fatal error: error in backend:
  Broken function found (Did not see access type in access path!)
  https://bugs.llvm.org/show_bug.cgi?id=35724

  Differential Revision: https://reviews.llvm.org/D41547

This fixes "Did not see access type in access path" fatal errors when
building the devel/gdb port (version 8.1).

Reported by: jbeich
PR: 226658
MFC after: 3 months
X-MFC-With: r327952

6 years agoPull in r327638 from upstream llvm trunk (by Matthew Simpson):
Dimitry Andric [Fri, 16 Mar 2018 17:50:44 +0000 (17:50 +0000)]
Pull in r327638 from upstream llvm trunk (by Matthew Simpson):

  [ConstantFolding, InstSimplify] Handle more vector GEPs

  This patch addresses some additional cases where the compiler crashes
  upon encountering vector GEPs. This should fix PR36116.

  Differential Revision: https://reviews.llvm.org/D44219
  Reference: https://bugs.llvm.org/show_bug.cgi?id=36116

This fixes an assertion when building the emulators/snes9x port.

Reported by: jbeich
PR: 225471
MFC after: 3 months
X-MFC-With: r327952

6 years agoExtend SSID maximum string length to 32 chars to support longer SSID
Kirill Ponomarev [Fri, 16 Mar 2018 16:56:56 +0000 (16:56 +0000)]
Extend SSID maximum string length to 32 chars to support longer SSID
names.

Approved by: adrian
Differential Revision: https://reviews.freebsd.org/D14710

6 years agoAdd the header file needed for the recently-added call to pagedaemon_wakeup().
Ian Lepore [Fri, 16 Mar 2018 16:06:25 +0000 (16:06 +0000)]
Add the header file needed for the recently-added call to pagedaemon_wakeup().

6 years agoSet the inp_vflag consistently for accepted TCP/IPv6 connections when
Michael Tuexen [Fri, 16 Mar 2018 15:26:07 +0000 (15:26 +0000)]
Set the inp_vflag consistently for accepted TCP/IPv6 connections when
net.inet6.ip6.v6only=0.

Without this patch, the inp_vflag would have INP_IPV4 and the
INP_IPV6 flags for accepted TCP/IPv6 connections if the sysctl
variable net.inet6.ip6.v6only is 0. This resulted in netstat
to report the source and destination addresses as IPv4 addresses,
even they are IPv6 addresses.

PR: 226421
Reviewed by: bz, hiren, kib
MFC after: 3 days
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D13514

6 years agoChase r331057 in libsysdecode erno table
Ed Maste [Fri, 16 Mar 2018 15:15:25 +0000 (15:15 +0000)]
Chase r331057 in libsysdecode erno table

6 years agolinux_errno.c: add newer errno values
Ed Maste [Fri, 16 Mar 2018 14:51:47 +0000 (14:51 +0000)]
linux_errno.c: add newer errno values

Also introduce a static assert to ensure the list is kept up to date.

Sponsored by: Turing Robotic Industries Inc.

6 years agoShare a single bsd-linux errno table across MD consumers
Ed Maste [Fri, 16 Mar 2018 14:46:38 +0000 (14:46 +0000)]
Share a single bsd-linux errno table across MD consumers

Three copies of the linuxulator linux_sysvec.c contained identical
BSD to Linux errno translation tables, and future work to support other
architectures will also use the same table.  Move the table to a common
file to be used by all.  Make it 'const int' to place it in .rodata.

(Some existing Linux architectures use MD errno values, but x86 and Arm
share the generic set.)

This change should introduce no functional change; a followup will add
missing errno values.

MFC after: 3 weeks
Sponsored by: Turing Robotic Industries Inc.
Differential Revision: https://reviews.freebsd.org/D14665

6 years agoMove assym.s to DPSRC in sgx module
Ed Maste [Fri, 16 Mar 2018 13:33:42 +0000 (13:33 +0000)]
Move assym.s to DPSRC in sgx module

assym.s is only to be included by other .s files, and should not
actually be assembled by itself.

6 years agoANSIfy i386/vm86.c
Ed Maste [Fri, 16 Mar 2018 12:12:41 +0000 (12:12 +0000)]
ANSIfy i386/vm86.c

6 years agoGarbage collect unused chacha20 code
Conrad Meyer [Fri, 16 Mar 2018 07:11:53 +0000 (07:11 +0000)]
Garbage collect unused chacha20 code

Two copies of chacha20 were imported into the tree on Apr 15 2017 (r316982)
and Apr 16 2017 (r317015).  Only the latter is actually used by anything, so
just go ahead and garbage collect the unused version while it's still only
in CURRENT.

I'm not making any judgement on which implementation is better.  If I pulled
the wrong one, feel free to swap the existing implementation out and replace
it with the other code (conforming to the API that actually gets used in
randomdev, of course).  We only need one generic implementation.

Sponsored by: Dell EMC Isilon

6 years agoFix GCC build: Remove redundant pagedaemon_wakeup declaration
Conrad Meyer [Fri, 16 Mar 2018 07:05:09 +0000 (07:05 +0000)]
Fix GCC build: Remove redundant pagedaemon_wakeup declaration

Introduced in r331018.

Reported by: kevans
Sponsored by: Dell EMC Isilon

6 years agoTry polling the qpairs on timeout.
Warner Losh [Fri, 16 Mar 2018 05:23:48 +0000 (05:23 +0000)]
Try polling the qpairs on timeout.

On some systems, we're getting timeouts when we use multiple queues on
drives that work perfectly well on other systems. On a hunch, Jim
Harris suggested I poll the completion queue when we get a timeout.
This patch polls the completion queue if no fatal status was
indicated. If it had pending I/O, we complete that request and
return. Otherwise, if aborts are enabled and no fatal status, we abort
the command and return. Otherwise we reset the card.

This may clear up the problem, or we may see it result in lots of
timeouts and a performance problem. Either way, we'll know the next
step. We may also need to pay attention to the fatal status bit
of the controller.

PR: 211713
Suggested by: Jim Harris
Sponsored by: Netflix

6 years agoAdd required interface header.
Ian Lepore [Fri, 16 Mar 2018 02:46:08 +0000 (02:46 +0000)]
Add required interface header.

Reported by: andreast@

6 years agortwn(4): de-hardcode ('h/w rate index' - 'corresponding MCS index') constant
Andriy Voskoboinyk [Fri, 16 Mar 2018 01:03:10 +0000 (01:03 +0000)]
rtwn(4): de-hardcode ('h/w rate index' - 'corresponding MCS index') constant

6 years agourtw(4), zyd(4): reduce code verbosity.
Andriy Voskoboinyk [Fri, 16 Mar 2018 00:38:10 +0000 (00:38 +0000)]
urtw(4), zyd(4): reduce code verbosity.

No functional change intended.

6 years agourtw(4): provide names for some commonly used rate indices + drop
Andriy Voskoboinyk [Fri, 16 Mar 2018 00:09:16 +0000 (00:09 +0000)]
urtw(4): provide names for some commonly used rate indices + drop
now-unused urtw_rate2rtl()

6 years agoCorrect comment for IFM_IEEE80211_VHT media variant.
Andriy Voskoboinyk [Thu, 15 Mar 2018 23:32:29 +0000 (23:32 +0000)]
Correct comment for IFM_IEEE80211_VHT media variant.

6 years agoAdd a request structure and make the implementation use it.
Brooks Davis [Thu, 15 Mar 2018 21:42:49 +0000 (21:42 +0000)]
Add a request structure and make the implementation use it.

This allows compatibility translation to take place on the stack
(md_ioctl is too big) and is more suitable as a public interface within
the kernel than the kern_ioctl interface.

Except for the initialization of the md_req from the md_ioctl
(including detection of kernel md_file pointers) and the updating
of the md_ioctl prior to return, this is a mechanical replacment
of md_ioctl and mdio with md_req and mdr.

Reviewed by: markj, cem, kib (assorted versions)
Obtained from: CheriBSD
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D14704

6 years agoFinish removal of dataacq.h (r330716) and pcaudioio.h (r330766).
Brooks Davis [Thu, 15 Mar 2018 21:31:19 +0000 (21:31 +0000)]
Finish removal of dataacq.h (r330716) and pcaudioio.h (r330766).

6 years agoEliminate pageout wakeup races. Take another step towards lockless
Jeff Roberson [Thu, 15 Mar 2018 19:23:07 +0000 (19:23 +0000)]
Eliminate pageout wakeup races.  Take another step towards lockless
vmd_free_count manipulation.  Reduce the scope of the free lock by
using a pageout lock to synchronize sleep and wakeup.  Only trigger
the pageout daemon on transitions between states.  Drive all wakeup
operations directly as side-effects from freeing memory rather than
requiring an additional function call.

Reviewed by: markj, kib
Tested by: pho
Sponsored by: Netflix, Dell/EMC Isilon
Differential Revision: https://reviews.freebsd.org/D14612

6 years agoAdd a space between a section number and a following comma.
Mark Johnston [Thu, 15 Mar 2018 19:03:54 +0000 (19:03 +0000)]
Add a space between a section number and a following comma.

Fix some nits from igor while here.

MFC after: 3 days

6 years agoModify rc.d/fsck to handle new status from fsck/fsck_ffs
David Bright [Thu, 15 Mar 2018 18:29:56 +0000 (18:29 +0000)]
Modify rc.d/fsck to handle new status from fsck/fsck_ffs

r328013 introduced a new error code from fsck_ffs that indicates that
it could not completely fix the file system; this happens when it
prints the message PLEASE RERUN FSCK. However, this status can happen
when fsck is run in "preen" mode and the rc.d/fsck script does not
handle that error code. Modify rc.d/fsck so that if "fsck -p"
("preen") returns the new status code (16) it will run "fsck -y", as
it currently does for a status code of 8 (the "standard error exit").

Reported by: markj
Reviewed by: mckusick, markj, ian, rgrimes
MFC after: 3 days
Sponsored by: Dell EMC
Differential Revision: https://reviews.freebsd.org/D14679

6 years agoMove implementation of ioctls into kern_*() functions.
Brooks Davis [Thu, 15 Mar 2018 18:12:55 +0000 (18:12 +0000)]
Move implementation of ioctls into kern_*() functions.

Move locks from outside ioctl to the individual implementations.

This is the first step of changing the implementations to act on a
kernel-internal request struct rather than on struct md_ioctl and to
removing the use of kern_ioctl in mountroot.

Reviewed by: cem, kib, markj (prior version)
Obtained from: CheriBSD
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D14700

6 years agoFix iSCSI target crash on session reinstation.
Edward Tomasz Napierala [Thu, 15 Mar 2018 17:36:13 +0000 (17:36 +0000)]
Fix iSCSI target crash on session reinstation.

The crash scenario goes like this: there's a thread waiting on "reinstate";
because it doesn't update the timeout counter it gets terminated by the
callout; at this point the maintenance thread starts the termination routine.
The first thread finishes waiting, proceeds to icl_conn_handoff(), and drops
the refcount, which allows the maintenance thread to free its resources.  At
this point another thread receives a PDU.  Boom.

PR: 222898, 219866
Reported by: Eugene M. Zheganin <emz at norma.perm.ru>
Tested by: Eugene M. Zheganin <emz at norma.perm.ru>
Reviewed by: mav@ (earlier version)
MFC after: 2 weeks
Sponsored by: playkey.net

6 years agoRestore the behavior of returning the total number of units by
Brooks Davis [Thu, 15 Mar 2018 16:37:43 +0000 (16:37 +0000)]
Restore the behavior of returning the total number of units by
unconditionally incrementing i in the loop;

Reported by: cem
MFC with: r330880
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D14685

6 years agoaesni(4): Stylistic/comment enhancements
Conrad Meyer [Thu, 15 Mar 2018 16:17:02 +0000 (16:17 +0000)]
aesni(4): Stylistic/comment enhancements

Improve clarity of a comment and style(9) some areas.

No functional change.

Reported by: markj (on review of a mostly-copied driver)
Sponsored by: Dell EMC Isilon

6 years agoAdd termcap entries for the st terminal (https://st.sucksless.org)
Baptiste Daroussin [Thu, 15 Mar 2018 15:13:17 +0000 (15:13 +0000)]
Add termcap entries for the st terminal (https://st.sucksless.org)

MFC after: 3 days

6 years agoFix tab vs space indentation
Baptiste Daroussin [Thu, 15 Mar 2018 15:05:26 +0000 (15:05 +0000)]
Fix tab vs space indentation

MFC after: 3 days

6 years agozfs test suite: move definition of DISK to the cfg file in zpool_get
Andriy Gapon [Thu, 15 Mar 2018 14:47:53 +0000 (14:47 +0000)]
zfs test suite: move definition of DISK to the cfg file in zpool_get

The variable is used not only by the setup script but also by the
atf test bodies.

Another one that should have been in r331001.

6 years agozfs test suite: add new pool properties / features to the zpool_get list
Andriy Gapon [Thu, 15 Mar 2018 14:41:09 +0000 (14:41 +0000)]
zfs test suite: add new pool properties / features to the zpool_get list

6 years agozfs test suite: move definition of DISK to the cfg file in zpool_get
Andriy Gapon [Thu, 15 Mar 2018 14:35:46 +0000 (14:35 +0000)]
zfs test suite: move definition of DISK to the cfg file in zpool_get

The variable is used not only by the setup script but also by the
atf test bodies.

This should have been in r331001.

6 years agozfs test suite: move definition of DISK to the cfg file in zpool_export
Andriy Gapon [Thu, 15 Mar 2018 14:23:31 +0000 (14:23 +0000)]
zfs test suite: move definition of DISK to the cfg file in zpool_export

The variable is used not only by the setup script but also by the
atf test bodies.

6 years agoMake getnameinfo(3) salen requirement less strict and
Hiroki Sato [Thu, 15 Mar 2018 13:46:28 +0000 (13:46 +0000)]
Make getnameinfo(3) salen requirement less strict and
document details of salen in getnameinfo(3) manual page.

getnameinfo(3) returned EAI_FAIL when salen was not equal to
the length corresponding to the value specified by sa->sa_family.
However, POSIX or RFC 3493 does not require it and RFC 4038
Sec.6.2.3 shows an example passing sizeof(struct sockaddr_storage)
to salen.

This change makes the requirement less strict by accepting
salen up to sizeof(struct sockaddr_storage).  It also includes
two more changes: one is to fix return values because both SUSv4
and RFC 3493 require EAI_FAMILY when the address length is invalid,
another is to fix sa_len dependency in PF_LOCAL.

Pointed out by: Christophe Beauval
Reviewed by: ae
Differential Revision: https://reviews.freebsd.org/D14585

6 years agozfs test suite: support device paths with intermediate directories
Andriy Gapon [Thu, 15 Mar 2018 12:47:34 +0000 (12:47 +0000)]
zfs test suite: support device paths with intermediate directories

The code assumed that disks (devices) used for testing are always named
like /dev/foo, but there is no reason for that restriction and we can
easily support paths like /dev/stripe/bar.

6 years agozfs test suite: fix a typo, TESTPOOL vs TESTPOOL2
Andriy Gapon [Thu, 15 Mar 2018 12:44:13 +0000 (12:44 +0000)]
zfs test suite: fix a typo, TESTPOOL vs TESTPOOL2

6 years agozfs test suite: destroy old gnops before creating new ones
Andriy Gapon [Thu, 15 Mar 2018 12:42:19 +0000 (12:42 +0000)]
zfs test suite: destroy old gnops before creating new ones

6 years agozfs test suite: align zfs_destroy_005_neg: with upstream
Andriy Gapon [Thu, 15 Mar 2018 12:40:43 +0000 (12:40 +0000)]
zfs test suite: align zfs_destroy_005_neg: with upstream

The change is to account for a different order in which the recursive
destroy may be attempted.  If we first try a dataset that can be destroyed
then it will be destroyed, but if we first try a dataset that cannot be
destroyed then we will not attempt to destroy the other dataset.

6 years agozfs test suite: fix a typo, da0 vs $disk
Andriy Gapon [Thu, 15 Mar 2018 12:35:22 +0000 (12:35 +0000)]
zfs test suite: fix a typo, da0 vs $disk

6 years agore-enable zfs_copies_006_pos test after a fix in r330977
Andriy Gapon [Thu, 15 Mar 2018 09:28:10 +0000 (09:28 +0000)]
re-enable zfs_copies_006_pos test after a fix in r330977

The test was disabled in r329408.

PR: 225960

6 years agog_access: deal with races created by geoms that drop the topology lock
Andriy Gapon [Thu, 15 Mar 2018 09:16:10 +0000 (09:16 +0000)]
g_access: deal with races created by geoms that drop the topology lock

The problem is that g_access() must be called with the GEOM topology
lock held.  And that gives a false impression that the lock is indeed
held across the call.  But this isn't always true because many classes,
ZVOL being one of the many, need to drop the lock.  It's either to
perform an I/O on the first open or to acquire a different lock (like in
g_mirror_access).

That, of course, can break many assumptions.  For example,
g_slice_access() adds an extra exclusive count on the first open. As
described above, an underlying geom may drop the topology lock and that
would open a race with another thread that would also request another
extra exclusive count.  In general, two consumers may be granted
incompatible accesses.

To avoid this problem the code is changed to mark a geom with special
flag before calling its access method and clear the flag afterwards.  If
another thread sees that flag, then it means that the topology lock has
been dropped (either by the geom in question or downstream from it), so
it is not safe to make another access call.  So, the second thread would
use g_topology_sleep() to wait until the flag is cleared and only then
would it proceed with the access.

Also see http://docs.freebsd.org/cgi/mid.cgi?809d9254-ee56-59d8-69a4-08838e985cea

PR: 225960
Reported by: asomers
Reviewed by: markj, mav
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D14533

6 years agore-enable zpool_upgrade_007_pos test after the fix in r330974
Andriy Gapon [Thu, 15 Mar 2018 08:52:49 +0000 (08:52 +0000)]
re-enable zpool_upgrade_007_pos test after the fix in r330974

The test was disabled in r329248.

PR: 225877

6 years agoMFV r330973: 9164 assert: newds == os->os_dsl_dataset
Andriy Gapon [Thu, 15 Mar 2018 08:49:21 +0000 (08:49 +0000)]
MFV r330973: 9164 assert: newds == os->os_dsl_dataset

illumos/illumos-gate@5f5913bb83405db87f982abee80162a479d363af
https://github.com/illumos/illumos-gate/commit/5f5913bb83405db87f982abee80162a479d363af

https://www.illumos.org/issues/9164
  This issue has been reported by Alan Somers as
  https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=225877

  dmu_objset_refresh_ownership() first disowns a dataset (and releases
  it) and then owns it again. There is an assert that the new dataset
  object is the same as the old dataset object.  When running ZFS Test
  Suite on FreeBSD we see this panic from zpool_upgrade_007_pos test:

  panic: solaris assert: newds == os->os_dsl_dataset (0xfffff80045f4c000
  == 0xfffff80021ab4800)

  I see that the old dataset has dsl_dataset_evict_async() pending in
  ds_dbu.dbu_tqent and its ds_dbuf is NULL.

Reviewed by: Matt Ahrens <mahrens@delphix.com>
Reviewed by: Don Brady <don.brady@delphix.com>
Approved by: Richard Lowe <richlowe@richlowe.net>
Author: Andriy Gapon <avg@FreeBSD.org>

PR: 225877
Reported by: asomers
MFC after: 1 week

6 years ago9164 assert: newds == os->os_dsl_dataset
Andriy Gapon [Thu, 15 Mar 2018 08:46:49 +0000 (08:46 +0000)]
9164 assert: newds == os->os_dsl_dataset

illumos/illumos-gate@5f5913bb83405db87f982abee80162a479d363af
https://github.com/illumos/illumos-gate/commit/5f5913bb83405db87f982abee80162a479d363af

https://www.illumos.org/issues/9164
  This issue has been reported by Alan Somers as
  https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=225877

  dmu_objset_refresh_ownership() first disowns a dataset (and releases
  it) and then owns it again. There is an assert that the new dataset
  object is the same as the old dataset object.  When running ZFS Test
  Suite on FreeBSD we see this panic from zpool_upgrade_007_pos test:

  panic: solaris assert: newds == os->os_dsl_dataset (0xfffff80045f4c000
  == 0xfffff80021ab4800)

  I see that the old dataset has dsl_dataset_evict_async() pending in
  ds_dbu.dbu_tqent and its ds_dbuf is NULL.

Reviewed by: Matt Ahrens <mahrens@delphix.com>
Reviewed by: Don Brady <don.brady@delphix.com>
Approved by: Richard Lowe <richlowe@richlowe.net>
Author: Andriy Gapon <avg@FreeBSD.org>