]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
4 years agoUpdate route MTUs for bridge, lagg and vlan interfaces.
Alexander Motin [Wed, 22 Jan 2020 20:36:45 +0000 (20:36 +0000)]
Update route MTUs for bridge, lagg and vlan interfaces.

Those interfaces may implicitly change their MTU on addition of parent
interface in addition to normal SIOCSIFMTU ioctl path, where the route
MTUs are updated normally.

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

4 years agoTag etc/termcap with package=runtime
Ed Maste [Wed, 22 Jan 2020 18:55:36 +0000 (18:55 +0000)]
Tag etc/termcap with package=runtime

/etc/termcap is a symlink to /usr/share/misc/termcap, which is in the
runtime package.  Tag the symlink with the same package so that it is
handled correctly on pkgbase-installed/updated systems.

Sponsored by: The FreeBSD Foundation

4 years agoTag NLS aliases with package=runtime
Ed Maste [Wed, 22 Jan 2020 18:40:19 +0000 (18:40 +0000)]
Tag NLS aliases with package=runtime

POSIX and en_US.US_ASCII are aliases (symlinks) to the C locale.  They were
not previously tagged with a pkgbase pacakge.  Add the tag so that they are
handled correctly on pkgbase-installed/updated systems.

Discussed with: manu

4 years agoPlug possible calls into ip6?_output() without network epoch from SCTP
Gleb Smirnoff [Wed, 22 Jan 2020 17:19:53 +0000 (17:19 +0000)]
Plug possible calls into ip6?_output() without network epoch from SCTP
bluntly adding epoch entrance into the macro that SCTP uses to call
ip6?_output().  This definitely will introduce several epoch recursions.

Reported by: https://syzkaller.appspot.com/bug?id=79f03f574594a5be464997310896765c458ed80a
Reported by: https://syzkaller.appspot.com/bug?id=07c6f52106cddbe356cc2b2f3664a1c51cc0dadf

4 years agoEnter network epoch when calling in_pcbconnect() for IPv6 mapped to IPv4
Gleb Smirnoff [Wed, 22 Jan 2020 17:06:55 +0000 (17:06 +0000)]
Enter network epoch when calling in_pcbconnect() for IPv6 mapped to IPv4
UDP sockets.  This is miss from r356983.

Reported by: https://syzkaller.appspot.com/bug?id=73c7a2e3f0783f9947459065e5c2f25fe8f82f54

4 years agoFix NOINET kernels after r356983.
Bjoern A. Zeeb [Wed, 22 Jan 2020 15:06:59 +0000 (15:06 +0000)]
Fix NOINET kernels after r356983.

All gotos to the label are within the #ifdef INET section, which leaves
us with an unused label.  Cover the label under #ifdef INET as well to
avoid the warning and compile time error.

4 years agoTag os-release symlink with package=runtime
Kyle Evans [Wed, 22 Jan 2020 14:07:27 +0000 (14:07 +0000)]
Tag os-release symlink with package=runtime

This ensures it gets into pkgbase-(installed/updated) systems.

4 years agoBring back redirect route expiration.
Alexander V. Chernikov [Wed, 22 Jan 2020 13:53:18 +0000 (13:53 +0000)]
Bring back redirect route expiration.

Redirect (and temporal) route expiration was broken a while ago.
This change brings route expiration back, with unified IPv4/IPv6 handling code.

It introduces net.inet.icmp.redirtimeout sysctl, allowing to set
 an expiration time for redirected routes. It defaults to 10 minutes,
 analogues with net.inet6.icmp6.redirtimeout.

Implementation uses separate file, route_temporal.c, as route.c is already
 bloated with tons of different functions.
Internally, expiration is implemented as an per-rnh callout scheduled when
 route with non-zero rt_expire time is added or rt_expire is changed.
 It does not add any overhead when no temporal routes are present.

Callout traverses entire routing tree under wlock, scheduling expired routes
 for deletion and calculating the next time it needs to be run. The rationale
 for such implemention is the following: typically workloads requiring large
 amount of routes have redirects turned off already, while the systems with
 small amount of routes will not inhibit large overhead during tree traversal.

This changes also fixes netstat -rn display of route expiration time, which
 has been broken since the conversion from kread() to sysctl.

Reviewed by: bz
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D23075

4 years agoMake in_pcbladdr() require network epoch entered by its callers. Together
Gleb Smirnoff [Wed, 22 Jan 2020 06:10:41 +0000 (06:10 +0000)]
Make in_pcbladdr() require network epoch entered by its callers.  Together
with this widen network epoch coverage up to tcp_connect() and udp_connect().

Revisions from r356974 and up to this revision cover D23187.

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

4 years agoRemove extraneous NET_EPOCH_ASSERT - the full function is covered.
Gleb Smirnoff [Wed, 22 Jan 2020 06:07:27 +0000 (06:07 +0000)]
Remove extraneous NET_EPOCH_ASSERT - the full function is covered.

4 years agoRe-absorb tcp_detach() back into tcp_usr_detach() as the comment suggests.
Gleb Smirnoff [Wed, 22 Jan 2020 06:06:27 +0000 (06:06 +0000)]
Re-absorb tcp_detach() back into tcp_usr_detach() as the comment suggests.
Not a functional change.

4 years agoDon't enter network epoch in tcp_usr_detach. A PCB removal doesn't
Gleb Smirnoff [Wed, 22 Jan 2020 06:04:56 +0000 (06:04 +0000)]
Don't enter network epoch in tcp_usr_detach. A PCB removal doesn't
require that.

4 years agoThe network epoch changes in the TCP stack combined with old r286227,
Gleb Smirnoff [Wed, 22 Jan 2020 06:03:45 +0000 (06:03 +0000)]
The network epoch changes in the TCP stack combined with old r286227,
actually make removal of a PCB not needing ipi_lock in any form.  The
ipi_list_lock is sufficient.

