]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
3 years agonetmap: tools: fix several compiler warnings
vmaffione [Sat, 3 Oct 2020 13:19:48 +0000 (13:19 +0000)]
netmap: tools: fix several compiler warnings

MFC after: 1 week

3 years agoOptimize riscv's cpu_fetch_syscall_args(), making it possible
trasz [Sat, 3 Oct 2020 13:01:07 +0000 (13:01 +0000)]
Optimize riscv's cpu_fetch_syscall_args(), making it possible
for the compiler to inline the memcpy.

Reviewed by: arichardson, mhorne
MFC after: 2 weeks
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D26528

3 years agoMove KTRUSERRET() from userret() to ast(). It's a really long
trasz [Sat, 3 Oct 2020 12:03:08 +0000 (12:03 +0000)]
Move KTRUSERRET() from userret() to ast().  It's a really long
detour - it writes ktrace entries to the filesystem - so the overhead
of ast() won't make any difference.

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

3 years agoIntroduce scalable route multipath.
melifaro [Sat, 3 Oct 2020 10:47:17 +0000 (10:47 +0000)]
Introduce scalable route multipath.

This change is based on the nexthop objects landed in D24232.

The change introduces the concept of nexthop groups.
Each group contains the collection of nexthops with their
 relative weights and a dataplane-optimized structure to enable
 efficient nexthop selection.

Simular to the nexthops, nexthop groups are immutable. Dataplane part
 gets compiled during group creation and is basically an array of
 nexthop pointers, compiled w.r.t their weights.

With this change, `rt_nhop` field of `struct rtentry` contains either
 nexthop or nexthop group. They are distinguished by the presense of
 NHF_MULTIPATH flag.
All dataplane lookup functions returns pointer to the nexthop object,
leaving nexhop groups details inside routing subsystem.

User-visible changes:

The change is intended to be backward-compatible: all non-mpath operations
 should work as before with ROUTE_MPATH and net.route.multipath=1.

All routes now comes with weight, default weight is 1, maximum is 2^24-1.

Current maximum multipath group width is statically set to 64.
 This will become sysctl-tunable in the followup changes.

Using functionality:
* Recompile kernel with ROUTE_MPATH
* set net.route.multipath to 1

route add -6 2001:db8::/32 2001:db8::2 -weight 10
route add -6 2001:db8::/32 2001:db8::3 -weight 20

netstat -6On

Nexthop groups data

Internet6:
GrpIdx  NhIdx     Weight   Slots                                 Gateway     Netif  Refcnt
1         ------- ------- ------- --------------------------------------- ---------       1
              13      10       1                             2001:db8::2     vlan2
              14      20       2                             2001:db8::3     vlan2

Next steps:
* Land outbound hashing for locally-originated routes ( D26523 ).
* Fix net/bird multipath (net/frr seems to work fine)
* Add ROUTE_MPATH to GENERIC
* Set net.route.multipath=1 by default

Tested by: olivier
Reviewed by: glebius
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D26449

3 years agonetmap: minor documentation fix
vmaffione [Sat, 3 Oct 2020 09:36:33 +0000 (09:36 +0000)]
netmap: minor documentation fix

Also update date of pkt-gen.8 (not done in r366387).

Submitted by: milosz.kaniewski@gmail.com
MFC after: 3 days

3 years agonetmap: fix constness warnings generated by "-Wcast-qual"
vmaffione [Sat, 3 Oct 2020 09:33:29 +0000 (09:33 +0000)]
netmap: fix constness warnings generated by "-Wcast-qual"

Submitted by: milosz.kaniewski@gmail.com
MFC after: 3 days

3 years agonetmap: pkt-gen: minor corrections to documentation
vmaffione [Sat, 3 Oct 2020 09:23:34 +0000 (09:23 +0000)]
netmap: pkt-gen: minor corrections to documentation

Submitted by: Brian Poole <brian90013@gmail.com>
MFC after: 3 days

3 years agopwm_backlight: Fix 32 bits build
manu [Sat, 3 Oct 2020 08:31:28 +0000 (08:31 +0000)]
pwm_backlight: Fix 32 bits build

Reported by: jenkins, mjg

3 years agocxgbe(4): set up the firmware flowc for the tid before send_abort_rpl.
np [Fri, 2 Oct 2020 23:48:57 +0000 (23:48 +0000)]
cxgbe(4): set up the firmware flowc for the tid before send_abort_rpl.

MFC after: 3 days
Sponsored by: Chelsio Communications

3 years agoFix LINT: Add backlight to NOTES
manu [Fri, 2 Oct 2020 20:52:09 +0000 (20:52 +0000)]
Fix LINT: Add backlight to NOTES

3 years agopwm_backlight: Restrict module to armv7 and aarch64
manu [Fri, 2 Oct 2020 19:56:54 +0000 (19:56 +0000)]
pwm_backlight: Restrict module to armv7 and aarch64

Both powerpc64 and riscv uses fdt but don't use EXT_RESOURCES.

Reported by: jenkins

3 years agovm_pageout: Avoid rounding down the inactive scan target
markj [Fri, 2 Oct 2020 19:16:06 +0000 (19:16 +0000)]
vm_pageout: Avoid rounding down the inactive scan target

With helper page daemon threads, enabled by default in r364786, we
divide the inactive target by the number of threads, rounding down, and
sum the total number of pages freed by the threads.  This sum is
compared with the original target, but by rounding down we might lose
pages, causing the page daemon control loop to conclude that inactive
queue scanning isn't keeping up with demand for free pages.  Typically
this results in excessive swapping.

Fix the problem by accounting for the error in the main pagedaemon
thread's target.  Note that by default the problem will manifest only in
systems with >16 CPUs in a NUMA domain.

