]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
6 years agoChange kdb_active type to u_char.
mjg [Sun, 22 Oct 2017 13:42:56 +0000 (13:42 +0000)]
Change kdb_active type to u_char.

Fixes warnings from gcc and keeps the small size. Perhaps nesting should be moved
to another variablle.

Reported by: ngie

6 years agoClean up trailing whitespace in kdb_thr_ctx(..)
ngie [Sun, 22 Oct 2017 12:12:52 +0000 (12:12 +0000)]
Clean up trailing whitespace in kdb_thr_ctx(..)

MFC after: 1 week

6 years agoModernise this man page somewhat.
bms [Sun, 22 Oct 2017 11:40:55 +0000 (11:40 +0000)]
Modernise this man page somewhat.

1. Add a reference to a good 3rd party list of compatible cables, but
provide suggestions for 'known good' vendors.

2. Change IP-based USB host-host example to a modern Ethernet one which
works 'out of box' with current Linux systems.

3. Explain that USB 3.0 is host-host, even though point-to-point soft
Ethernet can be achieved.

MFC after: 3 weeks

6 years agoAdd Prolific PL27A1 USB 3.0 Host-Host device to udbp(4).
bms [Sun, 22 Oct 2017 11:15:58 +0000 (11:15 +0000)]
Add Prolific PL27A1 USB 3.0 Host-Host device to udbp(4).

Tested with a Plugable cable in VirtualBox against Linux 4.11.

MFC after: 2 weeks

6 years agoAdd OID for the vm.overcommit sysctl. This makes it possible to remove
trasz [Sun, 22 Oct 2017 10:35:29 +0000 (10:35 +0000)]
Add OID for the vm.overcommit sysctl. This makes it possible to remove
one call to sysctl(2) from jemalloc startup code. (That also requires
changes to jemalloc, but I plan to push those to upstream first.)

Reviewed by: kib
MFC after: 2 weeks
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D12745

6 years agoDon't call realpath(3) from libmap rtld code. This gets rid of a few calls
trasz [Sun, 22 Oct 2017 10:32:40 +0000 (10:32 +0000)]
Don't call realpath(3) from libmap rtld code. This gets rid of a few calls
to fstatat(2) at binary startup; the difference looks like this:

--- przed       2017-10-14 13:55:49.983528000 +0100
+++ po  2017-10-14 14:10:39.134343000 +0100
@@ -1,15 +1,10 @@
 mmap(0x0,32768,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON,-1,0x0) = 34366173184 (0x800623000)
 issetugid()                                     = 0 (0x0)
-fstatat(AT_FDCWD,"/etc",{ mode=drwxr-xr-x ,inode=1364352,size=2560,blksize=32768 },AT_SYMLINK_NOFOLLOW) = 0 (0x0)
-fstatat(AT_FDCWD,"/etc/libmap.conf",{ mode=-rw-r--r-- ,inode=1373288,size=102,blksize=32768 },AT_SYMLINK_NOFOLLOW) = 0 (0x0)
 openat(AT_FDCWD,"/etc/libmap.conf",O_RDONLY|O_CLOEXEC,00) = 3 (0x3)
 fstat(3,{ mode=-rw-r--r-- ,inode=1373288,size=102,blksize=32768 }) = 0 (0x0)
 mmap(0x0,102,PROT_READ,MAP_PRIVATE,3,0x0)       = 34366205952 (0x80062b000)
 close(3)                                        = 0 (0x0)
-fstatat(AT_FDCWD,"/usr",{ mode=drwxr-xr-x ,inode=561792,size=512,blksize=32768 },AT_SYMLINK_NOFOLLOW) = 0 (0x0)
-fstatat(AT_FDCWD,"/usr/local",{ mode=drwxr-xr-x ,inode=561800,size=512,blksize=32768 },AT_SYMLINK_NOFOLLOW) = 0 (0x0)
-fstatat(AT_FDCWD,"/usr/local/etc",{ mode=drwxr-xr-x ,inode=653279,size=1536,blksize=32768 },AT_SYMLINK_NOFOLLOW) = 0 (0x0)
-fstatat(AT_FDCWD,"/usr/local/etc/libmap.d",0x7fffffffcf50,AT_SYMLINK_NOFOLLOW) ERR#2 'No such file or directory'
+open("/usr/local/etc/libmap.d",O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC,0165) ERR#2 'No such file or directory'
 munmap(0x80062b000,102)                                 = 0 (0x0)
 openat(AT_FDCWD,"/var/run/ld-elf.so.hints",O_RDONLY|O_CLOEXEC,00) = 3 (0x3)
 read(3,"Ehnt\^A\0\0\0\M^@\0\0\0\M-2\0\0"...,128) = 128 (0x80)

Reviewed by: kib
MFC after: 2 weeks
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D12741

6 years agoRemove the support for mknod(S_IFMT), which created dummy vnodes with
kib [Sun, 22 Oct 2017 08:11:45 +0000 (08:11 +0000)]
Remove the support for mknod(S_IFMT), which created dummy vnodes with
VBAD type.

FFS ffs_write() VOP catches such vnodes and panics, other VOPs do not
check for the type and their behaviour is really undefined.  The
comment claims that this support was done for 'badsect' to flag bad
sectors, we do not have such facility in kernel anyway.

Reported by: Dmitry Vyukov <dvyukov@google.com>
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

