]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
3 years agoMerge commit 4d52ebb9b9c7 from llvm git (by Chen Zheng):
Dimitry Andric [Mon, 17 Aug 2020 16:37:46 +0000 (16:37 +0000)]
Merge commit 4d52ebb9b9c7 from llvm git (by Chen Zheng):

  [PowerPC] Make StartMI ignore COPY like instructions.

  Reviewed By: lkail

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

This fixes an assertion failure when building world for powerpc. It was
reported upstream as <https://bugs.llvm.org/show_bug.cgi?id=47041>.

3 years agoRevert r364275, for reapplying the final upstream fix:
Dimitry Andric [Mon, 17 Aug 2020 16:34:10 +0000 (16:34 +0000)]
Revert r364275, for reapplying the final upstream fix:

Tentatively apply https://reviews.llvm.org/D85659, which fixes an
assertion failure when building world for powerpc. This has been
reported upstream as <https://bugs.llvm.org/show_bug.cgi?id=47041>.

3 years agonet80211: remove vertical whitespace
Bjoern A. Zeeb [Mon, 17 Aug 2020 16:28:59 +0000 (16:28 +0000)]
net80211: remove vertical whitespace

No functional changes.

MFC after: 2 weeks
Sponsored by: Rubicon Communications, LLC (d/b/a "Netgate")

3 years agoWith INVARIANTS panic immediately if M_WAITOK is requested in a
Gleb Smirnoff [Mon, 17 Aug 2020 15:37:08 +0000 (15:37 +0000)]
With INVARIANTS panic immediately if M_WAITOK is requested in a
non-sleepable context.  Previously only _sleep() would panic.
This will catch misuse of M_WAITOK at development stage rather
than at stress load stage.

Reviewed by: markj
Differential Revision: https://reviews.freebsd.org/D26027

3 years agoExtend EIIOE field handling according to ses4r5 draft.
Alexander Motin [Mon, 17 Aug 2020 15:11:46 +0000 (15:11 +0000)]
Extend EIIOE field handling according to ses4r5 draft.

It should not affect any existing systems.

MFC after: 2 weeks

3 years agoextfs: remove redundant little endian conversion.
Pedro F. Giffuni [Mon, 17 Aug 2020 15:05:41 +0000 (15:05 +0000)]
extfs: remove redundant little endian conversion.

The NSEC_TO_XTIME macro already calls the htole32(), so there is no need
to call it twice. This code does nothing on LE platforms and affects only
nanosecond and birthtime fields so it's difficult to notice on regular use.

X-MFC with: r361136

3 years agoAdd libprivateevent libs to ObsoleteFiles.inc
Ed Maste [Mon, 17 Aug 2020 14:07:29 +0000 (14:07 +0000)]
Add libprivateevent libs to ObsoleteFiles.inc

Missed in r361607

Reported by: dim

3 years agoCommit a missing piece of r364302.
Mark Johnston [Mon, 17 Aug 2020 14:06:51 +0000 (14:06 +0000)]
Commit a missing piece of r364302.

This had failed to apply due to a merge conflict.

Reported by: Jenkins
MFC with: r364302

3 years agoFor consistency and to avoid any problems getting past the 31bit
Bjoern A. Zeeb [Mon, 17 Aug 2020 13:51:25 +0000 (13:51 +0000)]
For consistency and to avoid any problems getting past the 31bit
boundry change the last two IF_Mbps(2500) and additionally one
IF_Mbps(5000) to ULL as well.

MFC after: 2 weeks
Sponsored by: Rubicon Communications, LLC (d/b/a "Netgate")

3 years agocpuset(1): Update the usage message.
Mark Johnston [Mon, 17 Aug 2020 13:08:04 +0000 (13:08 +0000)]
cpuset(1): Update the usage message.

Parameters related to domain selection were not listed.

MFC after: 1 week
Sponsored by: Juniper Networks, Klara Inc.

3 years ago80211: consistently order 160 and 80+80
Bjoern A. Zeeb [Mon, 17 Aug 2020 13:04:18 +0000 (13:04 +0000)]
80211: consistently order 160 and 80+80

For flags and checks the order goes VHT160 and then VHT80P80 unless
checks are in reverse order ("more comes first") in which case we
deal with VHT80P80 first.
The one reverse order to pick out is where we check channel
prefernences.  While it may seem that VHT160 is better, finding
two "free" channels (VHT 80+80) is more likely so we do prefer that.

While dealing with VHT160 and VHT80P80 add extra clauses previously
missing or marked TODO in a few places.

Reviewed by: adrian, gnn
MFC after: 2 weeks
Sponsored by: Rubicon Communications, LLC (d/b/a "Netgate")
Differential Revision: https://reviews.freebsd.org/D26002

3 years agoRemove the VM map zone.
Mark Johnston [Mon, 17 Aug 2020 13:02:01 +0000 (13:02 +0000)]
Remove the VM map zone.

Today, the zone is only used to allocate a trio of kernel maps: the
kernel map itself, and the exec and pipe submaps.  Maps for user
processes are dynamically allocated but are embedded in the vmspace
structure, which is allocated from its own zone.  Make the
aforementioned kernel maps statically allocated and get rid of the zone.

While here, remove a stale comment above vmspace_alloc() and change the
names of locks initialized in vm_map_init() to match vmspace_zinit().

Reported by: alc
Reviewed by: alc, kib
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D26052

3 years ago80211: consistently spell 80P80
Bjoern A. Zeeb [Mon, 17 Aug 2020 12:52:57 +0000 (12:52 +0000)]
80211: consistently spell 80P80

The standard uses 80+80 and 80p80 but nowhere 80_80.
Switch the latter to 80P80 for all the macros and comments refering
to #defined flags which I could find.
The only place we leave as 80p80 is the ifconfig command line arguments
as we spell them all in lower case.
Ideally we would use 80+80 for any interactions with the user and
80P80 for anything internal but let us not confuse parsers and
hence avoid the '+' in either case.