Reviewed by: cem
Discussed with: dougm
Reported and tested by: dhw, glebius
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D26610

3 years agouma: Use the bucket cache for cross-domain allocations
markj [Fri, 2 Oct 2020 19:04:29 +0000 (19:04 +0000)]
uma: Use the bucket cache for cross-domain allocations

uma_zalloc_domain() allocates from the requested domain instead of
following a first-touch policy (the default for most zones).  Currently
it is only used by malloc_domainset(), and consumers free returned items
with free(9) since r363834.

Previously uma_zalloc_domain() worked by always going to the keg for an
item.  As a result, the use of UMA zone caches was unbalanced: we free
items to the caches, but always allocate from the keg, skipping the
caches.

Make some effort to allocate from the UMA caches when performing a
cross-domain allocation.  This avoids blowing up the caches when
something is performing many transient allocations with
malloc_domainset().

Reported and tested by: dhw, glebius
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D26427

3 years agouma: Use LIFO for non-SMR bucket caches
markj [Fri, 2 Oct 2020 19:04:09 +0000 (19:04 +0000)]
uma: Use LIFO for non-SMR bucket caches

When SMR was introduced, zone_put_bucket() was changed to always place
full buckets at the end of the queue.  However, it is generally
preferable to use recently used buckets since their items are more
likely to be resident in cache.  So, for buckets that have no constraint
on item reuse, use a last-in-first-out ordering as we did before.

Reviewed by: rlibby
Tested by: dhw, glebius
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D26426

3 years agouma: Remove newlines from panic messages
markj [Fri, 2 Oct 2020 19:03:42 +0000 (19:03 +0000)]
uma: Remove newlines from panic messages

Sponsored by: The FreeBSD Foundation

3 years agoFix the INVARIANTS build for 32-bit platforms
markj [Fri, 2 Oct 2020 18:54:37 +0000 (18:54 +0000)]
Fix the INVARIANTS build for 32-bit platforms

Reported by: Jenkins
MFC with: r366368

3 years agonewlocale(3): Fix a memory leak.
markj [Fri, 2 Oct 2020 18:35:55 +0000 (18:35 +0000)]
newlocale(3): Fix a memory leak.

newlocale() optionally takes a "base" locale, from which components not
specified in the mask are inherited.  POSIX says that newlocale() may
modify "base" and return it, or free "base" and return a newly allocated
locale.  We were not doing either, so applications which use newlocale()
to modify an existing base locale end up leaking memory on FreeBSD.

This diff fixes the leak by releasing a reference to the base locale
before returning.  This is less efficient than modifying "base"
directly, but is simpler for an initial bug fix.  Also, update the man
page to clarify behaviour with respect to "base".

PR: 249416
MFC after: 3 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D26522

3 years agoBump __FreeBSD_version after latest linuxkpi changes
manu [Fri, 2 Oct 2020 18:29:25 +0000 (18:29 +0000)]
Bump __FreeBSD_version after latest linuxkpi changes

3 years agolinuxkpi: Add dmi_* function
manu [Fri, 2 Oct 2020 18:28:00 +0000 (18:28 +0000)]
linuxkpi: Add dmi_* function

dmi function are used to get smbios values.
The DRM subsystem and drivers use it to enabled (or not) quirks.

Reviewed by: hselasky
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D26046

3 years agolinuxkpi: Add backlight support
manu [Fri, 2 Oct 2020 18:26:41 +0000 (18:26 +0000)]
linuxkpi: Add backlight support

Add backlight function to linuxkpi.
Graphics drivers expose the backlight of the panel directly so allow them to use the backlight subsystem so
user can use backlight(8) to configure them.

Reviewed by: hselasky
Relnotes: yes
Differential Revision: The FreeBSD Foundation

3 years agoAdd pwm_backlight
manu [Fri, 2 Oct 2020 18:23:27 +0000 (18:23 +0000)]
Add pwm_backlight

Driver for pwm-backlight compatible device.

Relnotes: yes
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D26252

3 years agoAdd backlight(8)
manu [Fri, 2 Oct 2020 18:21:30 +0000 (18:21 +0000)]
Add backlight(8)

This tool is used to configure registered backlights.
It can incr/decr (default to 10%) or accept a percentage value directly.

Reviewed by: manpages (gbe@)
Relnotes: yes
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D26251

3 years agoAdd backlight subsystem
manu [Fri, 2 Oct 2020 18:18:01 +0000 (18:18 +0000)]
Add backlight subsystem

This is a simple subsystem that allow drivers to register as a backlight.
Each backlight creates a device node under /dev/backlight/backlightX and
an alias based on the name provided.

Relnotes: yes
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D26250

3 years agoImplement sparse core dumps
markj [Fri, 2 Oct 2020 17:50:22 +0000 (17:50 +0000)]
Implement sparse core dumps

Currently we allocate and map zero-filled anonymous pages when dumping
core.  This can result in lots of needless disk I/O and page
allocations.  This change tries to make the core dumper more clever and
represent unbacked ranges of virtual memory by holes in the core dump
file.

Add a new page fault type, VM_FAULT_NOFILL, which causes vm_fault() to
clean up and return an error when it would otherwise map a zero-filled
page.  Then, in the core dumper code, prefault all user pages and handle
errors by simply extending the size of the core file.  This also fixes a
bug related to the fact that vn_io_fault1() does not attempt partial I/O
in the face of errors from vm_fault_quick_hold_pages(): if a truncated
file is mapped into a user process, an attempt to dump beyond the end of
the file results in an error, but this means that valid pages
immediately preceding the end of the file might not have been dumped
either.

The change reduces the core dump size of trivial programs by a factor of
ten simply by excluding unaccessed libc.so pages.

