]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
6 years agoRationalize license text on Linuxolator files
emaste [Tue, 20 Mar 2018 02:50:11 +0000 (02:50 +0000)]
Rationalize license text on Linuxolator files

i386 linux.h missed in r330239.

Approved by: sos
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

6 years agoCast through uintptr_t to narrow the buf domain pointer on 32-bit archs
jhibbits [Tue, 20 Mar 2018 02:01:30 +0000 (02:01 +0000)]
Cast through uintptr_t to narrow the buf domain pointer on 32-bit archs

arg2 is an intmax_t, which on 32-bit architectures is 64 bits, wider than a
pointer.  When &bdomain[i] is added to arg2 it widens from uintptr_t to
intmax_t, then gcc whines when it gets cast to a pointer.  Casting through
uintptr_t silences this warning.

6 years agoAdd /boot/overlays to ObsoleteFiles
kevans [Tue, 20 Mar 2018 01:33:04 +0000 (01:33 +0000)]
Add /boot/overlays to ObsoleteFiles

It has been replaced by /boot/dtb/overlays. We haven't yet populated it with
any of our own overlays, so no further damage from here.

Reported by: Oliver Pinter <oliver.pinter@hardenedbsd.org>

6 years agoFix powerpc Book-E build post-331018/331048.
jhibbits [Tue, 20 Mar 2018 01:07:22 +0000 (01:07 +0000)]
Fix powerpc Book-E build post-331018/331048.

pagedaemon_wakeup() was moved from vm_pageout.h to vm_pagequeue.h.

6 years agoblacklist: Fix minor memory leak in configuration parsing error case
cem [Tue, 20 Mar 2018 00:16:24 +0000 (00:16 +0000)]
blacklist: Fix minor memory leak in configuration parsing error case

Ordinarily, the continue clause of the for-loop would free 'line.'  In this
case we instead return early, missing the free.  Add an explicit free to
avoid the leak.

Reported by: Coverity
Sponsored by: Dell EMC Isilon

6 years ago[ofw] fix errneous checks for OF_finddevice(9) return value
gonzo [Tue, 20 Mar 2018 00:03:49 +0000 (00:03 +0000)]
[ofw] fix errneous checks for OF_finddevice(9) return value

OF_finddevices returns ((phandle_t)-1) in case of failure. Some code
in existing drivers checked return value to be equal to 0 or
less/equal to 0 which is also wrong because phandle_t is unsigned
type. Most of these checks were for negative cases that were never
triggered so trhere was no impact on functionality.

Reviewed by: nwhitehorn
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D14645

6 years agoUpdate mpr(4) driver from v15 to v18 from Broadcom site.
mav [Mon, 19 Mar 2018 23:21:45 +0000 (23:21 +0000)]
Update mpr(4) driver from v15 to v18 from Broadcom site.

Version 16 is just a number bump, since we already had those changes.

Version 17 introduces new AdapterType value, that allows new user-space
tools from Broadcom to differentiate adapter generations 3 and 3.5.

Version 18 updates headers and adds SAS_DEVICE_DISCOVERY_ERROR reporting.

MFC after: 2 weeks

6 years agoFix initialization of eventhandler mutex.
mjoras [Mon, 19 Mar 2018 22:43:27 +0000 (22:43 +0000)]
Fix initialization of eventhandler mutex.

mtx_init does not do a copy of the name string it is passed. The
eventhandler code incorrectly passed the parameter string directly to
mtx_init instead of using the copy it makes. This was an existing
problem with the code that I dutifully copied over in my changes in r325621.

Reported by: Anton Rang <rang AT acm.org>
Reviewed by: rstone, markj
Approved by: rstone (mentor)
MFC after: 1 week
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D14764

6 years agoRename linuxulator functions with linux_ prefix
emaste [Mon, 19 Mar 2018 21:26:32 +0000 (21:26 +0000)]
Rename linuxulator functions with linux_ prefix

It's preferable to have a consistent prefix.  This also reduces
differences between the three linux*_sysvec.c files.

Sponsored by: Turing Robotic Industries Inc.

6 years agopf: Fix memory leak in DIOCRADDTABLES
kp [Mon, 19 Mar 2018 21:13:25 +0000 (21:13 +0000)]
pf: Fix memory leak in DIOCRADDTABLES

If a user attempts to add two tables with the same name the duplicate table
will not be added, but we forgot to free the duplicate table, leaking memory.
Ensure we free the duplicate table in the error path.

Reported by: Coverity
CID: 1382111
MFC after: 3 weeks

