]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
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.

3 years agosetlocale(3): Add an EXAMPLES section and add LANG category
Gordon Bergling [Fri, 7 Aug 2020 17:25:56 +0000 (17:25 +0000)]
setlocale(3): Add an EXAMPLES section and add LANG category

PR: 41824
Submitted by: Slaven Rezic <eserte atvran dot herceg dot de>
Obtained from: NetBSD
MFC after: 1 week

3 years agombsrtowcs(3): Clarify the RETURN VALUES section
Gordon Bergling [Fri, 7 Aug 2020 16:56:43 +0000 (16:56 +0000)]
mbsrtowcs(3): Clarify the RETURN VALUES section

PR: 215848
Submitted by: Andrew Stevenson <andrew at ugh dot net dot au>
MFC after: 1 week

3 years agoThe practice of creating symbolic links is somewhat fragile. Always
Warner Losh [Fri, 7 Aug 2020 16:26:56 +0000 (16:26 +0000)]
The practice of creating symbolic links is somewhat fragile. Always
make copies instead.

There's too many times that we can't run the new binaries with old
libraries. Making the links when things are known to be 'safe' is a
nice optimization, but a copy of all the binaries is only 30MB, so
saving the copies at the cost of increased support when new symbols
are added and used as part of the bootstrap seems to be unwise.

There may be additional optimizations possible here, especially for
!FreeBSD hosts. However, that's beyond the scope of the problem I'm
trying to fix with make failing mid-way through an installworld across
change r363679. This optimization there caused us to run a new binary
with an old library once a new make was installed due to the symbolic
link. One could just copy make, but then other binaries fail as well,
so rather than play whack-a-mole, I opted to take us back to the old
way.  Before r340157 or so we did copies (thogh of a lot fewer
artifacts), and we didn't have issues like this.

Reviewed by: arichards@
Differential Revision: https://reviews.freebsd.org/D25967

3 years agotmpnam(3): Also mention tmpfile in the ENVIRONMENT section
Gordon Bergling [Fri, 7 Aug 2020 16:20:07 +0000 (16:20 +0000)]
tmpnam(3): Also mention tmpfile in the ENVIRONMENT section

PR: 181785
Submitted by: Kevin P. Neal <kpneal atpobox dot com>
MFC after: 1 week

3 years agoImplement radix_tree_store() in the LinuxKPI for use with the coming
Hans Petter Selasky [Fri, 7 Aug 2020 16:15:44 +0000 (16:15 +0000)]
Implement radix_tree_store() in the LinuxKPI for use with the coming
extensible arrays implementation.

While at it add some more comments explaining the current
radix_tree_insert() function and make sure to clean the root node when
the radix tree reaches the maximum height. This can happen if the
index passed is too big when the tree is empty.

The radix_tree_store() function is basically a copy of the
radix_tree_insert() function with some added functionality.

The radix_tree_store() function is local to FreeBSD and does not yet
exist in Linux.

Reviewed by: kib
MFC after: 1 week
Sponsored by: Mellanox Technologies

3 years agoFix linker error in libuutil with recent LLVM
Alex Richardson [Fri, 7 Aug 2020 16:04:21 +0000 (16:04 +0000)]
Fix linker error in libuutil with recent LLVM

Not marking the function as static can result in a linker error:
undefined reference to __assfail [--no-allow-shlib-undefined]
I noticed this error after updating our CHERI LLVM to the latest upstream
LLVM HEAD revision.

This change effectively reverts r329984 and marks dmu_buf_init_user as
static (which keeps the GCC build happy).

Reviewed By: #zfs, asomers, freqlabs, mav
Differential Revision: https://reviews.freebsd.org/D25663

3 years agoFix duplicate assignment of _localedef in Makefile.inc1
Alex Richardson [Fri, 7 Aug 2020 16:04:15 +0000 (16:04 +0000)]
Fix duplicate assignment of _localedef in Makefile.inc1

The same .if exists a few lines below.

