]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/log
FreeBSD/FreeBSD.git
3 years agonetmap: bridge: update man page with more information
Vincenzo Maffione [Sat, 21 Nov 2020 18:20:21 +0000 (18:20 +0000)]
netmap: bridge: update man page with more information

Update the man page to describe how it is necessary to
enable promiscuous mode and/or disable offloads.

3 years agoRemove unused prototype.
Konstantin Belousov [Sat, 21 Nov 2020 10:58:19 +0000 (10:58 +0000)]
Remove unused prototype.

Missed part of r367918.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week

3 years agoStop using eventhandler to invoke umtx_exec hook.
Konstantin Belousov [Sat, 21 Nov 2020 10:32:40 +0000 (10:32 +0000)]
Stop using eventhandler to invoke umtx_exec hook.

There is no point in dynamic registration, umtx hook is there always.

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

3 years agocxgbe(4): Catch up with in-flight netmap rx before destroying queues.
Navdeep Parhar [Sat, 21 Nov 2020 03:27:32 +0000 (03:27 +0000)]
cxgbe(4): Catch up with in-flight netmap rx before destroying queues.

The netmap application using the driver is responsible for replenishing
the receive freelists and they may be totally depleted when the
application exits.  Packets in flight, if any, might block the pipeline
in case there aren't enough buffers left in the freelist.  Avoid this by
filling up the freelists with a driver allocated buffer.

MFC after: 1 week
Sponsored by: Chelsio Communications

3 years agoUnlucky change...
Alexander Motin [Sat, 21 Nov 2020 00:53:31 +0000 (00:53 +0000)]
Unlucky change...

MFC after: 3 days

3 years agoFix stupid math mistake in r366922.
Alexander Motin [Sat, 21 Nov 2020 00:51:39 +0000 (00:51 +0000)]
Fix stupid math mistake in r366922.

MFC after: 3 days

3 years agoDocument the new "tls" NFS mount option.
Rick Macklem [Fri, 20 Nov 2020 22:29:38 +0000 (22:29 +0000)]
Document the new "tls" NFS mount option.

Recent commits to head have added support for NFS over TLS
to the FreeBSD kernel.
To enable use of this for an NFS mount, the "tls" mount_nfs
option has been added.

Once the IETF has assigned an RFC number, I will replace "NNNN"
with the number.

This is a content change.

Reviewed by: gbe
Differential Revision: https://reviews.freebsd.org/D26262

3 years agoUpdate man page for new TLS export options.
Rick Macklem [Fri, 20 Nov 2020 22:14:51 +0000 (22:14 +0000)]
Update man page for new TLS export options.

NFS over TLS uses three new export options, added by r364979.
This patch updates the exports.5 man page for these new options.
Once assigned by IETF, "NNNN" will be replaced with the RFC number.

This is a content change.

Reviewed by: gbe
Differential Revision: https://review.freebsd.org/D26241

3 years agoOnly attempt a VOP_UNLOCK() when the vn_lock() has been successful.
Kirk McKusick [Fri, 20 Nov 2020 20:22:01 +0000 (20:22 +0000)]
Only attempt a VOP_UNLOCK() when the vn_lock() has been successful.

No MFC as this code is not present in 12-stable.

Reported by:  Peter Holm
Reviewed by:  Mateusz Guzik
Tested by:    Peter Holm
Sponsored by: Netflix

3 years agoAdd lists for customizing legacy and bootstrap-tools.
Bryan Drewery [Fri, 20 Nov 2020 20:11:59 +0000 (20:11 +0000)]
Add lists for customizing legacy and bootstrap-tools.

Reviewed by: arichardson
Sponsored by: Dell EMC
Differential Revision: https://reviews.freebsd.org/D27200

3 years agoIncrease queue depths from 1024/256 to 8192/1024 IOCBs.
Alexander Motin [Fri, 20 Nov 2020 19:36:34 +0000 (19:36 +0000)]
Increase queue depths from 1024/256 to 8192/1024 IOCBs.

Qlogic chips store S/G lists in the same queue as requests themselves.  In
the worst case 1MB I/O may require up to 52 IOCBs, that means queue of 1024
IOCBs can store only 19 of such requests.  The increase reduces chances of
overflow, while we should be able to afford additional 512KB of RAM per HBA.
The Linux driver uses comparable numbers.

While there, decouple ATIO queue size from response queue size.  There is
no reason for them to be equal.

3 years ago[POWERPC] print uprintf_signal 'type' field in hex
Alfredo Dal'Ava Junior [Fri, 20 Nov 2020 18:52:37 +0000 (18:52 +0000)]
[POWERPC] print uprintf_signal 'type' field in hex

Print 'type' field in hex to improve readability

Reviewed by: jhibbits
Differential Revision: https://reviews.freebsd.org/D27294

3 years ago[POWERPC64LE,POWEPCSPE] set default kernel config for powerpc64le and powerpcspe...
Alfredo Dal'Ava Junior [Fri, 20 Nov 2020 18:42:01 +0000 (18:42 +0000)]
[POWERPC64LE,POWEPCSPE] set default kernel config for powerpc64le and powerpcspe variants

Default KERNCONF for powerpc64le should be GENERIC64, and powerpcspe should
select MPC85XXSPE

Reviewed by: bdragon,emaste
Sponsored by: Eldorado Research Institute (eldorado.org.br)
Differential Revision: https://reviews.freebsd.org/D27257