4 years agotcp_usr_attach() doesn't need network epoch. in_pcbfree() and
Gleb Smirnoff [Wed, 22 Jan 2020 06:01:26 +0000 (06:01 +0000)]
tcp_usr_attach() doesn't need network epoch.  in_pcbfree() and
in_pcbdetach() perform all necessary synchronization themselves.

4 years agoRelax locking requirements for in_pcballoc(). All pcbinfo fields
Gleb Smirnoff [Wed, 22 Jan 2020 05:58:29 +0000 (05:58 +0000)]
Relax locking requirements for in_pcballoc().  All pcbinfo fields
modified by this function are protected by the PCB list lock that is
acquired inside the function.

This could have been done even before epoch changes, after r286227.

4 years agoInline tcp_attach() into tcp_usr_attach(). Not a functional change.
Gleb Smirnoff [Wed, 22 Jan 2020 05:54:58 +0000 (05:54 +0000)]
Inline tcp_attach() into tcp_usr_attach().  Not a functional change.

4 years agoMake tcp_output() require network epoch.
Gleb Smirnoff [Wed, 22 Jan 2020 05:53:16 +0000 (05:53 +0000)]
Make tcp_output() require network epoch.

Enter the epoch before calling into tcp_output() from those
functions, that didn't do that before.

This eliminates a bunch of epoch recursions in TCP.

4 years agoMake ip6_output() and ip_output() require network epoch.
Gleb Smirnoff [Wed, 22 Jan 2020 05:51:22 +0000 (05:51 +0000)]
Make ip6_output() and ip_output() require network epoch.

All callers that before may called into these functions
without network epoch now must enter it.

4 years agoRemove struct callout_handle. Should have gone with r355732.
Gleb Smirnoff [Wed, 22 Jan 2020 05:47:59 +0000 (05:47 +0000)]
Remove struct callout_handle.  Should have gone with r355732.

4 years agoRemove comment that no longer describe reality.
Gleb Smirnoff [Wed, 22 Jan 2020 05:32:23 +0000 (05:32 +0000)]
Remove comment that no longer describe reality.

4 years agoIn compatibility structure substitute 'struct callout_handle'
Gleb Smirnoff [Wed, 22 Jan 2020 05:31:37 +0000 (05:31 +0000)]
In compatibility structure substitute 'struct callout_handle'
to 'struct callout *' pointer of the same size.

4 years agoAdd documenting NET_EPOCH_ASSERT() to tcp_drop().
Gleb Smirnoff [Wed, 22 Jan 2020 02:38:46 +0000 (02:38 +0000)]
Add documenting NET_EPOCH_ASSERT() to tcp_drop().

4 years agoAdd some documenting NET_EPOCH_ASSERTs.
Gleb Smirnoff [Wed, 22 Jan 2020 02:37:47 +0000 (02:37 +0000)]
Add some documenting NET_EPOCH_ASSERTs.

4 years agoUnroll macro that is used just once. Not a functional change.
Gleb Smirnoff [Wed, 22 Jan 2020 02:35:39 +0000 (02:35 +0000)]
Unroll macro that is used just once.  Not a functional change.

4 years agoChange argument order of epoch_call() to more natural, first function,
Gleb Smirnoff [Wed, 22 Jan 2020 02:28:39 +0000 (02:28 +0000)]
Change argument order of epoch_call() to more natural, first function,
then its argument.

A miss from r356826.

4 years ago[PowerPC] libc backwards compatibility shim for auxv change
Brandon Bergren [Wed, 22 Jan 2020 02:06:34 +0000 (02:06 +0000)]
[PowerPC] libc backwards compatibility shim for auxv change

As part of the FreeBSD powerpc* flag day (1300070), the auxv numbering was
changed to match every other platform.

See D20799 for more details on that change.

While the kernel and rtld were adapted, libc was not, so old dynamic
binaries broke for reasons other than the ABI change on powerpc64.

Since it's possible to support nearly everything regarding old binaries by
adding compatibility code to libc (as besides rtld, it is the main point
where auxv is digested), we might as well provide compatibility code.

The only unhandled case remaining should be "new format libraries that call
elf_aux_info() which are dynamically linked to by old-format binaries",
which should be quite rare.

Reviewed by: jhibbits
Sponsored by: Tag1 Consulting, Inc.
Differential Revision: https://reviews.freebsd.org/D23096

4 years agoInstall man5 and man7 for OpenSSL.
Jung-uk Kim [Wed, 22 Jan 2020 01:15:57 +0000 (01:15 +0000)]
Install man5 and man7 for OpenSSL.

Note config.5 and crypto.7 are not installed because we have conflicts.

Requested by: phk
MFC after: 1 month

4 years agoAdd new USB ID to uslcom(4).
Hans Petter Selasky [Tue, 21 Jan 2020 22:28:16 +0000 (22:28 +0000)]
Add new USB ID to uslcom(4).

Submitted by: Oleg Sharoyko <osharoiko@gmail.com>
PR: 243494
MFC after: 1 week
Sponsored by: Mellanox Technologies

4 years agoposix_spawn: mark error as volatile
Kyle Evans [Tue, 21 Jan 2020 22:02:53 +0000 (22:02 +0000)]
posix_spawn: mark error as volatile

In the case of an error, the RFSPAWN'd thread will write back to psa->error
with the correct exit code. Mark this as volatile as the return value is
being actively dorked up for erroneous exits on !x86.

This fixes the following tests, tested on aarch64 (only under qemu, at the
moment):

- posix_spawn/spawn_test:t_spawn_missing
- posix_spawn/spawn_test:t_spawn_nonexec
- posix_spawn/spawn_test:t_spawn_zero

Reported by: mikael
MFC after: 3 days

4 years agoRevert r356948; breaks build somehow.
Edward Tomasz Napierala [Tue, 21 Jan 2020 20:32:49 +0000 (20:32 +0000)]
Revert r356948; breaks build somehow.

