]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
3 years agolualoader: improve the design of the brand-/logo- mechanism
kevans [Sun, 4 Oct 2020 22:41:43 +0000 (22:41 +0000)]
lualoader: improve the design of the brand-/logo- mechanism

In the previous world order, any brand/logo was forced to pull in the
drawer and call drawer.add{Brand,Logo} with the name their brand/logo is
taking and a table describing it.

In the new world order, these files just need to return a table that maps
out graphics types to a table of the exact same format as what was
previously being passed back into the drawer. The appeal here is not needing
to grab a reference back to the drawer module and having a cleaner
data-driven looking format for these. The format has been renamed to 'gfx-*'
prefixes and each one can provide a logo and a brand.

drawer.addBrand/drawer.addLogo will remain in place until FreeBSD 13, as
there's no overhead to them and it's not yet worth the break in
compatibility with any pre-existing brands and logos.

Reviewed by: freqlabs
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D24966

3 years agoExplicit CTLFLAG_DYN not needed
freqlabs [Sun, 4 Oct 2020 19:37:15 +0000 (19:37 +0000)]
Explicit CTLFLAG_DYN not needed

Dynamically created OIDs automatically get this flag set.

Reviewed by: jhb
MFC after: 1 week
Sponsored by: iXsystems, Inc.
Differential Revision: https://reviews.freebsd.org/D26561

3 years agoPopulate the acquire context field of a ww_mutex in the LinuxKPI.
hselasky [Sun, 4 Oct 2020 17:23:39 +0000 (17:23 +0000)]
Populate the acquire context field of a ww_mutex in the LinuxKPI.
Bump the FreeBSD version to force recompilation of external kernel modules.

MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D26657
Submitted by: greg_unrelenting.technology (Greg V)
Sponsored by: Mellanox Technologies // NVIDIA Networking

3 years agoAdd support for Google Cr50 (GSC) Closed Case Debugging UART interfaces to
hselasky [Sun, 4 Oct 2020 17:17:16 +0000 (17:17 +0000)]
Add support for Google Cr50 (GSC) Closed Case Debugging UART interfaces to
the USB generic serial port driver, ugensa.

MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D21863
Submitted by: greg_unrelenting.technology (Greg V)
Sponsored by: Mellanox Technologies // NVIDIA Networking

3 years agongctl: add -c (compact output) for the dot command
kevans [Sun, 4 Oct 2020 17:07:13 +0000 (17:07 +0000)]
ngctl: add -c (compact output) for the dot command

The output of "ngctl dot" is suitable for small netgraph networks. Even
moderate complex netgraph setups (about a dozen nodes) are hard to
understand from the .dot output, because each node and each hook are shown
as a full blown structure.

This patch allows to generate much more compact output and graphs by
omitting the extra structures for the individual hooks. Instead the names of
the hooks are labels to the edges.

Submitted by: Lutz Donnerhacke <lutz_donnerhacke.de>
Reviewed by: markj
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D21965

3 years agoAdd sig_intr(9).
kib [Sun, 4 Oct 2020 16:33:42 +0000 (16:33 +0000)]
Add sig_intr(9).

It gives the answer would the thread sleep according to current state
of signals and suspensions.  Of course the answer is racy and allows
for false-negatives (no sleep when signal is delivered after process
lock is dropped).  Also the answer might change due to signal
rescheduling among threads in multi-threaded process.

Still it is the best approximation I can provide, to answering the
question was the thread interrupted.

Reviewed by: markj
Tested by: pho, rmacklem
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D26628

3 years agoRefactor sleepq_catch_signals().
kib [Sun, 4 Oct 2020 16:30:05 +0000 (16:30 +0000)]
Refactor sleepq_catch_signals().

- Extract suspension check into sig_ast_checksusp() helper.
- Extract signal check and calculation of the interruption errno into
  sig_ast_needsigchk() helper.
The helpers are moved to kern_sig.c which is the proper place for
signal-related code.

Improve control flow in sleepq_catch_signals(), to handle ret == 0
(can sleep) and ret != 0 (interrupted) only once, by separating
checking code into sleepq_check_ast_sq_locked(), which return value is
interpreted at single location.