3 years agoCleanup DMA handling.
Alexander Motin [Fri, 20 Nov 2020 18:02:04 +0000 (18:02 +0000)]
Cleanup DMA handling.

 - Make isp_start() to set all the IOCB fields aside of S/G list, removing
extra information from isp_send_cmd(), now only doing S/G lists and sending.
 - Turn DMA setup/free from being card and PCI-specific into OS-specific,
instead add new card-specific method for isp_send_cmd().  Previously this
function was a monster handling all the cards.
 - Remove double error code translation.

3 years agoWhen copying types from one CTF container to another, ensure that we
Jonathan T. Looney [Fri, 20 Nov 2020 17:26:02 +0000 (17:26 +0000)]
When copying types from one CTF container to another, ensure that we
encode 0-length (i.e. "") structure and union member names as offset 0.
This ensures that we don't confuse other parts of the CTF code which
expect this encoding.

This resolves a Dtrace error resolving members of anonymous structs/unions
within the (struct mbuf) type which some users were seeing after r366908.

While here, update the code in ctf_add_generic() to encode 0-length type
names as offset 0.

Reviewed by: markj
MFC after: 2 weeks
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D27246

3 years agohostapd.conf(5): Add missing 'l'
Gordon Bergling [Fri, 20 Nov 2020 17:13:13 +0000 (17:13 +0000)]
hostapd.conf(5): Add missing 'l'

In r367901 I accidentally deleted the 'l' while fixing a few
mandoc erros.

Spotted by: Yuri Pankov

3 years agomoused(8): Fix a few mandoc warnings
Gordon Bergling [Fri, 20 Nov 2020 17:04:49 +0000 (17:04 +0000)]
moused(8): Fix a few mandoc warnings

- new sentence, new line

3 years agocrashinfo(8): Fix a few mandoc warnings
Gordon Bergling [Fri, 20 Nov 2020 16:59:51 +0000 (16:59 +0000)]
crashinfo(8): Fix a few mandoc warnings

- new sentence, new line

3 years agohostapd.conf(5): Fix a mandoc warning
Gordon Bergling [Fri, 20 Nov 2020 16:57:06 +0000 (16:57 +0000)]
hostapd.conf(5): Fix a mandoc warning

- new sentence, new line

3 years agosyslog.conf(5): Fix a few mandoc warnings
Gordon Bergling [Fri, 20 Nov 2020 16:50:52 +0000 (16:50 +0000)]
syslog.conf(5): Fix a few mandoc warnings

- new sentence, new line
- skipping paragraph macro: Pp at the end of Sh

3 years agosnmp_wlan(3): Fix mandoc warnings
Gordon Bergling [Fri, 20 Nov 2020 16:46:51 +0000 (16:46 +0000)]
snmp_wlan(3): Fix mandoc warnings

- new sentence, new line

3 years agoiscsi.conf(5): Fix a mandoc warning
Gordon Bergling [Fri, 20 Nov 2020 16:41:32 +0000 (16:41 +0000)]
iscsi.conf(5): Fix a mandoc warning

- new sentence, new line

3 years agodevmatch(8): Fix section ordering
Gordon Bergling [Fri, 20 Nov 2020 16:34:01 +0000 (16:34 +0000)]
devmatch(8): Fix section ordering

- sections out of conventional order: Sh HISTORY

3 years agoriscv: always initialize the static kernel environment
Mitchell Horne [Fri, 20 Nov 2020 15:21:10 +0000 (15:21 +0000)]
riscv: always initialize the static kernel environment

Ensure we initialize the static environment when not booting via
loader(8), and provide a static buffer if this is the case. This fixes
two issues.

First, performing the initialization ensures that kenv variables set in
the kernel's config file are honored. Previously, any new or overridden
values were ignored.

Second, providing the static buffer allows variables to be set in the
device tree's bootargs property of the chosen node. This can be set by
u-boot or by QEMU's '-append' flag. Attempting to this prior to this
change resulted in an early panic, since the static environment had no
buffer backing it.

Submitted by: syrinx (earlier version)
Reviewed by: kp
Differential Revision: https://reviews.freebsd.org/D25034

3 years agomsdosfs: suspend around unmount or remount rw->ro.
Konstantin Belousov [Fri, 20 Nov 2020 15:19:30 +0000 (15:19 +0000)]
msdosfs: suspend around unmount or remount rw->ro.

This also eliminates unsafe use of VFS_SYNC(MNT_WAIT).

Requested by: mckusick
Discussed with: imp
Tested by: pho (previous version)
Sponsored by: The FreeBSD Foundation
MFC after: 2 weeks
Differential revision: https://reviews.freebsd.org/D27269

3 years agoMake net/ifq.h C++ friendly
Mitchell Horne [Fri, 20 Nov 2020 14:45:45 +0000 (14:45 +0000)]
Make net/ifq.h C++ friendly

Don't use "new" as an identifier, and add explicit casts from void *.

As a general policy, FreeBSD doesn't make any C++ compatibility
guarantees for kernel headers like it does for userland, but it is a
small effort to do so in this case, to the benefit of a downstream
consumer (NetApp).

Reviewed by: rscheff
Sponsored by: NetApp, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D27286

3 years agoRevert r367291 (KEYWORD: shutdown for rc.d/zfs)
Mateusz Piotrowski [Fri, 20 Nov 2020 14:37:07 +0000 (14:37 +0000)]
Revert r367291 (KEYWORD: shutdown for rc.d/zfs)