4 years agoFix build when WITHOUT_WPA_SUPPLICANT_EAPOL option used.
Cy Schubert [Tue, 21 Jan 2020 20:21:52 +0000 (20:21 +0000)]
Fix build when WITHOUT_WPA_SUPPLICANT_EAPOL option used.

The build failure was discoved by Michael Dexter's recent Build Options
Survey run, at https://callfortesting.org/results/bos-2020-01-16/\
WITHOUT_WPA_SUPPLICANT_EAPOL-small.txt.

Reported by: Michael Dexter <editor@callfortesting.org> via emaste
MFC after: 2 weeks

4 years agoMake linux(4) handle MAP_32BIT.
Edward Tomasz Napierala [Tue, 21 Jan 2020 19:19:02 +0000 (19:19 +0000)]
Make linux(4) handle MAP_32BIT.

This unbreaks Mono (mono-devel-4.6.2.7+dfsg-1ubuntu1 from Ubuntu Bionic);
previously would crash on "amd64_is_imm32" assert.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

4 years agoAdd relocation handling required for -zifunc-noplt to work on arm64.
Mark Johnston [Tue, 21 Jan 2020 17:45:49 +0000 (17:45 +0000)]
Add relocation handling required for -zifunc-noplt to work on arm64.

Static relocations for the immediate operand of a branch instruction
must be applied.

In a patch which implements LSE-based atomic(9) operations using ifuncs,
-zifunc-noplt reduces system CPU usage during a buildkernel by several
percent.

Also fix elf_reloc_internal() to return an error if symbol lookup fails.

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

4 years agoRegen.
Mark Johnston [Tue, 21 Jan 2020 17:28:36 +0000 (17:28 +0000)]
Regen.

MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation

4 years agoFix 64-bit syscall argument fetching in 32-bit Linux syscall handlers.
Mark Johnston [Tue, 21 Jan 2020 17:28:22 +0000 (17:28 +0000)]
Fix 64-bit syscall argument fetching in 32-bit Linux syscall handlers.

The Linux32 system call argument fetcher places each argument (passed in
registers in the Linux x86 system call convention) into an entry in the
generic system call args array.  Each member of this array is 8 bytes
wide, so this approach is broken for system calls that take off_t
arguments.

Fix the problem by splitting l_loff_t arguments in the 32-bit system
call descriptions, the same as we do for FreeBSD32.  Change entry points
to handle this using the PAIR32TO64 macro.

Move linux_ftruncate64() into compat/linux.

PR: 243155
Reported by: Alex S <iwtcex@gmail.com>
Reviewed by: kib (previous version)
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D23210

4 years agolibexec/rc/rc.d/ipfw: style fix after r356943
Eugene Grosbein [Tue, 21 Jan 2020 17:16:02 +0000 (17:16 +0000)]
libexec/rc/rc.d/ipfw: style fix after r356943

Also, make sure it does not break for systems without ipfw code loaded.

MFC after: 1 months
X-MFC-with: 356943

4 years agoCorrect "service ipfw status" for INET6-only systems.
Eugene Grosbein [Tue, 21 Jan 2020 17:02:57 +0000 (17:02 +0000)]
Correct "service ipfw status" for INET6-only systems.

MFC after: 1 month

4 years agoCorrect a misleading indent.
Brooks Davis [Tue, 21 Jan 2020 16:31:08 +0000 (16:31 +0000)]
Correct a misleading indent.

This dates to before the beginning of our repo and was found clang 10.

MFC after: 3 days
Sponsored by: DARPA

4 years agoAdd support for Hygon Dhyana Family 18h processor.
Konstantin Belousov [Tue, 21 Jan 2020 13:22:35 +0000 (13:22 +0000)]
Add support for Hygon Dhyana Family 18h processor.

As a new x86 CPU vendor, Chengdu Haiguang IC Design Co., Ltd (Hygon)
is a joint venture between AMD and Haiguang Information Technology Co.,
Ltd., aims at providing x86 processors for China server market.

The first generation Hygon processor(Dhyana) shares most architecture
with AMD's family 17h, but with different CPU vendor ID("HygonGenuine")
and PCI vendor ID(0x1d94) and family series number 18h(Hygon negotiated
with AMD to confirm that only Hygon use family 18h).

To enable Hygon Dhyana support in FreeBSD, add new definitions
HYGON_VENDOR_ID("HygonGenuine") and X86_VENDOR_HYGON(0x1d94) to identify
Hygon Dhyana CPU.

Initialize the CPU features(topology, local APIC ext, MSI, TSC, hwpstate,
MCA, DEBUG_CTL, etc) for amd64 and i386 mode by sharing the code path of
AMD family 17h.

The changes have been applied on FreeBSD 13.0-CURRENT and tested
successfully on Hygon Dhyana processor.

References:
[1] Linux kernel patches for Hygon Dhyana, merged in 4.20:

https://git.kernel.org/tip/c9661c1e80b609cd038db7c908e061f0535804ef

[2] MSR and CPUID definition:

https://www.amd.com/system/files/TechDocs/54945_PPR_Family_17h_Models_00h-0Fh.pdf

Submitted by: Pu Wen <puwen@hygon.cn>
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D23163

4 years agoDocument requirements for the 'struct route' variations.
Alexander V. Chernikov [Tue, 21 Jan 2020 12:00:34 +0000 (12:00 +0000)]
Document requirements for the 'struct route' variations.

MFC after: 2 weeks

4 years agoMake sure the VNET is properly set when calling tcp_drop() from
Hans Petter Selasky [Tue, 21 Jan 2020 11:43:25 +0000 (11:43 +0000)]
Make sure the VNET is properly set when calling tcp_drop() from
the ktls taskqueue callback function.

A valid VNET is needed when updating statistics.

panic()
tcp_state_change()
tcp_drop()
ktls_reset_send_tag()
taskqueue_run_locked()
taskqueue_thread_loop()

Sponsored by: Mellanox Technologies