PR: 249067
Reviewed by: kib
Tested by: pho
MFC after: 1 month
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D26590

3 years agoSimplify the check for non-dumpable VM object types
markj [Fri, 2 Oct 2020 17:49:13 +0000 (17:49 +0000)]
Simplify the check for non-dumpable VM object types

OBJT_DEFAULT, _SWAP, _VNODE and _PHYS is exactly the set of
non-fictitious object types, so just check for OBJ_FICTITIOUS.  The
check no longer excludes dead objects, but such objects have to be
handled regardless.

No functional change intended.

Reviewed by: alc, dougm, kib
Tested by: pho
MFC after: 2 weeks
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D26589

3 years agoflash: Add support for SPI flash s25fl512s
nick [Fri, 2 Oct 2020 17:33:56 +0000 (17:33 +0000)]
flash: Add support for SPI flash s25fl512s

Reviewed by: kp
Approved by: kp (mentor)
Sponsored by: Axiado

3 years agofusefs tests: quell Coverity "Argument cannot be negative" warnings
asomers [Fri, 2 Oct 2020 17:06:05 +0000 (17:06 +0000)]
fusefs tests: quell Coverity "Argument cannot be negative" warnings

Must abort tests early if open(2) fails.

Reported by: Coverity
Coverity CID: 1432810 and many others
Reviewed by: kevans
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D26635

3 years agoCorrect the documented size of kern.msgbufsize
0mp [Fri, 2 Oct 2020 15:37:51 +0000 (15:37 +0000)]
Correct the documented size of kern.msgbufsize

The correct value is 96KB after r226090.

PR: 249971
Submitted by: johannes@jo-t.de
MFC after: 3 days

3 years agocache: update the commentary for path parsing
mjg [Fri, 2 Oct 2020 14:50:03 +0000 (14:50 +0000)]
cache: update the commentary for path parsing

3 years agolibmd: add dependency workaround for r366344
emaste [Fri, 2 Oct 2020 14:00:52 +0000 (14:00 +0000)]
libmd: add dependency workaround for r366344

r366344 fixed and reenabled the assembly optimized skein implementation,
but skein_block objects were not being rebuilt in no-clean builds. This
resulted in failing no-clean builds. SKEIN_USE_ASM controls which
routines come from C vs assembly, and with no explicit dependency
r366344's change to SKEIN_USE_ASM did not cause skein_block.{o,pico}
to be rebuilt.

Add a dependency on this Makefile for the skein_block objects. This
dependency is broader in scope than absolutely required (that is, the
skein_block objects will now be rebuilt on any change to this Makefile).
There are ways this could be addressed, but it is probably not worth the
additional effort or testing time to pursue them.

PR: 248221
Reported by: kevans, Jeremy Faulkner
Discussed with: kevans
Sponsored by: The FreeBSD Foundation

3 years agoriscv: handle access faults in user mode
kp [Fri, 2 Oct 2020 07:30:11 +0000 (07:30 +0000)]
riscv: handle access faults in user mode

Access faults in user mode are treated like TLB misses, which leads to an
endless loop of faults. It's less serious than the same fault in kernel mode,
because we can just terminate the process, but that's not ideal.

Treat user mode access faults as a bus error.

Suggested by: jrtc27
Reviewed by: br, jhb
Sponsored by: Axiado
Differential Revision: https://reviews.freebsd.org/D26621

3 years agocxgbe(4): validate largest_rx_cluster and safest_rx_cluster.
np [Fri, 2 Oct 2020 05:59:55 +0000 (05:59 +0000)]
cxgbe(4): validate largest_rx_cluster and safest_rx_cluster.

These tunables can only be set to a valid cluster size (2K, 4K, 9K, or
16K) as documented in the man page.  Anything else could lead to a
panic on interface up.

Reported by: mav@
MFC after: 1 week
Sponsored by: Chelsio Communications

3 years agoOpenZFS: don't call fpu_kern_thread on i386
mmacy [Fri, 2 Oct 2020 01:25:08 +0000 (01:25 +0000)]
OpenZFS: don't call fpu_kern_thread on i386

3 years agotmpfs tests: check for built-in tmpfs module
mhorne [Fri, 2 Oct 2020 00:52:31 +0000 (00:52 +0000)]
tmpfs tests: check for built-in tmpfs module

As of r363471, tmpfs is included in all GENERIC kernel configs. This
results in a warning being emitted for each call to kldload(8):

module_register: cannot register tmpfs from tmpfs.ko; already loaded from kernel

Check for the presence of the module via kldstat first to quiet this
warning.

Reviewed by: asomers, arichardson
Differential Revision: https://reviews.freebsd.org/D26632

3 years agoOpenZFS: MFV 2.0-rc3-gfc5966
mmacy [Thu, 1 Oct 2020 23:28:21 +0000 (23:28 +0000)]
OpenZFS: MFV 2.0-rc3-gfc5966

- Annotate FreeBSD sysctls with CTLFLAG_MPSAFE
- Reduce stack usage of Lua
- Don't save user FPU context in kernel threads
- Add support for procfs_list
- Code cleanup in zio_crypt
- Add DB_RF_NOPREFETCH to dbuf_read()s in dnode.c
- Drop references when skipping dmu_send due to EXDEV
- Eliminate gratuitous bzeroing in dbuf_stats_hash_table_data
- Fix legacy compat for platform IOCs

3 years agoUpdate OpenZFS to 2.0.0-rc3-gfc5966
mmacy [Thu, 1 Oct 2020 23:09:24 +0000 (23:09 +0000)]
Update OpenZFS to 2.0.0-rc3-gfc5966

