DragonFlyBSD/src 41fb764doc vpagetable_analysis.txt, share/man/man7 vkernel.7

vkernel: Restore MAP_VPAGETABLE support with COW/VPTE fix

Re-implement MAP_VPAGETABLE support which was removed in commit
4d4f84f5f26bf5e9fe4d0761b34a5f1a3784a16f. This enables vkernel
functionality - allowing a full kernel to run in userspace.

Changes:
- Re-enable VM_MAPTYPE_VPAGETABLE in sys/vm/vm.h
- Restore vm_fault_vpagetable() for VPTE translation
- Add PG_VPTMAPPED flag to track pages mapped via VPAGETABLE
- Handle MADV_SETMAP/MADV_INVAL for vkernel pmap management
- Fix COW/VPTE synchronization: set FW_DIDCOW for page-level COW
  so pmap_enter() updates VPTEs after copy-on-write
- Use anonymous memory (unlinked file) for vkernel memory backing
  to ensure proper page reclaim when vkernel exits
- Fix vkernel build issues (cpu_feature2, COWF_PREFAULT_* constants)
- Skip callout address validation for vkernels (_KERNEL_VIRTUAL)

NOTE: This code was almost fully generated by Claude Opus 4.5
DeltaFile
+553-0doc/vpagetable_analysis.txt
+266-2sys/vm/vm_fault.c
+47-48sys/platform/vkernel64/platform/init.c
+71-15sys/vm/vm_map.c
+46-16share/man/man7/vkernel.7
+57-1sys/platform/pc64/x86_64/pmap.c
+1,040-8213 files not shown
+1,123-12319 files

DragonFlyBSD/src d57128bshare/man/man4 virtio_blk.4, sys/dev/virtual/virtio/block virtio_blk.c

virtio_blk - Implement multiqueue support.

* For now, this code uses at most as many virtqueues as cpu cores and
  interrupts are available. The number of virtqueues can also be capped via
  "hw.vtblk.max_queues" and "hw.vtblk.X.max_queues" tunables (also useful
  for benchmarking different scenarios).

* Since virtio interrupts are currently tied together with the per-queue
  serializer lock, a fixed 1:1 mapping between interrupts and virtqueues is
  used for now, for simplicity. To support multiple virtqueues to share a
  single interrupt properly, it's going to be far more elegant if we have a
  separate serializer for each virtqueue, and not just for each interrupt.
DeltaFile
+227-142sys/dev/virtual/virtio/block/virtio_blk.c
+5-1share/man/man4/virtio_blk.4
+232-1432 files

DragonFlyBSD/src 0ee8636sys/dev/virtual/virtio/block virtio_blk.c

virtio_blk - Clean up detach code, to work better for multiqueue.

* Specifically this uses the fact that vtblk_flags is only ever modified in
  vtblk_attach(), vtblk_detach(), vtblk_suspend(), and vtblk_resume(). So
  we don't need to worry about taking all the serializers when setting the
  DETACH flag.

* Additionally the virtqueue_disable_intr() call from vtblk_stop() was
  completely superfluous, since the virtio_teardown_intr() call earlier
  already guarantees that none of the virtqueue interrupt handlers can be
  active anymore.
DeltaFile
+9-15sys/dev/virtual/virtio/block/virtio_blk.c
+9-151 files

DragonFlyBSD/src e04d760sys/dev/virtual/virtio/block virtio_blk.c virtio_blk.h

virtio_blk - Add some new feature bits, and config-space fields..
DeltaFile
+7-3sys/dev/virtual/virtio/block/virtio_blk.c
+6-3sys/dev/virtual/virtio/block/virtio_blk.h
+13-62 files

DragonFlyBSD/src eeb6b5elib/libutil pty.3, nrelease/root/etc ttys

kernel - Get rid of ancient unused 256 non-cloned pty devices.

* These haven't really been used in more than a decade, I think.

