]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
4 years agoepoch.9: Add missing functions, clean up documentation
Conrad Meyer [Sat, 28 Dec 2019 01:35:32 +0000 (01:35 +0000)]
epoch.9: Add missing functions, clean up documentation

Various rototilling.

4 years agoRemove some stale comments from the page allocator.
Mark Johnston [Fri, 27 Dec 2019 23:19:21 +0000 (23:19 +0000)]
Remove some stale comments from the page allocator.

Since r352110 the page lock is not required to wire pages in any
context.

4 years agoFix GEOM_UZIP orphanization.
Alexander Motin [Fri, 27 Dec 2019 21:44:13 +0000 (21:44 +0000)]
Fix GEOM_UZIP orphanization.

Previous code destroyed softc even with provider still open, that resulted
in panic under load.  This change postpones the free till the final close,
when we know for sure there will be no more I/O requests.

MFC after: 2 weeks
Sponsored by: iXsystems, Inc.

4 years agoImplement dump_stats command for usbconfig(8).
Hans Petter Selasky [Fri, 27 Dec 2019 20:37:14 +0000 (20:37 +0000)]
Implement dump_stats command for usbconfig(8).

This command is useful when debugging USB device issues.

MFC after: 1 week
Sponsored by: Mellanox Technologies

4 years agoImplement new libusb v2.0 API function, libusb20_dev_get_stats().
Hans Petter Selasky [Fri, 27 Dec 2019 20:35:12 +0000 (20:35 +0000)]
Implement new libusb v2.0 API function, libusb20_dev_get_stats().

This function is useful when debugging USB device issues.

MFC after: 1 week
Sponsored by: Mellanox Technologies

4 years agoMake USB statistics per device instead of per bus.
Hans Petter Selasky [Fri, 27 Dec 2019 20:29:13 +0000 (20:29 +0000)]
Make USB statistics per device instead of per bus.

Bump the FreeBSD version due to structure change to
force recompilation of external USB modules.

MFC after: 1 week
Sponsored by: Mellanox Technologies

4 years ago[PowerPC] Ignore fortify-source warning in trap vector copy
Brandon Bergren [Fri, 27 Dec 2019 19:58:14 +0000 (19:58 +0000)]
[PowerPC] Ignore fortify-source warning in trap vector copy

Due to a bug in clang 9.0.0 source tracking, the trap vector copying will
always trigger a fortify-source warning.

The destination buffers are 0x2f00 bytes, and the bcopy region is 0x2e00
bytes, so there is not an overflow here.

(I have been running with this patch since September.)

4 years agoFix the powerpc copyout fixup from r356113
Justin Hibbits [Fri, 27 Dec 2019 17:38:25 +0000 (17:38 +0000)]
Fix the powerpc copyout fixup from r356113

Summary:
r356113 used an older patch, which predated the
freebsd_copyout_auxargs() addition.  Fix this by using a private
powerpc_copyout_auxargs() instead, and keep it private to powerpc, not in MI
files.

Reviewed by: kib, bdragon
Differential Revision: https://reviews.freebsd.org/D22935

4 years agosrc.conf.5: regen after r356127, disable GPL_DTC by default
Ed Maste [Fri, 27 Dec 2019 17:12:06 +0000 (17:12 +0000)]
src.conf.5: regen after r356127, disable GPL_DTC by default

4 years agoSwitch GPL_DTC to default off
Ed Maste [Fri, 27 Dec 2019 16:59:26 +0000 (16:59 +0000)]
Switch GPL_DTC to default off

We use the BSDL devicetree compiler as long as we have a C++11 compiler.
dtc is not needed as a build tool on the platforms that are still using
GCC 4.2.1 (and it is being disabled very soon, anyhow).

Discussed with: imp, kevans

4 years agoufs: do not leave non-reclaimed vnodes with zero i_mode around.
Konstantin Belousov [Fri, 27 Dec 2019 16:43:34 +0000 (16:43 +0000)]
ufs: do not leave non-reclaimed vnodes with zero i_mode around.

After a recent change, vput() relocks even the exclusively locked
vnode before inactivating it.  Before that, UFS could safely
instantiate a vnode for cleared inode, then the last vput() after
ffs_vgetf() noted that ip->i_mode == 0 and recycled.  Now, it is
possible for other threads to note the half-constructed vnode, e.g. to
insert it into hash, which makes other threads to use it despite mode
is zero, before inactivation and reclaim.

Handle the found cases in SU code, by explicitly doing reclaim.
Assert that other places get fully constructed inode from ffs_vgetf(),
which cannot be cleared before dependencies are resolved.

Reported and tested by: pho
Reviewed by: mckusick
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

4 years agosrc.opts.mk: switch LLVM_LIBUNWIND to opt-out
Ed Maste [Fri, 27 Dec 2019 16:28:43 +0000 (16:28 +0000)]
src.opts.mk: switch LLVM_LIBUNWIND to opt-out

PowerPC switched to LLVM_LIBUNWIND along with the switch to Clang/LLVM
in r356111.  This leaves only 32-bit Arm and sparc64 not using LLVM's
unwinder, so switch the sense to opt-out.

I elected to list the individual arm MACHINE_ARCHs so future changes
are more clear if LLVM_LIBUNWIND is enabled for one or two but not all
32-bit Arm targets (see PR 233664).

4 years agosrc.opts.mk: switch LLVM toolchain to opt-out
Ed Maste [Fri, 27 Dec 2019 15:47:32 +0000 (15:47 +0000)]
src.opts.mk: switch LLVM toolchain to opt-out

After PowerPC switched in r356111, the list of targets using LLVM as the
default toolchain is much longer than those not using it.  Switch the
sense of the test to exclude those not using LLVM.

Targets not using LLVM is currently mips, riscv5, and sparc64; work is
in progress to migrate the first two to LLVM.

4 years agosrc.conf.5: regenerate after recent changes
Ed Maste [Fri, 27 Dec 2019 15:33:43 +0000 (15:33 +0000)]
src.conf.5: regenerate after recent changes

r355588 Fix WITHOUT_CLANG build
r355646 Revert r354348
r355943 add LDNS build knob dependency on OPENSSL
r356111 Use LLVM as default toolchain for all PowerPC targets

4 years agoPlug a warning in read-mostly spinlocks reported by gcc.
Mateusz Guzik [Fri, 27 Dec 2019 13:37:19 +0000 (13:37 +0000)]
Plug a warning in read-mostly spinlocks reported by gcc.

4 years agovfs: remove production kernel checks and mp == NULL support from vdrop
Mateusz Guzik [Fri, 27 Dec 2019 11:26:12 +0000 (11:26 +0000)]
vfs: remove production kernel checks and mp == NULL support from vdrop

1. The only place in the tree which calls getnewvnode with mp == NULL does it
for vp_crossmp which will never execute this codepath. Any vnode which legally
has ->v_mount == NULL is also doomed, which once more wont execute this code.
2. Remove an assertion for v_holdcnt from production kernels. It gets taken care
of by refcount macros in debug kernels.

