]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
3 years agoFix passing OPTIONS_UNSET with multiple options to make(1).
Glen Barber [Thu, 27 Aug 2020 13:25:24 +0000 (13:25 +0000)]
Fix passing OPTIONS_UNSET with multiple options to make(1).
While here, adjust the copyright.

Sponsored by: Rubicon Communications, LLC (netgate.com)

3 years agoFix the current working directory when setting GITREV and
Glen Barber [Tue, 25 Aug 2020 18:30:12 +0000 (18:30 +0000)]
Fix the current working directory when setting GITREV and
GITBRANCH.

Sponsored by: Rubicon Communications, LLC (netgate.com)

3 years agoRemove an escape that does not belong.
Glen Barber [Mon, 24 Aug 2020 19:00:57 +0000 (19:00 +0000)]
Remove an escape that does not belong.

Sponsored by: Rubicon Communications, LLC (netgate.com)

3 years agoMFH
Glen Barber [Wed, 12 Aug 2020 17:16:26 +0000 (17:16 +0000)]
MFH

Sponsored by: Rubicon Communications, LLC (netgate.com)

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 agorelease: update to use git instead of svn:
Glen Barber [Wed, 12 Aug 2020 16:30:33 +0000 (16:30 +0000)]
release: update to use git instead of svn:

Makefile.* (cloudware):
 - Consistify setting the BUILDDATE for snapshots.
   (Missed a spot)

Sponsored by: Rubicon Communications, LLC (netgate.com)

3 years agorelease: update to use git instead of svn:
Glen Barber [Wed, 12 Aug 2020 16:25:25 +0000 (16:25 +0000)]
release: update to use git instead of svn:

Makefile.* (cloudware):
 - Consistify setting the BUILDDATE for snapshots.

release.conf.sample/release.sh:
 - Run 'git clone' in 'quiet' mode.

Makefile.inc1:
 - Set BUILDDATE and export the variable.

Sponsored by: Rubicon Communications, LLC (netgate.com)

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

3 years agoFix stand/newvers.sh with zsh in sh mode
Alex Richardson [Wed, 12 Aug 2020 15:49:10 +0000 (15:49 +0000)]
Fix stand/newvers.sh with zsh in sh mode

When building on macOS with sh==zsh, newvers.sh was producing an
unterminated string literal due to \\n being turned as a newline. Fix this
by using a here document instead.

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

3 years agoFix crunchgen usage of mkstemp()
Alex Richardson [Wed, 12 Aug 2020 15:49:06 +0000 (15:49 +0000)]
Fix crunchgen usage of mkstemp()

On Glibc systems mkstemp can only be used once with the same template
string since it will be modified in-place and no longer contain any 'X' chars.
It is fine to reuse the same file here but we need to be explicit and use
open() instead of mkstemp() on the second use.

While touching this file also avoid a hardcoded /bin/pwd since that may not
work when building on non-FreeBSD systems.

Reviewed By: brooks
Differential Revision: https://reviews.freebsd.org/D25990

3 years agoiflib: netmap: improve rxsync to support IFLIB_HAS_RXCQ
Vincenzo Maffione [Wed, 12 Aug 2020 14:45:31 +0000 (14:45 +0000)]
iflib: netmap: improve rxsync to support IFLIB_HAS_RXCQ

For drivers with IFLIB_HAS_RXCQ set, there is a separate completion
queue. In this case, the netmap rxsync routine needs to update
rxq->ifr_cq_cidx in the same way it is updated by iflib_rxeof().
This improves the situation for vmx(4) and bnxt(4) drivers, which
use iflib and have the IFLIB_HAS_RXCQ bit set.

PR: 248494
MFC after: 3 weeks

3 years agoiflib: refactor netmap_fl_refill and fix off-by-one issue
Vincenzo Maffione [Wed, 12 Aug 2020 14:17:38 +0000 (14:17 +0000)]
iflib: refactor netmap_fl_refill and fix off-by-one issue

First, fix the initialization of the fl->ifl_rxd_idxs array,
which was affected by an off-by-one bug.
Once there, refactor the function to use better names for
local variables, optimize the variable assignments, and
merge the bus_dmamap_sync() inner loop with the outer one.

PR: 248494
MFC after: 3 weeks

3 years agohook cp2112.4 to the build
Andriy Gapon [Wed, 12 Aug 2020 11:37:28 +0000 (11:37 +0000)]
hook cp2112.4 to the build

Reported by: 0mp
MFC after: 1 week
X-MFC with: r364144

3 years agohook gpiokeys.4 to the build
Andriy Gapon [Wed, 12 Aug 2020 11:36:09 +0000 (11:36 +0000)]
hook gpiokeys.4 to the build

Reported by: 0mp
MFC after: 3 days
X-MFC with: r363905

3 years agoAdd support for Cortex-A76/Neoverse-N1 to hwpmc
Andrew Turner [Wed, 12 Aug 2020 10:17:17 +0000 (10:17 +0000)]
Add support for Cortex-A76/Neoverse-N1 to hwpmc

This adds support for the Cortex-A76 and Neoverse-N1 PMU counters to pmc.

While here add more PMCR_IDCODE values and check the implementers code is
correct before setting the PMU type.

Reviewed by: bz, emaste (looks reasonable to me)
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D25959