6 years agoRegenerate src.conf(5) after r324340 (armv7 addition)
ngie [Sun, 22 Oct 2017 07:36:28 +0000 (07:36 +0000)]
Regenerate src.conf(5) after r324340 (armv7 addition)

6 years agoDefine LIBSA32 to LIBSA on i386 to fix build.
imp [Sun, 22 Oct 2017 07:25:28 +0000 (07:25 +0000)]
Define LIBSA32 to LIBSA on i386 to fix build.

Sponsored by: Netflix

6 years agoAdd note to updating about shifting LOADER_*SUPPORT options.
imp [Sun, 22 Oct 2017 03:52:26 +0000 (03:52 +0000)]
Add note to updating about shifting LOADER_*SUPPORT options.

Sponsored by: Netflix

6 years agoUse BOOTOBJ and BOOTDIR to find geli includes and libraries.
imp [Sun, 22 Oct 2017 03:52:22 +0000 (03:52 +0000)]
Use BOOTOBJ and BOOTDIR to find geli includes and libraries.

Sponsored by: Netflix

6 years agoWhen building standalone, don't define errno. Let the definition from
imp [Sun, 22 Oct 2017 03:52:17 +0000 (03:52 +0000)]
When building standalone, don't define errno. Let the definition from
stand.h override. This is similar to what we do in the kernel.

Sponsored by: Netflix

6 years agoStopgap fix to the mistmatch between LOADER_GELI_SUPPORT and
imp [Sun, 22 Oct 2017 03:52:12 +0000 (03:52 +0000)]
Stopgap fix to the mistmatch between LOADER_GELI_SUPPORT and
LOADER_NO_GELI_SUPPORT. To disable geli support in the loader, define
LOADER_GELI_SUPPORT=no. Proper warnings for for old build options to
follow.

Sponsored by: Netflix

6 years agoIntroduce BOOTOBJ: The top level object directory for the boot tree
imp [Sun, 22 Oct 2017 03:52:08 +0000 (03:52 +0000)]
Introduce BOOTOBJ: The top level object directory for the boot tree
and use it in preference to spelling out the path.

Sponsored by: Netflix

6 years agoUse BOOTDIR more consistently in defs.mk rather than repeat sys/boot.
imp [Sun, 22 Oct 2017 03:52:03 +0000 (03:52 +0000)]
Use BOOTDIR more consistently in defs.mk rather than repeat sys/boot.

Sponsored By: Netflix

6 years agomtx: implement thread lock fastpath
mjg [Sat, 21 Oct 2017 22:40:09 +0000 (22:40 +0000)]
mtx: implement thread lock fastpath

MFC after: 1 week

6 years agoRemove a atrun check that is nullified by r318443.
brd [Sat, 21 Oct 2017 21:58:24 +0000 (21:58 +0000)]
Remove a atrun check that is nullified by r318443.

Approved by: will

6 years agoPull in r316035 from upstream llvm trunk (by Tim Northover):
dim [Sat, 21 Oct 2017 19:14:45 +0000 (19:14 +0000)]
Pull in r316035 from upstream llvm trunk (by Tim Northover):

  AArch64: account for possible frame index operand in compares.

  If the address of a local is used in a comparison, AArch64 can fold
  the address-calculation into the comparison via "adds".
  Unfortunately, a couple of places (both hit in this one test) are not
  ready to deal with that yet and just assume the first source operand
  is a register.

This should fix an assertion failure while building the test suite of
www/firefox for AArch64.

PR: 223048
MFC after: 3 days

6 years agoAfter the import of libc++ 5.0.0, there is no need to disable building
dim [Sat, 21 Oct 2017 18:21:44 +0000 (18:21 +0000)]
After the import of libc++ 5.0.0, there is no need to disable building
libc++experimental.a on arm (r318654) and mips (r318859) anymore, since
upstream fixed the static assertions which would occur.

Noticed by: George Abdelmalik <gabdelmalik@uniridge.com.au>
PR: 223119
MFC after: 3 days

6 years agoCheck that the page which is freed as zeroed, indeed has all-zero content.
kib [Sat, 21 Oct 2017 17:28:12 +0000 (17:28 +0000)]
Check that the page which is freed as zeroed, indeed has all-zero content.

This catches some rare mysterious failures at the source.  The check
is only performed on architectures which implement direct map, and
only enabled with option DIAGNOSTIC, similar to other costly
consistency checks.

Reviewed by: alc, markj
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks

6 years agoMention sysrc(8) as scripting interface for the modification of config
se [Sat, 21 Oct 2017 16:55:52 +0000 (16:55 +0000)]
Mention sysrc(8) as scripting interface for the modification of config
files. This is a follow up commit to r324721, which added sysrc(8) to
the SEE ALSO list.

Submitted by: Kurt Jaeger (lists at opsec.eu)
MFC after: 1 week

6 years agodtb/allwinner: Disconnect sinovoip-bpi-m3.dts from the build
manu [Sat, 21 Oct 2017 16:12:00 +0000 (16:12 +0000)]
dtb/allwinner: Disconnect sinovoip-bpi-m3.dts from the build

No active commiter have this board and we diverged too much from
the upstream DTS.

6 years agoFix spelling.
mmel [Sat, 21 Oct 2017 15:48:16 +0000 (15:48 +0000)]
Fix spelling.

Reported by: lidl
MFC after: 1 month