Any code which would want to pass NULL mp can construct a fake one instead.

Reviewed by: kib (previous version)
Differential Revision: https://reviews.freebsd.org/D22722

4 years agomac: use a sleepable rmlock instead of an sx lock
Mateusz Guzik [Fri, 27 Dec 2019 11:23:32 +0000 (11:23 +0000)]
mac: use a sleepable rmlock instead of an sx lock

If any non-static modules are loaded (and mac_ntpd tends to be), the lock is
taken all the time al over the kernel. On platforms like arm64 this results in
an avoidable significant performance degradation. Since write-locking is almost
never needed, use a primitive optimized towards read-locking.

Sample result of building the kernel on tmpfs 11 times:
stock           11142.80s user 6704.44s system 4924% cpu 6:02.42 total
patched         11118.95s user 2374.94s system 4547% cpu 4:56.71 total

4 years agoAdd read-mostly sleepable locks
Mateusz Guzik [Fri, 27 Dec 2019 11:19:57 +0000 (11:19 +0000)]
Add read-mostly sleepable locks

To be used when like rmlocks, except when sleeping for readers needs to be
allowed. See the manpage for more information.

Reviewed by: kib (previous version)
Differential Revision: https://reviews.freebsd.org/D22823

4 years ago[PowerPC] Clang powerpcspe build fixes
Brandon Bergren [Fri, 27 Dec 2019 05:01:13 +0000 (05:01 +0000)]
[PowerPC] Clang powerpcspe build fixes

* Fix a couple of format errors.
* Add some extra compiler flags needed to force clang to build SPE code.
  (These are temporary until the target triple is fixed)

4 years agoFix the build from r356113.
Justin Hibbits [Fri, 27 Dec 2019 04:52:17 +0000 (04:52 +0000)]
Fix the build from r356113.

Types had changed from when the patch was first created, and a final build
was not done pre-commit.

4 years agoAdd a note to UPDATING on the move to clang for powerpc*
Justin Hibbits [Fri, 27 Dec 2019 04:42:03 +0000 (04:42 +0000)]
Add a note to UPDATING on the move to clang for powerpc*

4 years ago[gpioths] Fix GPIOTHS_DEBUG
Brad Davis [Fri, 27 Dec 2019 04:11:14 +0000 (04:11 +0000)]
[gpioths] Fix GPIOTHS_DEBUG

Chase the removal of dev from gpioths_dht_readbytes() in r355540.

Reviewed by: ian
Approved by: will (mentor)
Differential Revision: https://reviews.freebsd.org/D22926

4 years ago[PowerPC] Switch to PIC kernel modules on powerpc*
Brandon Bergren [Fri, 27 Dec 2019 04:07:51 +0000 (04:07 +0000)]
[PowerPC] Switch to PIC kernel modules on powerpc*

To improve reliability of kernel modules after the clang switch, switch to
-fPIC when building for now.

This bypasses some limitations to the way clang and LLD handle relocations,
and is a more robustly tested compilation regime than the
"static shared object" mode that we were previously attempting to convince
the compiler stack to use.

The kernel linker was recently augmented to be able to handle this mode.

Reviewed by: jhibbits
Differential Revision: https://reviews.freebsd.org/D22798

4 years agoEliminate the last MI difference in AT_* definitions (for powerpc).
Justin Hibbits [Fri, 27 Dec 2019 04:07:03 +0000 (04:07 +0000)]
Eliminate the last MI difference in AT_* definitions (for powerpc).

Summary:
As a transition aide, implement an alternative elfN_freebsd_fixup which
is called for old powerpc binaries.  Similarly, add a translation to rtld to
convert old values to new ones (as expected by a new rtld).

Translation of old<->new values  is incomplete, but sufficient to allow an
installworld of a new userspace from an old one when a new kernel is running.

Test Plan:
Someone needs to see how a new kernel/rtld/libc works with an old
binary.  If if works we can probalby ship this.  If not we probalby need
some more compat bits.

Submitted by: brooks
Reviewed by: jhibbits
Differential Revision: https://reviews.freebsd.org/D20799

4 years ago[PowerPC64] Starting from FreeBSD 13.0, default to ELFv2 ABI
Justin Hibbits [Fri, 27 Dec 2019 04:00:04 +0000 (04:00 +0000)]
[PowerPC64] Starting from FreeBSD 13.0, default to ELFv2 ABI

This changes the LLVM default powerpc64 ABI to ELFv2, if target OS is
FreeBSD >= 13.0

This will also be sent upstream.

Submitted by: alfredo.junior_eldorado.org.br
Reviewed by: dim, luporl
Relnotes: YES
Differential Revision: https://reviews.freebsd.org/D20383

4 years agoUse LLVM as default toolchain for all PowerPC targets
Justin Hibbits [Fri, 27 Dec 2019 03:54:27 +0000 (03:54 +0000)]
Use LLVM as default toolchain for all PowerPC targets

This enables LLVM as the default compiler for powerpc, powerpc64, and
powerpcspe, as well as LLD as the default linker for powerpc64.

LLD is not yet ready for prime time for powerpc and powerpcspe, but work is
continuing on it.

Submitted by: alfredo.junior_eldorado.org.br
Relnotes: YES
Differential Revision: https://reviews.freebsd.org/D20378

4 years agoFix a pair of bugs introduced in r356002. When we reclaim physical pages we
Jeff Roberson [Fri, 27 Dec 2019 01:50:16 +0000 (01:50 +0000)]
Fix a pair of bugs introduced in r356002.  When we reclaim physical pages we
allocate them with VM_ALLOC_NOOBJ which means they are not busy.  For now
move the busy assert for the new page in vm_page_replace into the public
api and out of the private api used by contig reclaim.  Fix another issue
where we would leak busy if the page could not be removed from pmap.

Reported by: pho
Discussed with: markj

4 years agoReimplement gvinum orphanization.
Alexander Motin [Fri, 27 Dec 2019 01:36:53 +0000 (01:36 +0000)]
Reimplement gvinum orphanization.

gvinum was the only GEOM class, using consumer nstart/nend fields. Making
it do its own accounting for orphanization purposes allows in perspective
to remove burden of that expensive for SMP accounting from GEOM.

Also the previous implementation spinned in a tight event loop, waiting
for all active BIOs to complete, while the new one knows exactly when it
is possible to close the consumer.

MFC after: 1 month
Sponsored by: iXsystems, Inc.

4 years agoPlug some ifaddr refcount leaks.
Mark Johnston [Fri, 27 Dec 2019 01:12:54 +0000 (01:12 +0000)]
Plug some ifaddr refcount leaks.

- Only take an ifaddr ref in in rt_exportinfo() if the caller explicitly
  requests it.  Take care to release it in this case.