3 years agoDon't link against libdialog/ncurses when bootstrapping tzsetup
Alex Richardson [Fri, 7 Aug 2020 16:04:10 +0000 (16:04 +0000)]
Don't link against libdialog/ncurses when bootstrapping tzsetup

3 years agomakefs: Drop unnecessary sys/clock.h include
Alex Richardson [Fri, 7 Aug 2020 16:04:06 +0000 (16:04 +0000)]
makefs: Drop unnecessary sys/clock.h include

This breaks the build on macOS where this header doesn't exist. I could
also add a compat header to tools/build/cross-build but since it's not
needed removing it seems like the better solution.

3 years agoAlways install usr.bin/grep as grep when bootstrapping
Alex Richardson [Fri, 7 Aug 2020 16:04:01 +0000 (16:04 +0000)]
Always install usr.bin/grep as grep when bootstrapping

We have to bootstrap grep when cross-building from macOS/Linux.

3 years agoFix cddl tools bootstrapping on macOS and Linux
Alex Richardson [Fri, 7 Aug 2020 16:03:55 +0000 (16:03 +0000)]
Fix cddl tools bootstrapping on macOS and Linux

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

3 years agogrep(1): correct typos for 'if a name patches' to 'if a name matches'
Gordon Bergling [Fri, 7 Aug 2020 16:01:05 +0000 (16:01 +0000)]
grep(1): correct typos for 'if a name patches' to 'if a name matches'

PR: 237635
Submitted by: durin42 <raf atdurin42 dot com>
Reviewed by: kevans
Approved by: kevans
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D25994

3 years agoAdd full support support for dynamic allocation and freeing of epoch's.
Hans Petter Selasky [Fri, 7 Aug 2020 15:32:42 +0000 (15:32 +0000)]
Add full support support for dynamic allocation and freeing of epoch's.

Make sure to reclaim epoch structures when they are freed to support
dynamic allocation and freeing of epoch structures.

While at it, move the 64 supported epoch control structures to the
static memory domain. This overall simplifies the management and
debugging of system epoch's.

Reviewed by: kib, markj
Differential Revision: https://reviews.freebsd.org/D25960
MFC after: 1 week
Sponsored by: Mellanox Technologies

3 years agoIPV6_PKTINFO support for v4-mapped IPv6 sockets
Bjoern A. Zeeb [Fri, 7 Aug 2020 15:13:53 +0000 (15:13 +0000)]
IPV6_PKTINFO support for v4-mapped IPv6 sockets

When using v4-mapped IPv6 sockets with IPV6_PKTINFO we do not
respect the given v4-mapped src address on the IPv4 socket.
Implement the needed functionality. This allows single-socket
UDP applications (such as OpenVPN) to work better on FreeBSD.

Requested by: Gert Doering (gert greenie.net), pfsense
Tested by: Gert Doering (gert greenie.net)
Reviewed by: melifaro
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D24135

3 years agoAllow ACPI APEI driver build without PCI.
Alexander Motin [Fri, 7 Aug 2020 13:35:34 +0000 (13:35 +0000)]
Allow ACPI APEI driver build without PCI.

On x86 it seems difficult to build ACPI without PCI, but some aarch64
users appears to be doing it.

MFC after: 3 days

3 years agolib80211: fix indentation of comments for some netbands.
Bjoern A. Zeeb [Fri, 7 Aug 2020 12:47:00 +0000 (12:47 +0000)]
lib80211: fix indentation of comments for some netbands.

Whitespace only; no functional changes.

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

3 years agonet80211/ifconfig: print hardware device name for wlan interfaces
Bjoern A. Zeeb [Fri, 7 Aug 2020 12:24:23 +0000 (12:24 +0000)]
net80211/ifconfig: print hardware device name for wlan interfaces

Add IEEE80211_IOC_IC_NAME to query the ic_name field and in ifconfig
to print the parent interface again. This functionality was lost
around r287197. It helps in case of multiple wlan interfaces and
multiple underlying hardware devices to keep track which wlan
interface belongs to which physical device.

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