4 years agosysent.mk: split interpreter out of target command
Kyle Evans [Tue, 21 Jan 2020 05:01:11 +0000 (05:01 +0000)]
sysent.mk: split interpreter out of target command

The main objective here is to make it easy to identify what needs to change
in order to use a different sysent generator than the current Lua-based one,
which may be used to MFC some of the changes that have happened so we can
avoid parallel accidents in stable branches, for instance.

As a secondary objective, it's now feasible to override the generator on a
per-Makefile basis if needed, so that one could refactor their Makefile to
use this while pinning generation to the legacy makesyscalls.sh. I don't
anticipate any consistent need for such a thing, but it's low-effort to
achieve.

4 years agoMove readahead and dropbehind fault functionality into a helper routine for
Jeff Roberson [Tue, 21 Jan 2020 00:12:57 +0000 (00:12 +0000)]
Move readahead and dropbehind fault functionality into a helper routine for
clarity.

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

4 years agorandom.3: Some minor improvements to wording/clarity
Conrad Meyer [Mon, 20 Jan 2020 23:44:10 +0000 (23:44 +0000)]
random.3: Some minor improvements to wording/clarity

4 years agolibc: Delete unused rand.c ifdef TEST code
Conrad Meyer [Mon, 20 Jan 2020 23:43:47 +0000 (23:43 +0000)]
libc: Delete unused rand.c ifdef TEST code

4 years agoReduce object locking in vm_fault. Once we have an exclusively busied page we
Jeff Roberson [Mon, 20 Jan 2020 22:49:52 +0000 (22:49 +0000)]
Reduce object locking in vm_fault.  Once we have an exclusively busied page we
no longer need an object lock.  This reduces the longest hold times and
eliminates some trylock code blocks.

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

4 years agoMerge commit bc4bc5aa0 from llvm git (by Justin Hibbits):
Dimitry Andric [Mon, 20 Jan 2020 20:10:28 +0000 (20:10 +0000)]
Merge commit bc4bc5aa0 from llvm git (by Justin Hibbits):

  Add 8548 CPU definition and attributes

  8548 CPU is GCC's name for the e500v2, so accept this in clang.  The
  e500v2 doesn't support lwsync, so define __NO_LWSYNC__ for this as
  well, as GCC does.

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

Merge commit ff0311c4b from llvm git (by Justin Hibbits):

  [PowerPC]: Add powerpcspe target triple subarch component

  Summary:
  This allows the use of '-target powerpcspe-unknown-linux-gnu' or
  'powerpcspe-unknown-freebsd' to be used, instead of '-target
  powerpc-unknown-linux-gnu -mspe'.

  Reviewed By: dim
  Differential Revision: https://reviews.llvm.org/D72014

Merge commit ba91dffaf from llvm git (by Fangrui Song):

  [Driver][PowerPC] Move powerpcspe logic from cc1 to Driver

  Follow-up of D72014. It is more appropriate to use a target feature
  instead of a SubTypeArch to express the difference.

  Reviewed By: #powerpc, jhibbits

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

commit 36eedfcb3 from llvm git (by Justin Hibbits):

  [PowerPC] Fix powerpcspe subtarget enablement in llvm backend

  Summary:

  As currently written, -target powerpcspe will enable SPE regardless
  of disabling the feature later on in the command line.  Instead,
  change this to just set a default CPU to 'e500' instead of a generic
  CPU.

  As part of this, add FeatureSPE to the e500 definition.

  Reviewed By: MaskRay
  Differential Revision: https://reviews.llvm.org/D72673

These are needed to unbreak the build for powerpcspe.

Requested by: jhibbits
MFC after: 1 week

4 years agoWhen MK_CASPER=no is set remove files which are not needed to run system.
Mariusz Zaborski [Mon, 20 Jan 2020 19:56:22 +0000 (19:56 +0000)]
When MK_CASPER=no is set remove files which are not needed to run system.

PR: 242971

4 years agocache: revert r352613 now that vhold does not take locks
Mateusz Guzik [Mon, 20 Jan 2020 19:52:23 +0000 (19:52 +0000)]
cache: revert r352613 now that vhold does not take locks

4 years agoEven when the MK_CASPER is set to "no" we still want to install man pages
Mariusz Zaborski [Mon, 20 Jan 2020 19:51:53 +0000 (19:51 +0000)]
Even when the MK_CASPER is set to "no" we still want to install man pages
and the headers. If the user decides to install the system without Casper
support, then the Casper functions are mocked, but they still exist in
the system.

PR: 242971
MFC after: 2 weeks

4 years agoThose files are already removed in ObsoleteFiles.\
Mariusz Zaborski [Mon, 20 Jan 2020 19:47:58 +0000 (19:47 +0000)]
Those files are already removed in ObsoleteFiles.\
There is no need to remove them twice.

PR: 242971
MFC after: 2 weeks

4 years agoAdd myself (mikael) as a ports committer
Mikael Urankar [Mon, 20 Jan 2020 19:38:29 +0000 (19:38 +0000)]
Add myself (mikael) as a ports committer

Approved by: manu (mentor)
Differential Revision: https://reviews.freebsd.org/D23227

4 years agoqsort.3: Bump Dd and note that Annex K is optional
Conrad Meyer [Mon, 20 Jan 2020 18:43:10 +0000 (18:43 +0000)]
qsort.3: Bump Dd and note that Annex K is optional

4 years agox86: Wait for curthread to be set up as an indicator that the boot stack
Konstantin Belousov [Mon, 20 Jan 2020 17:23:03 +0000 (17:23 +0000)]
x86: Wait for curthread to be set up as an indicator that the boot stack
is no longer used.

pc_curthread is set by cpu_switch after it stopped using the old
thread (or boot) stack.  This makes the smp_after_idle_runnable()
function not dependent on the internals of the scheduler operations.

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