* The only binary that still has code for these is rfcomm_sppd(1), however
  that's part of the bluetooth stack, and hence isn't useable anyways.
  This should be easy to modernize, to use a cloned pty device instead.

* Updating manpages a bit, to refer to the "modern" cloned pty devices.
DeltaFile
+0-257nrelease/root/etc/ttys
+1-58sys/kern/tty_pty.c
+7-11lib/libutil/pty.3
+7-4share/man/man4/pty.4
+2-2usr.bin/mesg/mesg.1
+1-1usr.bin/window/ww.h
+18-3331 files not shown
+19-3347 files

DragonFlyBSD/src dab0b7betc/devd usb.conf, share/man/man4 mtw.4

if_mtw - Port from FreeBSD, with bugfixes, and parts re-ported from OpenBSD.

* Reverted some recent changes in FreeBSD for 80211 API changes on their side:
   * reverted ratectl API use in ieee80211_ratectl_tx_update()
   * crypto API change (git 5431dafdb9659fb578f)
   * seqno offload (git cce278510a820785d88)
   * ni->ni_txrate references use (git 7067450010931479f8)

* Re-ported the firmware loading code from OpenBSD. Unfortunately firmware
  loading still is not reliable. Sometimes it appears to be consistentl
  working, and then after a reboot it repeatedly fails with the same code.

* Added some error return-codes back that OpenBSD's code has, but got removed
  in the FreeBSD code. This makes it behave a bit better when it fails.

* Fixed the aggregated RX buffer handling, to split up the mbuf correctly,
  using the m_copym method, based on the corresponding code in if_iwm(4).

* Remove the small pieces of #ifdef IEEE80211_SUPPORT_SUPERG code.

    [5 lines not shown]
DeltaFile
+4,758-0sys/bus/u4b/wlan/if_mtw.c
+1,434-0sys/bus/u4b/wlan/if_mtwreg.h
+1,013-0sys/contrib/dev/mtw/mtw-mt7601u.fw.uu
+391-0sys/bus/u4b/wlan/if_mtwvar.h
+130-0share/man/man4/mtw.4
+24-0etc/devd/usb.conf
+7,750-011 files not shown
+7,822-317 files

DragonFlyBSD/src 17fa3edsys/netproto/802_11 ieee80211_proto.h

Add ieee80211_getqos() convenience helper from FreeBSD.

Taken-from: FreeBSD (git f3f08e16a3a8a661dc6b603f7045bc0be18c28e5)
DeltaFile
+16-0sys/netproto/802_11/ieee80211_proto.h
+16-01 files

DragonFlyBSD/src a0d2e0fsys/netproto/802_11 ieee80211_var.h, sys/netproto/802_11/wlan ieee80211.c

wlan - Add ieee80211_add_channels_default_2ghz() wrapper for 2GHz channels.

Taken-from: FreeBSD (git b84b36380eb1404f1cf06224cc8af5f805edb090)
DeltaFile
+11-0sys/netproto/802_11/wlan/ieee80211.c
+2-0sys/netproto/802_11/ieee80211_var.h
+13-02 files

DragonFlyBSD/src 8bd93bcsys/netproto/802_11 ieee80211_proto.h, sys/netproto/802_11/wlan ieee80211_output.c

wlan - Add ieee80211_alloc_prot() convenience wrapper from FreeBSD.

Taken-from: FreeBSD (git d1b671061b4f149f2175c931c62524a05e753aba)
DeltaFile
+34-0sys/netproto/802_11/wlan/ieee80211_output.c
+2-0sys/netproto/802_11/ieee80211_proto.h
+36-02 files

DragonFlyBSD/src ed9211acontrib/openresolv README.DRAGONFLY

Note update to openresolv-3.17.3
DeltaFile
+4-4contrib/openresolv/README.DRAGONFLY
+4-41 files

DragonFlyBSD/src 7fb4b7fcontrib/openresolv resolvconf.in

Merge branch 'vendor/OPENRESOLV'
DeltaFile
+41-12contrib/openresolv/resolvconf.in
+41-121 files

