FreeBSD/src af238d5 — contrib/kyua/cli cmd_debug.cpp, contrib/kyua/doc kyuafile.5.in kyuafile.5

kyua: Fixes after vendor merge

Reviewed by:    ngie
MFC after:      1 month
Differential Revision:  https://reviews.freebsd.org/D60446
DeltaFile
+31-16contrib/kyua/model/metadata.cpp
+10-6contrib/kyua/os/freebsd/main.cpp
+2-2contrib/kyua/engine/scheduler.cpp
+2-2contrib/kyua/cli/cmd_debug.cpp
+1-0contrib/kyua/doc/kyuafile.5.in
+1-0contrib/kyua/doc/kyuafile.5
+47-266 files

FreeBSD/src dbec277 — sys/arm64/arm64 pmap.c

arm64 pmap: correct the condition for flushing the icache

Whenever we create a user-space mapping, we always set ATTR_S1_PXN in
the PTE, which blocks execution of user-space code while running in
kernel mode.  However, when seeking to determine whether we need to
perform an icache flush before installing the new PTE, we test whether
sometimes the old PTE or other times the new PTE has ATTR_S1_XN set.
The trouble is that ATTR_S1_XN is defined as the bitwise OR of
ATTR_S1_PXN and ATTR_S1_UXN, and so the test for whether ATTR_S1_XN is
set is satisfied if either of its constituent bits is set, i.e., we
write (l3e & ATTR_S1_XN) != 0.  Consequently, the test is always true.

In practice, I believe that the ill effects of this bug are limited:
In pmap_enter(), in rare circumstances, e.g., wiring a code page, an
unnecessary icache flush will be performed.  In pmap_enter_l2() and
pmap_enter_l3c(), no icache flush will be performed.  However,
typically an icache flush would have already been performed on each of
the constituent base pages.

(cherry picked from commit 57407179be431dbe567de083aab5ce152163f4d3)
DeltaFile
+4-4sys/arm64/arm64/pmap.c
+4-41 files

FreeBSD/src 23b3267 — sys/kern vfs_lookup.c

namei: retry absolute symlink expansions from the native root

For a Linux ABI process, namei() resolves a path first under the ABI
root (compat.linux.emul_path) and, if that fails, restarts the walk
of the original path from the native root.  Since 459ac3044b51 an
absolute symlink target found during the ABI pass stays under the
ABI root, so self-contained Linux userlands resolve their own
symlinks correctly (PR 289739); but when the target names a file
that exists only in the native namespace, the walk fails and the
restart cannot recover: it re-walks the original path, whose
ABI-visible prefix (the symlink itself) does not exist natively.

Casualties are the absolute symlinks planted under the emulator root
to integrate the host into the Linux namespace -- among them
linux-rl9-fontconfig's /compat/linux/etc/fonts ->
/usr/local/etc/fonts (Linux fontconfig cannot load its
configuration, degrading font matching to arbitrary results) and
similar links from linux-rl9-alsa-lib and linux-rl9-ca-certificates
-- and linprocfs' /proc/<pid>/exe, whose target is a host path:

    [22 lines not shown]
DeltaFile
+105-1sys/kern/vfs_lookup.c
+105-11 files

FreeBSD/src 158c592 — usr.sbin/sysconf sysconf_priv.h sysconf-targets.c

sysconf: report a truncated keyword match list

snprintf(3) returns the length that would have been written, so an
ambiguous prefix can fill the match buffer with no sign that names
were cut off.  Append " (truncated)" when that happens.  Drop the
empty statement when scanning option arguments: only a separate
argument consumes the next argv entry.

Bump sysconf(8) to 2.2.1.

Suggested by:   fuz
Reviewed by:    fuz
Differential Revision:  https://reviews.freebsd.org/D60815
DeltaFile
+13-7usr.sbin/sysconf/sysconf-targets.c
+1-1usr.sbin/sysconf/sysconf_priv.h
+14-82 files

FreeBSD/src 2ff9182 — sys/compat/linuxkpi/common/src linux_work.c