- Don't unconditionally take a ref in rtrequest1_fib().  rt_getifa_fib()
  will acquire a reference, in which case we would previously acquire
  two references.
- Stop taking a reference in rtinit1() before calling rtrequest1_fib().
  rtrequest1_fib() will acquire a reference for the RTM_ADD case.

PR: 242746
Reviewed by: melifaro (previous version)
Tested by: ghuckriede@blackberry.com
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D22912

4 years agomsun: drop clause 3 from the Berkeley license.
Pedro F. Giffuni [Fri, 27 Dec 2019 01:11:26 +0000 (01:11 +0000)]
msun: drop clause 3 from the Berkeley license.

Per the University California Regents letter, drop the so-called
"advertisement" clause.

Discussed with: bde, kargl (2017)
Differential Revision: https://reviews.freebsd.org/D22928

4 years ago[PowerPC] enable atomic.c in compiler_rt and do not check and forces
Justin Hibbits [Thu, 26 Dec 2019 23:06:28 +0000 (23:06 +0000)]
[PowerPC] enable atomic.c in compiler_rt and do not check and forces
lock/lock_free decisions in compiled time

Summary:
Enables atomic.c in compiler_rt and forces clang to not emit a call for runtime
decision about lock/lock_free.  At compiling time, if clang can't decide if
atomic operation can be lock free, it emits calls to external functions  like
`__atomic_is_lock_free`, `__c11_atomic_is_lock_free` and
`__atomic_always_lock_free`, postponing decision to a runtime check.  According
to LLVM code documentation, the mechanism exists due to differences between
x86_64 processors that can't be decided at runtime.

On PowerPC and PowerPCSPE (32 bits), we already know in advance it can't be lock
free, so we force the decision at compile time and avoid having to implement it
in an external library.

This patch was made after 32 bit users testing the PowePC32 bit ISO reported
llvm could not be compiled with in-base llvm due to `__atomic_load8` not
implemented.

Submitted by: alfredo.junior_eldorado.org.br
Reviewed by: jhibbits, dim

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

4 years agocron(8): use proper variable to determine mailer process status
Kyle Evans [Thu, 26 Dec 2019 22:49:19 +0000 (22:49 +0000)]
cron(8): use proper variable to determine mailer process status

While the mailer is normally opened/set if the mailto is set, this is not
the case if the grandchild actually didn't produce any output. This change
corrects the situation to only attempt to kill/close the mail process if it
was actually opened in the first place.

The reporter initially stumbled on the -n (suppress mail on success) flag
leading to a SIGKILL of the process group, but simultaneously
discovered/reported the behavior with !-n jobs if MAILTO was set and no
output happened.

All of these places that are checking mailto should actually be checking
whether mail is set, so do that for consistency+correctness.

This set of bugs were introduced by r352668.

Submitted by: sigsys@gmail.com
Reported by: sigsys@gmail.com

4 years agopowerpc: Move ppc32_runtime_resolve() declaration to the right place
Justin Hibbits [Thu, 26 Dec 2019 22:47:24 +0000 (22:47 +0000)]
powerpc: Move ppc32_runtime_resolve() declaration to the right place

The function is only used in 32-bit kernels, so move the declaration to
!powerpc64.

4 years agoFix mount_nfs to recognize the NFSv4 specific errors returned by nmount(2).
Rick Macklem [Thu, 26 Dec 2019 22:33:20 +0000 (22:33 +0000)]
Fix mount_nfs to recognize the NFSv4 specific errors returned by nmount(2).

When mount_nfs calls nmount(2), certain NFSv4 specific errors such as
NFSERR_MINORVERMISMATCH can be returned.
Without this patch, 10021 is reported as an unknown error.
This is not particulcarily serious, but make it difficult for sysadmins
to figure out why the mount attempt is failing.
This patch uses nfsv4_errstr.h to convert 10021 and similar to error strings
that can be printed out.
A positive side effect of this patch is the removal of a reference to
sys/nfsclient/nfs.h, which should no longer be used, since it is
part of the old NFS client.

This patch should only affect reporting of failed mount attempts and not the
semantics of NFS mount attempts.

4 years agoMerge commit d3aeac8e2 from llvm git (by Justin Hibbits)
Dimitry Andric [Thu, 26 Dec 2019 21:20:45 +0000 (21:20 +0000)]
Merge commit d3aeac8e2 from llvm git (by Justin Hibbits)

  [PowerPC] Only use PLT annotations if using PIC relocation model

  Summary:
  The default static (non-PIC, non-PIE) model for 32-bit powerpc does
  not use @PLT annotations and relocations in GCC.  LLVM shouldn't use
  @PLT annotations either, because it breaks secure-PLT linking with
  (some versions of?) GNU LD.

  Update the available-externally.ll test to reflect that default mode
  should be the same as the static relocation, by using the same check
  prefix.

  Reviewed by:    sfertile
  Differential Revision: https://reviews.llvm.org/D70570

Reviewed by: jhibbits
Differential Revision: https://reviews.freebsd.org/D22913

4 years agoChange NFSv4.1 and NFSv4.2 error strings to start with lower case letter.
Rick Macklem [Thu, 26 Dec 2019 21:06:34 +0000 (21:06 +0000)]
Change NFSv4.1 and NFSv4.2 error strings to start with lower case letter.

r356084 added error strings for NFSv4.1 and NFSv4.2, with the first
character capitalized. Since the other error strings were not capitalized
and these strings would usually be imbedded in an error, I decided to
make the first characters lower cased.
No real effect but more consistent.

4 years agoAbstract the locking for PCIe hotplug. It still uses Giant so there's
Scott Long [Thu, 26 Dec 2019 21:00:06 +0000 (21:00 +0000)]
Abstract the locking for PCIe hotplug.  It still uses Giant so there's
no functional change yet.

4 years agorandom(9): Deprecate random(9), remove meaningless srandom(9)
Conrad Meyer [Thu, 26 Dec 2019 19:41:09 +0000 (19:41 +0000)]
random(9): Deprecate random(9), remove meaningless srandom(9)

srandom(9) is meaningless on SMP systems or any system with, say,
interrupts.  One could never rely on random(9) to produce a reproducible
sequence of outputs on the basis of a specific srandom() seed because the
global state was shared by all kernel contexts.  As such, removing it is
literally indistinguishable to random(9) consumers (as compared with
retaining it).

Mark random(9) as deprecated and slated for quick removal.  This is not to
say we intend to remove all fast, non-cryptographic PRNG(s) in the kernel.
It/they just won't be random(9), as it exists today, in either name or
implementation.

Before random(9) is removed, a replacement will be provided and in-tree
consumers will be converted.

Note that despite the name, the random(9) interface does not bear any
resemblance to random(3).  Instead, it is the same crummy 1988 Park-Miller
LCG used in libc rand(3).