DragonFlyBSD/src 2a5bea4contrib/openresolv resolvconf.in

import openresolv-3.17.3 with the following changes:

resolvconf: Add a function to quote and escape input for eval
resolvconf: quote on printf rather than on value
DeltaFile
+41-12contrib/openresolv/resolvconf.in
+41-121 files

DragonFlyBSD/src df8c47bcontrib/openresolv README.DRAGONFLY

Note update to openresolv
DeltaFile
+4-4contrib/openresolv/README.DRAGONFLY
+4-41 files

DragonFlyBSD/src 2f8966acontrib/openresolv resolvconf.in resolvconf.8.in

Merge branch 'vendor/OPENRESOLV'
DeltaFile
+536-247contrib/openresolv/resolvconf.in
+124-92contrib/openresolv/resolvconf.8.in
+112-38contrib/openresolv/resolvconf.conf.5.in
+33-20contrib/openresolv/libc.in
+1-0contrib/openresolv/README.md
+806-3975 files

DragonFlyBSD/src 6b50da2contrib/openresolv resolvconf.in resolvconf.8.in

Import openresolv-3.17.1 with the following changes:

* libc: add toggle resolv_conf_restore, defaulting to YES
* resolvconf: Fix -D
* resolvconf: Don't warn when we have no entries to list for *
* resolvconf: -I now inits subscribers after clearing state
* resolvconf: remember if any subscriber errored
* libc: Don't update resolv.conf on signature mismatch
* resolvconf: Single quote parsed values from resolv.conf
* resolvconf: -L now outputs fully processed resolv.conf files
DeltaFile
+536-247contrib/openresolv/resolvconf.in
+124-92contrib/openresolv/resolvconf.8.in
+112-38contrib/openresolv/resolvconf.conf.5.in
+33-20contrib/openresolv/libc.in
+1-0contrib/openresolv/README.md
+806-3975 files

DragonFlyBSD/src 2a7c11esys/dev/misc/syscons sckmsrndr.c

syscons - Fixup typo in fill_rect16() from 7550650651ca31fcb7d2edd0d60

Noticed-By: Aaron LI
DeltaFile
+1-1sys/dev/misc/syscons/sckmsrndr.c
+1-11 files

DragonFlyBSD/src d41d1a0share/man/man4 ahci.4, sys/dev/disk/ahci ahci.c ahci_dragonfly.c

ahci - Properly check and set SATA capabilities and features for ALPM.

- This should now only enable device-initiated and/or host-initiated link
  power-management when it is supported by both controller and disk device.

- Also this now allows for device-initiated power-management to be enabled
  with AHCI controllers that don't support automatic host-initiated
  power-management.

- In addition, this adds support for automatic promotion of "partial" state
  to "slumber" state (i.e. without needing to go through "active" state).

- The kernel console output now explicitly tells when it's enabling DIPM
  (device-initiated power management) and HIPM (host-initiated power
  management) respectively.
DeltaFile
+100-19sys/dev/disk/ahci/ahci.c
+5-8sys/dev/disk/ahci/ahci_dragonfly.c
+8-2sys/dev/disk/ahci/atascsi.h
+9-1share/man/man4/ahci.4
+122-304 files

DragonFlyBSD/src fe14ae5sys/netproto/802_11/wlan ieee80211_ratectl_none.c

wlan - Remove NULL free in fallback "none" ratectl code.