3 years agoRemove svn:executable from a couple of vmm(4) source files.
markj [Thu, 1 Oct 2020 22:20:29 +0000 (22:20 +0000)]
Remove svn:executable from a couple of vmm(4) source files.

MFC after: 3 days

3 years agofix setitimer test for returned it_value
vangyzen [Thu, 1 Oct 2020 21:52:57 +0000 (21:52 +0000)]
fix setitimer test for returned it_value

An old it_value of {4,3} is valid. Allow it.

Reviewed by: bdrewery
MFC after: 2 weeks
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D26445

3 years agozgrep: fix exit status with multiple files
vangyzen [Thu, 1 Oct 2020 21:48:22 +0000 (21:48 +0000)]
zgrep: fix exit status with multiple files

zgrep should exit with success when given multiple files and the
pattern is found in at least one file.  Prior to this change,
it would exit with success only if the pattern was found in _every_ file.

Reviewed by: dab ngie
MFC after: 2 weeks
Sponsored by: Dell EMC Isilon
Differential Revision: https://reviews.freebsd.org/D26616

3 years agolibmd: fix assembly optimized skein implementation
emaste [Thu, 1 Oct 2020 21:05:50 +0000 (21:05 +0000)]
libmd: fix assembly optimized skein implementation

The assembly implementation incorrectly used logical AND instead of
bitwise AND. Fix, and re-enable in libmd.

Submitted by: Yang Zhong <yzhong@freebsdfoundation.org>
Reviewed by: cem (earlier)
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D26614

3 years agoRevert r366340.
bdrewery [Thu, 1 Oct 2020 20:08:27 +0000 (20:08 +0000)]
Revert r366340.

CR wasn't finished and it breaks the build.

3 years agoauxv: partially revert r366207, cast buflen to unsigned int as needed
kevans [Thu, 1 Oct 2020 19:56:38 +0000 (19:56 +0000)]
auxv: partially revert r366207, cast buflen to unsigned int as needed

The warning generated pre-r366207 is actually a sign comparison warning:

error: comparison of integers of different signs: 'unsigned long' and 'int'
                        if (strlcpy(buf, execpath, buflen) >= buflen)

Revert parts that affected other lines and just cast this to unsigned int.

The buflen < 0 -> EINVAL has been kept despite no longer serving any
purposes w.r.t. sign-extension because I do believe it's the right thing to
do: "The provided buffer was not the right size for the requested item."

The original warning is confirmed to still be gone with an:
env WARNS=6 make WITHOUT_TESTS=yes.

Reviewed by: asomers, kib
X-MFC-With: r366207
Differential Revision: https://reviews.freebsd.org/D26631

3 years agoUse unlocked page lookup for inmem() to avoid object lock contention
bdrewery [Thu, 1 Oct 2020 19:17:03 +0000 (19:17 +0000)]
Use unlocked page lookup for inmem() to avoid object lock contention

Reviewed By: kib, markj
Sponsored by: Dell EMC Isilon
Submitted by: mlaier
Differential Revision: https://reviews.freebsd.org/D26597

3 years agoMerge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
dim [Thu, 1 Oct 2020 19:06:07 +0000 (19:06 +0000)]
Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
release/11.x llvmorg-11.0.0-rc5-0-g60a25202a7d.

MFC after: 4 weeks
X-MFC-With: r364284

3 years agoDon't ignore the return value from gethostname(3). It probably
trasz [Thu, 1 Oct 2020 18:56:44 +0000 (18:56 +0000)]
Don't ignore the return value from gethostname(3).  It probably
cannot happen, but it silences Coverity.

Reviewed by: mav
MFC after: 2 weeks
Sponsored by: NetApp, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D26606

3 years agoOnly clear TDP_NERRNO when needed, ie when it's previously been set.
trasz [Thu, 1 Oct 2020 18:45:31 +0000 (18:45 +0000)]
Only clear TDP_NERRNO when needed, ie when it's previously been set.

Reviewed by: kib
Tested by: pho
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D26612

3 years agobhyve: Fix build with option BHYVE_SNAPSHOT
jhb [Thu, 1 Oct 2020 17:16:05 +0000 (17:16 +0000)]
bhyve: Fix build with option BHYVE_SNAPSHOT

'ident' was replaced with 'ata_ident' in revision r363596.

Submitted by: Vitaliy Gusev <gusev.vitaliy_gmail.com>
Reviewed by: Darius Mihai
Differential Revision:  https://reviews.freebsd.org/D26263

3 years agoichsmb_pci: convert to pci_device_table / add PCI_PNP_INFO
manu [Thu, 1 Oct 2020 16:55:01 +0000 (16:55 +0000)]
ichsmb_pci: convert to pci_device_table / add PCI_PNP_INFO

Submitted by: Greg V <greg@unrelenting.technology>
Reviewed by: mav
Differential Revision: https://reviews.freebsd.org/D25260

3 years agoClear the upper 32-bits of registers in x86_emulate_cpuid().
jhb [Thu, 1 Oct 2020 16:45:11 +0000 (16:45 +0000)]
Clear the upper 32-bits of registers in x86_emulate_cpuid().

Per the Intel manuals, CPUID is supposed to unconditionally zero the
upper 32 bits of the involved (rax/rbx/rcx/rdx) registers.
Previously, the emulation would cast pointers to the 64-bit register
values down to `uint32_t`, which while properly manipulating the lower
bits, would leave any garbage in the upper bits uncleared.  While no
existing guest OSes seem to stumble over this in practice, the bhyve
emulation should match x86 expectations.

This was discovered through alignment warnings emitted by gcc9, while
testing it against SmartOS/bhyve.