6 years agodts: Update our device tree sources file fomr Linux 4.13
manu [Sat, 21 Oct 2017 15:47:40 +0000 (15:47 +0000)]
dts: Update our device tree sources file fomr Linux 4.13

6 years agodts: Update the Device Tree Sources to Linux 4.13
manu [Sat, 21 Oct 2017 15:18:20 +0000 (15:18 +0000)]
dts: Update the Device Tree Sources to Linux 4.13

6 years agoFullify implementation of AT_HWCAP and AT_HWCAP2 for ARMv6,7.
mmel [Sat, 21 Oct 2017 12:16:21 +0000 (12:16 +0000)]
Fullify implementation of AT_HWCAP and AT_HWCAP2 for ARMv6,7.
This makes elf_aux_info(3) useable for ARM ports.

MFC after: 1 month

6 years agoAdd C++ decoration to auxv.v forgotten in r324815.
mmel [Sat, 21 Oct 2017 12:15:12 +0000 (12:15 +0000)]
Add C++ decoration to auxv.v forgotten in r324815.

MFC after: 1 month

6 years agoMake elf_aux_info() as public libc function.
mmel [Sat, 21 Oct 2017 12:06:18 +0000 (12:06 +0000)]
Make elf_aux_info() as public libc function.
- Teach elf aux vector functions about newly added AT_HWCAP and AT_HWCAP2
  vectors.
- Export _elf_aux_info() as new public libc function elf_aux_info(3)

The elf_aux_info(3) should be considered as FreeBSD counterpart of glibc
getauxval() with more robust interface.

Note:
We cannot name this new function as getauxval(), with glibc compatible
interface. Some ports autodetect its existence and then expects that all
Linux specific AT_<*> vectors are defined and implemented.

MFC after: 1 month
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D12743

6 years agoAdd AT_HWCAP2 ELF auxiliary vector.
mmel [Sat, 21 Oct 2017 12:05:01 +0000 (12:05 +0000)]
Add AT_HWCAP2 ELF auxiliary vector.
 - allocate value for new AT_HWCAP2 auxiliary vector on all platforms.
 - expand 'struct sysentvec' by new 'u_long *sv_hwcap2', in exactly
   same way as for AT_HWCAP.

MFC after: 1 month
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D12699

6 years agopms/freebsd: fix compiler warnings
rlibby [Sat, 21 Oct 2017 07:23:45 +0000 (07:23 +0000)]
pms/freebsd: fix compiler warnings

 - A number of unused variable warnings,
 - a missing prototype warning (actually a dead function),
 - and a potential use of an uninitialized variable.

Reviewed by: pfg
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D12683

6 years agoWith r181803 on 2008-08-17 23:27:27Z the first VIMAGE commit went into
bz [Fri, 20 Oct 2017 21:40:59 +0000 (21:40 +0000)]
With r181803 on 2008-08-17 23:27:27Z the first VIMAGE commit went into
HEAD.  Enable VIMAGE in GENERIC kernels and some others (where GENERIC does
not exist) on HEAD.

Disable building LINT-VIMAGE with VIMAGE being default.

This should give it a lot more exposure in the run-up to 12 to help
us evaluate whether to keep it on by default or not.
We are also hoping to get better performance testing.
The feature can be disabled using nooptions.

Requested by: many
Reviewed by: kristof, emaste, hiren
X-MFC after: never
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D12639

6 years agoFree the right address range if kmem_back() fails in memguard_alloc().
markj [Fri, 20 Oct 2017 21:13:19 +0000 (21:13 +0000)]
Free the right address range if kmem_back() fails in memguard_alloc().

MFC after: 1 week
Sponsored by: Dell EMC Isilon

6 years agoamd64: plug missed dt_lock in cpu_fork
mjg [Fri, 20 Oct 2017 18:58:11 +0000 (18:58 +0000)]
amd64: plug missed dt_lock in cpu_fork

6 years agoTake the vm object lock in read mode in vnode_generic_putpages().
kib [Fri, 20 Oct 2017 18:40:29 +0000 (18:40 +0000)]
Take the vm object lock in read mode in vnode_generic_putpages().

Only upgrade it to write mode if we need to clear dirty bits of the
partially valid page after EOF.

Suggested and reviewed by: alc
Sponsored by: The FreeBSD Foundation
MFC after: 3 weeks

6 years agoUse the .Fx macro consistently.
asomers [Fri, 20 Oct 2017 15:29:28 +0000 (15:29 +0000)]
Use the .Fx macro consistently.

Sponsored by: Spectra Logic Corp

6 years agoFix the mps(4) HISTORY section.
asomers [Fri, 20 Oct 2017 15:24:28 +0000 (15:24 +0000)]
Fix the mps(4) HISTORY section.

Looks like a copy/paste error from r302673.

MFC after: 3 weeks
Sponsored by: Spectra Logic Corp

6 years agoAvoid the nbp lookup in the final loop iteration in flushbuflist().
markj [Fri, 20 Oct 2017 14:56:13 +0000 (14:56 +0000)]
Avoid the nbp lookup in the final loop iteration in flushbuflist().

The end of the loop must re-lookup the next buf since the bufobj lock
is dropped in the loop body. If the lookup fails, the loop is restarted.
This mechanism non-obviously also terminates the loop when the end of
the buf list is reached. Split up the two loops termination cases to
make the code a bit less fragile. No functional change intended.

Reviewed by: kib
MFC after: 1 week
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D12730