6 years agoixgbe(4): Update shared code, add support for X552 1G, fix bug
erj [Mon, 19 Mar 2018 20:55:05 +0000 (20:55 +0000)]
ixgbe(4): Update shared code, add support for X552 1G, fix bug

This patch will:

- Update ixgbe shared code
- Add support for Intel(R) Ethernet Connection X552 1000BASE-T
- Add error handling for link state check preventing VF from stopping traffic
  after changing PF's MTU value

Submitted by: Krzysztof Galazka <krzysztof.galazka@intel.com>
Reviewed by: Intel Networking
Sponsored by: Intel Corporation
Differential Revision: https://reviews.freebsd.org/D13885

6 years agocam_periph_acquire() now returns an errno.
ken [Mon, 19 Mar 2018 20:19:00 +0000 (20:19 +0000)]
cam_periph_acquire() now returns an errno.

The ch(4) driver was missed in change 328918, which changed
cam_periph_acquire() to return an errno instead of cam_status.

As a result, ch(4) failed to attach.

Sponsored by: Spectra Logic

6 years agoGiven hidden visibility to symbols referenced by the DOF section.
markj [Mon, 19 Mar 2018 19:32:05 +0000 (19:32 +0000)]
Given hidden visibility to symbols referenced by the DOF section.

MFC after: 1 week

6 years agoRevert r318180 and re-enable AIO tests on md(4) by default.
jhb [Mon, 19 Mar 2018 19:09:15 +0000 (19:09 +0000)]
Revert r318180 and re-enable AIO tests on md(4) by default.

The 'physio' fast-path used by AIO requests on md(4) devices, is not
gated on the unsafe_aio knob.  Prior to r327755, some AIO requests could
fail the fast-path and fall back to the slow-path (requests for devices
not supporting unmapped I/O and requests which failed with EFAULT during
the fast-path).  However, those cases now return a suitable error rather
than using the slow-path.

PR: 217261
Reviewed by: asomers
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D14742

6 years agoImport Intel Processor Trace decoder library from
br [Mon, 19 Mar 2018 18:59:15 +0000 (18:59 +0000)]
Import Intel Processor Trace decoder library from
vendor/processor-trace/24982c1a6fce48f1e416461d42899805f74fbb26

Sponsored by: DARPA, AFRL

6 years agoImport Intel Processor Trace library.
br [Mon, 19 Mar 2018 18:34:08 +0000 (18:34 +0000)]
Import Intel Processor Trace library.

Git ID 24982c1a6fce48f1e416461d42899805f74fbb26

Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D12815

6 years agoFix a typo.
jhb [Mon, 19 Mar 2018 17:14:56 +0000 (17:14 +0000)]
Fix a typo.

Reviewed by: kib

6 years agoAdd support for the experimental Internet-Draft "TCP Alternative Backoff with
lstewart [Mon, 19 Mar 2018 16:37:47 +0000 (16:37 +0000)]
Add support for the experimental Internet-Draft "TCP Alternative Backoff with
ECN (ABE)" proposal to the New Reno congestion control algorithm module.
ABE reduces the amount of congestion window reduction in response to
ECN-signalled congestion relative to the loss-inferred congestion response.

More details about ABE can be found in the Internet-Draft:
https://tools.ietf.org/html/draft-ietf-tcpm-alternativebackoff-ecn

The implementation introduces four new sysctls:

- net.inet.tcp.cc.abe defaults to 0 (disabled) and can be set to non-zero to
  enable ABE for ECN-enabled TCP connections.

- net.inet.tcp.cc.newreno.beta and net.inet.tcp.cc.newreno.beta_ecn set the
  multiplicative window decrease factor, specified as a percentage, applied to
  the congestion window in response to a loss-based or ECN-based congestion
  signal respectively. They default to the values specified in the draft i.e.
  beta=50 and beta_ecn=80.

- net.inet.tcp.cc.abe_frlossreduce defaults to 0 (disabled) and can be set to
  non-zero to enable the use of standard beta (50% by default) when repairing
  loss during an ECN-signalled congestion recovery episode. It enables a more
  conservative congestion response and is provided for the purposes of
  experimentation as a result of some discussion at IETF 100 in Singapore.

The values of beta and beta_ecn can also be set per-connection by way of the
TCP_CCALGOOPT TCP-level socket option and the new CC_NEWRENO_BETA or
CC_NEWRENO_BETA_ECN CC algo sub-options.

Submitted by: Tom Jones <tj@enoti.me>
Tested by: Tom Jones <tj@enoti.me>, Grenville Armitage <garmitage@swin.edu.au>
Relnotes: Yes
Differential Revision: https://reviews.freebsd.org/D11616