LinuxKPI: account for delayed work cancelled after taskqueue dequeue

I encounter intermittent shutdown/restart hangs with i915/GuC and the
normal 34 ms scheduling-disable delay. Setting that delay to zero has
avoided the hang in my testing. This change fixes a reproducible
LinuxKPI cancellation-accounting defect that can leave the
corresponding context reference unreleased, rather than changing the
driver's delay.

Commit 79e290d96786 corrected the ordinary queued and already-executing
return values of cancel_delayed_work_sync(). There is still a gap
between native taskqueue dequeue and LinuxKPI callback ownership:

1. In sys/kern/subr_taskqueue.c, taskqueue_run_locked() removes the
   task, clears ta_pending and sets tb_running before calling its
   handler.
2. Before linux_work_fn() claims the callback,
   linux_cancel_delayed_work_sync_int() atomically changes WORK_ST_TASK
   to WORK_ST_IDLE.

    [34 lines not shown]
DeltaFile
+16-7sys/compat/linuxkpi/common/src/linux_work.c
+16-71 files

FreeBSD/src 64b2fea — sys/powerpc/powerpc exec_machdep.c

powerpc: keep the VSX halves of the FPRs across back-to-back signals

grab_mcontext() only put the second halves of vs0-31 into the context
while the thread owned the VSX unit, but sigreturn(2) gives ownership
up so that the next use reloads the registers lazily. A signal that
arrives right after a sigreturn, like one the handler's mask was
holding back, got a context without them and its own sigreturn then
zeroed them in the PCB.

The halves saved in the PCB are current whenever the FP state is, since
VSX instructions can't run without PCB_VSX and save_fpu() stores them
in that case, so export them together with the FP registers.

Reviewed by:    jhibbits
MFC after:      1 week
Differential Revision:  https://reviews.freebsd.org/D60754
DeltaFile
+14-6sys/powerpc/powerpc/exec_machdep.c
+14-61 files

FreeBSD/src 747ee16 — sys/dev/sound/pcm mixer.c

sound: Lock around mixer_set*() in mixer_init() for consistency

Sponsored by:   The FreeBSD Foundation
MFC after:      1 month
Differential Revision:  https://reviews.freebsd.org/D59110

(cherry picked from commit 47cf9dc7861371edcfdb85a38e2c240f430ccb28)
DeltaFile
+5-0sys/dev/sound/pcm/mixer.c
+5-01 files

FreeBSD/src 4f4531b — sys/dev/sound/pcm mixer.c

sound: Remove unncessary locking in sysctl_hw_snd_hwvol_mixer()

The locking around strlcpy() was because of m->hwvol_mixer, but this is
just an int, so we don't need to lock in this case. Instead lock only
when m->hwvol_mixer is written.

While here, add parentheses around the returns.

Sponsored by:   The FreeBSD Foundation
MFC after:      1 month
Differential Revision:  https://reviews.freebsd.org/D59109

(cherry picked from commit 044ef293a8bbd057de3fb13ec97d3d0ee16462e4)
DeltaFile
+6-12sys/dev/sound/pcm/mixer.c
+6-121 files

FreeBSD/src 332d81c — sys/dev/sound/pcm mixer.c

sound: Reuse mixer_delete() in mixer_uninit()

Sponsored by:   The FreeBSD Foundation
MFC after:      1 month
Differential Revision:  https://reviews.freebsd.org/D59077

(cherry picked from commit 6c735475aeefc626962818c0ab8749aaeb6de9a4)
DeltaFile
+1-7sys/dev/sound/pcm/mixer.c
+1-71 files

FreeBSD/src de7cd7f — sys/dev/sound/pcm mixer.h mixer.c, sys/dev/sound/usb uaudio.c

sound: Retire mixer_hwvol locked variants