Reviewed by: markj
Tested by: pho
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D26628

3 years agoUse __func__ instead of __FUNCTION__ for consistency.
tuexen [Sun, 4 Oct 2020 15:37:34 +0000 (15:37 +0000)]
Use __func__ instead of __FUNCTION__ for consistency.

MFC after: 3 days

3 years agoCleanup, no functional change intended.
tuexen [Sun, 4 Oct 2020 15:22:14 +0000 (15:22 +0000)]
Cleanup, no functional change intended.

MFC after: 3 days

3 years agoFix route flags update during RTM_CHANGE.
melifaro [Sun, 4 Oct 2020 13:24:58 +0000 (13:24 +0000)]
Fix route flags update during RTM_CHANGE.
Nexthop lookup was not consireding rt_flags when doing
 structure comparison, which lead to an original nexthop
 selection when changing flags. Fix the case by adding
 rt_flags field into comparison and rearranging nhop_priv
 fields to allow for efficient matching.
Fix `route change X/Y flags` case - recent changes
 disallowed specifying RTF_GATEWAY flag without actual gateway.
 It turns out, route(8) fills in RTF_GATEWAY by default, unless
 -interface flag is specified. Fix regression by clearing
 RTF_GATEWAY flag instead of failing.
Fix route flag reporting in RTM_CHANGE messages by explicitly
 updating rtm_flags after operation competion.
Add IPv4/IPv6 tests for flag-only route changes.

3 years agoamd64: Store full 64bit of FIP/FDP for 64bit processes when using XSAVE.
kib [Sat, 3 Oct 2020 23:17:29 +0000 (23:17 +0000)]
amd64: Store full 64bit of FIP/FDP for 64bit processes when using XSAVE.

If current process is 64bit, use rex-prefixed version of XSAVE
(XSAVE64).  If current process is 32bit and CPU supports saving
segment registers cs/ds in the FPU save area, use non-prefixed variant
of XSAVE.

Reported and tested by: Michał Górny <mgorny@mgorny@moritz.systems>
PR: 250043
Reviewed by: emaste, markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D26643

3 years agoFix pmap_pti_add_kva() call for doublefault stack page.
kib [Sat, 3 Oct 2020 23:11:20 +0000 (23:11 +0000)]
Fix pmap_pti_add_kva() call for doublefault stack page.

After r354889 stack got struct nmi_pcpu at top, which makes IST top
not page-aligned.  Since pmap_pti_add_kva() truncates/rounds up
addresses, it erronously entered a page mapped before double fault
stack into the pti page table.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

3 years agoMove ctx_switch_xsave declaration to amd64 md_var.h.
kib [Sat, 3 Oct 2020 23:07:09 +0000 (23:07 +0000)]
Move ctx_switch_xsave declaration to amd64 md_var.h.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days

3 years agocpuset(1): Fix some issues reported by mandoc
gbe [Sat, 3 Oct 2020 19:10:54 +0000 (19:10 +0000)]
cpuset(1): Fix some issues reported by mandoc

- whitespace at end of input line
- new sentence, new line

MFC after: 1 week

3 years agoAdd virtio-9p (aka VirtFS) filesystem sharing to bhyve.
jceel [Sat, 3 Oct 2020 19:05:13 +0000 (19:05 +0000)]
Add virtio-9p (aka VirtFS) filesystem sharing to bhyve.

VirtFS allows sharing an arbitrary directory tree between bhyve virtual
machine and the host. Current implementation has a fairly complete support
for 9P2000.L protocol, except for the extended attribute support. It has
been verified to work with the qemu-kvm hypervisor.

Reviewed by: rgrimes, emaste, jhb, trasz
Approved by: trasz (mentor)
MFC after: 1 month
Relnotes: yes
Sponsored by: Conclusive Engineering (development), vStack.com (funding)
Differential Revision: https://reviews.freebsd.org/D10335

3 years agoImport lib9p 9d5aee77bcc1bf0e79b0a3bfefff5fdf2146283c.
jceel [Sat, 3 Oct 2020 18:52:54 +0000 (18:52 +0000)]
Import lib9p 9d5aee77bcc1bf0e79b0a3bfefff5fdf2146283c.