6 years agomtx: fix up UP build after r324778
mjg [Fri, 20 Oct 2017 14:04:01 +0000 (14:04 +0000)]
mtx: fix up UP build after r324778

Reported by: Michael Butler

6 years agoMove swapout code into vm/vm_swapout.c.
kib [Fri, 20 Oct 2017 09:10:49 +0000 (09:10 +0000)]
Move swapout code into vm/vm_swapout.c.

There is no NO_SWAPPING #ifdef left in the code.

Requested by: alc
Reviewed by: alc, markj
Sponsored by: The FreeBSD Foundation
MFC after: 3 weeks
Differential revision: https://reviews.freebsd.org/D12663

6 years agoDo not overwrite clean blocks on pageout.
kib [Fri, 20 Oct 2017 08:32:37 +0000 (08:32 +0000)]
Do not overwrite clean blocks on pageout.

If filesystem block size is less than the page size, it is possible
that the page-out run contains partially clean pages.  E.g., the chunk
of the page might be bdwrite()-ed, or some thread performed bwrite()
on a buffer which references a chunk of the paged out page.  As
result, the assertion added in r319975, which checked that all pages
in the run are dirty, does not hold on such filesystems.

One solution is to remove the assert, but it is undesirable, because
we do overwrite the valid on-disk content. I cannot provide a scenario
where such write would corrupt the file data, but I do not like it on
principle.  Another, in my opinion proper, solution is to only write
parts of the pages still marked dirty.  The patch implements this, it
skips clean blocks and only writes the dirty block runs.

Note that due to clustering, write one page might clean other pages in
the run, so the next write range must be calculated only after the
current range is written out.

More, due to a possible invalidation, and the fact that the object
lock is dropped and reacquired before the checks, it is possible that
the whole page-out pages run appears to consist of only clean pages.
For this reason, it is impossible to assert that there is some work
for the pageout method to do (i.e. assert that there is at least one
dirty page in the run).  But such clearing can only occur due to
invalidation, and not due to a parallel write, because we own the
vnode lock exclusive.

Reported by: fsu
In collaboration with: pho
Reviewed by: alc, markj
Sponsored by: The FreeBSD Foundation
MFC after: 3 weeks
Differential revision: https://reviews.freebsd.org/D12668

6 years agoIn vm_page_free_phys_pglist(), do not take vm_page_queue_free_mtx if
kib [Fri, 20 Oct 2017 08:25:49 +0000 (08:25 +0000)]
In vm_page_free_phys_pglist(), do not take vm_page_queue_free_mtx if
there is nothing to do.

Suggested by: mjg
Reviewed by: alc
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

6 years agoThe remote DMA TCP portspace selector, RDMA_PS_TCP, is used for both
hselasky [Fri, 20 Oct 2017 08:20:15 +0000 (08:20 +0000)]
The remote DMA TCP portspace selector, RDMA_PS_TCP, is used for both
iWarp and RoCE in ibcore. The selection of RDMA_PS_TCP can not be used
to indicate iWarp protocol use. Backport the proper IB device
capabilities from Linux upstream to distinguish between iWarp and
RoCE. Only allocate the additional socket required for iWarp for RDMA
IDs when at least one iWarp device present. This resolves
interopability issues between iWarp and RoCE in ibcore

Reviewed by: np @
Differential Revision: https://reviews.freebsd.org/D12563
Sponsored by: Mellanox Technologies
MFC after: 3 days

6 years agoMark kdb_active as __read_frequently and switch to bool to eat less space.
mjg [Fri, 20 Oct 2017 04:02:53 +0000 (04:02 +0000)]
Mark kdb_active as __read_frequently and switch to bool to eat less space.

6 years agoamd64: __exclusive_cache_line pv_chunks_mutex and pv_list_locks
mjg [Fri, 20 Oct 2017 03:38:58 +0000 (03:38 +0000)]
amd64: __exclusive_cache_line pv_chunks_mutex and pv_list_locks

Note that pv_list_locks is an array and currently it fits 2 locks per line.
Resizing it and/or putting more locks in different lines requires several tests.

MFC after: 1 week

6 years agorwlock: reduce lockstat branches in the slowpath
mjg [Fri, 20 Oct 2017 03:32:42 +0000 (03:32 +0000)]
rwlock: reduce lockstat branches in the slowpath

MFC after: 1 week

6 years agoExpand the TLB nest level mask to 3 bits to match the 32-bit mask
jhibbits [Fri, 20 Oct 2017 03:31:23 +0000 (03:31 +0000)]
Expand the TLB nest level mask to 3 bits to match the 32-bit mask

This really doesn't change anything right now, because BOOKE_TLB_MAXNEST is only
3, which fits into the 2 bits currently used.

6 years agoamd64: avoid acquiring dt lock if possible (which is the common case)
mjg [Fri, 20 Oct 2017 03:30:02 +0000 (03:30 +0000)]
amd64: avoid acquiring dt lock if possible (which is the common case)

Discussed with: kib
MFC after: 1 week

6 years agoNo need to check for AIM here
jhibbits [Fri, 20 Oct 2017 03:13:31 +0000 (03:13 +0000)]
No need to check for AIM here

This block is already in a #ifdef AIM block.

6 years agoBook-E debug trace fixes
jhibbits [Fri, 20 Oct 2017 03:03:04 +0000 (03:03 +0000)]
Book-E debug trace fixes

* Book-E can have Altivec exceptions, so move it out of the AIM-only block.
* Print the right DSI trap mode (read vs write) for Book-E