3 years agopkgbase: We can't easily have a package with either a - or a _
Emmanuel Vadot [Fri, 7 Aug 2020 12:19:21 +0000 (12:19 +0000)]
pkgbase: We can't easily have a package with either a - or a _

Rename iscsi_legacy to iscsilegacy, having - or _ in a package name cause
problems when we process them and generate the ucl.

3 years agopkgbase: Fix dependancies
Emmanuel Vadot [Fri, 7 Aug 2020 10:20:39 +0000 (10:20 +0000)]
pkgbase: Fix dependancies

The package name is converted with _ instead of - as we have some variables
that cannot contain -
Convert back the dependancies with - instead of _

3 years agoAdd a .Pp to separate description and sample code for readability.
Li-Wen Hsu [Fri, 7 Aug 2020 08:57:31 +0000 (08:57 +0000)]
Add a .Pp to separate description and sample code for readability.

3 years agotelnet(1): Document -P option
Gordon Bergling [Fri, 7 Aug 2020 08:41:14 +0000 (08:41 +0000)]
telnet(1): Document -P option

PR: 248157
Submitted by: Juraj Lutter <juraj at lutter dot sk>
Reviewed by: bcr
Approved by: bcr
Obtained from: NetBSD
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D25794

3 years agoAll the other printf() calls cast to (void) here, do the two newer ones for
Warner Losh [Fri, 7 Aug 2020 02:48:19 +0000 (02:48 +0000)]
All the other printf() calls cast to (void) here, do the two newer ones for
consistency.

3 years agoiflib: netmap: drop redundant check
Vincenzo Maffione [Thu, 6 Aug 2020 21:37:38 +0000 (21:37 +0000)]
iflib: netmap: drop redundant check

The validity of head is already checked by nm_rxsync_prologue().

MFC after: 2 weeks

3 years agoiflib: netmap: don't increment ifl_cidx on the wrong free list
Vincenzo Maffione [Thu, 6 Aug 2020 21:32:25 +0000 (21:32 +0000)]
iflib: netmap: don't increment ifl_cidx on the wrong free list

Netmap only uses free list 0 to keep it consistent with its
one-to-one mapping between each netmap ring and a device RX
(or TX) queue.
However, the current iflib_netmap_rxsync() routine was
mistakenly updating the ifl_cidx field of both free lists.

PR: 248494
MFC after: 2 weeks

3 years agoem(4): honor vlanhwtag offload
Vincenzo Maffione [Thu, 6 Aug 2020 21:01:26 +0000 (21:01 +0000)]
em(4): honor vlanhwtag offload

The FreeBSD em driver fails to properly reset the VME flag
in the e1000 CTRL register oneg the following ifconfig command

ifconfig em1 -vlanhwtag

Tested on the e1000 device emulated by QEMU, and on a real
NIC (chip=0x10d38086).

PR: 236584
Submitted by:  murat@sunnyvalley.io
Reported by:  murat@sunnyvalley.io
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D25286

3 years agostand: use portable ln -n instead of ln -h
Alex Richardson [Thu, 6 Aug 2020 20:46:18 +0000 (20:46 +0000)]
stand: use portable ln -n instead of ln -h

This fixes the build on Linux

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

3 years agoAllow bootstrapping pwd_mkdb on Linux/macOS
Alex Richardson [Thu, 6 Aug 2020 20:46:13 +0000 (20:46 +0000)]
Allow bootstrapping pwd_mkdb on Linux/macOS

We need to provide a struct passwd that is compatible with the target
system and this is not the case when cross-building from macOS/Linux.
It should also be a problem when bootstrapping for an i386 target from a
FreeBSD amd64 host since time_t does not match across those systems.
However, pwd_mkdb always truncates integer values to 32-bit so this
difference does not result in different databases.

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

3 years agoctfmerge: Fix missing pthread_cond_init()
Alex Richardson [Thu, 6 Aug 2020 20:44:40 +0000 (20:44 +0000)]
ctfmerge: Fix missing pthread_cond_init()