4 years agoThe ports tree now accepts /usr/local/share/man as a directory for manpage
Baptiste Daroussin [Mon, 20 Jan 2020 16:59:39 +0000 (16:59 +0000)]
The ports tree now accepts /usr/local/share/man as a directory for manpage
and will slowly transition from /usr/local/man to it. To reflect this remove
the documentation of the manpages being an exception in the layout of /usr/local

Reported by: Dan Nelson <dnelson_1901@yahoo.com> (via IRC)
MFC after: 3 days

4 years agoremove unused WITHOUT_PC_SYSINSTALL description
Ed Maste [Mon, 20 Jan 2020 15:19:56 +0000 (15:19 +0000)]
remove unused WITHOUT_PC_SYSINSTALL description

pc-sysinstall was moved from the base system to ports in r351781.

Submitted by: driesm.michiels gmail com
Differential Revision: https://reviews.freebsd.org/D21647

4 years agocache: make numcachehv use counter(9) on all archs
Mateusz Guzik [Mon, 20 Jan 2020 14:42:11 +0000 (14:42 +0000)]
cache: make numcachehv use counter(9) on all archs

Requested by: kib

4 years agoAdd support for latest Intel I219 device, supported in Lenovo Carbon X1 v7
George V. Neville-Neil [Mon, 20 Jan 2020 12:53:02 +0000 (12:53 +0000)]
Add support for latest Intel I219 device, supported in Lenovo Carbon X1 v7

MFC after: 2 weeks

4 years agoProperly translate MNT_FORCE flag to Linux umount2(2). Previously
Edward Tomasz Napierala [Mon, 20 Jan 2020 12:16:32 +0000 (12:16 +0000)]
Properly translate MNT_FORCE flag to Linux umount2(2).  Previously
it worked by accident.

MFC after: 2 weeks
Sponsored by: DARPA

4 years agoAdd qsort_r(3) regression test.
Edward Tomasz Napierala [Mon, 20 Jan 2020 11:45:18 +0000 (11:45 +0000)]
Add qsort_r(3) regression test.

MFC after: 2 weeks
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D23206

4 years agoAdd qsort_s(3). Apart from the constraints, it also makes it easier
Edward Tomasz Napierala [Mon, 20 Jan 2020 11:40:07 +0000 (11:40 +0000)]
Add qsort_s(3).  Apart from the constraints, it also makes it easier
to port software written for Linux variant of qsort_r(3).

Reviewed by: kib, arichardson
MFC after: 2 weeks
Relnotes: yes
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D23174

4 years agopowerpc/amiga: Hide CPLD date and time printing behind bootverbose
Justin Hibbits [Mon, 20 Jan 2020 04:01:35 +0000 (04:01 +0000)]
powerpc/amiga: Hide CPLD date and time printing behind bootverbose

There's no need to see the CPLD build date and time every boot.

4 years agoDon't hold the object lock while calling getpages.
Jeff Roberson [Sun, 19 Jan 2020 23:47:32 +0000 (23:47 +0000)]
Don't hold the object lock while calling getpages.

The vnode pager does not want the object lock held.  Moving this out allows
further object lock scope reduction in callers.  While here add some missing
paging in progress calls and an assert.  The object handle is now protected
explicitly with pip.

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

4 years agomps(4): add missing cam(4) dependency
Conrad Meyer [Sun, 19 Jan 2020 22:52:36 +0000 (22:52 +0000)]
mps(4): add missing cam(4) dependency

On a MINIMAL kernel, mps.ko wouldn't load because it uses the xpt_hold_boot
symbol from CAM, but didn't have a dependency on cam(4).

(CEM: Some context: when linking loaded modules, the kernel dynamic linker
only looks for definitions in explictly marked dependency modules.  Also,
the identical mpr(4) driver uses the same CAM function, but already had the
correct MODULE_DEPEND(), so no similar change is needed there.)

Submitted by: Greg V <greg AT unrelenting.technology>
Reviewed by: imp, myself
Differential Revision: https://reviews.freebsd.org/D23272

4 years agoCirrus-CI: add `make packages` to CI test
Ed Maste [Sun, 19 Jan 2020 22:29:22 +0000 (22:29 +0000)]
Cirrus-CI: add `make packages` to CI test

Now that we can override the format to avoid the time spent compressing
pkgbase packages we can test `make packages` with only 5 minutes or so
added to the CI cycle time.

A future change should switch the CI smoke test to using these packages.

Sponsored by: The FreeBSD Foundation

4 years agoPowerPC: Add CPLD driver for AmigaOne X5000
Justin Hibbits [Sun, 19 Jan 2020 21:43:15 +0000 (21:43 +0000)]
PowerPC: Add CPLD driver for AmigaOne X5000

Summary:
The CPLD is the communications medium between the CPU and the XMOS
"Xena" event coprocessor.  It provides a mailbox communication feature,
along with dual-port RAM to be used between the CPU and XMOS.  Also, it
provides basic board stats as well, such as PCIe presence, JTAG signals,
and CPU fan speed reporting (in revolutions per second).  Only fan speed
reading is handled, as a sysctl.

Reviewed by: bdragon
Differential Revision: https://reviews.freebsd.org/D23136

4 years agovfs: switch vop_stdunlock to call lockmgr_unlock
Mateusz Guzik [Sun, 19 Jan 2020 21:41:34 +0000 (21:41 +0000)]
vfs: switch vop_stdunlock to call lockmgr_unlock

Since the flags argument is now alawys 0 the new call provides the same
behavior.

4 years agox86: fix assertion in ipi_send_cpu to range check the passed id
Mateusz Guzik [Sun, 19 Jan 2020 21:35:51 +0000 (21:35 +0000)]
x86: fix assertion in ipi_send_cpu to range check the passed id

Prior to the change for sufficiently bad id (and in particular NOCPU which is -1)
it would access memory outside of the cpu_apic_ids array.

4 years ago[PowerPC64] fix crash when using machdep.moea64_bpvo_pool_size tunable
Justin Hibbits [Sun, 19 Jan 2020 21:17:57 +0000 (21:17 +0000)]
[PowerPC64] fix crash when using machdep.moea64_bpvo_pool_size tunable