The problem is that zfs is asked to stop too early in the shutdown
sequence. Other services, such as syslog may still be running and have some
files open (e.g., under /var/log). This of course causes the messages like:

  cannot unmount '/var/run': umount failed
  cannot unmount '/var/log': umount failed
  cannot unmount '/var': umount failed
  cannot unmount '/usr/home': umount failed
  cannot unmount '/usr': umount failed
  cannot unmount '/': umount failed

For now, let's remove the shutdown KEYWORD from the zfs service, as people are
reporting problems in their setups:
https://lists.freebsd.org/pipermail/freebsd-current/2020-November/077559.html

In the future, we may think of stopping zfs on shutdown after all the other
services and just before init(8) exits. Another interesting option might be to
a new rcorder(8) KEYWORD like "shutdownjail", but this idea would need to be
discussed a bit.

Reported by: Johan Hendriks <joh.hendriks gmail.com>
Reported by: Yasuhiro KIMURA <yasu utahime.org>
Reported by: Tomoaki AOKI <junchoon dec.sakura.ne.jp>
Approved by: kevans (src)
MFC: 3 days
Differential Revision: https://reviews.freebsd.org/D27263

3 years agoUnlock channels when any of them are locked, when returning for non-busy state.
Konstantin Belousov [Fri, 20 Nov 2020 14:02:43 +0000 (14:02 +0000)]
Unlock channels when any of them are locked, when returning for non-busy state.

Reported and tested by: "Wall, Stephen" <stephen.wall@redcom.com>
Sponsored by: The FreeBSD Foundation
MFC after: 1 week

3 years agoFix an issue I introuced in r367530: tcp_twcheck() can be called
Michael Tuexen [Fri, 20 Nov 2020 13:00:28 +0000 (13:00 +0000)]
Fix an issue I introuced in r367530: tcp_twcheck() can be called
with to == NULL for SYN segments. So don't assume tp != NULL.
Thanks to jhb@ for reporting and suggesting a fix.

PR: 250499
MFC after: 1 week
XMFC-with: r367530
Sponsored by: Netflix, Inc.

3 years agomsdosfs: Add trivial support for suspension.
Konstantin Belousov [Fri, 20 Nov 2020 12:31:02 +0000 (12:31 +0000)]
msdosfs: Add trivial support for suspension.

Tested by: pho (previous version)
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D27269

3 years agocamcontrol(8): Fix some warnings spotted by mandoc
Gordon Bergling [Fri, 20 Nov 2020 11:45:08 +0000 (11:45 +0000)]
camcontrol(8): Fix some warnings spotted by mandoc

- skipping paragraph macro: Pp before Bl

3 years agoif_dwc: Add checksum offloading support
Emmanuel Vadot [Fri, 20 Nov 2020 11:31:25 +0000 (11:31 +0000)]
if_dwc: Add checksum offloading support

3 years agoif_dwc: Add flow control support
Emmanuel Vadot [Fri, 20 Nov 2020 11:31:04 +0000 (11:31 +0000)]
if_dwc: Add flow control support

3 years agoif_awg: Add a awg_dma_start_tx function that trigger dma engine
Emmanuel Vadot [Fri, 20 Nov 2020 11:30:44 +0000 (11:30 +0000)]
if_awg: Add a awg_dma_start_tx function that trigger dma engine

No functional changes intended

3 years agoif_dwc: Use if_ function where appropriate
Emmanuel Vadot [Fri, 20 Nov 2020 11:30:23 +0000 (11:30 +0000)]
if_dwc: Use if_ function where appropriate

No functional changes intended

3 years agoif_dwc: Reorder functions and sort them by usage
Emmanuel Vadot [Fri, 20 Nov 2020 11:30:01 +0000 (11:30 +0000)]
if_dwc: Reorder functions and sort them by usage

No functional changes intended

3 years agoif_awg: Reorder functions and sort them by usage
Emmanuel Vadot [Fri, 20 Nov 2020 11:29:37 +0000 (11:29 +0000)]
if_awg: Reorder functions and sort them by usage

No functional changes intended

3 years agoif_dwc: dwc_get_hwaddr cannot fail, change return to void
Emmanuel Vadot [Fri, 20 Nov 2020 11:29:20 +0000 (11:29 +0000)]
if_dwc: dwc_get_hwaddr cannot fail, change return to void

No functional changes intended

3 years agoif_dwc: Add dwc_stop_dma and use it in dwc_stop_locked
Emmanuel Vadot [Fri, 20 Nov 2020 11:29:00 +0000 (11:29 +0000)]
if_dwc: Add dwc_stop_dma and use it in dwc_stop_locked

No functional changes intended

3 years agoif_awg: Add awg_stop_dma and use it in awg_stop
Emmanuel Vadot [Fri, 20 Nov 2020 11:28:23 +0000 (11:28 +0000)]
if_awg: Add awg_stop_dma and use it in awg_stop

No functional changes intended

3 years agoif_dwc: Use dwc_enable_mac in dwc_stop_locked
Emmanuel Vadot [Fri, 20 Nov 2020 11:28:06 +0000 (11:28 +0000)]
if_dwc: Use dwc_enable_mac in dwc_stop_locked

No functional changes intended

3 years agoif_dwc: Add a function to enable/disable the mac tx/rx
Emmanuel Vadot [Fri, 20 Nov 2020 11:27:43 +0000 (11:27 +0000)]
if_dwc: Add a function to enable/disable the mac tx/rx