This does not appear to matter on FreeBSD or Linux, but when building an
amd64 kernel on macOS I was seeing infinite loops in ctfmerge.
It turns out the loop in wip_save_work() was looping forever due to
pthread_cond_wait() always returning -EINVAL.

Reviewed By: markj, brooks
Differential Revision: https://reviews.freebsd.org/D25973

3 years agoFix clang 11 -Wformat warnings in yp_mkdb:
Dimitry Andric [Thu, 6 Aug 2020 20:31:50 +0000 (20:31 +0000)]
Fix clang 11 -Wformat warnings in yp_mkdb:

usr.sbin/yp_mkdb/yp_mkdb.c:91:40: error: format specifies type 'char *' but the argument has type 'void *' [-Werror,-Wformat]
                printf("%.*s %.*s\n", (int)key.size, key.data, (int)data.size,
                        ~~~~                         ^~~~~~~~
usr.sbin/yp_mkdb/yp_mkdb.c:92:7: error: format specifies type 'char *' but the argument has type 'void *' [-Werror,-Wformat]
                    data.data);
                    ^~~~~~~~~

MFC after: 3 days

3 years agoAdd CTL support for REPORT IDENTIFYING INFORMATION command.
Alexander Motin [Thu, 6 Aug 2020 19:16:11 +0000 (19:16 +0000)]
Add CTL support for REPORT IDENTIFYING INFORMATION command.

It allows to report to initiator LU identifying information, preset via
"ident_info" and "text_ident_info" options.

Unfortunately it is impossible to implement SET IDENTIFYING INFORMATION,
since we have no persistent storage it requires, so the information is
read-only for initiator and has to be set out-of-band.

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

3 years ago[POWERPC] Fix ppc64 makecontext() parameter overflow handling.
Brandon Bergren [Thu, 6 Aug 2020 17:49:19 +0000 (17:49 +0000)]
[POWERPC] Fix ppc64 makecontext() parameter overflow handling.

On ELFv2, the overflow parameters in the stack frame are at a different offset
from sp than ELFv1. Adjust code to use the correct offset in all cases.

This had resulted in argv[8] and up being copied to the incorrect address
in the new context's initial stack frame.

This is not necessarily the only bug in this function, I need to do a full
review still and ensure the rest of the math is sane for ELFv2 stack frames.

Reported by: pherde (Probably. My notes are a bit unclear.)
Reviewed by: jhibbits (in irc)
Sponsored by: Tag1 Consulting, Inc.

3 years agoPreserve ASLR vm_map flags across fork
Brooks Davis [Thu, 6 Aug 2020 16:20:20 +0000 (16:20 +0000)]
Preserve ASLR vm_map flags across fork

In the most common case (fork+execve) this doesn't matter, but further
attempts to apply entropy would fail in (e.g.) a pre-fork server.

Reported by: Alfredo Mazzinghi
Reviewed by: kib, markj
Obtained from: CheriBSD
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D25966

3 years agopkgbase: Add the possibility to choose the output dir
Emmanuel Vadot [Thu, 6 Aug 2020 16:14:43 +0000 (16:14 +0000)]
pkgbase: Add the possibility to choose the output dir

The output dir is set to ${REPODIR}/${PKG_ABI}/${PKG_VERSION} now.
Add the possibility to specify the last componant and set it by default
to ${PKG_VERSION} as before.
This is useful for tests and also for building packages with the same
PKG_VERSION provided to check differences.

3 years agopkgbase: Add a new variable PKG_TIMESTAMP
Emmanuel Vadot [Thu, 6 Aug 2020 16:13:54 +0000 (16:13 +0000)]
pkgbase: Add a new variable PKG_TIMESTAMP

libarchive uses the SOURCE_DATE_EPOCH env variable to set the date of file
in an archive, this is useful for reproducibility.
Add a variable name PKG_TIMESTAMP that take a epoch time and set SOURCE_DATE_EPOCH
to this. By default it is the current time so no changes here.