This avoids a kernel panic when detaching a wlan interface that was created
with the "none" ratectl code (i.e. when the wlan_amrr module wasn't loaded).
DeltaFile
+0-1sys/netproto/802_11/wlan/ieee80211_ratectl_none.c
+0-11 files

DragonFlyBSD/src 5f49e87sys/vfs/hammer2 hammer2_chain.c

hammer2 - Add debugging

* Debug situations where the CRC fails.  Print enough information
  for us to poke around and compare the in-kernel buffer against
  the disk buffer.

  All instances to date where hammer2 has detected CRC corruption
  has been due to in-memory corruption, source as yet undetermined.

* Usually hammer2 refuses to operate on the file/directory in
  question until the buffer cache buffer with the in-memory error
  is recycled or the machine is rebooted, avoiding corruption.
  But it is possible that hammer2 might miss an in-memory
  corruption event in some instances (occurring after the CRC
  check, for example).
DeltaFile
+24-3sys/vfs/hammer2/hammer2_chain.c
+24-31 files

DragonFlyBSD/src abe564fsys/kern vfs_bio.c vfs_vm.c, sys/vfs/ext2fs ext2_vnops.c

kernel - Minor Syntax cleanup

* Minor syntax cleanup
DeltaFile
+3-3sys/kern/vfs_bio.c
+4-2sys/vfs/ufs/ffs_vfsops.c
+2-2sys/kern/vfs_vm.c
+2-2sys/vfs/ext2fs/ext2_vnops.c
+2-1sys/vfs/hammer2/hammer2_vnops.c
+2-1sys/kern/vfs_sync.c
+15-115 files not shown
+25-1511 files

DragonFlyBSD/src c3f20a5sys/kern vfs_subr.c, sys/vfs/nfs nfs_vnops.c

kernel - Handle race in vfsync_bp() and nfs_flush_bp()

* The RB_SCAN callback code on the clean/dirty buffer trees
  must bump b_refs temporarily when issuing a blocking lock
  to prevent the buffer from being ripped out from under the
  call, as the vnode token will be lost during the blocking
  operation.

* vfsync_bp() and vfs_flush_bp() omitted the required refs.

* Code cleanup.
DeltaFile
+13-5sys/kern/vfs_subr.c
+2-0sys/vfs/nfs/nfs_vnops.c
+15-52 files

DragonFlyBSD/src 4748425sys/kern vfs_subr.c

kernel - Fix race in brelvp() and reassignbuf()

* brelvp() can be called with just the buffer (bp) locked.  The
  vnode might not be locked or referenced at the time brelvp()
  is called, or might be locked by some other entity at the time.

* brelvp() obtains the vnode token but this is not sufficient.
  There is a race where, once the bp is removed from the vnode lists,
  the related vnode might be retired out from under brelvp() if the
  vp token is temporarily lost.

  The token can, in fact, be temporarily lost during the syncer list
  manipulation at the end of the routine.  Fix with a vhold()/vdrop()
  around the related code.

* In addition, set bp->b_vp to NULL before the syncer_list manipulation
  instead of after, ensuring that it is NULL'd out while the vnode token
  is still atomically held.  It was theoretically ok before since the
  bp should be locked, but the lost vnode token atomicy was concerning

    [3 lines not shown]
DeltaFile
+23-10sys/kern/vfs_subr.c
+23-101 files

DragonFlyBSD/src ab7d624tools/tools/crypto cryptotest.c cryptokeytest.c

tools: Remove tools/crypto
DeltaFile
+0-622tools/tools/crypto/cryptotest.c
+0-287tools/tools/crypto/cryptokeytest.c
+0-105tools/tools/crypto/cryptostats.c
+0-50tools/tools/crypto/Makefile
+0-45tools/tools/crypto/README
+0-1,1095 files

DragonFlyBSD/src b84e7dc. Makefile_upgrade.inc, sys/config X86_64_GENERIC

crypo: Cleanup from last two patches

Suggested-by: aly
DeltaFile
+9-5sys/crypto/crypto.c
+0-10Makefile_upgrade.inc
+0-1sys/config/X86_64_GENERIC
+9-163 files

DragonFlyBSD/src 056e2ccshare/man/man9 crypto.9, sys/dev/crypto/aesni aesni.c

opencrypto - remove in-kernel crypto(9) framework

The opencrypto crypto(9) API was quite complex (8k LoC), slow and not
used by any other kernel subsystem within DragonFly anymore. It allowed
for chaining various operations, crypto ops and compression, but AFAIK
this was never really used and rather complicated.  For a much simpler,
synchronous API see sys/src/crypto/cryptoapi. For a nice writeup on the
problems of crypto(9) in the context of FreeBSD, please see [1].

The opencrypto API was asynchronous by design. This was good back in the
days when dedicated hardware crypto devices did exist to help offload
the CPU. But the world has now changed towards synchronous CPU
instructions like AESNI. These dedicated CPU instructions are best
called synchronously, which removes the need for book-keeping of
asynchronous requests, often greatly simplifying the caller as well as
the API and "backend" implementation.

Furthermore, those dedicated crypto CPU instructions are not limited to
the kernel, they can be directly used by userland applications as well.

    [15 lines not shown]
DeltaFile
+0-1,651sys/opencrypto/crypto.c
+0-1,433sys/opencrypto/cryptosoft.c
+0-1,099sys/opencrypto/xform.c
+0-672share/man/man9/crypto.9
+0-545sys/opencrypto/castsb.h
+0-516sys/dev/crypto/aesni/aesni.c
+0-5,91635 files not shown
+112-8,04341 files

DragonFlyBSD/src c1ba328. UPDATING, lib/libtcplay crypto-dev.c

cryptodev: remove /dev/crypto pseudo-device

Remove the /dev/crypto pseudo-device. OpenBSD, which invented this API,
did this step back in release 5.7 (2015).

Note that this commit only removes the userland-facing /dev/crypto
device while still keeping the in-kernel crypto(9) API as-is. The plan
is to finally remove crypto(9) in a future commit.

The only applications within DragonFly that ever made use of /dev/crypto
were tcplay(8), cryptsetup(8) and cryptdisks(8) via libtcplay. But this
dependency on /dev/crypto was dropped in commit
ede102cd94449fe52fa9da25631d9f15af6d62ef as of April 21, 2025 in favor
of doing the crypto operations directly in userland without any help
from the kernel via /dev/crypto.

Userland libraries or applications like OpenSSH and OpenSSL do not use
/dev/crypto, mainly for performance reasons (and portability).
DeltaFile
+0-930sys/opencrypto/cryptodev.c
+0-165lib/libtcplay/crypto-dev.c
+0-131share/man/man4/crypto.4
+0-124test/crypto/cryptoapi/crypto-dev.c
+18-0UPDATING
+0-7sys/dev/crypto/cryptodev/Makefile
+18-1,35713 files not shown
+34-1,38219 files

DragonFlyBSD/src fcabea4sys/dev/virtual/virtio/block virtio_blk.c

virtio_blk - Compare old/write-cache setting in vtblk_write_cache_sysctl.
DeltaFile
+5-2sys/dev/virtual/virtio/block/virtio_blk.c
+5-21 files

DragonFlyBSD/src c12552bsys/dev/virtual/virtio/block virtio_blk.c

virtio_blk - Move sysctl setup to the end of attachement.
DeltaFile
+1-2sys/dev/virtual/virtio/block/virtio_blk.c
+1-21 files

DragonFlyBSD/src ae06013sys/dev/disk/mmcsd mmcsd.c, sys/dev/virtual/virtio/block virtio_blk.c

kernel - Do readonly check in .d_open method in mmcsd(4) and virtio_blk(4).

* Makes read-write open fail properly for read-only storage in mmcsd(4) and
  virtio_blk(4), instead of only resulting in transfer errors for the
  disk writes.
DeltaFile
+3-13sys/dev/virtual/virtio/block/virtio_blk.c
+6-8sys/dev/disk/mmcsd/mmcsd.c
+9-212 files

DragonFlyBSD/src 7550650sys/dev/misc/syscons sckmsrndr.c syscons.c

syscons - Add 16bit rendering code for UEFI and KMS driver framebuffers.

This fixes syscons rendering with KMS graphics drivers, when the driver
hands us a 16bit console framebuffer.
DeltaFile
+179-70sys/dev/misc/syscons/sckmsrndr.c
+4-2sys/dev/misc/syscons/syscons.c
+183-722 files