4 years agorandom(4): Simplify RANDOM_LOADABLE
Conrad Meyer [Thu, 26 Dec 2019 19:32:11 +0000 (19:32 +0000)]
random(4): Simplify RANDOM_LOADABLE

Simplify RANDOM_LOADABLE by removing the ability to unload a LOADABLE
random(4) implementation.  This allows one-time random module selection
at boot, by loader(8).  Swapping modules on the fly doesn't seem
especially useful.

This removes the need to hold a lock over the sleepable module calls
read_random and read_random_uio.

init/deinit have been pulled out of random_algorithm entirely.  Algorithms
can run their own sysinits to initialize; deinit is removed entirely, as
algorithms can not be unloaded.  Algorithms should initialize at
SI_SUB_RANDOM:SI_ORDER_SECOND.  In LOADABLE systems, algorithms install
a pointer to their local random_algorithm context in p_random_alg_context at
that time.

Go ahead and const'ify random_algorithm objects; there is no need to mutate
them at runtime.

LOADABLE kernel NULL checks are removed from random_harvestq by ordering
random_harvestq initialization at SI_SUB_RANDOM:SI_ORDER_THIRD, after
algorithm init.  Prior to random_harvestq init, hc_harvest_mask is zero and
no events are forwarded to algorithms; after random_harvestq init, the
relevant pointers will already have been installed.

Remove the bulk of random_infra shim wrappers and instead expose the bare
function pointers in sys/random.h.  In LOADABLE systems, read_random(9) et
al are just thin shim macros around invoking the associated function
pointer.  We do not provide a registration system but instead expect
LOADABLE modules to register themselves at SI_SUB_RANDOM:SI_ORDER_SECOND.
An example is provided in randomdev.c, as used in the random_fortuna.ko
module.

Approved by: csprng(markm)
Discussed with: gordon
Differential Revision: https://reviews.freebsd.org/D22512

4 years agogone_in(9): Trivial string grammar and style cleanups
Conrad Meyer [Thu, 26 Dec 2019 18:25:07 +0000 (18:25 +0000)]
gone_in(9): Trivial string grammar and style cleanups

4 years agokbdmux: simplify modevent handler
Kyle Evans [Thu, 26 Dec 2019 17:25:51 +0000 (17:25 +0000)]
kbdmux: simplify modevent handler

In the event of a MOD_LOAD failure, MOD_UNLOAD will be invoked to unwind
module load. Most of the reversion in MOD_LOAD can just be deferred to
normal MOD_UNLOAD cleanup, rather than duplicating the effort.

A NULL return of kbd_get_switch in the MOD_UNLOAD handler has been
downgraded from a panic to a successful return, as that certainly just means
that kbd_add_driver failed (not possible at the moment) and we have no work
to do.

4 years agoRevert r355806: kbd drivers: don't double register keyboard drivers
Kyle Evans [Thu, 26 Dec 2019 17:09:36 +0000 (17:09 +0000)]
Revert r355806: kbd drivers: don't double register keyboard drivers

r356087 made it rather innocuous to double-register built-in keyboard
drivers; we now set a flag to indicate that it's been registered and only
act once on a registration anyways. There is no misleading here, as the
follow-up kbd_delete_driver will actually remove the driver as needed now
that the linker set isn't also consulted after kbdinit.

4 years agokern_cons: add a stub kbdinit for configs with no keyboard/console drivers
Kyle Evans [Thu, 26 Dec 2019 15:47:19 +0000 (15:47 +0000)]
kern_cons: add a stub kbdinit for configs with no keyboard/console drivers

A weak symbol here is decidedly cleaner than any #ifdef soup or relocating
kbdinit, the former leading to maintenance required on addition of any
console/keyboard drivers and the latter pushing kbd init bits away from
where they're used.

4 years agokbd: merge linker set drivers into standard kbd driver list
Kyle Evans [Thu, 26 Dec 2019 15:21:34 +0000 (15:21 +0000)]
kbd: merge linker set drivers into standard kbd driver list

This leads to the revert of r355806; this reduces duplication in keyboard
registration and driver switch lookup and leaves us with one authoritative
source for currently registered drivers. The reduced duplication later is
nice as we have more procedure involved in keyboard setup.

keyboard_driver->flags is used to more quickly detect bogus adds/removes.
From KPI consumers' perspective, nothing changes- kbd_add_driver of an
already-registered driver will succeed, and a single kbd_delete_driver will
later remove it as expected. In contrast to historical behavior,
kbd_delete_driver on a driver registered via linker set will now actually
de-register the driver so that it may not be used -- e.g. if kbdmux's
MOD_LOAD handler fails somewhere.

Detection for already-registered drivers in kbd_add_driver has improved, as
the previous SLIST_NEXT(driver) != NULL check would not have caught a driver
that's at the tail end.

kbdinit is now called from cninit() rather than via SYSINIT so that keyboard
drivers are available as early as console drivers. This is particularly
important as cnprobe will, in both syscons and vt, attempt to do any early
configuration of keyboard drivers built-in (see: kbd_configure).

Reviewed by: imp (earlier version, pre-cninit change)
Differential Revision: https://reviews.freebsd.org/D22835

4 years agoAdd comments to a couple i2c device lines.
Ian Lepore [Thu, 26 Dec 2019 02:22:38 +0000 (02:22 +0000)]
Add comments to a couple i2c device lines.

4 years agoIn kern.pre.mk, split SYSTEM_LD into two variables to avoid duplication in
Ian Lepore [Wed, 25 Dec 2019 22:33:47 +0000 (22:33 +0000)]
In kern.pre.mk, split SYSTEM_LD into two variables to avoid duplication in
other files.

Arm and mips systems need to replace the SYSTEM_LD variable because they
need to create intermediate files which are post-processed with objcopy to
create the final .TARGET file. Previously they did so by pasting the full
expansion of SYSTEM_LD with the output filename replaced. This means
changing SYSTEM_LD in kern.pre.mk means you need to chase down anything that
replaces it and figure out how it differs so you can paste your changes in
there too.

Now there is a SYSTEM_LD_BASECMD variable that holds the entire basic kernel
linker command without the input and output files. This will allow arm and
mips makefiles to create their custom versions by refering to
SYSTEM_LD_BASECMD, which then becomes the one place where you have to make
changes to the basic linker command args.

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

4 years agoAdd NFSv4.1 and NFSv4.2 errors to nfsv4_errstr.h.
Rick Macklem [Wed, 25 Dec 2019 22:25:30 +0000 (22:25 +0000)]
Add NFSv4.1 and NFSv4.2 errors to nfsv4_errstr.h.

nfsv4_errstr.h only had strings for NFSv4.0 errors. This patch adds the
errors for NFSv4.1 and NFSv4.2. At this time, this file is not used by
any sources in the tree, so the change is not significant.
I do plan on using nfsv4_errstr.h in a future patch to mount_nfs.c.
Since I am doing this patch so that "minor version mismatch" will be
recognized, I made that string less abbreviated.