3 years agopkgbase: Remove vcs revision from kernel and runtime comment
Emmanuel Vadot [Thu, 6 Aug 2020 16:11:30 +0000 (16:11 +0000)]
pkgbase: Remove vcs revision from kernel and runtime comment

This is not needed and we don't do that for other packages.

3 years agoClean up reassignbuf() and buf_vlist_remove() a bit.
Mark Johnston [Thu, 6 Aug 2020 15:43:15 +0000 (15:43 +0000)]
Clean up reassignbuf() and buf_vlist_remove() a bit.

- Convert panic() calls to INVARIANTS-only assertions.  The PCTRIE code
  provides some of the same protection since it will panic upon an
  attempt to remove a non-resident buffer.
- Update the comment above reassignbuf() to reflect reality.

Reviewed by: cem, kib, mjg
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D25965

3 years agoRemove the vfs.reassignbufcalls counter and sysctl.
Mark Johnston [Thu, 6 Aug 2020 15:42:59 +0000 (15:42 +0000)]
Remove the vfs.reassignbufcalls counter and sysctl.

As the 20-year old comment above it suggests, the counter is of dubious
value.  Moreover, the (global) counter was not updated precisely and
hurts scalability.

Reviewed by: cem, kib, mjg
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D25965

3 years agoAdd Intel Apollo Lake AHCI ID.
Alexander Motin [Thu, 6 Aug 2020 15:17:44 +0000 (15:17 +0000)]
Add Intel Apollo Lake AHCI ID.

Submitted by: Dmitry Luhtionov <dmitryluhtionov@gmail.com>
MFC after: 1 week

3 years agocp2112: driver for the namesake GPIO and I2C master gadget
Andriy Gapon [Thu, 6 Aug 2020 13:41:42 +0000 (13:41 +0000)]
cp2112: driver for the namesake GPIO and I2C master gadget

Documentation:
- CP2112 Datasheet
  https://www.silabs.com/documents/public/data-sheets/cp2112-datasheet.pdf
- AN495: CP2112 Interface Specification
  https://www.silabs.com/documents/public/application-notes/an495-cp2112-interface-specification.pdf
- CP2112 Errata
  https://www.silabs.com/documents/public/errata/cp2112-errata.pdf

The logic is implemented as three sub-drivers.
The parent driver claims the USB device and creates two child devices.
One acts as a GPIO controller and the other is an I2C controller.

Tested with CP2112 revision F02.
Both features seem to work.
HTU21 sensor was used as an I2C slave.

Reviewed by: adrian, hselasky
MFC after: 2 weeks
Relnotes: maybe
Differential Revision: https://reviews.freebsd.org/D25359

3 years agoAdd new USB ID.
Hans Petter Selasky [Thu, 6 Aug 2020 13:25:04 +0000 (13:25 +0000)]
Add new USB ID.

Submitted by: Dmitry Luhtionov <dmitryluhtionov@gmail.com>
MFC after: 1 week
Sponsored by: Mellanox Technologies

3 years agoMove dmar_domain_unload_task to busdma_iommu.c.
Ruslan Bukin [Thu, 6 Aug 2020 12:49:25 +0000 (12:49 +0000)]
Move dmar_domain_unload_task to busdma_iommu.c.

Reviewed by: kib
Sponsored by: DARPA/AFRL
Differential Revision: https://reviews.freebsd.org/D25972

3 years agoccu_sun8i_r: minor comment update
Andriy Gapon [Thu, 6 Aug 2020 11:18:06 +0000 (11:18 +0000)]
ccu_sun8i_r: minor comment update

MFC after: 1 week

3 years agoAdd iommu_domain constructor and destructor.
Ruslan Bukin [Thu, 6 Aug 2020 08:48:23 +0000 (08:48 +0000)]
Add iommu_domain constructor and destructor.

Reviewed by: kib
Sponsored by: DARPA/AFRL
Differential Revision: https://reviews.freebsd.org/D25956