Approved by: trasz (mentor)
Sponsored by: Conclusive Engineering Sp. z o. o.

3 years agogvinum(8): Fix an issue reported by mandoc
gbe [Sat, 3 Oct 2020 18:49:00 +0000 (18:49 +0000)]
gvinum(8): Fix an issue reported by mandoc

- new sentence, new line

MFC after: 1 week

3 years agomdmfs(8): Fix an issue reported by mandoc
gbe [Sat, 3 Oct 2020 18:47:50 +0000 (18:47 +0000)]
mdmfs(8): Fix an issue reported by mandoc

- whitespace at end of input line

MFC after: 1 week

3 years agoveriexec(8): Bugfix for an issue reported by mandoc
gbe [Sat, 3 Oct 2020 18:46:42 +0000 (18:46 +0000)]
veriexec(8): Bugfix for an issue reported by mandoc

- consider using OS macro: Nx

MFC after: 1 week

3 years agofsdb(8): Fix an issue reported by mandoc
gbe [Sat, 3 Oct 2020 18:44:13 +0000 (18:44 +0000)]
fsdb(8): Fix an issue reported by mandoc

- whitespace at end of input line

MFC after: 1 week

3 years agodhclient(8): Bugfixes for some issues reported by mandoc
gbe [Sat, 3 Oct 2020 18:42:15 +0000 (18:42 +0000)]
dhclient(8): Bugfixes for some issues reported by mandoc

- no blank before trailing delimiter
- new sentence, new line

MFC after: 1 week

3 years agocamcontrol(8): Bugfixes for some issues reported by mandoc
gbe [Sat, 3 Oct 2020 18:40:02 +0000 (18:40 +0000)]
camcontrol(8): Bugfixes for some issues reported by mandoc

- new sentence, new line

MFC after: 1 week

3 years agodevd.conf(5): Bugfix for an issue reported by mandoc
gbe [Sat, 3 Oct 2020 18:37:59 +0000 (18:37 +0000)]
devd.conf(5): Bugfix for an issue reported by mandoc

- whitespace at end of input line

MFC after: 1 week

3 years agocp(1): Bugfixes for some issues reported by mandoc
gbe [Sat, 3 Oct 2020 18:36:22 +0000 (18:36 +0000)]
cp(1): Bugfixes for some issues reported by mandoc

- no blank before trailing delimiter

MFC after: 1 week

3 years agols(1): Bugfix for an issue reported by mandoc
gbe [Sat, 3 Oct 2020 18:34:24 +0000 (18:34 +0000)]
ls(1): Bugfix for an issue reported by mandoc

- no blank before trailing delimiter

MFC after: 1 week

3 years agoipfw(8): Bugfixes for some issues reported by mandoc
gbe [Sat, 3 Oct 2020 18:30:01 +0000 (18:30 +0000)]
ipfw(8): Bugfixes for some issues reported by mandoc

- whitespace at end of input line
- new sentence, new line
- skipping paragraph macro: Pp before Pp

MFC after: 1 week

3 years agoRemove ROUTE_MPATH-related warnings introduced in r366390.
melifaro [Sat, 3 Oct 2020 14:37:54 +0000 (14:37 +0000)]
Remove ROUTE_MPATH-related warnings introduced in r366390.

Reported by: mjg

3 years agopwm_backlight: Add regnode_if.h to SRCS
manu [Sat, 3 Oct 2020 14:01:20 +0000 (14:01 +0000)]
pwm_backlight: Add regnode_if.h to SRCS

If the kernel config doesn't have this pseudo device it will not be generated
and then the module will fail to compile.

Reported by: mjg

3 years agopwm_backlight: Depend on ext_resources
manu [Sat, 3 Oct 2020 14:00:33 +0000 (14:00 +0000)]
pwm_backlight: Depend on ext_resources

This driver cannot work without it.

3 years agonetmap: tools: extend CFLAGS after including bsd.prog.mk
vmaffione [Sat, 3 Oct 2020 13:27:12 +0000 (13:27 +0000)]
netmap: tools: extend CFLAGS after including bsd.prog.mk

MFC after: 1 week

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