No functional changes intended

3 years agoif_awg: Add a function to enable/disable the mac tx/rx
Emmanuel Vadot [Fri, 20 Nov 2020 11:27:26 +0000 (11:27 +0000)]
if_awg: Add a function to enable/disable the mac tx/rx

No functional changes intended

3 years agoif_dwc: Use if_setdrvflagbits to notify that we are running
Emmanuel Vadot [Fri, 20 Nov 2020 11:27:08 +0000 (11:27 +0000)]
if_dwc: Use if_setdrvflagbits to notify that we are running

No functional changes intended

3 years agoif_dwc: Split init code into sub function
Emmanuel Vadot [Fri, 20 Nov 2020 11:26:46 +0000 (11:26 +0000)]
if_dwc: Split init code into sub function

Be clear of what we enable or init.

No functional changes intended

3 years agoif_awg: Split init code into sub function
Emmanuel Vadot [Fri, 20 Nov 2020 11:26:20 +0000 (11:26 +0000)]
if_awg: Split init code into sub function

Be clear of what we enable or init.

No functional changes intended

3 years agoif_awg: Remove the taskqueue for miibus_statchg
Emmanuel Vadot [Fri, 20 Nov 2020 11:25:54 +0000 (11:25 +0000)]
if_awg: Remove the taskqueue for miibus_statchg

I guess it was added so we can obtain the device lock but we already
have it when the function is called.

No functional changes intended

3 years agopf tests: Basic source tracking test
Kristof Provost [Fri, 20 Nov 2020 10:11:03 +0000 (10:11 +0000)]
pf tests: Basic source tracking test

MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D27255

3 years agopf: Fix incorrect assertion
Kristof Provost [Fri, 20 Nov 2020 10:08:33 +0000 (10:08 +0000)]
pf: Fix incorrect assertion

We never set PFRULE_RULESRCTRACK when calling pf_insert_src_node(). We do set
PFRULE_SRCTRACK, so update the assertion to match.

MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D27254

3 years agobzgrep: make flag --no-filename work
Eugene Grosbein [Fri, 20 Nov 2020 09:56:46 +0000 (09:56 +0000)]
bzgrep: make flag --no-filename work

PR: 248813
MFC after: 1 week

3 years agoAlso pass interrupt binding request to non-root interrupt controllers.
Michal Meloun [Fri, 20 Nov 2020 09:05:36 +0000 (09:05 +0000)]
Also pass interrupt binding request to non-root interrupt controllers.
There are message based controllers that can bind interrupts even if they are
not implemented as root controllers (such as the ITS subblock of GIC).

MFC after: 3 weeks

3 years agoMerge bmake-20201117
Simon J. Gerraty [Fri, 20 Nov 2020 06:02:31 +0000 (06:02 +0000)]
Merge bmake-20201117

o allow env var MAKE_OBJDIR_CHECK_WRITABLE=no to skip writable
  checks in InitObjdir.  Explicit .OBJDIR target always allows
  read-only directory.

o More code cleanup and refactoring.

o More unit tests

MFC after: 1 week

3 years agoMicrooptimize cam_num_doneqs math in xpt_done().
Alexander Motin [Fri, 20 Nov 2020 05:46:27 +0000 (05:46 +0000)]
Microoptimize cam_num_doneqs math in xpt_done().

MFC after: 1 week

3 years agoImport bmake-20201117
Simon J. Gerraty [Fri, 20 Nov 2020 03:54:37 +0000 (03:54 +0000)]
Import bmake-20201117

o allow env var MAKE_OBJDIR_CHECK_WRITABLE=no to skip writable
  checks in InitObjdir.  Explicit .OBJDIR target always allows
  read-only directory.

o Fix building and unit-tests on non-BSD.

o More code cleanup and refactoring.

o More unit tests

3 years agoFix r367857 build without ISP_TARGET_MODE.
Alexander Motin [Fri, 20 Nov 2020 02:03:58 +0000 (02:03 +0000)]
Fix r367857 build without ISP_TARGET_MODE.

3 years agoRemove parallel SCSI and 1/2Gb FC support from isp(4).
Alexander Motin [Fri, 20 Nov 2020 01:15:48 +0000 (01:15 +0000)]
Remove parallel SCSI and 1/2Gb FC support from isp(4).

This removes 288KB (36%) of the driver code and zillions of hacks and
workarounds, making single driver uniformly support several different
generations of hardware interfaces, not counting minor card variations.
After years of the hopeless fight, I don't think it worth to continue
support for hardware obsolete for 15-20 years.  Instead much cleaner
now code should allow to move forward toward better locking, multiple
queues and other cool features.

All the remaining Qlogic cards starting from 4Gb 24xx to 32Gb 27xx use
the same hardware/firmware interface with minor incremental improvements,
so it seems to be a good new starting point.  Except one PCI-X model all
all of them are PCIe and so still usable in modern systems.

Discussed with: ken, scottl, jpaetzel, imp
Relnotes: yes

3 years agopsm(4): Disable AUX multiplexer probing on all Lenovo laptops.
Vladimir Kondratyev [Fri, 20 Nov 2020 00:13:30 +0000 (00:13 +0000)]
psm(4): Disable AUX multiplexer probing on all Lenovo laptops.

Rudimentary AUX multiplexing support was added to kernel to make possible
touchpad initialization on some HP EliteBook laptops with trackpoint.