3 years agoaw_cir: in the pulse encoding the actual length is one greater than value
Andriy Gapon [Wed, 12 Aug 2020 09:57:28 +0000 (09:57 +0000)]
aw_cir: in the pulse encoding the actual length is one greater than value

While here change type of some variables from long to int, it's sufficient.
Also, add length reporting to a couple of debug printfs.

MFC after: 3 weeks

3 years agoaw_cir: lower activation threshold to support NECx protocol
Andriy Gapon [Wed, 12 Aug 2020 09:56:21 +0000 (09:56 +0000)]
aw_cir: lower activation threshold to support NECx protocol

In NECx the leading mark has length of 8T as opposed to 16T in NEC,
where T is  562.5 us.  So, 4.5 ms.
Our threshold was set to 128 * 42.7 us (derived from the sampling
frequency of 3/128 MHz).  So, ~5.5 ms.

The new threshold is set to AW_IR_L1_MIN.  I think that's a good enough
lower bound for detecting the leading pulse.

Also, calculations of active_delay (which is activation delay) are fixed.
Previously they would be wrong if AW_IR_ACTIVE_T was anything but zero,
because the value was already bit-shifted.

Finally, I am not sure why the activation delay was divided by two when
calculating the initial pulse length.  I have not found anything that
would explain or justify it.  So, I removed that division.

MFC after: 3 weeks

3 years agoaw_cir: minor cleanups
Andriy Gapon [Wed, 12 Aug 2020 09:52:39 +0000 (09:52 +0000)]
aw_cir: minor cleanups

MFC after: 1 week

3 years agoaw_cir: add support for allwinner,sun6i-a31-ir (found, e.g., on h3)
Andriy Gapon [Wed, 12 Aug 2020 09:52:12 +0000 (09:52 +0000)]
aw_cir: add support for allwinner,sun6i-a31-ir (found, e.g., on h3)

MFC after: 1 week

3 years agogpiokeys: add evdev support
Andriy Gapon [Wed, 12 Aug 2020 09:49:25 +0000 (09:49 +0000)]
gpiokeys: add evdev support

Only linux,code is supported as it maps 1:1 to evdev key codes.
No reverse mapping for freebsd,code yet.

Reviewed by: wulf
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D25940

3 years agoadd a manual page for cp2112
Andriy Gapon [Wed, 12 Aug 2020 09:42:05 +0000 (09:42 +0000)]
add a manual page for cp2112

MFC after: 1 week

3 years agocp2112: a number of cleanups and improvements
Andriy Gapon [Wed, 12 Aug 2020 09:07:07 +0000 (09:07 +0000)]
cp2112: a number of cleanups and improvements

- hoist all request / response structures from function level to top level
- replace magic numeric literals with constants
- regroup types, data and functions
- remove setting of the id field in responses as they are completely
  overwritten with data from the device
- centralize setting of the id field as it is always set to the value of
  request type
- fix setting and querying of open-drain vs push-pull configuration of
  an output pin -- it's always in one of those configurations
- detect special pin configurations: a pin in a special configuration is
  neither general purpose input or output
- there is still no support for setting special configurations

MFC after: 2 weeks

3 years agovfs: inline vrefcnt
Mateusz Guzik [Wed, 12 Aug 2020 04:53:20 +0000 (04:53 +0000)]
vfs: inline vrefcnt

3 years agovfs: garbage collect vrefactn
Mateusz Guzik [Wed, 12 Aug 2020 04:53:02 +0000 (04:53 +0000)]
vfs: garbage collect vrefactn

3 years agovfs: reimplement vref on top of vget
Mateusz Guzik [Wed, 12 Aug 2020 04:52:35 +0000 (04:52 +0000)]
vfs: reimplement vref on top of vget

No change in generated assembly.

3 years agoFix a bug introduced by r363001 for the ext_pgs case.
Rick Macklem [Wed, 12 Aug 2020 04:35:49 +0000 (04:35 +0000)]
Fix a bug introduced by r363001 for the ext_pgs case.

r363001 added support for ext_pgs mbufs to nfsm_uiombuf().
By inspection, I noticed that "mlen" was not set non-zero and, as such, there
would be an iteration of the loop that did nothing.
This patch sets it.
This bug would have no effect on the system, since the ext_pgs mbuf code
is not yet enabled.

3 years agodevfs: Abstract locking assertions
Conrad Meyer [Wed, 12 Aug 2020 00:32:31 +0000 (00:32 +0000)]
devfs: Abstract locking assertions

The conversion was largely mechanical: sed(1) with:

  -e 's|mtx_assert(&devmtx, MA_OWNED)|dev_lock_assert_locked()|g'
  -e 's|mtx_assert(&devmtx, MA_NOTOWNED)|dev_lock_assert_unlocked()|g'

The definitions of these abstractions in fs/devfs/devfs_int.h are the
only non-mechanical change.

No functional change.

3 years agoBack out unrelated change
Conrad Meyer [Wed, 12 Aug 2020 00:21:30 +0000 (00:21 +0000)]
Back out unrelated change

Reported by: kib, markj
X-MFC-With: r364129

3 years agoWhen booting a system with WITHOUT_IPFILTER the following errors
Cy Schubert [Tue, 11 Aug 2020 23:36:38 +0000 (23:36 +0000)]
When booting a system with WITHOUT_IPFILTER the following errors
are encountered at boot time:

rcorder: requirement `ipfs' in file `/etc/rc.d/netif' has no providers.
rcorder: requirement `ipfilter' in file `/etc/rc.d/netif' has no
providers.
rcorder: requirement `ipfilter' in file `/etc/rc.d/netwait' has no
providers.
rcorder: requirement `ipfilter' in file `/etc/rc.d/net_watchdog' has no
providers.
rcorder: requirement `ipfilter' in file `/etc/rc.d/securelevel' has no
providers.

Listing its own requrements in BEFORE rather than use REQUIRE of
non-optional scripts resolves this issue.

The issue was discovered and patched by glebius at Netflix.

Submitted by: glebius
Reported by: glebius
MFC after: 1 week

3 years agosince kld_deb.py was removed a while back, this script isn't useful
John-Mark Gurney [Tue, 11 Aug 2020 22:33:56 +0000 (22:33 +0000)]
since kld_deb.py was removed a while back, this script isn't useful
anymore...

3 years agotput(1): Several enhancements for the manual page
Gordon Bergling [Tue, 11 Aug 2020 21:44:43 +0000 (21:44 +0000)]
tput(1): Several enhancements for the manual page

- a couple of descriptions are incomplete
- synopsis doesn't show that all arguments are optional
- missing an ENVIRONMENT section with TERM mentioned

PR: 84670
Submitted by: Gary W. Swearingen <garys at opusnet dot com>
Reviewed by: bcr
Approved by: bcr
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D26009

3 years agosmp.h: Reconcile definition and declaration of smp_ncpus
Conrad Meyer [Tue, 11 Aug 2020 20:42:21 +0000 (20:42 +0000)]
smp.h: Reconcile definition and declaration of smp_ncpus

The variable is defined unconditionally; declare it unconditionally as well.

It is already initialized to the correct value (1) for !SMP builds.

No functional change.

3 years agoAdd support for multithreading the inactive queue pageout within a domain.
Conrad Meyer [Tue, 11 Aug 2020 20:37:45 +0000 (20:37 +0000)]
Add support for multithreading the inactive queue pageout within a domain.

In very high throughput workloads, the inactive scan can become overwhelmed
as you have many cores producing pages and a single core freeing.  Since
Mark's introduction of batched pagequeue operations, we can now run multiple
inactive threads working on independent batches.

To avoid confusing the pid and other control algorithms, I (Jeff) do this in
a mpi-like fan out and collect model that is driven from the primary page
daemon.  It decides whether the shortfall can be overcome with a single
thread and if not dispatches multiple threads and waits for their results.

The heuristic is based on timing the pageout activity and averaging a
pages-per-second variable which is exponentially decayed. This is visible in
sysctl and may be interesting for other purposes.

I (Jeff) have verified that this does indeed double our paging throughput
when used with two threads. With four we tend to run into other contention
problems.  For now I would like to commit this infrastructure with only a
single thread enabled.

The number of worker threads per domain can be controlled with the
'vm.pageout_threads_per_domain' tunable.

Submitted by: jeff (earlier version)
Discussed with: markj
Tested by: pho
Sponsored by: probably Netflix (based on contemporary commits)
Differential Revision: https://reviews.freebsd.org/D21629

3 years agoAllow linking the kernel with a linker that doesn't support -z ifunc-noplt
Alex Richardson [Tue, 11 Aug 2020 16:47:00 +0000 (16:47 +0000)]
Allow linking the kernel with a linker that doesn't support -z ifunc-noplt

This can happen when linking with upstream LLD < 9.0.

Reviewed By: markj
Differential Revision: https://reviews.freebsd.org/D25985

3 years agoFix libdtrace build with zsh as /bin/sh
Alex Richardson [Tue, 11 Aug 2020 16:46:54 +0000 (16:46 +0000)]
Fix libdtrace build with zsh as /bin/sh

When zsh runs in POSIX sh mode it does not support the -e flag to echo.
Use printf instead of echo to avoid the "-e" characters being printed.

Obtained from: CheriBSD
Reviewed By: markj
Differential Revision: https://reviews.freebsd.org/D26026

3 years agoFix -DBUILD_WITH_STRICT_TMPPATH dtrace builds
Alex Richardson [Tue, 11 Aug 2020 16:46:48 +0000 (16:46 +0000)]
Fix -DBUILD_WITH_STRICT_TMPPATH dtrace builds

Some of the scripts used for libdtrace invoke nawk instead of awk
(for example cddl/contrib/opensolaris/lib/libdtrace/common/mknames.sh).
When bootstrapping all tools, we get the nawk -> awk link while building
usr.bin/awk, but when linking/copying the dependencies from the host we
were only adding awk but not nawk.

This was silently generating invalid files when building libdtrace with
BUILD_WITH_STRICT_TMPPATH=1 since those scripts invoke nawk instead of
awk. In addition to adding the missing link this commit also adds
set -e to those scripts to catch errors like this in the future.

Reviewed By: markj, emaste
Differential Revision: https://reviews.freebsd.org/D26025

3 years agoAdd CLANG/LLD/LLD to BROKEN_OPTIONS when building on non-FreeBSD
Alex Richardson [Tue, 11 Aug 2020 16:46:43 +0000 (16:46 +0000)]
Add CLANG/LLD/LLD to BROKEN_OPTIONS when building on non-FreeBSD

These tools require a bootstrap llvm-tblgen/clang-tblgen and that cannot
be built with the current make infrastructure: the config header is not
correct for Linux/macOS and we don't include the CMakeLists.txt in contrib
so we can't generate one that would be correct.