SmartOS bug: https://smartos.org/bugview/OS-8168
Submitted by: Patrick Mooney
Reviewed by: rgrimes
Differential Revision: https://reviews.freebsd.org/D24727

3 years agoEliminate duplicate `afterinstallconfigs` target
ngie [Thu, 1 Oct 2020 16:37:49 +0000 (16:37 +0000)]
Eliminate duplicate `afterinstallconfigs` target

Define separate dependent targets which `afterinstallconfigs` relies on, in
order to modify `${DESTDIR}/etc/master.passwd` and
`${DESTDIR}/etc/nsswitch.conf`.

Mark these targets .PHONY, since they manipulate configurations on the fly and
the generation logic isn't 100% defined in terms of the source files/logic,
and is variable, based on MK_foo flags.

MFC after: 2 weeks
Reviewed by: bapt, brd
Differential Revision: https://reviews.freebsd.org/D20330

3 years agoUpgrade to version 3.1.6
se [Thu, 1 Oct 2020 15:45:07 +0000 (15:45 +0000)]
Upgrade to version 3.1.6

This upgrade addresses one (benign) compiler warning when building with
LLVM-12.

3 years agoriscv: Add memmmap so we can mmap /dev/mem
kp [Thu, 1 Oct 2020 15:04:55 +0000 (15:04 +0000)]
riscv: Add memmmap so we can mmap /dev/mem

Reviewed by: mhorne
Sponsored by: Axiado
Differential Revision: https://reviews.freebsd.org/D26622

3 years agolualoader: clear up some luacheck warnings
kevans [Thu, 1 Oct 2020 14:20:36 +0000 (14:20 +0000)]
lualoader: clear up some luacheck warnings

- One (1) unused argument
- One (1) trailing whitespace
- Two (2) "non-standard global" (curenv, rewind)

tools/boot/lua-lint.sh is once again happy.

3 years agoAdd cd device to arm64 GENERIC
emaste [Thu, 1 Oct 2020 13:29:29 +0000 (13:29 +0000)]
Add cd device to arm64 GENERIC

Big-iron arm64 machines might have a CD, possibly provided by some IPMI
emulation.

Reported by: scottph

3 years agoFix the inverted condition in mtx_asserts.
mmel [Thu, 1 Oct 2020 09:50:08 +0000 (09:50 +0000)]
Fix the inverted condition in mtx_asserts.
Mutex should be owned in affected functions.

Reborted by: emaste
MFC after: 4 weeks
MFC with: r366161

3 years agoRemove nfsstat. Running nfsstat in crashinfo will give the stats of the
netchild [Thu, 1 Oct 2020 08:57:36 +0000 (08:57 +0000)]
Remove nfsstat. Running nfsstat in crashinfo will give the stats of the
running kernel instead of the stats of the crashed kernel. The current
version uses sysctls to query the stats and does not work at all (anymore)
on crash dumps.

3 years agocache: properly report ENOTDIR on foo/bar lookups where foo is a file
mjg [Thu, 1 Oct 2020 08:46:21 +0000 (08:46 +0000)]
cache: properly report ENOTDIR on foo/bar lookups where foo is a file

Reported by: fernape

3 years agoUpdate nvi to 2.2.0-05ed8b9
bapt [Thu, 1 Oct 2020 04:46:23 +0000 (04:46 +0000)]
Update nvi to 2.2.0-05ed8b9

This version incorporates many fixes in particular a fix for vi -w
Another approach was proposed to merge those fixes (see review), I find
it easier to track changes if we keep importing snapshot on regular
basis

PR: 241985
Reported by: fernape
Differential Revision: https://reviews.freebsd.org/D26158

3 years agoDo a sweep and remove most WARNS=6 settings
kevans [Thu, 1 Oct 2020 01:10:51 +0000 (01:10 +0000)]
Do a sweep and remove most WARNS=6 settings

Repeating the default WARNS here makes it slightly more difficult to
experiment with default WARNS changes, e.g. if we did something absolutely
bananas and introduced a WARNS=7 and wanted to try lifting the default to
that.

Drop most of them; there is one in the blake2 kernel module, but I suspect
it should be dropped -- the default WARNS in the rest of the build doesn't
currently apply to kernel modules, and I haven't put too much thought into
whether it makes sense to make it so.

3 years agoModify the NFSv4.2 VOP_COPY_FILE_RANGE() client call to return after one
rmacklem [Thu, 1 Oct 2020 00:47:35 +0000 (00:47 +0000)]
Modify the NFSv4.2 VOP_COPY_FILE_RANGE() client call to return after one
successful RPC.

Without this patch, the NFSv4.2 VOP_COPY_FILE_RANGE() client call would
loop until the copy "len" was completed.  The problem with doing this is
that it might take a considerable time to complete for a large "len".
By returning after a single successful Copy RPC that copied some of the
data, the application that did the copy_file_range(2) syscall will be
more responsive to signal delivery for large "len" copies.

3 years agoClip the "len" argument to vn_generic_copy_file_range() at a
rmacklem [Thu, 1 Oct 2020 00:33:44 +0000 (00:33 +0000)]
Clip the "len" argument to vn_generic_copy_file_range() at a
hole size boundary.

By clipping the len argument of vn_generic_copy_file_range() to end at
an exact multiple of hole size, holes are more likely to be maintained
during the copy.
A hole can still straddle the boundary at the end of the
copy range, resulting in a block being allocated in the
output file as it is being grown in size, but this will reduce the
likelyhood of this happening.

While here, also modify setting of blksize to better handle the
case where _PC_MIN_HOLE_SIZE is returned as 1.

Reviewed by: asomers
Differential Revision: https://reviews.freebsd.org/D26570