Disable multiplexer probing on all Lenovo laptops now as they use touchpad
pass-through port rather than AUX multiplexer to connect trackpoint and
at least two model (X120e and X121e) is known for getting PS/2 AUX port
dysfunctional after switching back to hidden multiplexing mode.

AUX MUX probing can be reenabled with setting of hw.psm.mux_disabled loader
tunable to 0.

PR: 249987
Reported by: jwb
MFC after: 2 weeks

3 years agoaddr2line: swap if conditions for diff reduction in upcoming change
Ed Maste [Thu, 19 Nov 2020 21:10:36 +0000 (21:10 +0000)]
addr2line: swap if conditions for diff reduction in upcoming change

No functional change intended.

3 years agopipe: thundering herd problem in pipelock
Mateusz Guzik [Thu, 19 Nov 2020 19:25:47 +0000 (19:25 +0000)]
pipe: thundering herd problem in pipelock

All reads and writes are serialized with a hand-rolled lock, but unlocking it
always wakes up all waiters. Existing flag fields get resized to make room for
introduction of waiter counter without growing the struct.

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

3 years agofstat(1): Add EXAMPLES section
Fernando Apesteguía [Thu, 19 Nov 2020 19:05:16 +0000 (19:05 +0000)]
fstat(1): Add EXAMPLES section

* Add examples covering -f, -m and -p flags.

While here, extend the initial description paragraph to note that fstat(1)
will report on all opened files, belonging to processes the user has access to.
The current paragraph may lead to understand that you can get information on
opened files from processes belonging to other users.

Reviewed by: bjk@, danfe@, gbe@
Approved by: manpages (gbe@)
Differential Revision: https://reviews.freebsd.org/D26949

3 years agogrep(1): Add more EXAMPLES
Fernando Apesteguía [Thu, 19 Nov 2020 18:58:15 +0000 (18:58 +0000)]
grep(1): Add more EXAMPLES