Reviewed by: adrian, gnn
MFC after: 2 weeks
Sponsored by: Rubicon Communications, LLC (d/b/a "Netgate")
Differential Revision: https://reviews.freebsd.org/D26001

3 years agoasmc(4): Add support for MacBook7,1.
Mark Johnston [Mon, 17 Aug 2020 12:47:08 +0000 (12:47 +0000)]
asmc(4): Add support for MacBook7,1.

PR: 248693
Submitted by: gcx61@interia.pl
MFC after: 1 week

3 years agonet80211 / ifconfig: cleanup the use of IEEE80211_FVHT_USEVHT*
Bjoern A. Zeeb [Mon, 17 Aug 2020 12:43:07 +0000 (12:43 +0000)]
net80211 / ifconfig: cleanup the use of IEEE80211_FVHT_USEVHT*

Rather then using magic numbers duplicate IEEE80211_FVHT_VHT* in
ifconfig (cleanup of these and other flags used and not exposed by
net80211 should happen later) and use those.
In the kernel this simplifies one ioctl path (the other one currently
relies on individual bit flags being passed in).
We also re-order the 80P80 and 160 flag for 160 to come before 80+80
and more clearly leave the flags as TODO in one of the 160/80+80 cases.

Reviewed by: adrian
MFC after: 2 weeks
Sponsored by: Rubicon Communications, LLC (d/b/a "Netgate")
Differential Revision: https://reviews.freebsd.org/D26000

3 years agopmcstat.8: Improve description of -T
Mateusz Piotrowski [Mon, 17 Aug 2020 10:51:03 +0000 (10:51 +0000)]
pmcstat.8: Improve description of -T

3 years agoRevert 363598
Mateusz Piotrowski [Mon, 17 Aug 2020 10:25:02 +0000 (10:25 +0000)]
Revert 363598

The original wording was better.

Reported by: rgrimes

3 years agoComment out TODO notes from bectl(8) manual page
Mateusz Piotrowski [Mon, 17 Aug 2020 08:43:36 +0000 (08:43 +0000)]
Comment out TODO notes from bectl(8) manual page

MFC after: 2 days

3 years agoRemove an unnecessary macro
Mateusz Piotrowski [Mon, 17 Aug 2020 08:24:50 +0000 (08:24 +0000)]
Remove an unnecessary macro

MFC after: 2 days

3 years agoedquota(8): Cleanup to make it WARNS=6 clean.
Xin LI [Mon, 17 Aug 2020 05:57:22 +0000 (05:57 +0000)]
edquota(8): Cleanup to make it WARNS=6 clean.

Tested with: make tinderbox
MFC after: 2 weeks

3 years agoDon't explicitly specify c99 or gnu99 as the default is now gnu99.
Xin LI [Mon, 17 Aug 2020 05:57:02 +0000 (05:57 +0000)]
Don't explicitly specify c99 or gnu99 as the default is now gnu99.

MFC after: 2 weeks

3 years agoRemove heuristic for dealing with trailing newlines being truncated by mailers.
Warner Losh [Sun, 16 Aug 2020 23:55:23 +0000 (23:55 +0000)]
Remove heuristic for dealing with trailing newlines being truncated by mailers.

Every version of patch since the first one posted to mod.sources in 1985 have
included a heuristic for coping with the state of email messaging at the
time. This heuristic would add up to 4 blank lines to a patch if it thought it
needed it. The trouble is, though this causes at least one bug.

The bug in my case is that if you have a context diff whose last hunk only
deletes 3 or fewer lines, then if you try to reverse apply it with -R, it will
fail. The reason for this is the heuristic builds an internal representation
that includes those blank lines. However, it should really replicate the lines
from the pattern lines line it would any other time, not assume they are blank
lines. Removing this heuristic will prevent patch from misapplying the lines
removed after applying a 'fuzz' factor to the previous blank line in the file. I
believe this will only affect 'new-style' 4.3BSD context diffs and not the
older-style 4.2BSD diffs and plain, non-context diffs. It won't affect any of
the newer formats, since they don't use the 'omitted' construct in the same way.

Since this heuristic was put into patch at a time when email / etc ate trailing
white space on a regular basis, and since it's clear that this heuristic is the
wrong thing to do at least some of the time, it's better to remove it
entirely. It's not been needed for maybe 20 years since patch files are not
usually corrupted. If there are a small number of patch files that would benefit
from this corruption fixing, those already-currupt patches can be fixed by the
addition of blank lines. I'd wager that no one will ever come to me with an
example of a once-working patch file that breaks with this change. However, I
have 2 patches from the first 195 patches to 2.11BSD that are affected by this
bug, suggesting that the relative frequency of the issue has changed
signficantly since the original heuristic was put into place.

Reviewed by: phk@
Differential Revision: https://reviews.freebsd.org/D26081

3 years agoFix powerpc build.
Konstantin Belousov [Sun, 16 Aug 2020 22:50:59 +0000 (22:50 +0000)]
Fix powerpc build.

Sponsored by: The FreeBSD Foundation

3 years agoVMIO reads: enable for UFS
Konstantin Belousov [Sun, 16 Aug 2020 21:07:19 +0000 (21:07 +0000)]
VMIO reads: enable for UFS

Move v_object creation earlier, so that VIRF_PGREAD is never set if
v_object is NULL.  There is no much harm from instantiating v_object
when later check for append-only flags disallows open.

Reviewed by: markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D25968

3 years agoVMIO reads: enable for nullfs upper vnode if the lower vnode supports it.
Konstantin Belousov [Sun, 16 Aug 2020 21:05:56 +0000 (21:05 +0000)]
VMIO reads: enable for nullfs upper vnode if the lower vnode supports it.

Reviewed by: markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D25968