3 years agopciconf: print PCIe CTL max read request.
kib [Wed, 30 Sep 2020 21:12:14 +0000 (21:12 +0000)]
pciconf: print PCIe CTL max read request.

To not complicate existing parsers, the value is printed on a new
output line.

Sponsored by: Mellanox Technologies/NVIDIA Networking
MFC after: 1 week

3 years agoAvoid a dubious assignment to bio_data in aio_qbio().
jhb [Wed, 30 Sep 2020 17:49:06 +0000 (17:49 +0000)]
Avoid a dubious assignment to bio_data in aio_qbio().

A user pointer is not a suitable value for bio_data and the next block
of code always overwrites bio_data anyway.  Just use cb->aio_buf
directly in the call to vm_fault_quick_hold_pages().

Reviewed by: kib
Obtained from: CheriBSD
MFC after: 1 month
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D26595

3 years agoahci_generic: add quirk for NXP0004 (NXP Layerscape LX2160A)
manu [Wed, 30 Sep 2020 17:10:49 +0000 (17:10 +0000)]
ahci_generic: add quirk for NXP0004 (NXP Layerscape LX2160A)

This fixes this error :
(aprobe3:ahcich3:0:15:0): NOP FLUSHQUEUE. ACB: 00 00 00 00 00 00 00 00 00 00 00 00
(aprobe3:ahcich3:0:15:0): CAM status: Command timeout
(aprobe3:ahcich3:0:15:0): Error 5, Retries exhausted

Submitted by: Greg V <greg@unrelenting.technology>
Reviewed by: imp, mav
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D25157

3 years agoacpi_resource: support multiple IRQs
manu [Wed, 30 Sep 2020 17:09:17 +0000 (17:09 +0000)]
acpi_resource: support multiple IRQs

Some DSDT entries have multiple interrupts for one device.
Add support for it.

This fixes ahci on NXP LS2160 and genet on RPi4

Submitted by: Greg V <greg@unrelenting.technology>
Reviewed by: jhb
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D25145

3 years agocache: push the lock into cache_purge_impl
mjg [Wed, 30 Sep 2020 17:08:34 +0000 (17:08 +0000)]
cache: push the lock into cache_purge_impl

3 years agogdb(4): Don't escape GDB special characters at application layer
cem [Wed, 30 Sep 2020 14:55:54 +0000 (14:55 +0000)]
gdb(4): Don't escape GDB special characters at application layer

In r351368, we introduced this XML- and GDB-encoded data.  The protocol
'offset' should reflex the logical XML data offset, but unfortunately we
counted the GDB escapes as well.

In fact, we cannot safely do GDB character escaping at this layer at
all, because we don't know what will be flushed in a packet.  It is
bogus to send only the first character of a two-character escape
sequence.

This patch "corrects" the problem by squashing these characters in the
transmitted XML document.  It would be nice to transmit the characters
faithfully, but that is a more complicated change.  Thread names are a
nice convenience feature for the GDB client, but one can always inspect
td_name or p_comm directly to find the true name.

Reported by: Ka Ho Ng <khng300 AT gmail.com>
Tested by: Ka Ho Ng
Reviewed by: emaste, markj, rlibby
Differential Revision: https://reviews.freebsd.org/D26599

3 years agoContinued ipfilter #ifdef cleanup. The r343701 log entry contains a
cy [Wed, 30 Sep 2020 08:26:25 +0000 (08:26 +0000)]
Continued ipfilter #ifdef cleanup. The r343701 log entry contains a
complete description.

MFC after: 1 week

3 years agoipfilter getifname ifdef cleanup.
cy [Wed, 30 Sep 2020 08:26:22 +0000 (08:26 +0000)]
ipfilter getifname ifdef cleanup.

MFC after: 2 months

3 years agoResurrect ipfilter's getifname, replacing the stub with the real
cy [Wed, 30 Sep 2020 08:26:00 +0000 (08:26 +0000)]
Resurrect ipfilter's getifname, replacing the stub with the real
function.

MFC after: 2 months

3 years agoriscv: Panic on PMP errors
kp [Wed, 30 Sep 2020 08:23:43 +0000 (08:23 +0000)]
riscv: Panic on PMP errors

Load/store/fetch access exceptions always indicate a violation of a PMP
rule. We can't treat those as page faults, because updating the page
table and trying again will only result in exactly the same access
exception recurring. This leaves us in an endless exception loop.

We cannot recover from these exceptions, so panic instead.

Reviewed by: jhb
Sponsored by: Axiado
Differential Revision: https://reviews.freebsd.org/D26544

3 years agocache: use cache_has_entries where appropriate instead of opencoding it
mjg [Wed, 30 Sep 2020 04:27:38 +0000 (04:27 +0000)]
cache: use cache_has_entries where appropriate instead of opencoding it

3 years agoriscv: Define __PCI_REROUTE_INTERRUPT
jrtc27 [Wed, 30 Sep 2020 02:21:38 +0000 (02:21 +0000)]
riscv: Define __PCI_REROUTE_INTERRUPT

Every other architecture defines this and this is required for
interrupts to work when using QEMU's PCI VirtIO devices (which all
report an interrupt line of 0) for two reasons.

Firstly, interrupt line 0 is wrong; they use one of 0x20-0x23 with the
lines being cycled across devices like normal. Moreover, RISC-V uses
INTRNG, whose IRQs are virtual as indices into its irq_map, so even if
we have the right interrupt line we still need to try and route the
interrupt in order to ultimately call into intr_map_irq and get back a
unique index into the map for the given line, otherwise we will use
whatever happens to be in irq_map[line] (which for QEMU where the line
is initialised to 0 results in using the first allocated interrupt,
namely the RTC on IRQ 11 at time of commit).

