]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
6 years agoRemove artificial restriction on lio_listio's operation count
asomers [Mon, 23 Oct 2017 23:12:01 +0000 (23:12 +0000)]
Remove artificial restriction on lio_listio's operation count

In r322258 I made p1003_1b.aio_listio_max a tunable. However, further
investigation shows that there was never any good reason for that limit to
exist in the first place. It's used in two completely different ways:

* To size a UMA zone, which globally limits the number of concurrent
  aio_suspend calls.

* To artifically limit the number of operations in a single lio_listio call.
  There doesn't seem to be any memory allocation associated with this limit.

This change does two things:

* Properly names aio_suspend's UMA zone, and sizes it based on a new constant.

* Eliminates the artifical restriction on lio_listio. Instead, lio_listio
  calls will now be limited by the more generous max_aio_queue_per_proc. The
  old p1003_1b.aio_listio_max is now an alias for
  vfs.aio.max_aio_queue_per_proc, so sysconf(3) will still work with
  _SC_AIO_LISTIO_MAX.

Reported by: bde
Reviewed by: jhb
MFC after: 3 weeks
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D12120

6 years agoFix the error message when creating a zpool on a too-small device
asomers [Mon, 23 Oct 2017 23:05:29 +0000 (23:05 +0000)]
Fix the error message when creating a zpool on a too-small device

Don't check for SPA_MINDEVSIZE in vdev_geom_attach when opening by path.
It's redundant with the check in vdev_open, and failing to attach here
results in the wrong error message being printed.  However, still check for
it in some other situations:

* When opening by guids, so we don't get bogged down reading from slow
  devices like floppy drives.
* In vdev_geom_read_pool_label for the same reason, because we iterate over
  all providers.
* If the caller requests that we verify the guid, because then we'll have to
  read from the device before vdev_open verifies the size.

PR: 222227
Reported by: Marie Helene Kvello-Aune <marieheleneka@gmail.com>
Reviewed by: avg, mav
MFC after: 3 weeks
Sponsored by: Spectra Logic Corp
Differential Revision: https://reviews.freebsd.org/D12531

6 years agoAfter jemalloc was updated to version 5.0.0 in r319971, i386 executables
dim [Mon, 23 Oct 2017 21:31:04 +0000 (21:31 +0000)]
After jemalloc was updated to version 5.0.0 in r319971, i386 executables
linked with AddressSanitizer (even those linked on earlier versions of
FreeBSD, or with external versions of clang) started failing with errors
similar to:

  ==14688==AddressSanitizer CHECK failed:
  /usr/src/contrib/compiler-rt/lib/asan/asan_poisoning.cc:36
  "((AddrIsAlignedByGranularity(addr))) != (0)" (0x0, 0x0)

This is because AddressSanitizer expects all the TLS data in the program
to be aligned to at least 8 bytes.

Before the jemalloc 5.0.0 update, all the TLS data in the i386 version
of libc.so added up to 80 bytes (a multiple of 8), but 5.0.0 made this
grow to 2404 bytes (not a multiple of 8).  This is due to added caching
data in jemalloc's internal struct tsd_s.

To fix AddressSanitizer, ensure this struct is aligned to at least 16
bytes, which can be done unconditionally for all architectures.  (An
earlier version of the fix aligned the struct to 8 bytes, but only for
ILP32 architectures.  This was deemed unnecessarily complicated.)

PR: 221337
X-MFC-With: r319971

6 years agoSome cache related optimizations
shurd [Mon, 23 Oct 2017 20:50:08 +0000 (20:50 +0000)]
Some cache related optimizations

1. prefetch 128 bytes of mbufs.
2. Re-order filling the pkt_info so cache stalls happen at the end
3. Define empty prefetch2cachelines() macro when the function isn't present.

Provides small performance improvments on some hardware

Reviewed by: sbruno
Approved by: sbruno (mentor)
Sponsored by: Limelight Networks
Differential Revision: https://reviews.freebsd.org/D12447

6 years agouefi.8: mention use on (32-bit) arm
emaste [Mon, 23 Oct 2017 20:32:18 +0000 (20:32 +0000)]
uefi.8: mention use on (32-bit) arm

Sponsored by: The FreeBSD Foundation

6 years agoClean up trailing whitespace
ngie [Mon, 23 Oct 2017 16:55:22 +0000 (16:55 +0000)]
Clean up trailing whitespace