3 years agoVMIO read
Konstantin Belousov [Sun, 16 Aug 2020 21:02:45 +0000 (21:02 +0000)]
VMIO read

If possible, i.e. if the requested range is resident valid in the vm
object queue, and some secondary conditions hold, copy data for
read(2) directly from the valid cached pages, avoiding vnode lock and
instantiating buffers.  I intentionally do not start read-ahead, nor
handle the advises on the cached range.

Filesystems indicate support for VMIO reads by setting VIRF_PGREAD
flag, which must not be cleared until vnode reclamation.

Currently only filesystems that use vnode pager for v_objects can
enable it, due to reliance on vnp_size.  There is a WIP to handle it
for tmpfs.

Reviewed by: markj
Discussed with: jeff
Tested by: pho
Benchmarked by: mjg
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D25968

3 years agovm_object: allow paging_in_progress to be acquired after object termination.
Konstantin Belousov [Sun, 16 Aug 2020 20:57:02 +0000 (20:57 +0000)]
vm_object: allow paging_in_progress to be acquired after object termination.

The vm objects are type-stable, and can be accessed even after the
last reference is dropped, or in case of vnode objects, after vgone()
destroyed it as well.

Stop asserting that pip == 0 after vm_object_terminate() waited for
existing owners to drop it, we only want to drain them before setting
OBJ_DEAD flag.  Also stop asserting pip == 0 in object destructor.

Update comments explaining the interaction between paging_in_progress
and termination.

Reviewed by: markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D25968

3 years agoAtomically update vm_object vnp_size, where atomic is available.
Konstantin Belousov [Sun, 16 Aug 2020 20:52:24 +0000 (20:52 +0000)]
Atomically update vm_object vnp_size, where atomic is available.

This will be used later, where it matters on 32bit arches.

Reviewed by: markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
Differential revision: https://reviews.freebsd.org/D25968

3 years agoMerge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
Dimitry Andric [Sun, 16 Aug 2020 19:14:04 +0000 (19:14 +0000)]
Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
release/11.x llvmorg-11.0.0-rc1-47-gff47911ddfc.

MFC after: 6 weeks

3 years agovfs: retire vrefl as a symbol
Mateusz Guzik [Sun, 16 Aug 2020 18:51:12 +0000 (18:51 +0000)]
vfs: retire vrefl as a symbol

vrefl calls vref and there is only one in-tree consumer.

Keep it as a macro for assertion purposes.

3 years agovfs: assert that VI_TEXT_REF is not already set
Mateusz Guzik [Sun, 16 Aug 2020 18:45:31 +0000 (18:45 +0000)]
vfs: assert that VI_TEXT_REF is not already set

3 years agocache: add NOCAPCHECK to the list of supported flags for lockless lookup
Mateusz Guzik [Sun, 16 Aug 2020 18:33:24 +0000 (18:33 +0000)]
cache: add NOCAPCHECK to the list of supported flags for lockless lookup

It is de facto supported in that lockless lookup does not do any capability
checks.

3 years agovfs: restore sorted order of unused nameidata flags
Mateusz Guzik [Sun, 16 Aug 2020 18:27:42 +0000 (18:27 +0000)]
vfs: restore sorted order of unused nameidata flags

3 years agoMerge ^/head r364264 through r364278.
Dimitry Andric [Sun, 16 Aug 2020 18:24:48 +0000 (18:24 +0000)]
Merge ^/head r364264 through r364278.

3 years agoSet tentative merge date.
Dimitry Andric [Sun, 16 Aug 2020 18:23:52 +0000 (18:23 +0000)]
Set tentative merge date.

3 years agovfs: use namei_zone for getcwd allocations
Mateusz Guzik [Sun, 16 Aug 2020 18:21:21 +0000 (18:21 +0000)]
vfs: use namei_zone for getcwd allocations

instead of malloc.

Note that this should probably be wrapped with a dedicated API and other
vn_getcwd callers did not get converted.

3 years agolibcasper: Introduce cap_net a network service for Casper.
Mariusz Zaborski [Sun, 16 Aug 2020 18:12:21 +0000 (18:12 +0000)]
libcasper: Introduce cap_net a network service for Casper.

Reviewed by: emaste, markj (previous version), bcr (man page)
Differential Revision: https://reviews.freebsd.org/D24688

3 years agoTentatively apply https://reviews.llvm.org/D85659, which fixes an
Dimitry Andric [Sun, 16 Aug 2020 18:10:15 +0000 (18:10 +0000)]
Tentatively apply https://reviews.llvm.org/D85659, which fixes an
assertion failure when building world for powerpc. This has been
reported upstream as <https://bugs.llvm.org/show_bug.cgi?id=47041>.

3 years agoBump __FreeBSD_version after vget() and HASBUF change
Mateusz Guzik [Sun, 16 Aug 2020 17:56:30 +0000 (17:56 +0000)]
Bump __FreeBSD_version after vget() and HASBUF change

3 years agovfs: mark HASBUF as an internal flag
Mateusz Guzik [Sun, 16 Aug 2020 17:55:20 +0000 (17:55 +0000)]
vfs: mark HASBUF as an internal flag

There is no setter for cn_pnbuf.

3 years agotmpfs: use vget_prep/vget_finish instead of vget + vnode
Mateusz Guzik [Sun, 16 Aug 2020 17:19:23 +0000 (17:19 +0000)]
tmpfs: use vget_prep/vget_finish instead of vget + vnode

3 years agovfs: remove the thread argument from vget
Mateusz Guzik [Sun, 16 Aug 2020 17:18:54 +0000 (17:18 +0000)]
vfs: remove the thread argument from vget

It was already asserted to be curthread.

Semantic patch:

@@

expression arg1, arg2, arg3;

@@

- vget(arg1, arg2, arg3)
+ vget(arg1, arg2)