* Add more EXAMPLES covering flags: -A, -B, -c, -f, -i, -H, -l, -q, -R, -w
* While here, change existing wording to use the imperative (remove "To
  find")
* Reword first example to be consistent with how grep(1) understand
  words (-w)

Approved by: manpages (bcr@)
Differential Revision: https://reviews.freebsd.org/D27264

3 years agocallout(9): Fix a race between CPU migration and callout_drain()
Mark Johnston [Thu, 19 Nov 2020 18:37:28 +0000 (18:37 +0000)]
callout(9): Fix a race between CPU migration and callout_drain()

Suppose a running callout re-arms itself, and before the callout
finishes running another CPU calls callout_drain() and goes to sleep.
softclock_call_cc() will wake up the draining thread, which may not run
immediately if there is a lot of CPU load.  Furthermore, the callout is
still in the callout wheel so it can continue to run and re-arm itself.
Then, suppose that the callout migrates to another CPU before the
draining thread gets a chance to run.  The draining thread is in this
loop in _callout_stop_safe():

while (cc_exec_curr(cc) == c) {
CC_UNLOCK(cc);
sleep();
CC_LOCK(cc);
}

but after the migration, cc points to the wrong CPU's callout state.
Then the draining thread goes off and removes the callout from the
wheel, but does so using the wrong lock and per-CPU callout state.

Fix the problem by doing a re-lookup of the callout CPU after sleeping.

Reported by: syzbot+79569cd4d76636b2cc1c@syzkaller.appspotmail.com
Reported by: syzbot+1b27e0237aa22d8adffa@syzkaller.appspotmail.com
Reported by: syzbot+e21aa5b85a9aff90ef3e@syzkaller.appspotmail.com
Reviewed by: emaste, hselasky
Tested by: pho
MFC after: 1 week
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D27266

3 years agoAdd an option for entering KDB on recursive panics
Mitchell Horne [Thu, 19 Nov 2020 18:03:40 +0000 (18:03 +0000)]
Add an option for entering KDB on recursive panics

There are many cases where one would choose avoid entering the debugger
on a normal panic, opting instead to reboot and possibly save a kernel
dump. However, recursive kernel panics are an unusual case that might
warrant attention from a human, so provide a secondary tunable,
debug.debugger_on_recursive_panic, to allow entering the debugger only
when this occurs.

For for simplicity in maintaining existing behaviour, the tunable
defaults to zero.

Reviewed by: cem, markj
Sponsored by: NetApp, Inc.
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D27271

3 years agoDocument disk ioctl
Warner Losh [Thu, 19 Nov 2020 17:54:41 +0000 (17:54 +0000)]
Document disk ioctl

First stab at documenting the different disk ioctl commands defined in
sys/disk.h.

Reviewed by: phk (prior version)
Differential Revision: https://reviews.freebsd.org/D26994

3 years agointro.7: Add missing manual page
Daniel Ebdrup Jensen [Thu, 19 Nov 2020 16:57:45 +0000 (16:57 +0000)]
intro.7: Add missing manual page

Section 7 of the manual pages contain lots of very useful information, but
finding the pages is not always obvious - to assist people in finding the
information, add missing cross-references.

Reviewed by: 0mp (mentor), mhorne, yuripv
Approved by: 0mp (mentor
Differential Revision: https://reviews.freebsd.org/D27284

3 years agoWrap a long line in vm_pqbatch_process_page()
Mark Johnston [Thu, 19 Nov 2020 15:41:42 +0000 (15:41 +0000)]
Wrap a long line in vm_pqbatch_process_page()

3 years agoMicro-optimize vm_page_pqbatch_submit()
Mark Johnston [Thu, 19 Nov 2020 15:40:58 +0000 (15:40 +0000)]
Micro-optimize vm_page_pqbatch_submit()

Avoid calling vm_page_domain() twice.

Discussed with: alc (in D27207)

3 years agorelease: Switch the Allwinner board to GPT
Emmanuel Vadot [Thu, 19 Nov 2020 14:27:01 +0000 (14:27 +0000)]
release: Switch the Allwinner board to GPT

Allwinner bootrom have an alternate location for u-boot at 128k.
Work was made recently in u-boot to relocate correctly if loaded from
there.
The advantage of this offset is that we can now use a GPT scheme.

3 years agothread: numa-aware zombie reaping
Mateusz Guzik [Thu, 19 Nov 2020 10:00:48 +0000 (10:00 +0000)]
thread: numa-aware zombie reaping

The current global list is a significant problem, in particular induces a lot
of cross-domain thread frees. When running poudriere on a 2 domain box about
half of all frees were of that nature.

Patch below introduces per-domain thread data containing zombie lists and
domain-aware reaping. By default it only reaps from the current domain, only
reaping from others if there is free TID shortage.

A dedicated callout is introduced to reap lingering threads if there happens
to be no activity.

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

3 years agoFall back to use the GICR address from the generic interrupt struct
Andrew Turner [Thu, 19 Nov 2020 09:26:51 +0000 (09:26 +0000)]
Fall back to use the GICR address from the generic interrupt struct

When there is no ACPI redistributor sub-table in the MADT we need to
fall back to use the GICR base address from the GIC CPU interface
structure.

Handle this fallback when adding memory to the device and when counting
the number of redistributors.

PR: 251171
Reported by: Andrey Fesenko <f0andrey_gmail.com>
Sponsored by: Innovate UK
Differential Revision: https://reviews.freebsd.org/D27247

3 years agopipe: tidy up pipelock
Mateusz Guzik [Thu, 19 Nov 2020 08:16:45 +0000 (08:16 +0000)]
pipe: tidy up pipelock

3 years agoAdvance RIP after userspace instruction decode
Peter Grehan [Thu, 19 Nov 2020 07:23:39 +0000 (07:23 +0000)]
Advance RIP after userspace instruction decode

Add update to RIP after a userspace instruction decode (as is done for
the in-kernel counterpart of this case).

Submitted by: adam_fenn.io
Reviewed by: cem, markj
Approved by: grehan (bhyve)
MFC after: 3 weeks
Differential Revision: https://reviews.freebsd.org/D27243

3 years agopipe: allow for lockless pipe_stat
Mateusz Guzik [Thu, 19 Nov 2020 06:30:25 +0000 (06:30 +0000)]
pipe: allow for lockless pipe_stat

pipes get stated all thet time and this avoidably contributed to contention.
The pipe lock is only held to accomodate MAC and to check the type.

Since normally there is no probe for pipe stat depessimize this by having the
flag.

The pipe_state field gets modified with locks held all the time and it's not
feasible to convert them to use atomic store. Move the type flag away to a
separate variable as a simple cleanup and to provide stable field to read.
Use short for both fields to avoid growing the struct.

While here short-circuit MAC for pipe_poll as well.

3 years agoMerge upstream r948: fix race condition in openpam_ttyconv(3).
Dag-Erling Smørgrav [Thu, 19 Nov 2020 05:46:59 +0000 (05:46 +0000)]
Merge upstream r948: fix race condition in openpam_ttyconv(3).

3 years agoMerge upstream r948: fix race condition in openpam_ttyconv(3).
Dag-Erling Smørgrav [Thu, 19 Nov 2020 05:44:41 +0000 (05:44 +0000)]
Merge upstream r948: fix race condition in openpam_ttyconv(3).

3 years agocred: fix minor nits in r367695
Mateusz Guzik [Thu, 19 Nov 2020 04:28:39 +0000 (04:28 +0000)]
cred: fix minor nits in r367695

Noted by: jhb

3 years agosmp: fix smp_rendezvous_cpus_retry usage before smp starts
Mateusz Guzik [Thu, 19 Nov 2020 04:27:51 +0000 (04:27 +0000)]
smp: fix smp_rendezvous_cpus_retry usage before smp starts

Since none of the other CPUs are running there is nobody to clear their
entries and the routine spins indefinitely.

3 years agovm_phys: Try to clean up NUMA KPIs
Mark Johnston [Thu, 19 Nov 2020 03:59:21 +0000 (03:59 +0000)]
vm_phys: Try to clean up NUMA KPIs

It can useful for code outside the VM system to look up the NUMA domain
of a page backing a virtual or physical address, specifically when
creating NUMA-aware data structures.  We have _vm_phys_domain() for
this, but the leading underscore implies that it's an internal function,
and vm_phys.h has dependencies on a number of other headers.

Rename vm_phys_domain() to vm_page_domain(), and _vm_phys_domain() to
vm_phys_domain().  Make the latter an inline function.

Add _vm_phys.h and define struct vm_phys_seg there so that it's easier
to use in other headers.  Include it from vm_page.h so that
vm_page_domain() can be defined there.

Include machine/vmparam.h from _vm_phys.h since it depends directly on
some constants defined there.

Reviewed by: alc
Reviewed by: dougm, kib (earlier versions)
Differential Revision: https://reviews.freebsd.org/D27207

3 years agoMove kern_clocksource.c to sys/conf/files
Mark Johnston [Thu, 19 Nov 2020 02:53:29 +0000 (02:53 +0000)]
Move kern_clocksource.c to sys/conf/files

Sponsored by: The FreeBSD Foundation

3 years agoRemove NO_EVENTTIMERS support
Mark Johnston [Thu, 19 Nov 2020 02:50:48 +0000 (02:50 +0000)]
Remove NO_EVENTTIMERS support

The arm configs that required it have been removed from the tree.
Removing this option makes the callout code easier to read and
discourages developers from adding new configs without eventtimer
drivers.

Reviewed by: ian, imp, mav
Sponsored by: The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D27270

3 years agoAdd '-u' switch that would uncompress cores that were compressed by
Gleb Smirnoff [Thu, 19 Nov 2020 02:20:38 +0000 (02:20 +0000)]
Add '-u' switch that would uncompress cores that were compressed by
kernel during dump time.

A real life scenario is that cores are compressed to reduce
size of dumpon partition, but we either don't care about space
in the /var/crash or we have a filesystem level compression of
/var/crash. And we want cores to be uncompressed in /var/crash
because we'd like to instantily read them with kgdb. In this
case we want kernel to write cores compressed, but savecore(1)
write them uncompressed.

Reviewed by: markj, gallatin
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D27245

3 years agolibc: fix undefined behavior from signed overflow in strstr and memmem
Ed Maste [Thu, 19 Nov 2020 00:03:15 +0000 (00:03 +0000)]
libc: fix undefined behavior from signed overflow in strstr and memmem

unsigned char promotes to int, which can overflow when shifted left by
24 bits or more. this has been reported multiple times but then
forgotten. it's expected to be benign UB, but can trap when built with
explicit overflow catching (ubsan or similar). fix it now.

note that promotion to uint32_t is safe and portable even outside of
the assumptions usually made in musl, since either uint32_t has rank
at least unsigned int, so that no further default promotions happen,
or int is wide enough that the shift can't overflow. this is a
desirable property to have in case someone wants to reuse the code
elsewhere.

musl commit: 593caa456309714402ca4cb77c3770f4c24da9da

Obtained from: musl

3 years agolibc: optimize memmem two-way bad character shift
Ed Maste [Thu, 19 Nov 2020 00:02:12 +0000 (00:02 +0000)]
libc: optimize memmem two-way bad character shift

first, the condition (mem && k < p) is redundant, because mem being
nonzero implies the needle is periodic with period exactly p, in which
case any byte that appears in the needle must appear in the last p
bytes of the needle, bounding the shift (k) by p.

second, the whole point of replacing the shift k by mem (=l-p) is to
prevent shifting by less than mem when discarding the memory on shift,
in which case linear time could not be guaranteed. but as written, the
check also replaced shifts greater than mem by mem, reducing the
benefit of the shift. there is no possible benefit to this reduction of
the shift; since mem is being cleared, the full shift is valid and
more optimal. so only replace the shift by mem when it would be less
than mem.

musl commits:
8f5a820d147da36bcdbddd201b35d293699dacd8
122d67f846cb0be2c9e1c3880db9eb9545bbe38c

Obtained from: musl
MFC after: 2 weeks

3 years agoclang-format libc string functions imported from musl
Ed Maste [Wed, 18 Nov 2020 22:01:34 +0000 (22:01 +0000)]
clang-format libc string functions imported from musl

We have adopted these and don't consider them 'contrib' code, so bring
them closer to style(9).  This is a followon to r315467 and r351700.

MFC after: 1 week
Sponsored by: The FreeBSD Foundation

3 years agoAdd CTLFLAG_MPSAFE to the suser_enabled sysctl.
Mariusz Zaborski [Wed, 18 Nov 2020 21:26:14 +0000 (21:26 +0000)]
Add CTLFLAG_MPSAFE to the suser_enabled sysctl.

Pointed out by: mjg

3 years agojail: introduce per jail suser_enabled setting
Mariusz Zaborski [Wed, 18 Nov 2020 21:07:08 +0000 (21:07 +0000)]
jail: introduce per jail suser_enabled setting

The suser_enable sysctl allows to remove a privileged rights from uid 0.
This change introduce per jail setting which allow to make root a
normal user.

Reviewed by: jamie
Previous version reviewed by: kevans, emaste, markj, me_igalic.co
Discussed with: pjd
Differential Revision: https://reviews.freebsd.org/D27128

3 years agoFix style nits.
Mariusz Zaborski [Wed, 18 Nov 2020 20:59:58 +0000 (20:59 +0000)]
Fix style nits.

3 years agomsdosfs(5): Fix debug-only format string
Conrad Meyer [Wed, 18 Nov 2020 20:20:03 +0000 (20:20 +0000)]
msdosfs(5): Fix debug-only format string

No functional change; MSDOSFS_DEBUG isn't a real build option, so this isn't
covered by LINT kernels.

3 years agoMake use of the getlocalbase() function for run-time adjustment of the
Stefan Eßer [Wed, 18 Nov 2020 20:00:55 +0000 (20:00 +0000)]
Make use of the getlocalbase() function for run-time adjustment of the
local software base directory, as committed in SVN rev. 367813.

The pkg and mailwrapper programs used the LOCALBASE environment variable
for this purpose and this functionality is preserved by getlocalbase().

After this change, the value of the user.localbase sysctl variable is used
if present (and not overridden in the environment).

The nvmecontrol program gains support of a dynamic path to its plugin
directory with this update.

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

3 years agoFor llvm's internal function which retrieves the number of available
Dimitry Andric [Wed, 18 Nov 2020 19:55:24 +0000 (19:55 +0000)]
For llvm's internal function which retrieves the number of available
"hardware threads", use cpuset_getaffinity(2) on FreeBSD, so it will
honor processor sets configured by the cpuset(1) command.

This should make it possible to avoid e.g. lld creating a huge number of
threads on a machine with many cores, even for linking simple programs.

This will also be submitted upstream.

Submitted by: mjg
MFC after: 1 week

3 years agofd: reorder struct file to reduce false sharing
Mateusz Guzik [Wed, 18 Nov 2020 19:47:24 +0000 (19:47 +0000)]
fd: reorder struct file to reduce false sharing

The size on LP64 is 80 bytes, which is just more than a cacheline, does
not lend itself to easy shrinking and rounding up to 2 would be a huge
waste given NOFREE marker.

The least which can be done is to reorder it so that most commonly used
fields are less likely to span different lines, and consequently suffer
less false sharing.

With the change at hand most commonly used fields land in the same line
about 3/4 of the time, as opposed to 2/4.

3 years agoAdd function getlocalbase() to libutil.
Stefan Eßer [Wed, 18 Nov 2020 19:44:30 +0000 (19:44 +0000)]
Add function getlocalbase() to libutil.

This function returns the path to the local software base directory, by
default "/usr/local" (or the value of _PATH_LOCALBASE in include/paths.h
when building the world).

The value returned can be overridden by 2 methods:

- the LOCALBASE environment variable (ignored by SUID programs)
- else a non-default user.localbase sysctl value

Reviewed by: hps (earlier version)
Relnotes: yes
Differential Revision: https://reviews.freebsd.org/D27236

3 years agoipheth(4): Fix for iOS 14
Li-Wen Hsu [Wed, 18 Nov 2020 19:35:30 +0000 (19:35 +0000)]
ipheth(4): Fix for iOS 14

Fix USB tethering for iOS 14.

Inspired by: https://github.com/libimobiledevice/libimobiledevice/issues/1038

PR: 249979
Reviewed by: hselasky
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D27250

3 years agomsun tests: use standard floating-point exception flags on lrint and fenv tests
Alfredo Dal'Ava Junior [Wed, 18 Nov 2020 19:23:30 +0000 (19:23 +0000)]
msun tests: use standard floating-point exception flags on lrint and fenv tests

Some platforms have additional architecture-specific floating-point flags.
Msun test cases lrint and test_fegsetenv (fenv) expects only standard flags,
so make sure to mask them appropriately.

This makes test pass on PowerPC64.

Reviewed by: jhibbits, ngie
Sponsored by: Eldorado Research Institute (eldorado.org.br)
Differential Revision: https://reviews.freebsd.org/D27202

3 years agomergemaster: handle symbolic links during update.
Warner Losh [Wed, 18 Nov 2020 19:22:24 +0000 (19:22 +0000)]
mergemaster: handle symbolic links during update.

/etc/os-release is now a symbolic link to a generated file. Make
mergemaster cope with symbolic links generically. I'm no longer
a big mergemaster user, so this has only been lightly tested
by me, though Kimura-san has ran it through its paces.

Submitted by: Yasushiro KIMURA-san
PR: 242212
MFC After: 2 weeks

3 years agoWhen elftoolchain's objcopy (or strip) is rewriting a file in-place,
Dimitry Andric [Wed, 18 Nov 2020 18:40:58 +0000 (18:40 +0000)]
When elftoolchain's objcopy (or strip) is rewriting a file in-place,
make it create the temporary file in the same directory as the source
file by default, instead of always using $TMPDIR or /tmp. If creating
that file fails because the directory is not writable, also fallback to
$TMPDIR or /tmp.

This has also been submitted upstream as:
https://sourceforge.net/p/elftoolchain/tickets/597/

Reported by: cem
PR: 250872
MFC after: 2 weeks

3 years agoFix octeon_pmc post-r334827
Justin Hibbits [Wed, 18 Nov 2020 17:37:01 +0000 (17:37 +0000)]
Fix octeon_pmc post-r334827

MFC after: 3 days
Sponsored by: Juniper Networks, Inc

3 years agoFix a few nits in vn_printf().
John Baldwin [Wed, 18 Nov 2020 16:21:37 +0000 (16:21 +0000)]
Fix a few nits in vn_printf().

- Mask out recently added VV_* bits to avoid printing them twice.

- Keep VI_LOCKed on the same line as the rest of the flags.

Reviewed by: kib
Obtained from: CheriBSD
Sponsored by: DARPA
Differential Revision: https://reviews.freebsd.org/D27261

3 years agoUpdate ENA driver version to v2.3.0
Marcin Wojtas [Wed, 18 Nov 2020 15:25:38 +0000 (15:25 +0000)]
Update ENA driver version to v2.3.0

The v2.3.0 introduces new ena_com layer, ENI metrics updates and SPDX
license tags.

Submitted by:   Michal Krawczyk <mk@semihalf.com>
Obtained from:  Semihalf
Sponsored by:   Amazon, Inc
MFC after:      1 week
Differential revision:  https://reviews.freebsd.org/D27120

3 years agoFix mandoc lint warnings.
Nick Hibma [Wed, 18 Nov 2020 15:23:43 +0000 (15:23 +0000)]
Fix mandoc lint warnings.