Note that pci_assign_interrupt will still do the wrong thing for INTRNG
when using a tunable, as it will bypass INTRNG entirely and use the
tunable's value as the index into irq_map, when it should instead
(indirectly) call intr_map_irq to allocate a new entry for the given
IRQ and treat the tunable as stating the physical line in use, which is
what one would expect. This, however, is a problem shared by all INTRNG
architectures, and not exclusive to RISC-V.

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

3 years agoMake copy_file_range(2) Linux compatible for overflow of offset + len.
rmacklem [Wed, 30 Sep 2020 02:18:09 +0000 (02:18 +0000)]
Make copy_file_range(2) Linux compatible for overflow of offset + len.

Without this patch, if a call to copy_file_range(2) specifies an input file
offset + len that would wrap around, EINVAL is returned.
I thought that was the Linux behaviour, but recent testing showed that
Linux accepts this case and does the copy_file_range() to EOF.

This patch changes the FreeBSD code to exhibit the same behaviour as
Linux for this case.

Reviewed by: asomers, kib
Differential Revision: https://reviews.freebsd.org/D26569

3 years agoMakefile.inc1: sysent: allow subordinate sysent targets to run in parallel
kevans [Wed, 30 Sep 2020 00:47:57 +0000 (00:47 +0000)]
Makefile.inc1: sysent: allow subordinate sysent targets to run in parallel

makesyscalls.lua (and indeed makesyscalls.sh) are both safe to be run in
parallel, so let's do it.

This is a trivial difference because runtime per-target is pretty small, but
I like seeing it run in parallel when my muscle memory types `make -sj4`.

Reviewed by: brooks, emaste
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D26594

3 years agoHoist comment on fixup of ld path
brooks [Tue, 29 Sep 2020 23:48:05 +0000 (23:48 +0000)]
Hoist comment on fixup of ld path

Reported by: jrtc27
Differential Revision: https://reviews.freebsd.org/D26591

3 years agoarm64: set the correct HWCAP
mhorne [Tue, 29 Sep 2020 23:21:56 +0000 (23:21 +0000)]
arm64: set the correct HWCAP

This appears to be a typo. The AdvSIMD field encodes support for
half-precision floating point SIMD instructions, which corresponds to
HWCAP_ASIMDHP, not HWCAP_ASIMDDP.

MFC after: 3 days
Sponsored by: The FreeBSD Foundation

3 years agoPrefer --ld-path=/path/to/ld on clang >= 12
brooks [Tue, 29 Sep 2020 22:30:15 +0000 (22:30 +0000)]
Prefer --ld-path=/path/to/ld on clang >= 12

Clang 12 warns about passing a path to -fuse-ld and -Werror makes that
an error preventing building world without this change.

Reviewed by: arichardson, emaste
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D26591

3 years agoFallback to software for more GCM and CCM requests.
jhb [Tue, 29 Sep 2020 21:51:32 +0000 (21:51 +0000)]
Fallback to software for more GCM and CCM requests.

ccr(4) uses software to handle GCM and CCM requests not supported by
the crypto engine (e.g. with only AAD and no payload).  This change
adds a fallback for a few more requests such as those with more SGL
entries than can fit in a work request (this can happen for GCM when
decrypting a TLS record split across 15 or more packets).

Reported by: Chelsio QA
Reviewed by: np
Sponsored by: Chelsio Communications
Differential Revision: https://reviews.freebsd.org/D26582

3 years agortwn: narrow the epoch area
bz [Tue, 29 Sep 2020 20:46:25 +0000 (20:46 +0000)]
rtwn: narrow the epoch area

Rather than placing the epoch around the entire receive loop which
might call into rtwn_rx_frame() and USB and sleep, split the loop
into two[1] and leave us with one unlock/lock cycle as well.

PR: 249925
Reported by: thj, (rkoberman gmail.com)
Tested by: thj
Suggested by: adrian [1]
Reviewed by: adrian
MFC after: 3 days
Sponsored by: The FreeBSD Foundation (initially, paniced my iwl lab host)
Differential Revision: https://reviews.freebsd.org/D26554

3 years agoRename kernel option ACPI_DMAR to IOMMU.
br [Tue, 29 Sep 2020 20:29:07 +0000 (20:29 +0000)]
Rename kernel option ACPI_DMAR to IOMMU.
This is mostly needed for a common arm64/amd64 iommu code.

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

3 years agoUpdates to chroot(2) docs
imp [Tue, 29 Sep 2020 18:13:54 +0000 (18:13 +0000)]
Updates to chroot(2) docs

1. Note what settings give historic behavior
2. Recommend jail under security considerations.

3 years agoStandalone SX shims
imp [Tue, 29 Sep 2020 18:06:02 +0000 (18:06 +0000)]
Standalone SX shims

Create a do-nothing version of SX locks. OpenZFS needs them. However,
since the boot loader is single threaded, they can be nops.

3 years agokldconfig(8): Add EXAMPLES to the man page
fernape [Tue, 29 Sep 2020 17:52:15 +0000 (17:52 +0000)]
kldconfig(8): Add EXAMPLES to the man page

Add EXAMPLES section to the man page showing the use of all flags except for
-S.

While here, clarify -f description. It not only suppresses diagnostic messages
but it also affects the exit status of the command itself. This is shown in two
of the examples.

Approved by: bcr@
Differential Revision: https://reviews.freebsd.org/D26588

3 years agoImplement some time variables from kernel
imp [Tue, 29 Sep 2020 16:29:50 +0000 (16:29 +0000)]
Implement some time variables from kernel

OpenZFS will start using some of the kernel timekeeping bits
shortly. This implements the bare minimum of that which currently
is just the time_seconds variable.