4 years agoFurther reduce the cacheline footprint of fast allocations by duplicating
Jeff Roberson [Wed, 25 Dec 2019 20:57:24 +0000 (20:57 +0000)]
Further reduce the cacheline footprint of fast allocations by duplicating
the zone size and flags fields in the per-cpu caches.  This allows fast
alloctions to proceed only touching the single per-cpu cacheline and
simplifies the common case when no ctor/dtor is specified.

Reviewed by: markj, rlibby
Differential Revision: https://reviews.freebsd.org/D22826

4 years agoOptimize fast path allocations by storing bucket headers in the per-cpu
Jeff Roberson [Wed, 25 Dec 2019 20:50:53 +0000 (20:50 +0000)]
Optimize fast path allocations by storing bucket headers in the per-cpu
cache area.  This allows us to check on bucket space for all per-cpu
buckets with a single cacheline access and fewer branches.

Reviewed by: markj, rlibby
Differential Revision: https://reviews.freebsd.org/D22825

4 years agoFix a bug with _NUMA domains introduced in r339686. When M_NOWAIT is
Jeff Roberson [Wed, 25 Dec 2019 19:26:35 +0000 (19:26 +0000)]
Fix a bug with _NUMA domains introduced in r339686.  When M_NOWAIT is
specified there was no loop termination condition in keg_fetch_slab().

Reported by: pho
Reviewed by: markj

4 years agoRevert r356077, apparently the change doesn't work after all (failed to
Ian Lepore [Wed, 25 Dec 2019 18:24:38 +0000 (18:24 +0000)]
Revert r356077, apparently the change doesn't work after all (failed to
build in CI).

4 years agoFor riscv kernel builds, add -N to LDFLAGS instead of replacing the
Ian Lepore [Wed, 25 Dec 2019 17:26:51 +0000 (17:26 +0000)]
For riscv kernel builds, add -N to LDFLAGS instead of replacing the
SYSTEM_LD variable.  This avoids duplicating the contents of SYSTEM_LD
from kern.pre.mk just to add the -N flag to it.  If the basic linker command
ever needs to be changed, this will be one less place that has to be found
and fixed.

Some testing by kp@ indicates that the -N flag may not be needed at all,
so a comment to that effect is also added, and the -N flag may be removed
in a followup commit.

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

4 years agoatkbdc: use proper pointer type for KBDC
Kyle Evans [Wed, 25 Dec 2019 15:55:45 +0000 (15:55 +0000)]
atkbdc: use proper pointer type for KBDC

Proper locking for atkbdc will likely replace the kbdc_lock mechanism
entirely with a mutex in atkbdc_softc, so that other consumers can also
properly ensure locking protocol is followed (e.g. psm.c:doinitialize).

The first step to doing this neatly is making KBDC less opaque so that
others don't have to jump through weird casting hoops to address the mutex.

No functional change intended; this diff effectively just removes a bunch of
casting. A future change may remove the KBDC typedef entirely and just opt
for using `atkbdc_softc_c *` directly, but this was decidedly a good
intermediate step to make these changes simple to audit.

4 years agoFix panic when running etherswitchcfg port command.
Ganbold Tsagaankhuu [Wed, 25 Dec 2019 11:26:38 +0000 (11:26 +0000)]
Fix panic when running etherswitchcfg port command.

4 years agoFix nfsmount() so that it will return NFSERR_MINORVERMISMATCH.
Rick Macklem [Wed, 25 Dec 2019 01:15:38 +0000 (01:15 +0000)]
Fix nfsmount() so that it will return NFSERR_MINORVERMISMATCH.

If nfsrpc_getdirpath() returns NFSERR_MINORVERMISMATCH, it would erroneously
get mapped to EIO. This was not particularily harmful, but would make it
hard for sysadmins to diagnose why an NFSv4 mount is failing.

mount_nfs.c still needs to be fixed so that it does not report
NFSERR_MINORVERMISMATCH as an unknown error 10021.

MFC after: 1 week

4 years agoInitialize the bounce pages list in armv[4|6] DMA maps.
Luiz Otavio O Souza [Tue, 24 Dec 2019 23:43:29 +0000 (23:43 +0000)]
Initialize the bounce pages list in armv[4|6] DMA maps.

Fixes the crash on the first use of STAILQ_INSERT_TAIL() in
add_bounce_page().

Sponsored by: Rubicon Communications, LLC (Netgate)

4 years agoWhen running fsck_ffs manually, do not ask:
Kirk McKusick [Tue, 24 Dec 2019 23:03:12 +0000 (23:03 +0000)]
When running fsck_ffs manually, do not ask:

USE JOURNAL? [yn]

when the journal timestamp does not match the filesystem mount time
as we are just going to print an error and fall through to a full fsck.
Instead, just run a full fsck.

Requested by: Bjoern A. Zeeb (bz)
MFC after:    7 days

4 years agoFix trivial whitespace issue that is tripping -Wmisleading-indentation
Brandon Bergren [Tue, 24 Dec 2019 22:27:06 +0000 (22:27 +0000)]
Fix trivial whitespace issue that is tripping -Wmisleading-indentation
in clang HEAD.

There was an invisible space in the middle of the tabs, and that apprently
was enough to throw off clang's column counting.

Even if clang is "incorrect" here, it's still a style(9) violation.

4 years ago[PowerPC] Define powerpc IFUNC kernel/userspace ABI.
Brandon Bergren [Tue, 24 Dec 2019 20:13:29 +0000 (20:13 +0000)]
[PowerPC] Define powerpc IFUNC kernel/userspace ABI.

This is a prerequisite for anything IFUNC in the ELFv2 / clang switch.

Since probing cpu info on powerpc is a privileged operation, define that we
pass AT_HWCAP / AT_HWCAP2 through as cpu_features and cpu_features2 to ifunc
resolvers.

This is particularly important when dealing with non-PLT GNU IFUNC, which is
not allowed to PLT call from resolvers and therefore can't access global
variables.

The naming convention "cpu_features"/"cpu_features2" is an existing FreeBSD
PowerPC convention and matches the way we treat these variables in
machine/cpu.h.

The underlying variables are u_long, however, as per the commit message for
r332868, only the low 32 bits are ever used, so the underlying flags are
compatible across all of PowerPC.

The resolver prototype is defined to reserve the maximum number of
register-passed parameters the various PowerPC ABIs allow. This leaves
plenty of room for growth without needing to resort to passing via the
stack in the future.

Reviewed by: jhibbits
Differential Revision: https://reviews.freebsd.org/D22787

4 years agosbin/fstyp: recgonize Dragonfly's hammer and hammer2.
Pedro F. Giffuni [Tue, 24 Dec 2019 19:00:20 +0000 (19:00 +0000)]
sbin/fstyp: recgonize Dragonfly's hammer and hammer2.