MFC after: 1 week

6 years agoRemove dead stores
ngie [Mon, 23 Oct 2017 16:54:30 +0000 (16:54 +0000)]
Remove dead stores

The return value of various snprintf calls was stored in `len` and not used
in many functions.

MFC after: 1 week
Reported by: clang-scanbuild

6 years agoExpand explanation of atomicity.
kib [Mon, 23 Oct 2017 16:14:55 +0000 (16:14 +0000)]
Expand explanation of atomicity.

Mention per-location total order, out of thin air, and torn writes
guarantees.  Mention C11 standard' memory model and one most important
FreeBSD additional requirement, that is aligned ordinary loads and
stores are atomic on processors.

The text is introductional and informal.  Reference the C11 and
C++1{1,4,7} standards for authorative description.

In collaboration with: alc
Sponsored by: The FreeBSD Foundation (kib)
MFC after: 1 week

6 years agoRemove resource_set_*() declarations from sys/bus.h.
markj [Mon, 23 Oct 2017 16:02:48 +0000 (16:02 +0000)]
Remove resource_set_*() declarations from sys/bus.h.

The corresponding definitions were removed in r78135.

PR: 223189
Submitted by: marc.priggemeyer@gmail.com
MFC after: 1 week

6 years agoMove clear_unrhdr to tmpfs_free_tmp.
mjoras [Mon, 23 Oct 2017 15:43:38 +0000 (15:43 +0000)]
Move clear_unrhdr to tmpfs_free_tmp.

Clearing the unr in tmpfs_unmount is not correct. In the case of
multiple references to the tmpfs mount (e.g. when there are lookup
threads using it) it will not be the one to finish tmpfs_free_tmp. In
those cases tmpfs_free_node_locked will be the final one to execute
tmpfs_free_tmp, and until then the unr must be valid.

Reported by: pho
Approved/reviewed by: rstone (mentor)
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D12749

6 years agoFix the VM_NRESERVLEVEL == 0 build.
markj [Mon, 23 Oct 2017 15:34:05 +0000 (15:34 +0000)]
Fix the VM_NRESERVLEVEL == 0 build.

Add VM_NRESERVLEVEL guards in the pmaps that implement transparent
superpage promotion using reservations.

Reviewed by: alc, kib
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D12764

6 years agoFix an omission in a comment
ngie [Mon, 23 Oct 2017 07:56:56 +0000 (07:56 +0000)]
Fix an omission in a comment

Soft float API support applies to armv7 too after r324340

6 years agoBump WITNESS_PENDLIST to accomodate sleepq chain bump.
mjg [Mon, 23 Oct 2017 01:00:35 +0000 (01:00 +0000)]
Bump WITNESS_PENDLIST to accomodate sleepq chain bump.

Reported by: ngie

6 years agoUse preferred defined paths, rather than relative paths in fdt.
imp [Sun, 22 Oct 2017 22:52:27 +0000 (22:52 +0000)]
Use preferred defined paths, rather than relative paths in fdt.

Sponsored by: Netflix

6 years agoCreate a shell script to build sys/boot on all the architectures.
imp [Sun, 22 Oct 2017 22:52:23 +0000 (22:52 +0000)]
Create a shell script to build sys/boot on all the architectures.

One could run this from any directory, but it's designed to do
regression testing on sys/boot (it only tests on a subset of
architectures since all of them would take a lot longer and not help).
This will also ensure that future commits to sys/boot compile
everywhere.

Sponsored by: Netflix

6 years agoUse SYSDIR instead of ${.CURDIR}/../..<etc>/sys.
imp [Sun, 22 Oct 2017 22:50:28 +0000 (22:50 +0000)]
Use SYSDIR instead of ${.CURDIR}/../..<etc>/sys.

Sponsored by: Netflix

6 years agoUse BOOTSRC here.
imp [Sun, 22 Oct 2017 22:50:23 +0000 (22:50 +0000)]
Use BOOTSRC here.

sponsored by: Netflix

6 years agoPrefer SRCTOP paths for bits we're grabbing from libc.
imp [Sun, 22 Oct 2017 22:50:19 +0000 (22:50 +0000)]
Prefer SRCTOP paths for bits we're grabbing from libc.

Sponsored by: Netflix

6 years agoMake at91 boot loader compile again.
imp [Sun, 22 Oct 2017 22:50:15 +0000 (22:50 +0000)]
Make at91 boot loader compile again.