While here, fix some whitespace found while reviewing other diffs.

6 years agomtx: stop testing SCHEDULER_STOPPED in kabi funcs for spin mutexes
mjg [Fri, 20 Oct 2017 00:34:25 +0000 (00:34 +0000)]
mtx: stop testing SCHEDULER_STOPPED in kabi funcs for spin mutexes

There is nothing panic-breaking to do in the unlock case and the lock
case will fallback to the slow path doing the check already.

MFC after: 1 week

6 years agomtx: clean up locking spin mutexes
mjg [Fri, 20 Oct 2017 00:30:35 +0000 (00:30 +0000)]
mtx: clean up locking spin mutexes

1) shorten the fast path by pushing the lockstat probe to the slow path
2) test for kernel panic only after it turns out we will have to spin,
in particular test only after we know we are not recursing

MFC after: 1 week

6 years agoCorrect an inverted conditional for determining the multiplier of
marius [Thu, 19 Oct 2017 21:57:14 +0000 (21:57 +0000)]
Correct an inverted conditional for determining the multiplier of
the user data area size.

6 years agoAllwinner: Fix compilation
manu [Thu, 19 Oct 2017 21:34:53 +0000 (21:34 +0000)]
Allwinner: Fix compilation

Forgot an #endif in r324773, sorry for the breakage.

6 years agopsm(4): Add sanity checks to Synaptics touchpad driver resolution parser.
wulf [Thu, 19 Oct 2017 21:07:28 +0000 (21:07 +0000)]
psm(4): Add sanity checks to Synaptics touchpad driver resolution parser.

This fixes "Kernel has only x or y resolution, not both" libinput error.

Reported by: Ivan <bsd@abinet.ru>
Tested by: Ivan <bsd@abinet.ru>
Approved by: gonzo (mentor)
MFC after: 2 weeks

6 years agoAllwinner: Add EARLY_PRINTF function
manu [Thu, 19 Oct 2017 20:56:30 +0000 (20:56 +0000)]
Allwinner: Add EARLY_PRINTF function

EARLY_PRINTF can help debugging early problems.
Add it for Allwinner SoCs.

Tested On: OrangePi One (H3)

6 years agoums(4): Unreverse evdev Tilt-axis reporting to match Linux.
wulf [Thu, 19 Oct 2017 20:54:55 +0000 (20:54 +0000)]
ums(4): Unreverse evdev Tilt-axis reporting to match Linux.

sysmouse tilt to button mapping remained unchanged.

Reviewed by: hselasky
Approved by: gonzo (mentor)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D12671

6 years agotegra: Do not define early printf function
manu [Thu, 19 Oct 2017 20:52:17 +0000 (20:52 +0000)]
tegra: Do not define early printf function

Since tegra is now in GENERIC, do not enable the early printf
function as it can conflict with others.

6 years agobthidd: Fix leds on multireport keyboards broken after r297217
wulf [Thu, 19 Oct 2017 20:42:46 +0000 (20:42 +0000)]
bthidd: Fix leds on multireport keyboards broken after r297217

Reviewed by: emax, gonzo
Approved by: gonzo (mentor)
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D12214

6 years agoHide struct sockbuf from userland.
glebius [Thu, 19 Oct 2017 18:04:16 +0000 (18:04 +0000)]
Hide struct sockbuf from userland.

PR: 222917 (exp-run)

6 years agoFix unused variable + style(9) fixes inside the ext4_ext_find_extent()
fsu [Thu, 19 Oct 2017 16:42:03 +0000 (16:42 +0000)]
Fix unused variable + style(9) fixes inside the ext4_ext_find_extent()

Approved by:    pfg (mentor)
Reported by:    Coverity
CID:            1381754
MFC after:      6 months

6 years agopsci: change bootverbose string to 'PSCI 0.2 compatible'
emaste [Thu, 19 Oct 2017 16:40:17 +0000 (16:40 +0000)]
psci: change bootverbose string to 'PSCI 0.2 compatible'

Prior to r324754 we treated PSCI 0.2 and 1.0 as identical, and r324754
extended that to include all PSCI 1.x revisions. Change the string
emitted under bootverbose to reference '0.2 compatible' to avoid
confusion when the system includes a later PSCI rev.

Discussed with: andrew
Sponsored by: The FreeBSD Foundation

6 years agoremove spa_sync_on assert from spa_async_thread_vd
avg [Thu, 19 Oct 2017 16:36:07 +0000 (16:36 +0000)]
remove spa_sync_on assert from spa_async_thread_vd

Unlike spa_async_thread that can get started only from spa_sync()
spa_async_thread_vd can get started from other contexts.
Additionally, spa_async_thread_vd does not really depend on
spa sync being enabled.

The incorrect assert could be triggered by importing a pool in the
read-only mode and then disconnecting one of its disks.
In this case spa_sync_on was false because the pool was read-only
and spa_async_thread_vd was started to handle SPA_ASYNC_REMOVE event.

Note: spa_async_thread_vd() currently exists only in FreeBSD, it was
split out of spa_async_thread() in r253990.

Discussed with: mav
MFC after: 2 weeks

6 years agoAllow later PSCI revisions to also work. The latest ARM Trusted Firmware
andrew [Thu, 19 Oct 2017 13:22:52 +0000 (13:22 +0000)]
Allow later PSCI revisions to also work. The latest ARM Trusted Firmware
reports version 1.1 so the check was failing. As thjis is a minor change
from 1.0, and future 1.x revisions are also expected to be backwards
compatible just ignore the minor revision in the init handler.