Summary:
This fixes kernel crashing when tunable "machdep.moea64_bpvo_pool_size" is
set to a value higher then 327680 (default value).  Function
moea64_mid_bootstrap() relies on moea64_bpvo_pool_size, but at time of the
use the variable wan't yet updated with the new value provided by user.

Problem was detected after trying to use a VM with 64GB of RAM, and default
moea64_bpvo_pool_size is insufficient (kernel boot used more than 470000) .
I think default value must be discussed to address this use case, or find a
way to calculate pool size automatically based on amount of memory detected.

Test Plan: Tested on QEMU VM with 64GB of RAM using "set
machdep.moea64_bpvo_pool_size=655360" on loader prompt

Submitted by: Alfredo Dal'Ava JĂșnior (alfredo.junior_eldorado.org.br)
Differential Revision: https://reviews.freebsd.org/D23233

4 years agozilinx/zy7_qspi: Add a qspi driver for Zynq platforms.
Emmanuel Vadot [Sun, 19 Jan 2020 20:04:44 +0000 (20:04 +0000)]
zilinx/zy7_qspi: Add a qspi driver for Zynq platforms.

This is a qspi driver for the Xilinx Zynq-7000 chip.
It could be useful for anyone wanting to boot a system from flash memory
instead of SD cards.

Submitted by: Thomas Skibo (thomasskibo@yahoo.com)
Differential Revision: https://reviews.freebsd.org/D14698

4 years agosrc.conf.5: regen after BINUTILS defaults and description changes
Ed Maste [Sun, 19 Jan 2020 19:57:14 +0000 (19:57 +0000)]
src.conf.5: regen after BINUTILS defaults and description changes

4 years agork805: Add a regnode_init method
Emmanuel Vadot [Sun, 19 Jan 2020 19:56:50 +0000 (19:56 +0000)]
rk805: Add a regnode_init method

This method will set the desired voltaged based on values in the DTS.
It will not enable the regulator, this is the job of either a consumer
or regnode_set_constraint SYSINIT if the regulator is boot_on or always_on.

Reviewed by: mmel
MFC after: 1 month
Differential Revision: https://reviews.freebsd.org/D23216

4 years agosrc.opts.mk: default BINUTILS_BOOTSTRAP to NO except for x86 and powerpc
Ed Maste [Sun, 19 Jan 2020 19:56:05 +0000 (19:56 +0000)]
src.opts.mk: default BINUTILS_BOOTSTRAP to NO except for x86 and powerpc

x86 needs bootstrap GNU as for assembling a few files, and powerpc needs
GNU ld.bfd for linking 32-bit objects.  All other targets either fully
use in-tree Clang and lld, or rely on external toolchain.

Sponsored by: The FreeBSD Foundation

4 years agoarm: allwinner: Add GPIO Interrupt support
Emmanuel Vadot [Sun, 19 Jan 2020 19:51:20 +0000 (19:51 +0000)]
arm: allwinner: Add GPIO Interrupt support

Not all pins in Allwinner have interrupts support so we rely
on the padconf data to add the proper caps when pin_getcaps is called.
The pin is switch to the specific "eint" function during setup_intr and
switched back to its old function in teardown_intr.
Only INTR_MAP_DATA_GPIO is supported for now.

MFC after: 1 month

4 years agoremove caution notes from WITHOUT_BINUTILS* descriptions
Ed Maste [Sun, 19 Jan 2020 19:47:04 +0000 (19:47 +0000)]
remove caution notes from WITHOUT_BINUTILS* descriptions

WITHOUT_BINUTILS and WITHOUT_BINUTILS_BOOTSTRAP previously included
claims about being unable to build if set.  Those cautions are no longer
universally true, and most FreeBSD targets can function more or less
without enabling GNU Binutils.  Just remove the cautions.

Sponsored by: The FreeBSD Foundation

4 years agolimit building GNU assembler (as) to x86
Ed Maste [Sun, 19 Jan 2020 19:16:32 +0000 (19:16 +0000)]
limit building GNU assembler (as) to x86

GNU as 2.17.50 is currently required by amd64 and i386 for at least one
file that cannot be assembled by Clang's integrated assembler (IAS).
Other supported CPU architectures either use Clang IAS for all assembly
files, or rely on external toolchain.

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

4 years agoarm: allwinner: Fix padconf for interrupts information
Emmanuel Vadot [Sun, 19 Jan 2020 19:14:49 +0000 (19:14 +0000)]
arm: allwinner: Fix padconf for interrupts information

Add a eint_bank member to the allwinner_pins structure.
On Allwinner SoCs not all pins can do interrupt.
Older SoC (A10/A13 and A20) there is a maximum number of interrupts
set to 32 and all the configuration is done in the same registers.
While on "newer" SoCs (>=A31) interrupts registers are splitted per
pin bank (i.e. all interrupts available in bank B will be configured
with a sets of registers and the one in bank G in another set).
While here set the names to all interrupts function to
pX_eintY where X is the bank name and Y the interrupt number.

To whom ever in the future look at the H5 manual and notice that the bank F
have interrupts support : This isn't true, trust me.

MFC after: 1 month

4 years agoIt has not been possible to recursively terminate a vnode object for some time
Jeff Roberson [Sun, 19 Jan 2020 18:36:03 +0000 (18:36 +0000)]
It has not been possible to recursively terminate a vnode object for some time
now.  Eliminate the dead code that supports it.

Approved by: kib, markj
Differential Revision: https://reviews.freebsd.org/D22908

4 years agoMake collapse synchronization more explicit and allow it to complete during
Jeff Roberson [Sun, 19 Jan 2020 18:30:23 +0000 (18:30 +0000)]
Make collapse synchronization more explicit and allow it to complete during
paging.