3 years agoRemove a line which is needed and was added in
Michael Tuexen [Sun, 16 Aug 2020 13:31:14 +0000 (13:31 +0000)]
Remove a line which is needed and was added in
https://svnweb.freebsd.org/changeset/base/364268

MFC after: 3 days

3 years agoUnbreak building cp2112(8) as a module outside of kernel build environment.
Eugene Grosbein [Sun, 16 Aug 2020 12:59:43 +0000 (12:59 +0000)]
Unbreak building cp2112(8) as a module outside of kernel build environment.

3 years agoImprove the handling of concurrent send() calls for SCTP sockets,
Michael Tuexen [Sun, 16 Aug 2020 11:50:37 +0000 (11:50 +0000)]
Improve the handling of concurrent send() calls for SCTP sockets,
especially when having the explicit EOR mode enabled.

Reported by: Megan2013678@protonmail.com
Reported by: syzbot+bc02585076c3cc977f9b@syzkaller.appspotmail.com
MFC after: 3 days

3 years agoUnbreak nvd(8) build as module outside of kernel build environment.
Eugene Grosbein [Sun, 16 Aug 2020 11:37:28 +0000 (11:37 +0000)]
Unbreak nvd(8) build as module outside of kernel build environment.

3 years agoMerge ^/head r364251 through r364263.
Dimitry Andric [Sat, 15 Aug 2020 22:59:44 +0000 (22:59 +0000)]
Merge ^/head r364251 through r364263.

3 years agoTemporarily disable libunwind's FrameHeaderCache, until there is a
Dimitry Andric [Sat, 15 Aug 2020 22:58:07 +0000 (22:58 +0000)]
Temporarily disable libunwind's FrameHeaderCache, until there is a
resolution for <https://bugs.llvm.org/show_bug.cgi?id=47181>.

The cache implementation depends on dl_iterate_phdr(3) ensuring that its
callbacks are not called simultaneously for multiple threads, but that
is only the case for the dl_iterate_phdr() implementation in rtld.

In a statically linked executable, libc's dl_iterate_phdr() is used,
which does no such locking. If multiple threads then call into the
unwinder at the same time, it is possible to trigger a segfault.

In particular, the statically linked lld which is built during the
cross-tools stage can segfault in this way, because it starts multiple
worker threads that can exit in parallel. Since our pthread_exit(3)
invokes the unwinder, it will therefore call into it in parallel too.

3 years agoUse the sbput() function to write alternate superblocks so that
Kirk McKusick [Sat, 15 Aug 2020 21:40:36 +0000 (21:40 +0000)]
Use the sbput() function to write alternate superblocks so that
they get a checkhash.

PR:           246983
Sponsored by: Netflix

3 years agowitness(4): Print stack of prior observed lock order on reversal
Conrad Meyer [Sat, 15 Aug 2020 19:45:50 +0000 (19:45 +0000)]
witness(4): Print stack of prior observed lock order on reversal

The first time Witness observes a lock order between two locks, it records
the caller's stack.  On detected reversal, print out that previous observed
stack.  It is quite possible that the reported "LOR" is the correct
ordering, and the violation was the observed earlier ordering.

Reviewed by: mjg
Differential Revision: https://reviews.freebsd.org/D26070

3 years agopcg-c: Add 'static' to inline function definitions
Conrad Meyer [Sat, 15 Aug 2020 18:46:26 +0000 (18:46 +0000)]
pcg-c: Add 'static' to inline function definitions

Make the inlines static to avoid kernel build failure with Clang 11 on i386.
(The issue was not observed with Clang 10, currently in tree; reproduction
depends on compiler inlining choices.)