Sponsored by: DARPA, AFRL

6 years agomsdosfs: fix build with MSDOSFS_DEBUG
emaste [Thu, 19 Oct 2017 12:55:11 +0000 (12:55 +0000)]
msdosfs: fix build with MSDOSFS_DEBUG

Inspired by a patch submission by longwitz@incore.de with many changes
for ino64 in HEAD.

PR: 199152
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

6 years agoRelax per-ifnet cif_vrs list double locking in carp(4).
mav [Thu, 19 Oct 2017 09:01:15 +0000 (09:01 +0000)]
Relax per-ifnet cif_vrs list double locking in carp(4).

In all cases where cif_vrs list is modified, two locks are held: per-ifnet
CIF_LOCK and global carp_sx.  It means to read that list only one of them
is enough to be held, so we can skip CIF_LOCK when we already have carp_sx.

This fixes kernel panic, caused by attempts of copyout() to sleep while
holding non-sleepable CIF_LOCK mutex.

Discussed with: glebius
MFC after: 2 weeks
Sponsored by: iXsystems, Inc.

6 years agoBatch atomic updates to the number of active, inactive, and laundry
alc [Thu, 19 Oct 2017 04:13:47 +0000 (04:13 +0000)]
Batch atomic updates to the number of active, inactive, and laundry
pages by vm_object_terminate_pages().  For example, for a "buildworld"
workload, this batching reduces vm_object_terminate_pages()'s average
execution time by 12%.  (The total savings were about 11.7 billion
processor cycles.)

Reviewed by: kib
MFC after: 1 week

6 years agoAdd some more devices to the MPC85XX-based configs
jhibbits [Thu, 19 Oct 2017 03:38:53 +0000 (03:38 +0000)]
Add some more devices to the MPC85XX-based configs

These devices bring the configs closer to a desktop-like (GENERIC) kernel
config.
* The Freescale DIU support was added to the config in r306358.
  Without keyboard support video support is nearly pointless, so add ukbd and
  ums.
* The AmigaOne X5000, and P1022 devboard, both use a variant of the ds1307 RTC
* cpufreq scaling is currently supported by the p1022.  More SoCs will be added
  eventually.

6 years agoAnticongestion refinements for ntpd rc script. This reverts r324681
cy [Thu, 19 Oct 2017 03:17:50 +0000 (03:17 +0000)]
Anticongestion refinements for ntpd rc script. This reverts r324681
and checks if ntp leapfile needs fetching before entering into the
anticongestion sleep.

Unfortunately some ports still use their own sleeps so, this commit
doesn't address the complete problem which is compounded by every
port that uses its own anticongestion mechanism.

Discussed with: asomers

6 years agoRemove some unnecessary includes
jhibbits [Thu, 19 Oct 2017 02:14:39 +0000 (02:14 +0000)]
Remove some unnecessary includes

6 years agosysctl: only take mem lock if oldlen is > 4 * PAGE_SIZE
mjg [Thu, 19 Oct 2017 01:38:31 +0000 (01:38 +0000)]
sysctl: only take mem lock if oldlen is > 4 * PAGE_SIZE

The previous limit of just one page is hit by ps.

The entire mechanism should be reworked, if not whacked. It seems the intent
is to reduce kernel dos-ability - some handlers wire the amount of memory
passed here. Handlers should probably stop wiring in the first place or in
the worst case indicate they are doing so so that the check is done only if
necessary. It should also probably be a counter, not a lock.

MFC after: 1 week

6 years agoexecve: avoid one proc lock/unlock trip unless PTRACE_EXEC is set
mjg [Thu, 19 Oct 2017 00:46:15 +0000 (00:46 +0000)]
execve: avoid one proc lock/unlock trip unless PTRACE_EXEC is set

MFC after: 1 week

6 years agoTidy up pmc support at execve.
mjg [Thu, 19 Oct 2017 00:38:14 +0000 (00:38 +0000)]
Tidy up pmc support at execve.

The proc-specific check is inherently racy, so the code can just unlock
beforehand.

MFC after: 1 week

6 years agosysvsem: check if semu_list has anything on it before grabbing the lock
mjg [Thu, 19 Oct 2017 00:31:00 +0000 (00:31 +0000)]
sysvsem: check if semu_list has anything on it before grabbing the lock

This should get a process-specific support instead.

MFC after: 1 week

6 years agoAdopt jail.8 to our brave new bsdinstall world
bjk [Wed, 18 Oct 2017 22:56:46 +0000 (22:56 +0000)]
Adopt jail.8 to our brave new bsdinstall world

Submitted by: Steve Kargl
MFC after: 3 days

6 years agoDon't take Giant for SMP status and cpu topology sysctls.
mjg [Wed, 18 Oct 2017 22:00:44 +0000 (22:00 +0000)]
Don't take Giant for SMP status and cpu topology sysctls.

Not only this lock doesn't play any role here, dirtying it slows down
other things a little bit as giant-held checks (e.g. DROP_GIANT) are
spread all over the kernel.

MFC after: 1 week

6 years agoFix a signed/unsigned warning.
tuexen [Wed, 18 Oct 2017 21:08:35 +0000 (21:08 +0000)]
Fix a signed/unsigned warning.