This is based on DragonFly's implementation from about 2019-09-13. It
only contains the basic code and header information to identify the
disks.

Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D13369

4 years agoDon't unnecessarily relock the vm object after sleeps. This results in a
Jeff Roberson [Tue, 24 Dec 2019 18:38:06 +0000 (18:38 +0000)]
Don't unnecessarily relock the vm object after sleeps.  This results in a
surprising amount of object contention on loop restarts in fault.

Reviewed by: kib, markj
Differential Revision: https://reviews.freebsd.org/D22821

4 years agoUnbreak build. It seems that mips and amd64 still pull in link_elf.c, so
Brandon Bergren [Tue, 24 Dec 2019 16:52:10 +0000 (16:52 +0000)]
Unbreak build. It seems that mips and amd64 still pull in link_elf.c, so
we need to have elf_cpu_parse_dynamic() everywhere after all to avoid
an undefined symbol.

4 years agosleep(9), sleepqueue(9): const'ify wchan pointers
Conrad Meyer [Tue, 24 Dec 2019 16:19:33 +0000 (16:19 +0000)]
sleep(9), sleepqueue(9): const'ify wchan pointers

_sleep(9), wakeup(9), sleepqueue(9), et al do not dereference or modify the
channel pointers provided in any way; they are merely used as intptrs into a
dictionary structure to match waiters with wakers.  Correctly annotate this
such that _sleep() and wakeup() may be used on const pointers without
invoking ugly patterns like __DECONST().  Plumb const through all of the
underlying sleepqueue bits.

No functional change.

Reviewed by: rlibby
Discussed with: kib, markj
Differential Revision: https://reviews.freebsd.org/D22914

4 years ago[PowerPC] powerpc32 rtld IFUNC handling code
Brandon Bergren [Tue, 24 Dec 2019 16:13:15 +0000 (16:13 +0000)]
[PowerPC] powerpc32 rtld IFUNC handling code

As PowerPC is moving to clang, we can finally start taking advantage of
IFUNC.

Implement the MD parts of IFUNC handling for rtld.

Currently, it is necessary to look for R_PPC_IRELATIVE in the PLT in
addition to RELA. This is an ABI violation, but LLD9 has some .iplt bugs
that require this as a workaround.

Reviewed by: jhibbits
Differential Revision: https://reviews.freebsd.org/D22855

4 years ago[PowerPC] powerpc64 rtld IFUNC handling code
Brandon Bergren [Tue, 24 Dec 2019 16:07:35 +0000 (16:07 +0000)]
[PowerPC] powerpc64 rtld IFUNC handling code

As PowerPC is moving to clang, we can finally start taking advantage of
IFUNC.

Implement the MD parts of IFUNC handling for rtld.

Currently, it is necessary to look for R_PPC_IRELATIVE in the PLT in
addition to RELA. This is an ABI violation, but LLD9 has some .iplt bugs
that require this as a workaround.

Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D22789

4 years ago[PowerPC64] Use ld.bfd to build LIB32 and STAND - when using llvm
Justin Hibbits [Tue, 24 Dec 2019 16:03:33 +0000 (16:03 +0000)]
[PowerPC64]  Use ld.bfd to build LIB32 and STAND - when using llvm

Summary:
This patch is to support ongoing work for replacing "GCC/BFD" by "CLANG/LLD" on
target PowerPC64 [1], by proposing a way to specify and/or locate a secondary
ld.bfd linker.
This is necessary as LLD currently doesn't support PowerPC 32 bits, so we keep
using BFD for the 32 bit stuff on PowePC64(LIB32 compatibility and
STAND/slof/loader.)

- creates LD_BFD variable pointing to ld.bfd
- use LD_BFD as linker for LIB32/compat
- Default behavior for other platforms aren't changed.

[1] https://wiki.freebsd.org/powerpc/llvm-elfv2

Submitted by: alfredo.junior_eldorado.org.br
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D20261

4 years ago[PowerPC] Implement Secure-PLT jump table processing for ppc32.
Brandon Bergren [Tue, 24 Dec 2019 15:56:24 +0000 (15:56 +0000)]
[PowerPC] Implement Secure-PLT jump table processing for ppc32.

Due to clang and LLD's tendency to use a PLT for builtins, and as they
don't have full support for EABI, we sometimes have to deal with a PLT in
.ko files in a clang-built kernel.

As such, augment the in-kernel linker to support jump table processing.

As there is no particular reason to support lazy binding in kernel modules,
only implement Secure-PLT immediate binding.

As part of these changes, add elf_cpu_parse_dynamic() to the MD API of the
in-kernel linker (except on platforms that use raw object files.)

The new function will allow MD code to act on MD tags in _DYNAMIC.

Use this new function in the PowerPC MD code to ensure BSS-PLT modules using
PLT will be rejected during insertion, and to poison the runtime resolver to
ensure we get a clear panic reason if a call is made to the resolver.

Reviewed by: jhibbits
Differential Revision: https://reviews.freebsd.org/D22608

4 years agoConvert the mpr driver to use busdma templates.
Scott Long [Tue, 24 Dec 2019 14:50:17 +0000 (14:50 +0000)]
Convert the mpr driver to use busdma templates.

4 years agoBump __FreeBSD_version for the addition of busdma templates.
Scott Long [Tue, 24 Dec 2019 14:49:37 +0000 (14:49 +0000)]
Bump __FreeBSD_version for the addition of busdma templates.

4 years agoIntroduce the concept of busdma tag templates. A template can be allocated
Scott Long [Tue, 24 Dec 2019 14:48:46 +0000 (14:48 +0000)]
Introduce the concept of busdma tag templates. A template can be allocated
off the stack, initialized to default values, and then filled in with
driver-specific values, all without having to worry about the numerous
other fields in the tag. The resulting template is then passed into
busdma and the normal opaque tag object created.  See the man page for
details on how to initialize a template.

Templates do not support tag filters.  Filters have been broken for many
years, and only existed for an ancient make/model of hardware that had a
quirky DMA engine.  Instead of breaking the ABI/API and changing the
arugment signature of bus_dma_tag_create() to remove the filter arguments,
templates allow us to ignore them, and also significantly reduce the
complexity of creating and managing tags.

Reviewed by: imp, kib
Differential Revision: https://reviews.freebsd.org/D22906

4 years agokern_synch: Fix some UB
Conrad Meyer [Tue, 24 Dec 2019 06:08:29 +0000 (06:08 +0000)]
kern_synch: Fix some UB

It is UB to evaluate pointer comparisons when pointers do not point within
the same object.  Instead, convert the pointers to numbers and compare the
numbers.

Reported by: kib
Discussed with: rlibby

4 years agogpart(8): ms-basic-data is used for exFAT on GPT
Conrad Meyer [Tue, 24 Dec 2019 01:47:08 +0000 (01:47 +0000)]
gpart(8): ms-basic-data is used for exFAT on GPT