3 years agommccam: Unhold the periph when we add the device
Emmanuel Vadot [Thu, 6 Aug 2020 08:21:33 +0000 (08:21 +0000)]
mmccam: Unhold the periph when we add the device

Otherwise the device node aren't created.

Pointy hat to:      manu
Reported by: bz

3 years agocache: add more predicts for failing conditions
Mateusz Guzik [Thu, 6 Aug 2020 04:20:14 +0000 (04:20 +0000)]
cache: add more predicts for failing conditions

3 years agocache: plug unititalized variable use
Mateusz Guzik [Thu, 6 Aug 2020 04:19:47 +0000 (04:19 +0000)]
cache: plug unititalized variable use

CID: 1431128

3 years agomac: even up all entry points to the same scheme
Mateusz Guzik [Thu, 6 Aug 2020 00:23:06 +0000 (00:23 +0000)]
mac: even up all entry points to the same scheme

- use a macro for checking whether the site is enabled
- expand it to 0 if mac is not compiled in to begin with

3 years agoarm64: fix uintfptr_t
Mateusz Guzik [Wed, 5 Aug 2020 22:09:57 +0000 (22:09 +0000)]
arm64: fix uintfptr_t

Fixes compilation after r363932

3 years agoriscv: fix uintfptr_t
Mateusz Guzik [Wed, 5 Aug 2020 22:09:40 +0000 (22:09 +0000)]
riscv: fix uintfptr_t

Fixes compilation after r363932

3 years agopmcstat: fix build on non-64 bit platforms
Mateusz Guzik [Wed, 5 Aug 2020 20:42:08 +0000 (20:42 +0000)]
pmcstat: fix build on non-64 bit platforms

3 years agovfs hash: annotate the lock with __exclusive_cache_line
Mateusz Guzik [Wed, 5 Aug 2020 19:34:13 +0000 (19:34 +0000)]
vfs hash: annotate the lock with __exclusive_cache_line

Note the code does not scale in the current form.

3 years agopipe: reduce atime precision
Mateusz Guzik [Wed, 5 Aug 2020 19:15:59 +0000 (19:15 +0000)]
pipe: reduce atime precision

The routine is called on successful write and read, which on pipes happens a
lot and for small sizes.

Precision provided by default seems way bigger than necessary and it causes
problems in vms on amd64 (it rdtscp's which vmexits). getnanotime seems to
provide the level roughly in lines of Linux so we should be good here.

Sample result from will-it-scale pipe1_processes -t 1 (ops/s):
before: 426464
after: 3247421

Note the that atime handling for named pipes is broken with and without the
patch. The filesystem code is never used for updating atime and never looks
at the updated field. Consequently, while there are no provisions added to
handle named pipes separately, the change is a nop for that case.

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

3 years agoo Add machine/iommu.h and include MD iommu headers from it,
Ruslan Bukin [Wed, 5 Aug 2020 19:11:31 +0000 (19:11 +0000)]
o Add machine/iommu.h and include MD iommu headers from it,
  so we don't ifdef for every arch in busdma_iommu.c;
o No need to include specialreg.h for x86, remove it.

Requested by: andrew
Reviewed by: kib
Sponsored by: DARPA/AFRL
Differential Revision: https://reviews.freebsd.org/D25957

3 years agopmcstat: implement showing offsets into symbols in top mode
Mateusz Guzik [Wed, 5 Aug 2020 19:05:49 +0000 (19:05 +0000)]
pmcstat: implement showing offsets into symbols in top mode

The -I option (and hotkey) is reused for this. Skipping symbol resolution is
moved to the new -A option (and hotkey).

While arguably this violates POLA I think it's a change for the better.
ALso note the -I option was added in head.

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

3 years agoAdd clocks for ethernet controllers on RK3328
Oleksandr Tymoshenko [Wed, 5 Aug 2020 18:22:24 +0000 (18:22 +0000)]
Add clocks for ethernet controllers on RK3328

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