MFC after: 1 week

6 years agoAbort an SCTP association, when a DATA chunk is followed by an unknown
tuexen [Wed, 18 Oct 2017 20:17:44 +0000 (20:17 +0000)]
Abort an SCTP association, when a DATA chunk is followed by an unknown
chunk with a length smaller than the minimum length.

Thanks to Felix Weinrank for making me aware of the problem.
MFC after: 3 days

6 years agoql*_def.h: fix QL_ALIGN parenthesization
rlibby [Wed, 18 Oct 2017 19:28:28 +0000 (19:28 +0000)]
ql*_def.h: fix QL_ALIGN parenthesization

QL_ALIGN is a set of copies of roundup2, but it was missing an outer set
of parentheses, which began to matter with r324538. Now, fully copy the
parenthesization of roundup2.

Reviewed by: davidcs
Differential Revision: https://reviews.freebsd.org/D12673

6 years agoImport the latest CloudABI definitions, version 0.16.
ed [Wed, 18 Oct 2017 19:22:53 +0000 (19:22 +0000)]
Import the latest CloudABI definitions, version 0.16.

The most important change in this release is the removal of the
poll_fd() system call; CloudABI's equivalent of kevent(). Though I think
that kqueue is a lot saner than many of its alternatives, our
experience is that emulating this system call on other systems
accurately isn't easy. It has become a complex API, even though I'm not
convinced this complexity is needed. This is why we've decided to take a
different approach, by looking one layer up.

We're currently adding an event loop to CloudABI's C library that is API
compatible with libuv (except when incompatible with Capsicum).
Initially, this event loop will be built on top of plain inefficient
poll() calls. Only after this is finished, we'll work our way backwards
and design a new set of system calls to optimize it.

Interesting challenges will include integrating asynchronous I/O into
such a system call API. libuv currently doesn't aio(4) on Linux/BSD, due
to it being unreliable and having undesired semantics.

Obtained from: https://github.com/NuxiNL/cloudabi

6 years agoRevert change which got in accidently.
tuexen [Wed, 18 Oct 2017 18:59:35 +0000 (18:59 +0000)]
Revert change which got in accidently.

6 years agoFix a bug introduced in r324638.
tuexen [Wed, 18 Oct 2017 18:56:56 +0000 (18:56 +0000)]
Fix a bug introduced in r324638.
Thanks to Felix Weinrank for making me aware of this.

MFC after: 3 days

6 years agoRemove CPU_HAVEFPU.
jhb [Wed, 18 Oct 2017 17:23:16 +0000 (17:23 +0000)]
Remove CPU_HAVEFPU.

Instead, use a runtime decision to handle COP1 traps.  If floating point
support is present in the current CPU, enable saving of the floating point
state.  If support is not present, fail with SIGILL.

Reviewed by: imp, br
Sponsored by: DARPA / AFRL
Differential Revision: https://reviews.freebsd.org/D12707

6 years agoTeach beinstall to use and prefer svnlite, with a fallback to svn.
brd [Wed, 18 Oct 2017 15:48:26 +0000 (15:48 +0000)]
Teach beinstall to use and prefer svnlite, with a fallback to svn.

Approved by: will

6 years agoMove kernel dump offset tracking into MI code.
markj [Wed, 18 Oct 2017 15:38:05 +0000 (15:38 +0000)]
Move kernel dump offset tracking into MI code.

All of the kernel dump implementations keep track of the current offset
("dumplo") within the dump device. However, except for textdumps, they
all write the dump sequentially, so we can reduce code duplication by
having the MI code keep track of the current offset. The new
dump_append() API can be used to write at the current offset.

This is needed to implement support for kernel dump compression in the
MI kernel dump code.

Also simplify dump_encrypted_write() somewhat: use dump_write() instead
of duplicating its bounds checks, and get rid of the redundant offset
tracking.

Reviewed by: cem
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D11722

6 years agoAdd references to sysrc(8).
se [Wed, 18 Oct 2017 13:25:44 +0000 (13:25 +0000)]
Add references to sysrc(8).

Reported by: Kurt Jaeger (lists at opsec.eu)

6 years agolibsa/ip: stop read loop on bad fragments
tsoome [Wed, 18 Oct 2017 08:06:05 +0000 (08:06 +0000)]
libsa/ip: stop read loop on bad fragments

Lets try to clear out from case of overlapping etc fragments and stop read.

Reported by: Dan McDonald

6 years agolibsa/ip.c: misplaced comment, ip_v is half char, not ip_p
tsoome [Wed, 18 Oct 2017 07:39:21 +0000 (07:39 +0000)]
libsa/ip.c: misplaced comment, ip_v is half char, not ip_p

The comment should be at previous line.

Reported by: Dan McDonald

6 years agoDo not report reduction of swap zone if it was not.
kib [Wed, 18 Oct 2017 07:27:43 +0000 (07:27 +0000)]
Do not report reduction of swap zone if it was not.

After r324600 we see the actual reservation.

Reported by: jkim
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

6 years agoext2: delete redundant decl of ext2_fserr
rlibby [Wed, 18 Oct 2017 00:41:23 +0000 (00:41 +0000)]
ext2: delete redundant decl of ext2_fserr

Fix gcc build after r324706.

Reviewed by: pfg
Differential Revision: https://reviews.freebsd.org/D12709