Prior to 9a00e0b8ca56 ("snd_uaudio: Do not use snd_mixer->lock as
mixer_lock"), there was a need for mixer_hwvol_mute_locked() and
mixer_hwvol_step_locked(), because the unlocked variants would acquire
the lock, but uaudio_hid_rx_callback() would also hold the lock, so this
was a measure to avoid recursion on snd_mixer->lock. Now that
snd_uaudio(4) has a private mixer lock, the locked variants are not only
unnecessary, but wrong, because we now lock the private lock and not the
snd_mixer one, which is what mixer_hwvol_mute_locked() and
mixer_hwvol_step_locked() expect. Retire the locked variants and call
the regular functions instead.

The unlocked variants take the mixer lock, which is now the PCM lock,
and reach uaudio_mixer_ctl_set(), which takes mixer_lock. Calling them
straight from uaudio_hid_rx_callback() would therefore take mixer_lock
and the PCM lock in the opposite order to the mixer ioctl path, so
record what the HID report asked for and perform the volume change at
the end of the callback, with mixer_lock dropped. The USB stack allows a

    [7 lines not shown]
DeltaFile
+28-3sys/dev/sound/usb/uaudio.c
+5-19sys/dev/sound/pcm/mixer.c
+0-2sys/dev/sound/pcm/mixer.h
+33-243 files

FreeBSD/src 0fcd6a1 — sys/dev/sound/macio onyx.c tumbler.c, sys/dev/sound/pci neomagic-coeff.h solo.c

sound: Use uint8_t instead of legacy u_char

No functional change intended.

MFC after:      1 week
Sponsored by:   The FreeBSD Foundation

(cherry picked from commit 2793e5498dd9bceada62ebe38967d89180bd15f6)
DeltaFile
+30-30sys/dev/sound/macio/snapper.c
+22-22sys/dev/sound/macio/tumbler.c
+13-13sys/dev/sound/pci/solo.c
+13-13sys/dev/sound/macio/onyx.c
+10-10sys/dev/sound/pci/hda/hdaa.h
+1-1sys/dev/sound/pci/neomagic-coeff.h
+89-891 files not shown
+90-907 files

FreeBSD/src 6d1ff70 — sys/dev/sound/pcm mixer.c

sound: Improve some mixer return values and their handling

Sponsored by:   The FreeBSD Foundation
MFC after:      1 month
Differential Revision:  https://reviews.freebsd.org/D59078

(cherry picked from commit db62d784f02a913c7fca612b04585c633ba8277c)
DeltaFile
+10-10sys/dev/sound/pcm/mixer.c
+10-101 files

FreeBSD/src 03b8055 — sys/dev/sound/pcm mixer.c

sound: Do not set a recording source in mixer_uninit()

We currently set the recording source to SOUND_MIXER_MIC during mixer
deletion. Apart from the fact that this control might not be present on
all devices, it is unnecessary to do that, plus we already set all the
volumes to 0 in the mixer_set() call above.

Sponsored by:   The FreeBSD Foundation
MFC after:      1 month
Differential Revision:  https://reviews.freebsd.org/D59076

(cherry picked from commit 03b59d2e7df263ea5a8904e5593d14f6e3e0fbd8)
DeltaFile
+0-2sys/dev/sound/pcm/mixer.c
+0-21 files

FreeBSD/src 3e19ea7 — sys/dev/sound/pcm mixer.h channel.c

sound: Use snddev_info->lock in place of snd_mixer->lock

snd_mixer and snddev_info have a 1:1 relationship. Now that snd_mixer is
embedded into snddev_info, it makes even more sense for both to share
the PCM lock. The only exceptions to this are MIXER_TYPE_SECONDARY
mixers, which still retain a private lock (snd_mixer->priv_lock),
because they are attached to the device driver, and not snddev_info.
Only snd_emu10kx(4) uses a secondary mixer.

A side-effect of this is that the MIXER_SET_LOCK()/MIXER_SET_UNLOCK()
mess goes away. These macros were used in the mixer_set*() functions to
drop the mixer lock if the driver is Giant-locked and the function can
sleep inside MIXER_SET*() methods, and to avoid an LOR before locking
PCM to guard channel list traversal.

Since mixers now use the PCM lock, drop the channel lock in
chn_syncstate() before calling mix_get(), to avoid an LOR. These lines
were actually already commented out for years.


    [5 lines not shown]
DeltaFile
+46-123sys/dev/sound/pcm/mixer.c
+4-4sys/dev/sound/pcm/channel.c
+2-1sys/dev/sound/pcm/mixer.h
+52-1283 files

FreeBSD/src 7ca2e1c — sys/dev/sound/macio tumbler.c snapper.c

sound: Defer macio codec volume writes to a task

tumbler(4), snapper(4) and onyx(4) write the volume over I2C, and
iicbus_transfer() sleeps. This is why mixer_set() drops the mixer lock
around MIXER_SET() for non-MPSAFE drivers, relying on Giant to keep them
serialized.

Store the volume in the softc and let a task do the I2C write with no
lock held, so that the mixer method does not sleep at all. The lock
dropping for non-MPSAFE drivers will be removed in a follow-up patch.

Sponsored by:   The FreeBSD Foundation
MFC after:      1 month
Differential Revision:  https://reviews.freebsd.org/D59073

(cherry picked from commit b9761547077fb94e12c0bfa81f3b8b2b2df3c0bb)
DeltaFile
+40-2sys/dev/sound/macio/onyx.c
+36-1sys/dev/sound/macio/tumbler.c
+36-1sys/dev/sound/macio/snapper.c
+112-43 files

FreeBSD/src 017cf4b — sys/dev/sound/pci es137x.c, sys/dev/sound/pcm sound.h mixer.h

sound: Embed mixer cdev in snd_mixer

The mixer cdev belongs to the mixer, not to the PCM device, so move it
from snddev_info->mixer_dev into a new snd_mixer->cdev field. snd_mixer
itself is now included in snddev_info.

Also add a MIXER_REGISTERED() macro similar to PCM_REGISTERED().

Sponsored by:   The FreeBSD Foundation
MFC after:      1 month
Differential Revision:  https://reviews.freebsd.org/D59071

(cherry picked from commit a614c07ad4520c072f58aebee54d16d9b72837f5)
DeltaFile
+17-20sys/dev/sound/pcm/mixer.c
+8-8sys/dev/sound/pcm/dsp.c
+3-0sys/dev/sound/pcm/mixer.h
+1-1sys/dev/sound/pci/es137x.c
+0-1sys/dev/sound/pcm/sound.h
+29-305 files

FreeBSD/src 2b61245 — sys/dev/sound/pci es137x.c, sys/dev/sound/pcm feeder_volume.c channel.c

sound: Simplify how snd_mixer is fetched and how the cdev is created

The primary snd_mixer was reached by accessing the mixer cdev's si_drv1.
This is tedious and ugly, so store the mixer in snddev_info->mixer and
access it directly.

Additionally, create the cdev in a new mixer_make_dev() function (in
similar fashion to dsp_make_dev()) in pcm_register(), when everything is
initialized, instead of risking potential races because mixer_init()
(called before pcm_register()) used to create the cdev.

Also add some NULL checks in pcm_register(), to avoid creating a mixer
cdev when the driver (e.g., fdt/audio_soc.c) does not create a mixer in
the first place, and similarly in pcm_unregister().

Sponsored by:   The FreeBSD Foundation
MFC after:      1 month
Differential Revision:  https://reviews.freebsd.org/D59070

(cherry picked from commit 221babdf9feb7e1c1c001a4be735400ca6fb12cb)
DeltaFile
+53-36sys/dev/sound/pcm/mixer.c
+10-2sys/dev/sound/pcm/sound.c
+2-3sys/dev/sound/pci/es137x.c
+1-3sys/dev/sound/pcm/dsp.c
+1-2sys/dev/sound/pcm/channel.c
+1-1sys/dev/sound/pcm/feeder_volume.c
+68-472 files not shown
+70-478 files

FreeBSD/src 4798ab5 — sys/dev/sound/fdt audio_soc.c, sys/dev/sound/macio aoa.c i2s.c

sound: Standardize mixer_init() call order

Device drivers call mixer_init() in a non-standard order - some before
pcm_init(), and some after pcm_register(). However, both approaches are
potentially risky, and logically weak, since pcm_register() is supposed
to be the function that finalizes sound(4) attach.

Standardize the call ordering by moving all mixer_init() calls after
pcm_init(). This is also necessary for a follow-up patch, which expects
pcm_init() to have run first and initialized the PCM lock.

Sponsored by:   The FreeBSD Foundation
MFC after:      1 month
Differential Revision:  https://reviews.freebsd.org/D59069

(cherry picked from commit 13fcc9caaf968083254b92546e21dedb322a920b)
DeltaFile
+11-8sys/dev/sound/macio/davbus.c
+8-7sys/dev/sound/usb/uaudio.c
+6-6sys/dev/sound/pci/hda/hdaa.c
+8-4sys/dev/sound/macio/i2s.c
+5-4sys/dev/sound/fdt/audio_soc.c
+5-1sys/dev/sound/macio/aoa.c
+43-3027 files not shown
+85-6733 files

FreeBSD/src c712a03 — sys/dev/sound/usb uaudio.c

snd_uaudio: drop the default monitor level to 10%

As noted in the comment, some headsets with a hardware sidetone are
incredibly sensitive and emit immediate feedback upon attach with the
current system-wide default of 75%.  Drop it down just for snd_uaudio(4)
to avoid incredibly unpleasant surprises.

MFC after:      3 days
Reviewed by:    christos
Differential Revision:  https://reviews.freebsd.org/D59199

(cherry picked from commit c3c6a6c7825ccc744afddba692820296f72ea53f)
DeltaFile
+9-0sys/dev/sound/usb/uaudio.c
+9-01 files

FreeBSD/src 7af3fd0 — sys/dev/null null.c

null.c: fix signature mismatch for null_read

Reviewed by:    jhb
Differential Revision: https://reviews.freebsd.org/D49168
DeltaFile
+9-1sys/dev/null/null.c
+9-11 files

FreeBSD/src fe6aee4 — sys/kern vfs_subr.c

vfs_subr.c: fix signature mismatch for close method

Reviewed by:    jhb
Differential Revision:  https://reviews.freebsd.org/D49166
DeltaFile
+7-1sys/kern/vfs_subr.c
+7-11 files

FreeBSD/src a0e1529 — lib/libthr/thread thr_join.c

libthr: Remove deadcode in join_common

The while loop previous can only be break when ret == ETIMEDOUT. They
never produce EBUSY. Remove the deadcode here.

Reviewed by:    kib
MFC after:      2 weeks
Differential Revision: https://reviews.freebsd.org/D60711
DeltaFile
+1-1lib/libthr/thread/thr_join.c
+1-11 files

FreeBSD/src 02971f2 — sys/rpc clntrdma.h

clntrdma.h: Add some fields to RDMA structures (glue for nfsclrdma.ko)

This patch adds some fields to NFS client side RDMA
structures and an additional argument to xprt_rdma_release_send().
This patch does not fix any semantics issue.

MFC after:      3 months
Fixes:  884ee8d6c9b4 ("nfscl: Add some glue for client side NFS over RDMA")
DeltaFile
+3-1sys/rpc/clntrdma.h
+3-11 files

FreeBSD/src 461da47 — sys/dev/iwm if_iwmvar.h if_iwm.c

iwm: mask closed_rb_num to the RX ring size

iwm_notif_intr() reads hw = le16toh(sc->rxq.stat->closed_rb_num) & 0xfff and
loops while (sc->rxq.cur != hw) without masking hw to the ring size (512 entries
for 9000-series MQ RX, 256 for legacy). If the hardware reports a value at or
above the ring size, cur never equals hw: the loop walks stale ring entries
indefinitely and the write-pointer update uses a bogus index. Linux iwlwifi
masks the value (5eae443eb5e2) and OpenBSD has done the same since 9000-series
support was added (3287dca4fa10).

This was found while debugging an iwm crash on another BSD using the same
driver lineage (DragonFly, upstream bug 3449)

Locally tested:

* 7260, 9260, STA mode

PR: kern/299427
Submitted by: David Bidner <david at crap.solutions>

    [2 lines not shown]
DeltaFile
+2-0sys/dev/iwm/if_iwm.c
+1-0sys/dev/iwm/if_iwmvar.h
+3-02 files

FreeBSD/src 176fd23 — sys/dev/iwm if_iwm.c

iwm: ensure NIC is alive during txq enable

I broke this in a previous commit.  OpenBSD already has the NIC
nailed alive but FreeBSD's codebase currently does not.

Locally tested:

* 7260, 9260, STA mode

Fixes: 0a12ff65b9647a6e31471e5d27a8692b4adb6803

Differential Revision:  https://reviews.freebsd.org/D60823
DeltaFile
+10-3sys/dev/iwm/if_iwm.c
+10-31 files

FreeBSD/src 37337c4 — sys/dev/iwm if_iwm.c

iwm: fix incorrect mutex / crash use during error detach path

My previous commit (b3ef4013a4) added a couple of lock assertions.
However, the detach assertion is wrong - if the driver hasn't
attached then detach needs to be a no-op and this includes
not touching a deinit'ed mutex.

So, move the mutex check and use until after the attached check.

This fixes the driver crash I saw when another bit of in-flight
work caused attach to fail, and thus iwm_detach() -> iwm_detach_local()
ended up trying to use a deinit'ed mutex, leading to a crash.

Fixes: b3ef4013a4fa75063930d0221a0bc50f95af0527

Differential Revision:  https://reviews.freebsd.org/D60821
DeltaFile
+8-4sys/dev/iwm/if_iwm.c
+8-41 files

FreeBSD/src 454e8ff — usr.sbin/sysrc sysrc

sysrc: Be quiet when changing values

Make it easier for the rc group to facilitate having an option to fully
boot muted (à la OmniOS) without resorting to /dev/null redirections.

Reviewed by:    imp, dteske
Differential Revision:  https://reviews.freebsd.org/D46120
DeltaFile
+14-10usr.sbin/sysrc/sysrc
+14-101 files

FreeBSD/src fce354b — sys/compat/linuxkpi/common/include/linux uuid.h

linuxkpi: add uuid_t and helpers

linux/uuid.h has only the guid_t family. Add uuid_t, next to guid_t,
with uuid_equal(), uuid_copy(), import_uuid() and export_uuid(),
mirroring the guid_ versions.

Used by drm/virtio for dma-buf UUID export.

Signed-off-by:  Denis Borovikov <denis.borovikov at gmail.com>
Reviewed by:    wulf
Differential Revision:  https://reviews.freebsd.org/D60199
DeltaFile
+30-0sys/compat/linuxkpi/common/include/linux/uuid.h
+30-01 files

FreeBSD/src 8558dd6 — sys/compat/linuxkpi/common/include/linux pci.h

linuxkpi: add pci_is_vga()

Returns true for a VGA-compatible display controller and for the
pre-PCI 2.0 VGA class (base 0x00, subclass 0x01), as Linux's
pci_is_vga() does. Used by drm/virtio to decide whether to remove
the firmware framebuffer on virtio-vga.

Signed-off-by:  Denis Borovikov <denis.borovikov at gmail.com>
Reviewed by:    wulf
Differential Revision:  https://reviews.freebsd.org/D60200
DeltaFile
+11-0sys/compat/linuxkpi/common/include/linux/pci.h
+11-01 files

FreeBSD/src 59642e0 — sys/compat/linuxkpi/common/include/linux uaccess.h

linuxkpi: add strncpy_from_user()

Same semantics as Linux: returns the string length without the NUL,
count if the string was truncated, or -EFAULT. Implemented with
copyinstr(9). Unlike linux_copyin() it does not translate the remapped
ioctl argument window; its user, drm/virtio, passes a pointer taken
from the ioctl payload, so that is not needed.

Signed-off-by:  Denis Borovikov <denis.borovikov at gmail.com>
Reviewed by:    wulf
Differential Revision:  https://reviews.freebsd.org/D60198
DeltaFile
+17-0sys/compat/linuxkpi/common/include/linux/uaccess.h
+17-01 files