6 years agoAmend missed reference to /boot/overlays, moved to /boot/dtb/overlays
kevans [Mon, 19 Mar 2018 16:17:10 +0000 (16:17 +0000)]
Amend missed reference to /boot/overlays, moved to /boot/dtb/overlays

6 years agoMove /boot/overlays to /boot/dtb/overlays
kevans [Mon, 19 Mar 2018 16:16:12 +0000 (16:16 +0000)]
Move /boot/overlays to /boot/dtb/overlays

The former is fairly vague; these are FDT overlays to be applied to the
running system, so /boot/dtb is a sensible location to put it without
cluttering up /boot/dtb even further if desired.

6 years agolualoader: Setup default color scheme if we're using colors
kevans [Mon, 19 Mar 2018 15:48:31 +0000 (15:48 +0000)]
lualoader: Setup default color scheme if we're using colors

The console may have been set for different colors before lualoader kicks
in; notably, a black-on-white color scheme is not necessarily what we're
expecting.

While here, make color.default() a composition of color.escape() instead of
rewriting the escape sequence to make it more obvious what it's achieving: a
white-on-black color scheme with no attributes set.

Reported by: emaste, whose eyes may rest easily

6 years agosys/dts: Remove arm64 from subdir as it no longer exists.
manu [Mon, 19 Mar 2018 15:35:26 +0000 (15:35 +0000)]
sys/dts: Remove arm64 from subdir as it no longer exists.

r325987 removed the arm64 directory, remove it from SUBDIR too.

6 years agoAdd note to UPDATING about UEFI changes requiring loader(8) update
kevans [Mon, 19 Mar 2018 15:27:53 +0000 (15:27 +0000)]
Add note to UPDATING about UEFI changes requiring loader(8) update

These problems have only been observed with boards using U-Boot (e.g. ARM)
where virtual addresses are already set in the memory map by the firmware
and the firmware is expecting a call to SetVirtualAddressMap to be made.
I refrain from mentioning this in the note because this could also be the
case on some not-yet-tested firmware on amd64 and it's not a bad
recommendation for the general case.

6 years agolinux*_sysvec.c: rationalize whitespace and comments
emaste [Mon, 19 Mar 2018 15:11:10 +0000 (15:11 +0000)]
linux*_sysvec.c: rationalize whitespace and comments

There's a fair amount of duplication between MD linuxulator files.
Make indentation and comments consistent between the three versions of
linux_sysvec.c to reduce diffs when comparing them.

Sponsored by: Turing Robotic Industries Inc.

6 years agoloader.conf: remove obsolete non-x86 beastie menu statement
emaste [Mon, 19 Mar 2018 15:07:15 +0000 (15:07 +0000)]
loader.conf: remove obsolete non-x86 beastie menu statement

As of r330005 the same loader.conf defaults are used on all platforms.

Sponsored by: The FreeBSD Foundation

6 years agoRemove redundant integer cast in ibcore. The "ref_count" field already
hselasky [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
ae [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.
delphij [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
mjg [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.
oshogbo [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 [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
imp [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 [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 [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.
oshogbo [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 [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.
markj [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().
markj [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 [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.
markj [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.
markj [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 [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.
markj [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.
trasz [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 [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.
oshogbo [Sun, 18 Mar 2018 16:06:35 +0000 (16:06 +0000)]
Fix similar typos to r331124.

6 years agoFix typo.
oshogbo [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 [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
trasz [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.
oshogbo [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.
oshogbo [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.
oshogbo [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.
oshogbo [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
cem [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).
trasz [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
mjg [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 [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
asomers [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
asomers [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
asomers [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)
imp [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
imp [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
imp [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.
imp [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.
melifaro [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
imp [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
emaste [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)
emaste [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.
trasz [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
emaste [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
emaste [Sat, 17 Mar 2018 01:40:09 +0000 (01:40 +0000)]
ANSIfy sys/x86

6 years agoelftoolchain nm(1): Initialize allocated memory before use
cem [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 [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
cem [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
dteske [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'
cem [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
cem [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
cem [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.
imp [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 [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
imp [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):
dim [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):
dim [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
krion [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 [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
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
emaste [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
emaste [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
emaste [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
emaste [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
emaste [Fri, 16 Mar 2018 12:12:41 +0000 (12:12 +0000)]
ANSIfy i386/vm86.c

6 years agoGarbage collect unused chacha20 code
cem [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
cem [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.
imp [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 [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
avos [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.
avos [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
avos [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.
avos [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 [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