Be explicit about it; the first mention of exFAT is for the MBR type 'ntfs',
and the reader must work back from there to the GPT type and infer that a
reference to MBR ntfs type means ms-basic-data is canonical for exFAT.

(It'd also be great if gpart had convenient aliases that did the right
thing for the partition scheme, such as 'ntfs' => ms-basic-data on GPT
schemes or 'exfat' => 'ntfs' in MBR schemes.  The tool is also bad about
providing user-meaningful reasons for EINVAL failures.)

4 years agooce: Disallow the passthrough ioctl for unprivileged users.
Mark Johnston [Mon, 23 Dec 2019 23:43:50 +0000 (23:43 +0000)]
oce: Disallow the passthrough ioctl for unprivileged users.

A missing check meant that unprivileged users could send passthrough
commands to the device firmware.

Reported by: Ilja Van Sprundel <ivansprundel@ioactive.com>
MFC after: 3 days
Sponsored by: The FreeBSD Foundation

4 years agopowerpc: repeat of r356044
Kyle Evans [Mon, 23 Dec 2019 21:57:11 +0000 (21:57 +0000)]
powerpc: repeat of r356044

It would have been nice to not have these duplicated in every single
sc_machdep.

4 years agoterasic_mtl: kill off final dummy keyboard driver
Kyle Evans [Mon, 23 Dec 2019 21:46:48 +0000 (21:46 +0000)]
terasic_mtl: kill off final dummy keyboard driver

The rest were removed in r355936, which speculated that the cause of this
phenomenon was due to an inability to have an empty linker set. The comment
included with this one shows that this was, in fact, not the reason.

Regardless, syscons no longer seems to have an issue with not having any
keyboard drivers and in-fact ignores the keyboard probe anyways.

X-MFC-With: r355936

4 years agosc: fix arm/mips/sparc64 MD bits
Kyle Evans [Mon, 23 Dec 2019 21:41:04 +0000 (21:41 +0000)]
sc: fix arm/mips/sparc64 MD bits

r356043 missed a couple of references in machdep parts... arguably, these
lines could probably be dropped as the softc is likely still zero'd at this
point.

Pointy hat: kevans

4 years agosyscons: drop keyboard index from softc
Kyle Evans [Mon, 23 Dec 2019 21:32:07 +0000 (21:32 +0000)]
syscons: drop keyboard index from softc

Analysis seems to reveal that sc->keyboard >= 0 implies sc->kbd != NULL and
there's no such scenario where sc->kbd is set (and theoretically used to
rebuild sc->keyboard) with the keyboard unavailable.

Drop the index softc. The index is only explicitly needed in few places, in
which case we can just as easily grab it from sc->kbd. There's no need for
keeping sc->kbd and sc->keyboard in sync when it can be readily accomplished
with just the former.

4 years agoMake pass(4) handle misaligned buffers of MAXPHYS size.
Alexander Motin [Mon, 23 Dec 2019 20:41:55 +0000 (20:41 +0000)]
Make pass(4) handle misaligned buffers of MAXPHYS size.

Since we are already using malloc()+copyin()/copyout() for smaller data
blocks, and since new asynchronous API does it always, I see no reason
to keep this ugly artificial size/alignment limitation in old API.

Tape applications suffer enough from the MAXPHYS limitations by itself,
and additional alignment requirement, often halving effectively usable
block size, does not help.

It would be good to use unmapped I/O here instead, but it require some
HBA drivers polishing first to support non-BIO unmapped buffers.

MFC after: 2 weeks
Sponsored by: iXsystems, Inc.

4 years agofstyp(8): Fix WITHOUT_ICONV build
Conrad Meyer [Mon, 23 Dec 2019 20:23:02 +0000 (20:23 +0000)]
fstyp(8): Fix WITHOUT_ICONV build

Reported by: olivier

4 years agoFix undefined behavior: left-shifting into the sign bit.
Konstantin Belousov [Mon, 23 Dec 2019 20:18:05 +0000 (20:18 +0000)]
Fix undefined behavior: left-shifting into the sign bit.

Reviewed by: dim, markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D22898

4 years agoDo not use waitable allocation of pbuf when creating cluster for write.
Konstantin Belousov [Mon, 23 Dec 2019 20:15:19 +0000 (20:15 +0000)]
Do not use waitable allocation of pbuf when creating cluster for write.

Previously just ensuring that we do not sleep when clustering for
md(4) vnode was enough.  Now, with the switch of the pbuf allocator to
uma and completely broken per-subsystem pbuf limits, it might cause
unbounded sleep even for non-md(4) vnodes.

Reported and tested by: pho
Reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D22899

4 years agofstyp(8): Detect APFS containers
Conrad Meyer [Mon, 23 Dec 2019 05:43:18 +0000 (05:43 +0000)]
fstyp(8): Detect APFS containers

APFS NXSBs are more like slices (or zvols?) than individual filesystem,
but go ahead and detect them nicely as well.

4 years agofstyp(8): Detect HFS+ / HFSX volumes
Conrad Meyer [Mon, 23 Dec 2019 05:43:01 +0000 (05:43 +0000)]
fstyp(8): Detect HFS+ / HFSX volumes

4 years agofstyp(8): Use iconv(3) to convert NTFS vol labels correctly
Conrad Meyer [Mon, 23 Dec 2019 02:41:13 +0000 (02:41 +0000)]
fstyp(8): Use iconv(3) to convert NTFS vol labels correctly

Rather than hackily extracting only the ASCII subset of UTF-16LE, go ahead
and convert the label to the user's locale correctly.

4 years agoIn gptboot, don't assume a partition number is a single digit, 1-9. GPT
Ian Lepore [Sun, 22 Dec 2019 22:33:22 +0000 (22:33 +0000)]
In gptboot, don't assume a partition number is a single digit, 1-9.  GPT
partitions can have 128 partitions, so parse contiguous digits and then
validate that the number is between 1-128 inclusive.

I'm not sure 128 is a hard limit in the GPT standard, but it's the common
number in use, and it's a better upper limit than 9.

4 years agoCompile uart_cpu_acpi.c, added in r348195, into uart.ko.
Mark Johnston [Sun, 22 Dec 2019 22:10:20 +0000 (22:10 +0000)]
Compile uart_cpu_acpi.c, added in r348195, into uart.ko.

PR: 242771
MFC after: 3 days
Sponsored by: The FreeBSD Foundation

4 years agolagg: Clean up handling of the rr_limit option.
Mark Johnston [Sun, 22 Dec 2019 21:56:47 +0000 (21:56 +0000)]
lagg: Clean up handling of the rr_limit option.

- Don't allow an unprivileged user to set the stride. [1]
- Only set the stride under the softc lock.
- Rename the internal fields to accurately reflect their use.  Keep
  ro_bkt to avoid changing the user API.
- Simplify the implementation.  The port index is just sc_seq / stride.
- Document rr_limit in ifconfig.8.