3 years agoo Rename acpi_iommu_get_dma_tag() -> iommu_get_dma_tag().
br [Tue, 29 Sep 2020 15:10:56 +0000 (15:10 +0000)]
o Rename acpi_iommu_get_dma_tag() -> iommu_get_dma_tag().
  This function isn't ACPI dependent and we may use it on FDT systems
  as well.
o Don't repeat the function declaration, include iommu.h instead.

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

3 years agoApply 0daa0320e994 ("Fix a logic bug in the FreeBSD getpages VOP")
markj [Tue, 29 Sep 2020 13:56:09 +0000 (13:56 +0000)]
Apply 0daa0320e994 ("Fix a logic bug in the FreeBSD getpages VOP")

3 years agoZFS: Fix a logic bug in the FreeBSD getpages VOP
markj [Tue, 29 Sep 2020 13:41:47 +0000 (13:41 +0000)]
ZFS: Fix a logic bug in the FreeBSD getpages VOP

This was introduced when I merged r361287 to OpenZFS and has been fixed
there already, commit 3f6bb6e43fd68e.

Reported by: swills
Reviewed by: allanjude, freqlabs, mmacy

3 years agoBuild debug kernels with -O2.
trasz [Tue, 29 Sep 2020 11:48:22 +0000 (11:48 +0000)]
Build debug kernels with -O2.

LLVM 11 changed the meaning of '-O' from '-O2' to '-O1', which resulted
in debug kernels (with 'makeoptions DEBUG=-g') being built with inlining
disabled, causing severe performance hit.

The -O2 was already being used for building amd64, powerpc, and powerpcspe.

Discussed with: jrtc27, arichardson, bdragon, jhibbits
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D26471

3 years agoUse the 'traced' variable instead of comparing p->p_flag again.
trasz [Tue, 29 Sep 2020 11:18:48 +0000 (11:18 +0000)]
Use the 'traced' variable instead of comparing p->p_flag again.

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

3 years agoBump manual page date after 366243
0mp [Tue, 29 Sep 2020 10:07:46 +0000 (10:07 +0000)]
Bump manual page date after 366243

While here, address mandoc warnings.

3 years agoImprove the input validation and processing of cookies.
tuexen [Tue, 29 Sep 2020 09:36:06 +0000 (09:36 +0000)]
Improve the input validation and processing of cookies.
This avoids setting the association in an inconsistent
state, which could result in a use-after-free situation.
This can be triggered by a malicious peer, if the peer
can modify the cookie without the local endpoint recognizing
it.
Thanks to Ned Williamson for reporting the issue.

MFC after: 3 days

3 years agocxgbe(4): Avoid unnecessary work in the firmware during netmap tx.
np [Tue, 29 Sep 2020 09:25:52 +0000 (09:25 +0000)]
cxgbe(4): Avoid unnecessary work in the firmware during netmap tx.

Bind the netmap tx queues to a special '0xff' scheduling class which
makes the firmware skip some processing related to rate limiting on the
outgoing traffic.  Future firmwares will do this automatically.

MFC after: 1 week
Sponsored by: Chelsio Communications

3 years agoRemove duplicate line.
np [Tue, 29 Sep 2020 09:11:51 +0000 (09:11 +0000)]
Remove duplicate line.

3 years agocxgbe(4): adjust the doorbell threshold for netmap freelists to match the
np [Tue, 29 Sep 2020 07:51:06 +0000 (07:51 +0000)]
cxgbe(4): adjust the doorbell threshold for netmap freelists to match the
maximum burst size used when fetching descriptors from the list.

MFC after: 1 week
Sponsored by: Chelsio Communications

3 years agocxgbe(4): display an error message when netmap cannot be enabled because
np [Tue, 29 Sep 2020 07:36:21 +0000 (07:36 +0000)]
cxgbe(4): display an error message when netmap cannot be enabled because
the interface is down.

MFC after: 1 week

3 years agoDocument the fact (bug?) that the -a option will normally process
grog [Tue, 29 Sep 2020 05:49:45 +0000 (05:49 +0000)]
Document the fact (bug?) that the -a option will normally process
root's calendar files three times, once each for root, toor and
daemon.

This relates to bug 246943, but does not solve it.  See discussion in
bug report for more details.

PR: 246943
Reported by: wcarson.bugzilla@disillusion.net

3 years agocxgbe(4): fixes for netmap operation with only some queues active.
np [Tue, 29 Sep 2020 05:08:45 +0000 (05:08 +0000)]
cxgbe(4): fixes for netmap operation with only some queues active.

- Only active netmap receive queues should be in the RSS lookup table.

- The RSS table should be restored for NIC operation when the last
  active netmap queue is switched off, not the first one.

- Support repeated netmap ON/OFF on a subset of the queues.  This works
  whether the the queues being enabled and disabled are the only ones
  active or not.  Some kring indexes have to be reset in the driver for
  the second case.

MFC after: 1 week
Sponsored by: Chelsio Communications

3 years agoprocstat: Fix regression after 365880.
kib [Tue, 29 Sep 2020 00:20:58 +0000 (00:20 +0000)]
procstat: Fix regression after 365880.

Basically it reverts one chunk that reversed the parsing logic, making
legacy variants of invocation, like `procstat -a -f', non-operational.

Reported and tested by: Dewayne Geraghty <dewayne@heuristicsystems.com.au>
Sponsored by: The FreeBSD Foundation
MFC after: 3 days

3 years agoAddress whitespace nits in subr_rtc.c
kevans [Mon, 28 Sep 2020 17:19:57 +0000 (17:19 +0000)]
Address whitespace nits in subr_rtc.c

These were separated out from a nearby patch from Andrew Gierth.

MFC after: 3 days