Shadow objects are marked with a COLLAPSING flag while they are collapsing with
their backing object.  This gives us an explicit test rather than overloading
paging-in-progress.  While split is on-going we mark an object with SPLIT.
These two operations will modify the swap tree so they must be serialized
and swap_pager_getpages() can now directly detect these conditions and page
more conservatively.

Callers to vm_object_collapse() now will reliably wait for a collapse to finish
so that the backing chain is as short as possible before other decisions are
made that may inflate the object chain.  For example, split, coalesce, etc.
It is now safe to run fault concurrently with collapse.  It is safe to increase
or decrease paging in progress with no lock so long as there is another valid
ref on increase.

This change makes collapse more reliable as a secondary benefit.  The primary
benefit is making it safe to drop the object lock much earlier in fault or
never acquire it at all.

This was tested with a new shadow chain test script that uncovered long
standing bugs and will be integrated with stress2.

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

4 years agoProvide an API for interlocked refcount sleeps.
Jeff Roberson [Sun, 19 Jan 2020 18:18:17 +0000 (18:18 +0000)]
Provide an API for interlocked refcount sleeps.

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

4 years agovfs: allow v_holdcnt to transition 0->1 without the interlock
Mateusz Guzik [Sun, 19 Jan 2020 17:47:04 +0000 (17:47 +0000)]
vfs: allow v_holdcnt to transition 0->1 without the interlock

Since r356672 ("vfs: rework vnode list management") there is nothing to do
apart from altering freevnodes count, but this much can be safely done based
on the result of atomic_fetchadd.

Reviewed by: kib
Tested by: pho
Differential Revision: https://reviews.freebsd.org/D23186

4 years agocache: counter_u64_add_protected -> counter_u64_add
Mateusz Guzik [Sun, 19 Jan 2020 17:05:26 +0000 (17:05 +0000)]
cache: counter_u64_add_protected -> counter_u64_add

Fixes booting on RISC-V where it does happen to not be equivalent.

Reported by: lwhsu

4 years agoAdd myself as a mentee of bcr
Sergio Carlavilla Delgado [Sun, 19 Jan 2020 16:24:25 +0000 (16:24 +0000)]
Add myself as a mentee of bcr

Patch by: carlavilla@(doc-committer)
Approved by: bcr@(mentor)

4 years agopkgbase: allow the pkg format to be overridden
Ed Maste [Sun, 19 Jan 2020 14:46:28 +0000 (14:46 +0000)]
pkgbase: allow the pkg format to be overridden

Compressing .txz packages can be rather slow, and speed is likely more
important than disk space during development.  Allow package format to
be set via PKG_FORMAT make variable.

Reviewed by: bapt
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D23257

4 years agocache: convert numcachehv to counter(9) on 64-bit platforms
Mateusz Guzik [Sun, 19 Jan 2020 05:37:27 +0000 (05:37 +0000)]
cache: convert numcachehv to counter(9) on 64-bit platforms

4 years agovfs: plug a conditional assigment of lo_name in getnewvnode
Mateusz Guzik [Sun, 19 Jan 2020 05:36:45 +0000 (05:36 +0000)]
vfs: plug a conditional assigment of lo_name in getnewvnode

It only matters for witness. No functional changes.

4 years ago[PowerPC] Fix 32-bit ubldr calling convention
Brandon Bergren [Sun, 19 Jan 2020 04:13:19 +0000 (04:13 +0000)]
[PowerPC] Fix 32-bit ubldr calling convention

Due to the way u-boot for 32-bit powerpc is compiled, the interrupt code
assumes that the GOT pointer (r30) on u-boot is always intact.

When making syscalls to u-boot, ensure that we have restored r30 like we
found it before we enable interrupts to prevent u-boot from crashing if a
timer interrupt was pending.

This fixes ubldr on e500 qemu (assuming you have recompiled qemu's u-boot
with API support!)

Reviewed by: jhibbits
Sponsored by: Tag1 Consulting, Inc.
Differential Revision: https://reviews.freebsd.org/D23258

4 years agolibbe: use the new zfs_mount_at()
Kyle Evans [Sun, 19 Jan 2020 02:48:56 +0000 (02:48 +0000)]
libbe: use the new zfs_mount_at()

More background is available in r356876, but this new interface is more
portable across ZFS implementations and cleaner for what libbe is attempting
to achieve anyways.

MFC after: 3 days

4 years agolibzfs: add zfs_mount_at
Kyle Evans [Sun, 19 Jan 2020 02:45:02 +0000 (02:45 +0000)]
libzfs: add zfs_mount_at

This will be used in libbe in place of the internal zmount(); libbe only
wants to be able to mount a dataset at an arbitrary mountpoint without
altering dataset/pool properties. The natural way to do this in a portable
way is by creating a zfs_mount_at() interface that's effectively zfs_mount()
+ a mountpoint parameter. zfs_mount() is now a light wrapper around the new
method.

The interface and implementation have already been accepted into ZFS On
Linux, and the next commit to switch libbe() over to this new interface will
solve the last compatibility issue with ZoL.  The next sysutils/openzfs
rebase against ZoL should be able to build libbe/bectl with only minor
adjustments to build glue.

Reviewed by: Ryan Moeller <ryan freqlabs com>
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D23132

4 years agopkgbase: cache pkg ABI for all world/kernel packages
Ed Maste [Sat, 18 Jan 2020 22:58:32 +0000 (22:58 +0000)]
pkgbase: cache pkg ABI for all world/kernel packages

Rather than invoking `pkg config ABI` repeatedly.

Reviewed by: manu
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D23255

4 years agosysent targets: further cleanup and deduplication
Kyle Evans [Sat, 18 Jan 2020 20:37:45 +0000 (20:37 +0000)]
sysent targets: further cleanup and deduplication

r355473 vastly improved the readability and cleanliness of these Makefiles.
Every single one of them follows the same pattern and duplicates the exact
same logic.

Now that we have GENERATED/SRCS, split SRCS up into the two parameters we'll
use for ${MAKESYSCALLS} rather than assuming a specific ordering of SRCS and
include a common sysent.mk to handle the rest. This makes it less tedious to
make sweeping changes.