No clue if it actually still works, but it might.

6 years agoEnd source directories with SRC rather than a hodgepodge of names
imp [Sun, 22 Oct 2017 22:50:08 +0000 (22:50 +0000)]
End source directories with SRC rather than a hodgepodge of names

BOOTDIR->BOOTSRC
FICLDIR->FICLSRC
LDR_MI->LDRSRC

This matches the patterns used in the rest of the system a bit vetter.

Suggested by: rgrimes@
Sponsored by: Netflix

6 years agoMove fdt and uboot defines into common uboot.mk.
imp [Sun, 22 Oct 2017 22:49:51 +0000 (22:49 +0000)]
Move fdt and uboot defines into common uboot.mk.

Sponsored by: Netflix

6 years agoMake the sleepq chain hash size configurable per-arch and bump on amd64.
mjg [Sun, 22 Oct 2017 20:43:50 +0000 (20:43 +0000)]
Make the sleepq chain hash size configurable per-arch and bump on amd64.

While here cache-align chains.

This shortens longest found chain during poudriere -j 80 from 32 to 16.

Pushing this higher up will probably require allocation on boot.

6 years agosdt: make all sdt probe sites test one variable
mjg [Sun, 22 Oct 2017 20:22:23 +0000 (20:22 +0000)]
sdt: make all sdt probe sites test one variable

This saves on cache misses at the expense of a slight grow of .text.

Note this is a bandaid for lack of hotpatching.

Discussed with: markj

6 years agoDelete declarations of struct pfs_bitmap, removed in r143841.
markj [Sun, 22 Oct 2017 20:22:11 +0000 (20:22 +0000)]
Delete declarations of struct pfs_bitmap, removed in r143841.

MFC after: 1 week

6 years agosdt: whack unused SDT_PROBE_ENABLED
mjg [Sun, 22 Oct 2017 20:14:48 +0000 (20:14 +0000)]
sdt: whack unused SDT_PROBE_ENABLED

6 years agolibc: Do not refer to _DefaultRuneLocale in ctype inlines
jilles [Sun, 22 Oct 2017 20:01:07 +0000 (20:01 +0000)]
libc: Do not refer to _DefaultRuneLocale in ctype inlines

Referring to _DefaultRuneLocale causes this >4KB structure to be copied to
all executables that use <ctype.h> inlines (except PIE executables).

This only affects the case where thread local storage is available.

_CurrentRuneLocale cannot be NULL, so the check can be removed entirely.

_DefaultRuneLocale needs to remain available for now since libc++ uses it.
The __isctype inline in include/_ctype.h also refers to _DefaultRuneLocale
and remains available because it may still be used by third party software.

Reviewed by: bdrewery, theraven
Differential Revision: https://reviews.freebsd.org/D10363

6 years agoAddress some miscellaneous issues in the CTF man page.
markj [Sun, 22 Oct 2017 19:17:25 +0000 (19:17 +0000)]
Address some miscellaneous issues in the CTF man page.

- Fix a number of typos.
- Replace some illumos-specific references.
- Note that a type definition of kind CTF_K_FUNCTION may be followed by
  a null type identifier in order to provide 4-byte alignment for the
  next type definition.

MFC after: 2 weeks

6 years agoMFV r323105 (partial): 8300 fix man page issues found by mandoc 1.14.1
markj [Sun, 22 Oct 2017 18:32:28 +0000 (18:32 +0000)]
MFV r323105 (partial): 8300 fix man page issues found by mandoc 1.14.1

illumos/illumos-gate@72d3dbb9ab4481606cb93caca98ba3b3a8eb6ce2
https://github.com/illumos/illumos-gate/commit/72d3dbb9ab4481606cb93caca98ba3b3a8eb6ce2

https://www.illumos.org/issues/8300
  Prior to integrating the mdocml update to 1.14.1, fix issues found by
  new version, especially the "new sentence, new line" style rule.

FreeBSD note: this revision merges only the changes to the CTF manual
page. The changes to the ZFS pages cannot be applied directly.

Reviewed by: Robert Mustacchi <rm@joyent.com>
Reviewed by: Toomas Soome <tsoome@me.com>
Approved by: Gordon Ross <gwr@nexenta.com>
Author: Yuri Pankov <yuri.pankov@nexenta.com>

Discussed with: avg
MFC after: 2 weeks

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