Reviewed By: emaste, imp, dim
Differential Revision: https://reviews.freebsd.org/D14245

3 years agoFix bootstrapping of pwd_mkdb after r364049
Alex Richardson [Tue, 11 Aug 2020 16:46:38 +0000 (16:46 +0000)]
Fix bootstrapping of pwd_mkdb after r364049

I moved the bootstrap pwd.h to a subdirectory in r364049 but forgot to
adjust the #include path.

3 years agoFix bootstrapping ldd after r362152
Alex Richardson [Tue, 11 Aug 2020 16:46:33 +0000 (16:46 +0000)]
Fix bootstrapping ldd after r362152

r362152 started using DF_1_PIE, which is not present in older versions
of sys/elf_common.h. To fix this include the ELF headers as part of -legacy.

3 years agoAllow overriding the tool used for stripping binaries
Alex Richardson [Tue, 11 Aug 2020 16:46:27 +0000 (16:46 +0000)]
Allow overriding the tool used for stripping binaries

Since the make variable STRIP is already used for other purposes, this
uses STRIPBIN (which is also used for the same purpose by install(1).
This allows using LLVM objcopy to strip binaries instead of the in-tree
elftoolchain objcopy. We make use of this in CheriBSD since passing
binaries generated by our toolchain to elftoolchain strip sometimes results
in assertion failures.

This allows working around https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=248516
by specifying STRIPBIN=/path/to/llvm-strip

Obtained from: CheriBSD
Reviewed By: emaste, brooks
Differential Revision: https://reviews.freebsd.org/D25988

3 years agoRemove sys/compat/netbsd.
Mark Johnston [Tue, 11 Aug 2020 16:40:09 +0000 (16:40 +0000)]
Remove sys/compat/netbsd.

It contained only a header used by ncv(4), which was mainly used on pc98
systems.  Both ncv(4) and pc98 support have long been removed.

3 years agoipfw: make the "frag" keyword accept additional options "mf",
Gleb Smirnoff [Tue, 11 Aug 2020 15:46:22 +0000 (15:46 +0000)]
ipfw: make the "frag" keyword accept additional options "mf",
"df", "rf" and "offset".  This allows to match on specific
bits of ip_off field.

For compatibility reasons lack of keyword means "offset".

Reviewed by: ae
Differential Revision: https://reviews.freebsd.org/D26021

3 years agodevfs: rework si_usecount to track opens
Mateusz Guzik [Tue, 11 Aug 2020 14:27:57 +0000 (14:27 +0000)]
devfs: rework si_usecount to track opens

This removes a lot of special casing from the VFS layer.

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

3 years agoscript: Minor cleanups.
Mark Johnston [Tue, 11 Aug 2020 14:19:05 +0000 (14:19 +0000)]
script: Minor cleanups.

- Instead of using isatty() to decide whether to call tcgetattr(), just
  call tcgetattr() directly, since that's all that isatty() does anyway.
- Simplify error handling in termset().  Check for errno != ENOTTY from
  tcgetattr() to handle errors that may be raised while running
  script(1) under a debugger.

PR: 248377
Submitted by: Soumendra Ganguly <soumendraganguly@gmail.com>
MFC after: 1 week

3 years agoUse atomic_clear_rel_long() to implement clear_bit_unlock() in the LinuxKPI
Hans Petter Selasky [Tue, 11 Aug 2020 12:41:40 +0000 (12:41 +0000)]
Use atomic_clear_rel_long() to implement clear_bit_unlock() in the LinuxKPI
after r363842.

Suggested by: alc@
MFC after: 1 week
Sponsored by: Mellanox Technologies

3 years agoNeed to clone the task struct fields related to RCU aswell in the
Hans Petter Selasky [Tue, 11 Aug 2020 12:17:46 +0000 (12:17 +0000)]
Need to clone the task struct fields related to RCU aswell in the
LinuxKPI after r359727. This fixes a minor regression issue. Else the
priority tracking won't work properly when both sleepable and
non-sleepable RCU is in use on the same thread.

Bump the __FreeBSD_version to force recompilation of external kernel
modules.

PR: 242272
MFC after: 1 week
Sponsored by: Mellanox Technologies

3 years agopkgbase: Replace / with | for PKG_WWW
Emmanuel Vadot [Tue, 11 Aug 2020 10:07:59 +0000 (10:07 +0000)]
pkgbase: Replace / with | for PKG_WWW

PKG_WWW contain / char, replace the delimiter by a '|'.

Reported by: 0mp

3 years agopkgbase: Add PKG_NAME_PREFIX, PKG_MAINTAINER and PKG_WWW
Emmanuel Vadot [Tue, 11 Aug 2020 08:42:24 +0000 (08:42 +0000)]
pkgbase: Add PKG_NAME_PREFIX, PKG_MAINTAINER and PKG_WWW

This is useful for downstream users to customize the packages.
Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D26019

3 years agoUse a static initializer for the multicast free tasks.
Hans Petter Selasky [Tue, 11 Aug 2020 08:31:40 +0000 (08:31 +0000)]
Use a static initializer for the multicast free tasks.
This makes the SYSINIT() function updated in r364072 superfluous.

Suggested by: glebius@
MFC after: 1 week
Sponsored by: Mellanox Technologies

3 years agoDo not enter epoch in add_route(), as it is already called in epoch.
Alexander V. Chernikov [Tue, 11 Aug 2020 07:23:07 +0000 (07:23 +0000)]
Do not enter epoch in add_route(), as it is already called in epoch.

Reviewed by: glebius

3 years agoMake <add|del|change>_route() static to finish the transition to the new kpi.
Alexander V. Chernikov [Tue, 11 Aug 2020 07:21:32 +0000 (07:21 +0000)]
Make <add|del|change>_route() static to finish the transition to the new kpi.

Discussed with: glebius

3 years agoFix rib_subscribe() waitok flag by performing allocation outside epoch.
Alexander V. Chernikov [Tue, 11 Aug 2020 07:05:30 +0000 (07:05 +0000)]
Fix rib_subscribe() waitok flag by performing allocation outside epoch.
Make in6_inithead() use rib_subscribe with waitok to achieve reliable
 subscription allocation.

Reviewed by: glebius

3 years agoFix armv{6,7} build after r364088
Li-Wen Hsu [Tue, 11 Aug 2020 05:17:10 +0000 (05:17 +0000)]
Fix armv{6,7} build after r364088

Sponsored by: The FreeBSD Foundation

3 years agoAdd an UPDATING entry for r364092, since it did a version bump.
Rick Macklem [Tue, 11 Aug 2020 02:05:09 +0000 (02:05 +0000)]
Add an UPDATING entry for r364092, since it did a version bump.

3 years agovfs: stricter validation for flags passed to namei in cn_flags
Mateusz Guzik [Tue, 11 Aug 2020 01:34:40 +0000 (01:34 +0000)]
vfs: stricter validation for flags passed to namei in cn_flags

namei de facto expects that the naimeidata object is properly initialized,
but at the same time it mixes consumer-passable and internal flags, while
tolerating this part by explicitly clearing some of them.

Tighten the interface instead.

While here renumber the flags and denote the gap between the 2 variants.

Try to piggy back th renumber on the just bumped __FreeBSD_version.

3 years agofusefs: fix the FUSE_FORGET unit test after r364064
Alan Somers [Tue, 11 Aug 2020 01:09:06 +0000 (01:09 +0000)]
fusefs: fix the FUSE_FORGET unit test after r364064

Thanks to r364064, the name cache now returns a hit where previously it
would miss.  Adjust the expectations accordingly.

PR: 248583
Reported by: lwhsu
MFC with: r364064

3 years agoAdd an argument to newnfs_connect() that indicates use TLS for the connection.
Rick Macklem [Tue, 11 Aug 2020 00:26:45 +0000 (00:26 +0000)]
Add an argument to newnfs_connect() that indicates use TLS for the connection.

For NFSv4.0, the server creates a server->client TCP connection for callbacks.
If the client mount on the server is using TLS, enable TLS for this callback
TCP connection.
TLS connections from clients will not be supported until the kernel RPC
changes are committed.

Since this changes the internal ABI between the NFS kernel modules that
will require a version bump, delete newnfs_trimtrailing(), which is no
longer used.

Since LCL_TLSCB is not yet set, these changes should not have any semantic
affect at this time.

3 years agoExport scandir_b from libc.
Konstantin Belousov [Mon, 10 Aug 2020 21:41:49 +0000 (21:41 +0000)]
Export scandir_b from libc.

Apparently it was not exported, because scandir_b.c was not included
into libc SRCS.  Export it with the CURRENT-13 version.

Also, because it was not exported before ino64, clean up
scandir-compat11.c.

PR: 248572
Reported by: Alex S <iwtcex@gmail.com>
Reviewed by: emaste
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D26020

3 years agoCheck the UMA zone's full bucket cache before short-circuiting an alloc.
Mark Johnston [Mon, 10 Aug 2020 20:34:45 +0000 (20:34 +0000)]
Check the UMA zone's full bucket cache before short-circuiting an alloc.

The global "bucketdisable" flag indicates that we are in a low memory
situation and should avoid allocating buckets.  However, in the
allocation path we were checking it before the full bucket cache and
bailing even if the cache is non-empty.  Defer the check so that we have
a shot at allocating from the cache.

This came up because M_NOWAIT allocations from the buf trie node zone
must always succeed.  In one scenario, all of the preallocated trie
nodes were in the bucket list, and a new slab allocation could not
succeed due to a memory shortage.  The short-circuiting caused an
allocation failure which triggered a panic.

Reported by: pho
Reviewed by: cem
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D25980

3 years agoFix the following issues related to the TCP SYN-cache:
Michael Tuexen [Mon, 10 Aug 2020 20:24:48 +0000 (20:24 +0000)]
Fix the following issues related to the TCP SYN-cache:
* Let the accepted TCP/IPv4 socket inherit the configured TTL and
  TOS value.
* Let the accepted TCP/IPv6 socket inherit the configured Hop Limit.
* Use the configured Hop Limit and Traffic Class when sending
  IPv6 packets.

Reviewed by: rrs, lutz_donnerhacke.de
MFC after: 1 week
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D25909

3 years agoImprove Rockchip's integration of if_dwc
Oleksandr Tymoshenko [Mon, 10 Aug 2020 19:37:06 +0000 (19:37 +0000)]
Improve Rockchip's integration of if_dwc

- Do not rely on U-Boot for clocks configuration, enable and set frequencies
    in the driver's attach method.
- Adjust MAC settings according to detected linespeed on RK3399 and RK3328.
- Add support for RMII PHY mode on RK3328.

Reviewed by: manu
Differential Revision: https://reviews.freebsd.org/D26006

3 years agovfs: drop the hello world stat probes from the vfs provider
Mateusz Guzik [Mon, 10 Aug 2020 18:11:00 +0000 (18:11 +0000)]
vfs: drop the hello world stat probes from the vfs provider

Interested parties can get the same information by hoooking on vop_stat.

3 years agofortune, strfile: Improve validation of command-line arguments.
Mark Johnston [Mon, 10 Aug 2020 17:01:59 +0000 (17:01 +0000)]
fortune, strfile: Improve validation of command-line arguments.

- Avoid potential overflow when parsing a percentage.
- Avoid truncation when copying file paths.

PR: 246050
Submitted by: Akos Somfai <akos.somfai@gmail.com> (original)
MFC after: 1 week

3 years agoFollow-up to r358851 (llvm-project 10.0.0-rc3 import), where I added
Dimitry Andric [Mon, 10 Aug 2020 16:55:54 +0000 (16:55 +0000)]
Follow-up to r358851 (llvm-project 10.0.0-rc3 import), where I added
subdirectories for compiler-rt's internal fuzzer, profile and xray
headers, but forgot to add installing those headers themselves.

MFC after: 3 days

3 years agocache: let SAVESTART passthrough
Mateusz Guzik [Mon, 10 Aug 2020 12:28:56 +0000 (12:28 +0000)]
cache: let SAVESTART passthrough

The flag is only passed for non-LOOKUP ops and those fallback to the slowpath.

3 years agocache: resize struct namecache to a multiply of alignment
Mateusz Guzik [Mon, 10 Aug 2020 12:05:55 +0000 (12:05 +0000)]
cache: resize struct namecache to a multiply of alignment

For example struct namecache on amd64 is 100 bytes, but it has to occupies
104. Use the extra bytes to support longer names.

3 years agocache: remove unused variables from cache_fplookup_parse
Mateusz Guzik [Mon, 10 Aug 2020 11:51:56 +0000 (11:51 +0000)]
cache: remove unused variables from cache_fplookup_parse

3 years agovfs: clean MNTK_FPLOOKUP if MNT_UNION is set
Mateusz Guzik [Mon, 10 Aug 2020 11:51:21 +0000 (11:51 +0000)]
vfs: clean MNTK_FPLOOKUP if MNT_UNION is set

Elides checking it during lookup.

3 years agodevfs: bool -> int
Mateusz Guzik [Mon, 10 Aug 2020 11:46:39 +0000 (11:46 +0000)]
devfs: bool -> int

Fixes buildworld after r364069

3 years agoMC: add a note with reference to the discussion and history as-to why we
Bjoern A. Zeeb [Mon, 10 Aug 2020 10:58:43 +0000 (10:58 +0000)]
MC: add a note with reference to the discussion and history as-to why we
are where we are now.  The main thing is to try to get rid of the delayed
freeing to avoid blocking on the taskq when shutting down vnets.

X-Timeout: if you still see this before 14-RELEASE remove it.

3 years agoMake sure the multicast release tasks are properly drained when
Hans Petter Selasky [Mon, 10 Aug 2020 10:46:08 +0000 (10:46 +0000)]
Make sure the multicast release tasks are properly drained when
destroying a VNET or a network interface.

Else the inm release tasks, both IPv4 and IPv6 may cause a panic
accessing a freed VNET or network interface.

Reviewed by: jmg@
Discussed with: bz@
Differential Revision: https://reviews.freebsd.org/D24914
MFC after: 1 week
Sponsored by: Mellanox Technologies

3 years agoUse proper prototype for SYSINIT() functions.
Hans Petter Selasky [Mon, 10 Aug 2020 10:40:19 +0000 (10:40 +0000)]
Use proper prototype for SYSINIT() functions.
Mark the unused argument using the __unused macro.

Discussed with: kib@
MFC after: 1 week
Sponsored by: Mellanox Technologies

3 years agocache: strlcpy -> memcpy
Mateusz Guzik [Mon, 10 Aug 2020 10:40:14 +0000 (10:40 +0000)]
cache: strlcpy -> memcpy

3 years agovfs: garbage collect unused ISUNICODE namei flag
Mateusz Guzik [Mon, 10 Aug 2020 10:37:16 +0000 (10:37 +0000)]
vfs: garbage collect unused ISUNICODE namei flag

3 years agodevfs: save on spurious relocking for devfs_populate
Mateusz Guzik [Mon, 10 Aug 2020 10:36:43 +0000 (10:36 +0000)]
devfs: save on spurious relocking for devfs_populate

Tested by: pho

3 years agodevfs: use cheaper lockmgr entry points
Mateusz Guzik [Mon, 10 Aug 2020 10:36:10 +0000 (10:36 +0000)]
devfs: use cheaper lockmgr entry points

Tested by: pho

3 years agodevfs: use vget_prep/vget_finish
Mateusz Guzik [Mon, 10 Aug 2020 10:35:47 +0000 (10:35 +0000)]
devfs: use vget_prep/vget_finish

Tested by: pho

3 years agovfs: partially support file create/delete/rename in lockless lookup
Mateusz Guzik [Mon, 10 Aug 2020 10:35:18 +0000 (10:35 +0000)]
vfs: partially support file create/delete/rename in lockless lookup

Perform the lookup until the last 2 elements and fallback to slowpath.

Tested by: pho
Sponsored by: The FreeBSD Foundation

3 years agovfs: drop the thread argumemnt from vfs_fplookup_vexec
Mateusz Guzik [Mon, 10 Aug 2020 10:34:22 +0000 (10:34 +0000)]
vfs: drop the thread argumemnt from vfs_fplookup_vexec

It is guaranteed curthread.

Tested by: pho
Sponsored by: The FreeBSD Foundation

3 years agovfs: disallow NOCACHE with LOOKUP
Mateusz Guzik [Mon, 10 Aug 2020 10:33:40 +0000 (10:33 +0000)]
vfs: disallow NOCACHE with LOOKUP

This means there is no expectation lookup will purge the terminal entry,
which simplifies lockless lookup.

Tested by: pho
Sponsored by: The FreeBSD Foundation

3 years agonullfs: add missing VOP_STAT handling
Mateusz Guzik [Mon, 10 Aug 2020 10:31:17 +0000 (10:31 +0000)]
nullfs: add missing VOP_STAT handling

Tested by: pho

3 years agoDocument the order in which the kernel and the user environment versions
Alexey Dokuchaev [Mon, 10 Aug 2020 09:03:29 +0000 (09:03 +0000)]
Document the order in which the kernel and the user environment versions
are printed when both -K and -U options are passed on the command line.

Approved by: 0mp
Differential Revision: https://reviews.freebsd.org/D25970

3 years agoMove ifconfig SFP status functionality into libifconfig
Ryan Moeller [Sun, 9 Aug 2020 16:27:28 +0000 (16:27 +0000)]
Move ifconfig SFP status functionality into libifconfig

libifconfig_sfp.h provides an API in libifconfig for querying SFP module
properties, operational status, and vendor strings, as well as descriptions
of the various fields, string conversions, and other useful helpers for
implementing user interfaces.

SFP module status is obtained by reading registers via an I2C interface.
Descriptions of these registers and the values therein have been collected
in a Lua table which is used to generate all the boilerplace C headers and
source files for accessing these values, their names, and descriptions.
The generated code is fully commented and readable.

This is the first use of libifconfig in ifconfig itself.  For now, the
scope remains very limited.  Over time, more of ifconfig will be replaced
with libifconfig.

Some minor changes to the formatting of ifconfig output have been made:
- Module memory hex dumps are indented one extra space as a result of using
hexdump(3) instead of a bespoke hex dump function.
- Media descriptions have an added two-character short-name in parenthesis.
- QSFP modules were incorrectly displaying TX bias current as power.  Now
  TX channels display bias current, and this change has been made for both
  SFP and QSFP modules for consistency.

A Lua binding for libifconfig including this functionality is implemented
but has not been included in this commit.  The plan is for it to be
committed after dynamic module loading has been enabled in flua.

Reviewed by: kp, melifaro
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D25494

3 years agoCorrect date for Nagasaki bombing.
Greg Lehey [Sun, 9 Aug 2020 00:35:47 +0000 (00:35 +0000)]
Correct date for Nagasaki bombing.

3 years agoRemove incorrect duplicate.
Greg Lehey [Sun, 9 Aug 2020 00:34:35 +0000 (00:34 +0000)]
Remove incorrect duplicate.

3 years agoMention the new implementation of bc and dc which has become the default
Stefan Eßer [Sat, 8 Aug 2020 19:48:15 +0000 (19:48 +0000)]
Mention the new implementation of bc and dc which has become the default
version in FreeBSD-CURRENT.

3 years agoImprove the ECN negotiation when the TCP SYN-cache is used by making
Michael Tuexen [Sat, 8 Aug 2020 19:39:38 +0000 (19:39 +0000)]
Improve the ECN negotiation when the TCP SYN-cache is used by making
sure that
* ECN is disabled if the client sends an non-ECN-setup SYN segment.
* ECN is disabled is the ECN-setup SYN-ACK segment is retransmitted more
  than net.inet.tcp.ecn.maxretries times.

Reviewed by: rscheff
MFC after: 1 week
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D26008

3 years agorelease: RPI3: Add the RPI2 DTB
Emmanuel Vadot [Sat, 8 Aug 2020 16:56:20 +0000 (16:56 +0000)]
release: RPI3: Add the RPI2 DTB

The RPI2 v1.2 is using the same SoC as the RPI3 so it can boot this image
but needs the RPI2 dtb.

MFC after: 3 days

3 years agoUse static inline for iface_{setup,delete}_addr in tests/sys/net/routing.
Dimitry Andric [Sat, 8 Aug 2020 11:06:27 +0000 (11:06 +0000)]
Use static inline for iface_{setup,delete}_addr in tests/sys/net/routing.

This fixes possible link errors, similar to:

ld: error: undefined symbol: iface_setup_addr
>>> referenced by test_rtsock_l3.c:111 (tests/sys/net/routing/test_rtsock_l3.c:111)
>>>               test_rtsock_l3.o:(presetup_ipv4)
>>> referenced by test_rtsock_l3.c:79 (tests/sys/net/routing/test_rtsock_l3.c:79)
>>>               test_rtsock_l3.o:(presetup_ipv6)
>>> referenced by test_rtsock_l3.c:512 (tests/sys/net/routing/test_rtsock_l3.c:512)
>>>               test_rtsock_l3.o:(atfu_rtm_change_v4_gw_success_body)
>>> referenced 10 more times

In C (not C++), 'naked' inline is almost always a mistake. Either use
static inline (this is appropriate for most cases), or extern inline.

MFC after: 3 days

3 years agoFix i386 build of chpass after r363992
Alex Richardson [Sat, 8 Aug 2020 10:05:27 +0000 (10:05 +0000)]
Fix i386 build of chpass after r363992

My change to allow bootstrapping pwd_mkdb (r363992) resulted in i386 build
failures because the bootstrap header was being included in non-bootstrap chpass.
Dropping the no longer required pwd_mkdb include path from chpass fixes
the build, but to be certain that the failure doesn't get re-introduced,
I've also moved the bootstrap pwd.h into a subdirectory so that adding
-I${SRCTOP}/usr.sbin/pwd_mkdb doesn't pull it in.

Reported by: mjg

3 years agoufs: add VOP_STAT handler
Mateusz Guzik [Fri, 7 Aug 2020 23:08:17 +0000 (23:08 +0000)]
ufs: add VOP_STAT handler

3 years agotmpfs: add VOP_STAT handler
Mateusz Guzik [Fri, 7 Aug 2020 23:07:47 +0000 (23:07 +0000)]
tmpfs: add VOP_STAT handler

3 years agovfs: add VOP_STAT
Mateusz Guzik [Fri, 7 Aug 2020 23:06:40 +0000 (23:06 +0000)]
vfs: add VOP_STAT

The current scheme of calling VOP_GETATTR adds avoidable overhead.

An example with tmpfs doing fstat (ops/s):
before: 7488958
after:  7913833

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

3 years agommc_da: fix memory leak in sddaregister()
Bjoern A. Zeeb [Fri, 7 Aug 2020 19:58:16 +0000 (19:58 +0000)]
mmc_da: fix memory leak in sddaregister()

In case we are failing to allocate mmcdata, we are returning with
a softc allocated but not attached to anything and thus leak the
memory.

Reviewed by: scottl
MFC after: 2 weeks
X-MFC: only if we also mfc other mmccam changes?
Differential Revision: https://reviews.freebsd.org/D25987

3 years agovfs: release the interlock after failing to set VHOLD_NO_SMR
Mateusz Guzik [Fri, 7 Aug 2020 19:36:08 +0000 (19:36 +0000)]
vfs: release the interlock after failing to set VHOLD_NO_SMR

While here add more comments.

Diagnosed by: markj
Reported by: pho
Fixes: r362827 ("vfs: protect vnodes with smr")

3 years agoFix clang 11 inline asm constraint error when building powerpc GENERIC64
Dimitry Andric [Fri, 7 Aug 2020 19:32:54 +0000 (19:32 +0000)]
Fix clang 11 inline asm constraint error when building powerpc GENERIC64
kernels:

sys/powerpc/aim/mmu_radix.c:728:19: error: invalid operand for inline asm constraint 'i'
        __asm __volatile(PPC_TLBIEL(%0, %1, %2, %3, 1)
                         ^
sys/powerpc/aim/mmu_radix.c:149:3: note: expanded from macro 'PPC_TLBIEL'
         __XSTRING(.long PPC_INST_TLBIEL | \
         ^
sys/sys/cdefs.h:161:22: note: expanded from macro '__XSTRING'
#define __XSTRING(x)    __STRING(x)     /* expand x, then stringify */
                        ^
sys/sys/cdefs.h:160:21: note: expanded from macro '__STRING'
#define __STRING(x)     #x              /* stringify without expanding x */
                        ^
<scratch space>:112:1: note: expanded from here
".long 0x7c000224 | (((%0) & 0x1f) << 11) | (((%1) & 0x1f) << 21) | (((%2) & 0x3) << 18) | (((%3) & 0x1) << 17) | (((1) & 0x1) << 16)"
^

This is solved by making the affected inline functions __always_inline.

Suggested by: jhibbits
MFC after: 3 days

3 years agoscript: Put the terminal in raw mode when playing back a session.
Mark Johnston [Fri, 7 Aug 2020 18:48:56 +0000 (18:48 +0000)]
script: Put the terminal in raw mode when playing back a session.

Otherwise recorded sessions of some interactive programs do not play
back properly.

PR: 248377
Submitted by: Soumendra Ganguly <0.gangzta@gmail.com>
MFC after: 1 week

3 years agoEnable hw.pci.enable_aspm tunable by default.
Alexander Motin [Fri, 7 Aug 2020 18:40:56 +0000 (18:40 +0000)]
Enable hw.pci.enable_aspm tunable by default.

While effects on power saving is only a guess, effects on hot-plug are
clearly visible.  Lets try to enable it and see what happen.

MFC after: 3 months

3 years agoAdd some more checks to make APEI driver more robust.
Alexander Motin [Fri, 7 Aug 2020 18:38:10 +0000 (18:38 +0000)]
Add some more checks to make APEI driver more robust.

MFC after: 5 days

3 years agoRemove obsolete part of comment. It was cut and pasted from the old version of
Warner Losh [Fri, 7 Aug 2020 18:21:48 +0000 (18:21 +0000)]
Remove obsolete part of comment. It was cut and pasted from the old version of
this function, and was never relevant to the new version.