Some default values are provided for GENERATED/SYSENT_*; almost all of these
just use a 'syscalls.master' and 'syscalls.conf' in cwd, and they all use
effectively the same filenames with an arbitrary prefix. Most ABIs will be
able to get away with just setting GENERATED_PREFIX and including
^/sys/conf/sysent.mk, while others only need light additions. kern/Makefile
is the notable exception, as it doesn't take a SYSENT_CONF and the generated
files are spread out between ^/sys/kern and ^/sys/sys, but it otherwise fits
the pattern enough to use the common version.

Reviewed by: brooks, imp
Nice!: emaste
Differential Revision: https://reviews.freebsd.org/D23197

4 years agoCirrus-CI: bump VM image to FreeBSD 12.1
Ed Maste [Sat, 18 Jan 2020 20:19:07 +0000 (20:19 +0000)]
Cirrus-CI: bump VM image to FreeBSD 12.1

12.0 will be EOL.

Sponsored by: The FreeBSD Foundation

4 years agopcpu_page_alloc: guard against empty NUMA domains
Andrew Gallatin [Sat, 18 Jan 2020 18:25:37 +0000 (18:25 +0000)]
pcpu_page_alloc: guard against empty NUMA domains

Some systems, such as higher end Threadripper, may have
NUMA domains with no physical memory, Don't allocate
from these domains.

This fixes a "panic: vm_wait in early boot" on my 2990WX desktop

Reviewed by: jeff
Sponsored by: Netflix

4 years agoifa_maintain_loopback_route: adjust debugging output
Eugene Grosbein [Sat, 18 Jan 2020 04:48:05 +0000 (04:48 +0000)]
ifa_maintain_loopback_route: adjust debugging output

Correction after r333476:

- write this as LOG_DEBUG again instead of LOG_INFO;
- get back function name into the message;
- error may be ESRCH if an address is removed in process (by carp f.e.),
not only ENOENT;
- expression complexity grows, so try making it more readable.

MFC after: 1 week

4 years agoD23057: [PowerPC] Fix offset calculations in bridge mode
Brandon Bergren [Sat, 18 Jan 2020 04:12:41 +0000 (04:12 +0000)]
D23057: [PowerPC] Fix offset calculations in bridge mode

In rS354701, I replaced text relocations with offsets from &generictrap.

Unfortunately, the magic variable I was using doesn't actually mean the
address of &generictrap, in bridge mode it actually means &generictrap64.

So, for bridge mode to work, it is necessary to differentiate between
"where do we need to branch to to handle a trap" and "where is &generictrap
for purposes of doing relative math".

Introduce a new TRAP_ENTRY and use it instead of TRAP_GENTRAP for doing
actual calls to the generic trap handler.

Reported by: Mark Millard <marklmi@yahoo.com>
Reviewed by: jhibbits
Sponsored by: Tag1 Consulting, Inc.
Differential Revision: https://reviews.freebsd.org/D23057

4 years agoGEOM label: strip leading/trailing space synthesizing devfs names
Conrad Meyer [Sat, 18 Jan 2020 03:33:44 +0000 (03:33 +0000)]
GEOM label: strip leading/trailing space synthesizing devfs names

%20%20%20 is ugly and doesn't really help make human-readable devfs names.

PR: 243318
Reported by: Peter Eriksson <pen AT lysator.liu.se>
Relnotes: yes

4 years agoAdd a 'SINGLETON' directive to kobj interface definition
Justin Hibbits [Sat, 18 Jan 2020 02:39:38 +0000 (02:39 +0000)]
Add a 'SINGLETON' directive to kobj interface definition

Summary:
This makes the interface described in the definition file act like a
pseudo-IFUNC service, by caching the found method locally.

Applying this to the PowerPC MMU definitions, it yields a significant
(15-20%) performance improvement, seen in both a 'make buildworld' and a
parallel build of LLVM, on a POWER9 system.

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

4 years agovfs: distribute freevnodes counter per-cpu
Mateusz Guzik [Sat, 18 Jan 2020 01:29:02 +0000 (01:29 +0000)]
vfs: distribute freevnodes counter per-cpu

It gets rolled up to the global when deferred requeueing is performed.
A dedicated read routine makes sure to return a value only off by a certain
amount.

This soothes a global serialisation point for all 0<->1 hold count transitions.

Reviewed by: jeff
Differential Revision: https://reviews.freebsd.org/D23235

4 years agopowerpc: Fix the NUMA domain list on powernv
Justin Hibbits [Sat, 18 Jan 2020 01:26:54 +0000 (01:26 +0000)]
powerpc: Fix the NUMA domain list on powernv

Summary:
Consolidate the NUMA associativity handling into a platform function.
Non-NUMA platforms will just fall back to the default (0).  Currently
only implemented for powernv, which uses a lookup table to map the
device tree associativity into a system NUMA domain.

Fixes hangs on powernv after r356534, and corrects a fairly longstanding
bug in powernv's NUMA handling, which ended up using domains 1 and 2 for
devices and memory on power9, while CPUs were bound to domains 0 and 1.

Reviewed by: bdragon, luporl
Differential Revision: https://reviews.freebsd.org/D23220

4 years ago[PowerPC] Fix Book-E direct map for >=16G ram on e5500
Brandon Bergren [Sat, 18 Jan 2020 01:22:54 +0000 (01:22 +0000)]
[PowerPC] Fix Book-E direct map for >=16G ram on e5500

It turns out the maximum TLB1 page size on e5500 is 4G, despite the format
being defined for up to 1TB.

So, we need to clamp the DMAP TLB1 entries to not attempt to create 16G or
larger entries.

Fixes boot on my X5000 in which I just installed 16G of RAM.

Reviewed by: jhibbits
Sponsored by: Tag1 Consulting, Inc.
Differential Revision: https://reviews.freebsd.org/D23244