Reported by: Ilja Van Sprundel <ivansprundel@ioactive.com> [1]
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D22857

4 years agoFix typo using RB_INITIALIZER.
Doug Moore [Sun, 22 Dec 2019 21:53:05 +0000 (21:53 +0000)]
Fix typo using RB_INITIALIZER.

The macro RB_INITIALIZER ignores its argument, but is documented to
require "&head" as argument to initialize "head".  So using
"_vm_phys_fictitious_tree" as the argument to initialize
"vm_phys_fictitious_tree" is an inconsequential error, corrected here.

Discussed with: alc

4 years agoFix a bug introduced in r356002. Prior versions of this patchset had
Jeff Roberson [Sun, 22 Dec 2019 20:35:50 +0000 (20:35 +0000)]
Fix a bug introduced in r356002.  Prior versions of this patchset had
vm_page_remove() rather than !vm_page_wired() as the condition for free.
When this changed back to wired the busy lock was leaked.

Reported by: pho
Reviewed by: markj

4 years agoMerge commit f97936fab from llvm git (by Eric Fiselier):
Dimitry Andric [Sun, 22 Dec 2019 11:58:44 +0000 (11:58 +0000)]
Merge commit f97936fab from llvm git (by Eric Fiselier):

  [libc++] Cleanup and enable multiple warnings.

  Too many warnings are being disabled too quickly. Warnings are
  important to keeping libc++ correct. This patch re-enables two
  warnings: -Wconstant-evaluated and -Wdeprecated-copy.

  In future, all warnings disabled for the test suite should require an
  attached bug. The bug should state the plan for re-enabling that
  warning, or a strong case why it should remain disabled.

This should fix a number of new g++ 9 warnings.

Requested by: rlibby
MFC after: 3 days

4 years agoMerge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
Dimitry Andric [Sun, 22 Dec 2019 11:50:44 +0000 (11:50 +0000)]
Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
9.0.1 final release c1a0a213378a458fbea1a5c77b315c7dce08fd05.

Release notes for llvm, clang, lld and libc++ 9.0.1 will become
available here:

https://releases.llvm.org/9.0.1/docs/ReleaseNotes.html
https://releases.llvm.org/9.0.1/tools/clang/docs/ReleaseNotes.html
https://releases.llvm.org/9.0.1/tools/lld/docs/ReleaseNotes.html
https://releases.llvm.org/9.0.1/projects/libcxx/docs/ReleaseNotes.html

PR: 240629
MFC after: 1 month

4 years agoMake page busy state deterministic on free. Pages must be xbusy when
Jeff Roberson [Sun, 22 Dec 2019 06:56:44 +0000 (06:56 +0000)]
Make page busy state deterministic on free.  Pages must be xbusy when
removed from objects including calls to free.  Pages must not be xbusy
when freed and not on an object.  Strengthen assertions to match these
expectations.  In practice very little code had to change busy handling
to meet these rules but we can now make stronger guarantees to busy
holders and avoid conditionally dropping busy in free.

Refine vm_page_remove() and vm_page_replace() semantics now that we have
stronger guarantees about busy state.  This removes redundant and
potentially problematic code that has proliferated.

Discussed with: markj
Reviewed by: kib
Differential Revision: https://reviews.freebsd.org/D22822

4 years agoAdd vmgenc(4) driver for ACPI VM generation counter
Conrad Meyer [Sun, 22 Dec 2019 06:25:20 +0000 (06:25 +0000)]
Add vmgenc(4) driver for ACPI VM generation counter

The VM generation counter is a 128-bit value exposed by the BIOS via ACPI.
The value changes to another unique identifier whenever a VM is duplicated.
Additionally, ACPI provides notification events when such events occur.

The driver decodes the pointer to the UUID, exports the value to userspace
via OPAQUE sysctl blob, and forwards the ACPI notifications in the form of
an EVENTHANDLER invocation as well as userspace devctl events.

See design paper: https://go.microsoft.com/fwlink/p/?LinkID=260709

4 years agoRemove unused includes.
Xin LI [Sun, 22 Dec 2019 05:44:29 +0000 (05:44 +0000)]
Remove unused includes.

MFC after: 2 weeks

4 years agoMove vm_fault busy logic into its own function for clarity and re-use by
Jeff Roberson [Sun, 22 Dec 2019 04:21:16 +0000 (04:21 +0000)]
Move vm_fault busy logic into its own function for clarity and re-use by
later changes.

Reviewed by: kib, markj
Differential Revision: https://reviews.freebsd.org/D22820

4 years agofstyp(8): Show exFAT volume labels with -l flag
Conrad Meyer [Sun, 22 Dec 2019 03:19:17 +0000 (03:19 +0000)]
fstyp(8): Show exFAT volume labels with -l flag

exfat is fundamentally the same design as fat32.  The superblock differs
marginally, and there are some additional optional features irrelevant to
fstype(8); the structure of dirents has changed slightly to enable, among
other things, larger files; the directory entries are no longer DOS 8.3
ASCII or local 8-bit encoding, but instead explicitly UCS-2-LE.

(As a result, this change uses iconv to convert a found exfat volume label
to the user's locale.)

Locating the volume label is identical to FAT32: locate the root directory
and walk through dirents until you find a volume label.  Like FAT32, follow
the FAT chain between root directory clusters as necessary.

PR: 242225
Reported by: Victor Sudakov <vas AT sibptus.ru>

4 years agoFix typo in hastd.8 manual page.
Kirk McKusick [Sun, 22 Dec 2019 01:22:51 +0000 (01:22 +0000)]
Fix typo in hastd.8 manual page.

Reported by: Steve Kargl <sgk at troutmask dot apl dot washington dot edu>
MFC after:   3 days

4 years agoUpdate the nfsstat man page to reflect r355992.
Rick Macklem [Sun, 22 Dec 2019 00:36:22 +0000 (00:36 +0000)]
Update the nfsstat man page to reflect r355992.

r355992 added listing of NFSv4.2 procedure and operation counts.
This patch updates the nfsstat.1 man page to reflect that change.

This is a content change.

4 years agoUpdate nfsstat to list the NFSv4.2 procedures and operations.
Rick Macklem [Sun, 22 Dec 2019 00:12:22 +0000 (00:12 +0000)]
Update nfsstat to list the NFSv4.2 procedures and operations.

r355677 added NFSv4.2 support to the NFS client and server. It also updated
the nfsstats structure to keep counts for the new procedures (client) and
operations (server) added for NFSv4.2.
This patch updates the "-E" option of nfsstat so that it lists counts for
these new procedures and operations.

4 years agoMicro-optimize the control flow in _pmap_unwire_ptp(), and eliminate
Alan Cox [Sat, 21 Dec 2019 22:32:24 +0000 (22:32 +0000)]
Micro-optimize the control flow in _pmap_unwire_ptp(), and eliminate
unnecessary parentheses.

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