The compiler may choose not to inline 'bare' C inlines, and in that case
expects a symbol of the same name will be available.  It does not
automatically define that symbol at use, because of traditional C linking
semantics. (In contrast, C++ does define it, and then deduplicates redundant
definitions at link).  As we do not instantiate the C99 inline ('extern
inline ...;'), the linker errors with "undefined symbol."

Reported by: dim
Tested by: dim
Fixes: r364219

3 years agoCorrect the mask byte order when checking for reserved bits.
Qing Li [Sat, 15 Aug 2020 16:48:58 +0000 (16:48 +0000)]
Correct the mask byte order when checking for reserved bits.

Reviewed by: gnn
Approved by: gnn
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D26071

3 years agoRISC-V: copy kernelname from the environment
Mitchell Horne [Sat, 15 Aug 2020 16:15:34 +0000 (16:15 +0000)]
RISC-V: copy kernelname from the environment

This is allows kern.bootfile to report the correct value.

3 years agoarm64: parse HWCAP values using user_cpu_desc
Mitchell Horne [Sat, 15 Aug 2020 15:06:39 +0000 (15:06 +0000)]
arm64: parse HWCAP values using user_cpu_desc

The hard work of parsing fields per-CPU, handling heterogeneous
features, and excluding features from userspace is already done by
update_special_regs. We can build our set of HWCAPs from the result.

This exposed a small bug in update_special_regs, in which the
generated bitmask was not wide enough, and as a result some bits
weren't being exposed in user_cpu_desc. Fix this.

While here, adjust some formatting.

Reviewed by: andrew
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D26069

3 years agoarm64: update instruction set attribute register definitions
Mitchell Horne [Sat, 15 Aug 2020 14:57:53 +0000 (14:57 +0000)]
arm64: update instruction set attribute register definitions

This adds definitions for the latest additions to the AA64ISAR[01] ID
registers. This brings these registers in sync with ARMv8.6 initial spec
release.

An future change will parse many of these fields for HWCAP features.

Reviewed by: andrew, manu, markj (all previous versions)
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D26029

3 years agoMerge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
Dimitry Andric [Sat, 15 Aug 2020 12:29:55 +0000 (12:29 +0000)]
Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
release/11.x llvmorg-11.0.0-rc1-47-gff47911ddfc.

3 years agoUpdate OptionalObsoleteFiles.inc for added and removed clang 11.0.0
Dimitry Andric [Sat, 15 Aug 2020 12:24:05 +0000 (12:24 +0000)]
Update OptionalObsoleteFiles.inc for added and removed clang 11.0.0
internal headers.

3 years agoMerge ^/head r364082 through r364250.
Dimitry Andric [Sat, 15 Aug 2020 11:49:31 +0000 (11:49 +0000)]
Merge ^/head r364082 through r364250.

3 years agoMake net.inet6.ip6.deembed_scopeid behaviour default & remove sysctl.
Alexander V. Chernikov [Sat, 15 Aug 2020 11:37:44 +0000 (11:37 +0000)]
Make net.inet6.ip6.deembed_scopeid behaviour default & remove sysctl.

Submitted by: Neel Chauhan <neel AT neelc DOT org>
Differential Revision: https://reviews.freebsd.org/D25637

3 years agoVendor import of llvm-project branch release/11.x
Dimitry Andric [Sat, 15 Aug 2020 11:27:21 +0000 (11:27 +0000)]
Vendor import of llvm-project branch release/11.x
llvmorg-11.0.0-rc1-47-gff47911ddfc.

3 years agoEnter epoch earlier. This is needed because we are exiting it also
Michael Tuexen [Sat, 15 Aug 2020 11:22:07 +0000 (11:22 +0000)]
Enter epoch earlier. This is needed because we are exiting it also
in error cases.

MFC after: 1 week

3 years ago- Update to Unicode CLDR v35 (Unicode 12.0).
Hiroki Sato [Sat, 15 Aug 2020 07:19:37 +0000 (07:19 +0000)]
- Update to Unicode CLDR v35 (Unicode 12.0).

- Update tools/tools/locale to add make targets to automatically
  generate locale source files.  With this change, just typing
  "make obj && make -j4" will rebuild them.  Check README for more details.

- Fix issues in ja_JP ctypedef and range specification support
  in utf8-rollup.pl.

- Add a temporary patch for UnicodeData.txt to fix code ranges of
  CJK Ideograph Extension A and Extension B.

- tools/cldr2def.pl:
    Use eucJP for ja_JP ctypedef because eucJP is not compatible with UTF-8.

- tools/convert_map.pl:
    Add a verbose error message.

- tools/utf8-rollup.pl:
    Normalize entries to use Unicode, not UTF-8.

Reviewed by: bapt
Differential Revision: https://reviews.freebsd.org/D25503

3 years agoRemove redeclaration found by gcc build
Li-Wen Hsu [Sat, 15 Aug 2020 03:26:00 +0000 (03:26 +0000)]
Remove redeclaration found by gcc build

Reviewed by: Jacob Keller <jacob.e.keller@intel.com>
Suggested editing from: Krzysztof Galazka <krzysztof.galazka@intel.com>
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D25954

3 years agoRemove redeclaration found by gcc build
Li-Wen Hsu [Sat, 15 Aug 2020 03:20:39 +0000 (03:20 +0000)]
Remove redeclaration found by gcc build

Reviewed by: erj
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D25953

3 years agokenv: avoid sleepable alloc for integer tunables
Jason A. Harmening [Fri, 14 Aug 2020 21:37:38 +0000 (21:37 +0000)]
kenv: avoid sleepable alloc for integer tunables

Avoid performing a potentially-blocking malloc for kenv lookups that will only
perform non-destructive integer conversions on the returned buffer. Instead,
perform the strtoq() in-place with the kenv lock held.

While here, factor the logic around kenv_lock acquire and release into
kenv_acquire() and kenv_release(), and use these functions for some light
cleanup. Collapse getenv_string_buffer() into kern_getenv(), as the former
no longer has any other callers and the only additional task performed by
the latter is a WITNESS check that hasn't been useful since r362231.

PR: 248250
Reported by: gbe
Reviewed by: mjg
Tested by: gbe
Differential Revision: https://reviews.freebsd.org/D26010

3 years agoSimplify dom_<rtattach|rtdetach>.
Alexander V. Chernikov [Fri, 14 Aug 2020 21:29:56 +0000 (21:29 +0000)]
Simplify dom_<rtattach|rtdetach>.

Remove unused arguments from dom_rtattach/dom_rtdetach functions and make
  them return/accept 'struct rib_head' instead of 'void **'.
Declare inet/inet6 implementations in the relevant _var.h headers similar
  to domifattach / domifdetach.
Add rib_subscribe_internal() function to accept subscriptions to the rnh
  directly.

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

3 years agovm_pageout: Correct threshold calculation on single-CPU systems
Conrad Meyer [Fri, 14 Aug 2020 18:48:48 +0000 (18:48 +0000)]
vm_pageout: Correct threshold calculation on single-CPU systems

Reported by: Michael Butler
X-MFC-With: r364129

3 years agoRename the pipe_map field of struct pipe.
Mark Johnston [Fri, 14 Aug 2020 14:50:41 +0000 (14:50 +0000)]
Rename the pipe_map field of struct pipe.

This is to avoid conflicts with a upcoming macro.  pipe_pages is a
more accurate name since the field tracks pages wired into the kernel as
part of a process-to-process copy operation.

Reviewed by: alc, kib
MFC after: 1 week
Sponsored by: The FreeBSD Foundation

3 years agocrunchgen: use pwd -P without env
Alex Richardson [Fri, 14 Aug 2020 09:45:41 +0000 (09:45 +0000)]
crunchgen: use pwd -P without env

The -P flag is required by POSIX so we don't have to care whether pwd is
a shell builtin or not. This also allows removing pwd from the list of
bootstrap tools since all shells we care about for building have a
builtin pwd command. This effectively reverts r364190.

Suggested By: rgrimes, jrtc27

3 years agoBump __FreeBSD_version after r364232
Emmanuel Vadot [Fri, 14 Aug 2020 08:49:40 +0000 (08:49 +0000)]
Bump __FreeBSD_version after r364232

We now have everything needed for DRM from Linux v5.4, let the
ports tree know that.

3 years agolinuxkpi: Add a few wait_bit functions
Emmanuel Vadot [Fri, 14 Aug 2020 08:48:17 +0000 (08:48 +0000)]
linuxkpi: Add a few wait_bit functions

The linux function does a lot more than that as multiple waitqueue could be fetch
from a static table based on the hash of the argument but since in DRM it's only used
in one place just add a single variable.
We will probably need to change that in the futur but it's ok with DRM even with current
linux.

Reviewed by: hselasky
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D26054

3 years agoProperly disable LUA_USE_DLOPEN for bootstrap flua
Kyle Evans [Fri, 14 Aug 2020 02:40:17 +0000 (02:40 +0000)]
Properly disable LUA_USE_DLOPEN for bootstrap flua

flua does have some specific bits that will include luaconf.h, but the
definition of LUA_USE_DLOPEN for those won't matter. This belongs in liblua
instead.

To expand on my previous commit, which was a little sparse with details,
it's not really safe to allow LUA_USE_DLOPEN with host lib paths being used.
The host system could have an entirely different lua version and this could
cause us to crash and burn.

If we want to revive this later, we need to make sure to define c module
paths inside OBJDIR that are compiled against whatever version we've
bootstrapped.

Pointy hat: kevans

3 years agoflua: don't allow dlopen, et al., for bootstrap flua
Kyle Evans [Fri, 14 Aug 2020 02:22:19 +0000 (02:22 +0000)]
flua: don't allow dlopen, et al., for bootstrap flua

There are some logistics issues that need to be sorted out here before we
can actually allow this to work.

3 years agosyslog(3): Send proper NILVALUE if gethostname(3) fails.
Bryan Drewery [Fri, 14 Aug 2020 00:18:18 +0000 (00:18 +0000)]
syslog(3): Send proper NILVALUE if gethostname(3) fails.

RFC5424 defines NILVALUE as '-'. Replace its usage with a macro and
separate out the fields to be more clear. fputs(3) is used in some
places to avoid hiding possible format string problems in a macro.

Reviewed by: cem, vangyzen (earlier version)
Sponsored by: Dell EMC

3 years agoflua: support "require" for binary objects in the base system
Ed Maste [Thu, 13 Aug 2020 23:13:05 +0000 (23:13 +0000)]
flua: support "require" for binary objects in the base system

Export symbols from flua, and enable dlopen.

Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D26059

3 years agoAdd test to for FreeBSD-SA-19:20.bsnmp
Bryan Drewery [Thu, 13 Aug 2020 22:42:24 +0000 (22:42 +0000)]
Add test to for FreeBSD-SA-19:20.bsnmp

Submitted by: Darrick Lew <darrick.freebsd at gmail.com>
Reviewed by: cem
Sponsored by: Dell EMC
Differential Revision: https://reviews.freebsd.org/D26037

3 years agolagg: Avoid adding a port to a lagg device being destroyed.
Bryan Drewery [Thu, 13 Aug 2020 22:06:27 +0000 (22:06 +0000)]
lagg: Avoid adding a port to a lagg device being destroyed.

The lagg_clone_destroy() handles detach and waiting for ifconfig callers
to drain already.

This narrows the race for 2 panics that the tests triggered. Both were a
consequence of adding a port to the lagg device after it had already detached
from all of its ports. The link state task would run after lagg_clone_destroy()
free'd the lagg softc.

    kernel:trap_fatal+0xa4
    kernel:trap_pfault+0x61
    kernel:trap+0x316
    kernel:witness_checkorder+0x6d
    kernel:_sx_xlock+0x72
    if_lagg.ko:lagg_port_state+0x3b
    kernel:if_down+0x144
    kernel:if_detach+0x659
    if_tap.ko:tap_destroy+0x46
    kernel:if_clone_destroyif+0x1b7
    kernel:if_clone_destroy+0x8d
    kernel:ifioctl+0x29c
    kernel:kern_ioctl+0x2bd
    kernel:sys_ioctl+0x16d
    kernel:amd64_syscall+0x337

    kernel:trap_fatal+0xa4
    kernel:trap_pfault+0x61
    kernel:trap+0x316
    kernel:witness_checkorder+0x6d
    kernel:_sx_xlock+0x72
    if_lagg.ko:lagg_port_state+0x3b
    kernel:do_link_state_change+0x9b
    kernel:taskqueue_run_locked+0x10b
    kernel:taskqueue_run+0x49
    kernel:ithread_loop+0x19c
    kernel:fork_exit+0x83

PR: 244168
Reviewed by: markj
MFC after: 2 weeks
Sponsored by: Dell EMC
Differential Revision: https://reviews.freebsd.org/D25284

3 years agoAdd prng(9) API
Conrad Meyer [Thu, 13 Aug 2020 20:48:14 +0000 (20:48 +0000)]
Add prng(9) API

Add prng(9) as a replacement for random(9) in the kernel.

There are two major differences from random(9) and random(3):

- General prng(9) APIs (prng32(9), etc) do not guarantee an
  implementation or particular sequence; they should not be used for
  repeatable simulations.

- However, specific named API families are also exposed (for now: PCG),
  and those are expected to be repeatable (when so-guaranteed by the named
  algorithm).

Some minor differences from random(3) and earlier random(9):

- PRNG state for the general prng(9) APIs is per-CPU; this eliminates
  contention on PRNG state in SMP workloads.  Each PCPU generator in an
  SMP system produces a unique sequence.

- Better statistical properties than the Park-Miller ("minstd") PRNG
  (longer period, uniform distribution in all bits, passes
  BigCrush/PractRand analysis).

- Faster than Park-Miller ("minstd") PRNG -- no division is required to
  step PCG-family PRNGs.

For now, random(9) becomes a thin shim around prng32().  Eventually I
would like to mechanically switch consumers over to the explicit API.

Reviewed by: kib, markj (previous version both)
Discussed with: markm
Differential Revision: https://reviews.freebsd.org/D25916

3 years agoFix a typo in the cpp macro defined for PIC.
John Baldwin [Thu, 13 Aug 2020 20:28:35 +0000 (20:28 +0000)]
Fix a typo in the cpp macro defined for PIC.

In practice this isn't used in OpenSSL outside of some sparc-specific
code.

Reviewed by: delphij
Differential Revision: https://reviews.freebsd.org/D26058

3 years agoMove rtzone handling code to net/route_ctl.c
Alexander V. Chernikov [Thu, 13 Aug 2020 18:35:29 +0000 (18:35 +0000)]
Move rtzone handling code to net/route_ctl.c

After moving the route control plane code from net/route.c,
 all rtzone users ended up being in net/route_ctl.c.
Move uma(9) rtzone setup/teardown code to net/route_ctl.c as well
 to have everything in a single place.

While here, remove custom initializers from the zone.
It was added originally to avoid setup/teardown of costy per-cpu couters.
With these counters removed, the only remaining job was avoiding rte mutex
 setup/teardown. Mutex setup is relatively cheap. Additionally, this mutex
 will soon be removed. With that in mind, there is no sense in keeping
 custom zone callbacks.

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

3 years agoTCP Cubic: Have Fast Convergence Heuristic work for ECN, and align concave region
Richard Scheffenegger [Thu, 13 Aug 2020 16:45:55 +0000 (16:45 +0000)]
TCP Cubic: Have Fast Convergence Heuristic work for ECN, and align concave region

The Cubic concave region was not aligned nicely for the very first exit from
slow start, where a 50% cwnd reduction is done instead of the normal 30%.

This addresses an issue, where a short line-rate burst could result from that
sudden jump of cwnd.

In addition, the Fast Convergence Heuristic has been expanded to work also
with ECN induced congestion response.

Submitted by: chengc_netapp.com
Reported by: chengc_netapp.com
Reviewed by: tuexen (mentor), rgrimes (mentor)
Approved by: tuexen (mentor), rgrimes (mentor)
MFC after: 3 weeks
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D25976

3 years agoTCP Cubic: After leaving slowstart fix unintended cwnd jump.
Richard Scheffenegger [Thu, 13 Aug 2020 16:38:51 +0000 (16:38 +0000)]
TCP Cubic: After leaving slowstart fix unintended cwnd jump.

Initializing K to zero in D23655 introduced a miscalculation,
where cwnd would suddenly jump to cwnd_max instead of gradually
increasing, after leaving slow-start.

Properly calculating K instead of resetting it to zero resolves
this issue. Also making sure, that cwnd is recalculated at the
earliest opportunity once slow-start is over.

Reported by: chengc_netapp.com
Reviewed by: chengc_netapp.com, tuexen (mentor), rgrimes (mentor)
Approved by: tuexen (mentor), rgrimes (mentor)
MFC after: 3 weeks
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D25746

3 years agoImprove SACK support code for RFC6675 and PRR
Richard Scheffenegger [Thu, 13 Aug 2020 16:30:09 +0000 (16:30 +0000)]
Improve SACK support code for RFC6675 and PRR

Adding proper accounting of sacked_bytes and (per-ACK)
delivered data to the SACK scoreboard. This will
allow more aspects of RFC6675 to be implemented as well
as Proportional Rate Reduction (RFC6937).

Prior to this change, the pipe calculation controlled with
net.inet.tcp.rfc6675_pipe was also susceptible to incorrect
results when more than 3 (or 4) holes in the sequence space
were present, which can no longer all fit into a single
ACK's SACK option.

Reviewed by: kbowling, rgrimes (mentor)
Approved by: rgrimes (mentor, blanket)
MFC after: 3 weeks
Sponsored by: NetApp, Inc.
Differential Revision: https://reviews.freebsd.org/D18624

3 years agoEnable interrupts while handling traps
Mitchell Horne [Thu, 13 Aug 2020 14:21:05 +0000 (14:21 +0000)]
Enable interrupts while handling traps

I observed hangs post-r362977 in QEMU with -smp 2, in which one thread
would acquire write access to an rm_lock (sysctllock) and get stuck
waiting in smp_rendezvous_cpus while the other CPU was servicing a trap.
The other thread was waiting for read access to the same lock, thus
causing deadlock.

It's clear that this is just one symptom of a larger problem. The
general expectation of MI kernel code is that interrupts are enabled.
Violating this assumption will at best create some additional latency,
but otherwise might cause locking or other unforeseen issues. All other
architectures do so for some subset of trap values, but this somehow got
missed in the RISC-V port. Enable interrupts now during kernel page
faults and for all user trap types.

The code in exception.S already knows to disable interrupts while
handling the return from exception, so there are no changes required
there.

Reviewed by: jhb, markj
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D26017

3 years agoSmall fixes in locore.S
Mitchell Horne [Thu, 13 Aug 2020 14:17:36 +0000 (14:17 +0000)]
Small fixes in locore.S

 - Properly set up the frame pointer
 - Hang if we return from mi_startup
 - Whitespace

Clearing the frame pointer marks the end of the backtrace. This fixes
"bt 0" in ddb, which previously would unwind one frame too far.

Reviewed by: jhb
Differential Revision: https://reviews.freebsd.org/D26016

3 years agoMake bsd.linker.mk work with the MacOS linker
Alex Richardson [Thu, 13 Aug 2020 14:14:51 +0000 (14:14 +0000)]
Make bsd.linker.mk work with the MacOS linker

This is not strictly required for crossbuilding but having lots of warnings
from bsd.linker.mk in the output was making it hard to see the actual
warning messages.

Reviewed By: imp
Differential Revision: https://reviews.freebsd.org/D14318

3 years agoAdd pwd to the list of tools that are linked to $WORLDTMP/legacy
Alex Richardson [Thu, 13 Aug 2020 14:14:46 +0000 (14:14 +0000)]
Add pwd to the list of tools that are linked to $WORLDTMP/legacy

After r364166 and r364174, crunchgen needs a pwd binary in $PATH instead
of using a hardcoded absolute path. This commit is needed for
BUILD_WITH_STRICT_TMPPATH builds (currently not on by default).

3 years agovfs: add missing pwd_drop on error in namei_setup
Mateusz Guzik [Thu, 13 Aug 2020 10:24:45 +0000 (10:24 +0000)]
vfs: add missing pwd_drop on error in namei_setup

Reported by: pho

3 years agoifconfig(8): plug memory leak after r361790 by me.
Eugene Grosbein [Thu, 13 Aug 2020 06:32:39 +0000 (06:32 +0000)]
ifconfig(8): plug memory leak after r361790 by me.

MFC after: 3 days

3 years agoFill device serial_num and device_id in NVMe XPT.
Alexander Motin [Thu, 13 Aug 2020 02:32:46 +0000 (02:32 +0000)]
Fill device serial_num and device_id in NVMe XPT.

It allows to report GEOM::lunid for nda(4) same as for nvd(4).  Since
NVMe now allows multiple LUs (namespaces) with multiple paths unique
LU identification is important.  The serial_num field is filled same
as before with the controller serial number, while device_id is based
on namespace GUID and/or EUI64 fields as recommended by "NVM Express:
SCSI Translation Reference" and matching nvd(4) at the end.

MFC after: 1 week

3 years agoflua: initial support for "require" in the base system
Ed Maste [Thu, 13 Aug 2020 00:19:05 +0000 (00:19 +0000)]
flua: initial support for "require" in the base system

Use /usr not /usr/local for base system components.

Use /usr/lib/flua and /usr/share/flua (not lua) for consistency and to
avoid the possibility that other software accidentally finds our base
system modules.

Also drop the version from the path, as flua represents an unspecified
lua version that corresponds to the FreeBSD version it comes with.

LUA_USE_DLOPEN is not yet enabled because some additional changes are
needed wrt symbol visibility.

Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D24605

3 years agoCheck that the frame pointer is within the current stack.
John Baldwin [Wed, 12 Aug 2020 20:33:29 +0000 (20:33 +0000)]
Check that the frame pointer is within the current stack.

This same check is used on other architectures.  Previously this would
permit a stack frame to unwind into any arbitrary kernel address
(including unmapped addresses).

Reviewed by: mhorne
Obtained from: CheriBSD
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D25996

3 years agoUse uintptr_t instead of uint64_t for pointers in stack frames.
John Baldwin [Wed, 12 Aug 2020 20:29:49 +0000 (20:29 +0000)]
Use uintptr_t instead of uint64_t for pointers in stack frames.

Reviewed by: mhorne
Obtained from: CheriBSD
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D25995

3 years agoReport cpi->hba_* for nda(4) because why not.
Alexander Motin [Wed, 12 Aug 2020 20:05:43 +0000 (20:05 +0000)]
Report cpi->hba_* for nda(4) because why not.

MFC after: 1 week

3 years agoReport proper stripesize for nda(4).
Alexander Motin [Wed, 12 Aug 2020 19:37:57 +0000 (19:37 +0000)]
Report proper stripesize for nda(4).

Same as for nvd(4) report NPWG if present, otherise NOIOB.

MFC after: 1 week

3 years agoReport attachment for nvd same as reported for nda.
Alexander Motin [Wed, 12 Aug 2020 19:11:53 +0000 (19:11 +0000)]
Report attachment for nvd same as reported for nda.

MFC after: 1 week

3 years agoCorrect padding length for RISC-V PCPU data.
John Baldwin [Wed, 12 Aug 2020 18:45:36 +0000 (18:45 +0000)]
Correct padding length for RISC-V PCPU data.

There was an additional 7 bytes of compiler-inserted padding at the
end of the structure visible via 'ptype /o' in gdb.

Reviewed by: mhorne
Obtained from: CheriBSD
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D25867

3 years agoUse env pwd instead of pwd in crunchgen.c
Alex Richardson [Wed, 12 Aug 2020 17:27:24 +0000 (17:27 +0000)]
Use env pwd instead of pwd in crunchgen.c

In r364166 I changed /bin/pwd to pwd, but pwd can be shell builtin that
may not correctly return a real path. To ensure that all symlinks are
resolved use `env pwd -P` instead (the -P flag is part of POSIX so
should be supported everywhere).

Reported By: rgrimes
Suggested By: jrtc27

3 years agoCorrectly set error in rt_mpath_unlink
Mitchell Horne [Wed, 12 Aug 2020 16:43:20 +0000 (16:43 +0000)]
Correctly set error in rt_mpath_unlink

It is possible for rn_delete() to return NULL. If this happens, then set
*perror to ESRCH, as is done in the rest of the function.

Sponsored by: NetApp, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D25871

3 years agolinprocfs: Fix some inaccuracies in meminfo.
Mark Johnston [Wed, 12 Aug 2020 16:08:44 +0000 (16:08 +0000)]
linprocfs: Fix some inaccuracies in meminfo.

- Fill out MemFree correctly.  Delete an ancient comment suggesting that
  we don't want to advertise the true quantity of free memory.
- Populate the Buffers field by reading vfs.bufspace.
- The page cache consists of all pages in page queues, not just the
  inactive queue.

PR: 248463
Reported and tested by: danfe
MFC after: 1 week
Sponsored by: The FreeBSD Foundation