6 years agoImprove computation of {BC,LL}OBJS.
jonathan [Wed, 18 Oct 2017 00:33:20 +0000 (00:33 +0000)]
Improve computation of {BC,LL}OBJS.

Now that OBJS has grown an OBJS_SRCS_FILTER variable, use this variable
in the computation of BCOBJS and LLOBJS too. Also move BCOBJS and LLOBJS
computation to be next to the OBJS computation: this should both make
the parallel structure clearer and serve to remind people changing OBJS
that parallel changes are required in BCOBJS and LLOBJS.

A side effect of this change is that BCOBJS and LLOBJS will be available
even when LLVM_LINK has not been defined, but that seems like a positive
change: there's no reason we can't ask "what bitcode files would you
generate" just because we can't link those files together into a
complete bitcode representation of a binary or library.

Reviewed by: sjg
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D12701

6 years agoImprove logic of CLEANFILES+=${PROG_FULL}.{bc,ll}.
jonathan [Wed, 18 Oct 2017 00:30:15 +0000 (00:30 +0000)]
Improve logic of CLEANFILES+=${PROG_FULL}.{bc,ll}.

The build rule describing how to create ${PROG_FULL}.{bc,ll} is only
dependent on LLVM_LINK being defined, not on MK_DEBUG_FILES being "yes".
Move the addition of ${PROG_FULL}.{bc,ll} out of the conditional block
under `.if ${MK_DEBUG_FILES} != "no"` and up next to where the build
rules for ${PROG_FULL}.{bc,ll} are defined.

Reviewed by: emaste
MFC after: 1 week
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D12703

6 years agoRemove mbpool(9) now that it has no consumers.
brooks [Wed, 18 Oct 2017 00:18:03 +0000 (00:18 +0000)]
Remove mbpool(9) now that it has no consumers.

mbpool existed to support NICs with memory interfaces and all remaining
comsumers were removed earlier this year with NATM.

Reviewed by: jhb
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D10513

6 years agoRevert "Unify boot1 with loader" change r324646
imp [Tue, 17 Oct 2017 23:38:27 +0000 (23:38 +0000)]
Revert "Unify boot1 with loader" change r324646

Back out the unification commit to boot1. There's some issues on the
arm and arm64 platforms that need to be addressed with code
changes. There's also a discussion on arch@ about the future of
boot1.efi vs just using loader.efi that needs to play out. So take a
pause on these changes until the arm issues can be fixed and it's
clear boot1.efi will survive into FreeBSD 12.

OK'd by: Eric@meatspace

6 years agoembed_mfs: add error handling, usage
emaste [Tue, 17 Oct 2017 21:13:26 +0000 (21:13 +0000)]
embed_mfs: add error handling, usage

Ensure that we are called with two arguments, and that the output file
is writable. Also, if we cannot find the mfs section report the output
file name rather than "kernel", as this script may be used with other
than kernels.

Sponsored by: The FreeBSD Foundation

6 years agoAdd inital extents read-write support.
fsu [Tue, 17 Oct 2017 20:45:44 +0000 (20:45 +0000)]
Add inital extents read-write support.

Approved by:    pfg (mentor)
MFC after:      6 months
RelNotes:       Yes

Differential Revision:    https://reviews.freebsd.org/D12087

6 years agocxgbe: delete now-redundant vnet decls
rlibby [Tue, 17 Oct 2017 20:37:31 +0000 (20:37 +0000)]
cxgbe: delete now-redundant vnet decls

r324539 gathered some vnet decls into netinet/tcp_var.h, so that they
are now redundant in dev/cxgbe/tom/{t4_cpl_io.c,t4_ddp.c}. This triggers
gcc -Wredundant-decls.

Reviewed by: np
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D12674

6 years agoFix a racy VI_DOOMED check in MNT_VNODE_FOREACH_ALL().
markj [Tue, 17 Oct 2017 19:41:45 +0000 (19:41 +0000)]
Fix a racy VI_DOOMED check in MNT_VNODE_FOREACH_ALL().

MNT_VNODE_FOREACH_ALL() is supposed to avoid returning doomed vnodes,
but the VI_DOOMED check it used was done without the vnode interlock
held, so it could race with a concurrent vgone().

Submitted by: Don Morris <don.morris@isilon.com>
Reviewed by: kib, mckusick
MFC after: 1 week
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D12704

6 years agoloader.mk: clean md.o even if MD_IMAGE_SIZE not defined
emaste [Tue, 17 Oct 2017 19:11:29 +0000 (19:11 +0000)]
loader.mk: clean md.o even if MD_IMAGE_SIZE not defined

We don't normally provide special handling for optionally-included src
files, but md.o depends on both md.c and the value of ${MD_IMAGE_SIZE}.
Previously if one built with MD_IMAGE_SIZE, executed "make clean", and
then built with a different MD_IMAGE_SIZE md.o would not be rebuilt.

Reported by: Zakary Nafziger
Sponsored by: The FreeBSD Foundation

6 years agoWe need to include disk.o in libuboot.a when we're building with
imp [Tue, 17 Oct 2017 19:11:19 +0000 (19:11 +0000)]
We need to include disk.o in libuboot.a when we're building with
support for disk access.

Sponsored by: Netflix

6 years agoAdd a test for r324671 along with some other masked tests.
bdrewery [Tue, 17 Oct 2017 19:01:01 +0000 (19:01 +0000)]
Add a test for r324671 along with some other masked tests.

MFC after: 1 week
Sponsored by: Dell EMC Isilon