DragonFlyBSD/src f940d57usr.bin/truss setup.c main.c

truss - Various small code cleanups.

* Remove accidentally committed ktrace.out file.

* Simplify some code, e.g. malloc+bzero -> calloc, and fprintf+exit -> errx.

* Use runtime variable sys_nsig, instead of compile-time NSIG for the
  range-check in the sys_signame[] lookup.

* We don't even have a "break" syscall in DragonFly, rename entry to "sbrk".
DeltaFile
+3-6usr.bin/truss/setup.c
+3-5usr.bin/truss/main.c
+3-4usr.bin/truss/syscalls.c
+0-0usr.bin/truss/ktrace.out
+9-154 files

DragonFlyBSD/src b67e205usr.bin/truss main.c ktrace.out

truss - Fail properly, if we suddenly are missing permissions.

* This avoids infinitely retrying the ioctl in a loop. If we are missing
  permissions, it's reasonable to just give up.

* This happens for example, when you try to run truss on a setuid executable
  like ping(8).
DeltaFile
+6-3usr.bin/truss/main.c
+0-0usr.bin/truss/ktrace.out
+6-32 files

DragonFlyBSD/src 6201675usr.bin/truss syscalls.c x86_64-fbsd.c

truss - Use pread(2) instead of seek+read for reading the process' memory.

* Also drastically simplifies get_string() by setting an absolute maximum
  on the length of the string at MAXPATHLEN. That makes it easy to just use
  a pread() to read the memory, and then we can simply extract the string
  using strndup().
DeltaFile
+29-55usr.bin/truss/syscalls.c
+4-6usr.bin/truss/x86_64-fbsd.c
+1-1usr.bin/truss/syscall.h
+34-623 files

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

virtio_blk - Only read num_queues config field when MultiQueue is supported.
DeltaFile
+15-9sys/dev/virtual/virtio/block/virtio_blk.c
+15-91 files

DragonFlyBSD/src c19adc0usr.bin/truss syscalls.c x86_64-fbsd.c

truss - Use asprintf instead of malloc+sprintf.

* And eliminate redundant "if (a) free(a)" pattern, just free(a) is fine,
  because free() already handles NULL values.
DeltaFile
+10-19usr.bin/truss/syscalls.c
+6-13usr.bin/truss/x86_64-fbsd.c
+16-322 files

DragonFlyBSD/src c3cffc6usr.bin/truss setup.c

truss - Prevent infinite loop when exec fails.

* And remove waitpid(2) call that can never reliably catch this error when
  we do a real fork(2), and not a vfork(2).
DeltaFile
+1-11usr.bin/truss/setup.c
+1-111 files

DragonFlyBSD/src e1d4ba6usr.bin/truss x86_64-fbsd.c syscalls.c

truss - Fix xsyscall printing of 6th argument. Fix lseek arguments.

* The 6th argument of an xsyscall gets buried underneath one extra stack
  value, so we need to add 2*sizeof(register_t) to the RSP register value.

* The 3rd argument of lseek(2) gets passed in the place where the 4th
  argument is expected.

* Add "execve" to the list in syscalls.c, in order to print the path string.
  Explicitly specify the number of return values as 0, and print a newline
  after printing the Syscall Entry information in that case.
  This does the right thing, since "execve" only returns a value when it
  fails, and errors are handled separately in truss(1).

* At least for very basic programs, truss(1) should now be somewhat useable
  again, but a lot remains to make it great again.
DeltaFile
+7-4usr.bin/truss/x86_64-fbsd.c
+4-2usr.bin/truss/syscalls.c
+11-62 files

DragonFlyBSD/src 7f7e8e1sys/dev/virtual/virtio/block virtio_blk.c

virtio_blk - Respect VIRTIO_MAX_VIRTQUEUES limit (currently at 8) as well.

* There is currently a hardcoded limit of VIRTIO_MAX_VIRTQUEUES virtqueues
  in the virtio_pci(4) driver's softc struct, that virtio_blk needs to
  respect for now.
DeltaFile
+5-8sys/dev/virtual/virtio/block/virtio_blk.c
+5-81 files

DragonFlyBSD/src bc3495fusr.bin/truss syscalls.c x86_64-fbsd.c

truss - Handle xsyscall syscalls better, and fix argument printing on x86_64.

* Some further work is needed to make sure arguments are printed correctly
  for xsyscall syscalls, and to update and improve the output.

* xsyscall syscalls are currently always signaled to the PIOCWAIT ioctl with
  nargs=0, because the syscall2() handler only looks up the argument count
  for the xsyscall SYSCALL (i.e. syscall(2) or __syscall(2)), which takes a
  variable argument count. So for now, we can just let truss figure out the
  argument count itself.

* Argument printing code was broken on x86_64, due to wrong malloc buffer
  sizing (it only didn't segfault out of luck). Update to explicitly
  distinguish between 32bit and 64bit arguments.

* Small first update on the syscall argument table maintained in truss.

* Get rid of the Quad argument type printing, which is obsolete on 64bit
  systems.
DeltaFile
+27-45usr.bin/truss/syscalls.c
+28-17usr.bin/truss/x86_64-fbsd.c
+6-5usr.bin/truss/syscall.h
+61-673 files

DragonFlyBSD/src ac3a753etc/etc.x86_64 ttys, etc/rc.d ttys

Further cleanup after removal of ancient unused pre-allocated ptys.

This further cleans up after commit eeb6b5e961aef58fbddb75319eeac0e1246c3ee1.

* Two more instances of ttys(5) files in the tree.

* Manpages still refering to /dev/tty[pqrsPQRS][0-9a-v] files, updated to
  revert to /dev/pts/[0-9] instead.

* Removed permissions cleanup of those pre-allocated ptys in /etc/rc.d/ttys.

* Typo in ptyleak.sh test script.

Noticed-by: Aaron Li (the other ttys(5) file instances)
DeltaFile
+0-257etc/etc.x86_64/ttys
+0-257nrelease/gui/etc/ttys
+0-9etc/rc.d/ttys
+3-3usr.bin/window/window.1
+0-3libexec/getty/ttys.5
+1-1test/stress/stress2/tools/ptyleak.sh
+4-5306 files

DragonFlyBSD/src 662e5e1sys/vm vm_zone.c

kernel - Tune zalloc/zfree a bit more

* Adjust the hysteresis to improve margins and use opportunistic
  spin locks more often.  The desired cache levels will be adjusted
  in 10% chunks opportunistically and not back-off into blocking spin
  locks until cache levels are 40% off desired targets.

* Increase zmax_pcpu by 2x.  Allow more entries to be cached in the
  per-cpu caches, reducing the need to drop into the per-zone pool
  (which requires the spin lock).
DeltaFile
+8-4sys/vm/vm_zone.c
+8-41 files

DragonFlyBSD/src 3e53184sys/sys vkernel.h, sys/vm vm_vmspace.c

vkernel - Vastly improve ve caching

* Improve per-host-LWP ve caching, vastly reducing primary vkp token
  contention under heavy multi-core loads (e.g. build-all).  The
  per-LWP cache has been increased from one to four entries and
  is now tracked on all operations.

  Remaining host-side contention is on the vkernel's kernel map, and
  there isn't a whole lot I can do about that for now.

* Release the primary vkp token across the pmap and vm_map deletion
  when destroying a context to reduce contention with vkernel
  operations on other cpus.

* Changes should significantly vkernel improve concurrent syscall
  and fault performance in multi-core setups.
DeltaFile
+92-31sys/vm/vm_vmspace.c
+6-1sys/sys/vkernel.h
+98-322 files

DragonFlyBSD/src 8ec33efsys/platform/pc64/x86_64 pmap.c, sys/platform/vkernel64/platform pmap.c

vkernel: Restore MAP_VPAGETABLE support with COW/VPTE fix (2)

* Retain the wiring of vkernel-related pages but remove
  the PG_VPTMAPPED and replace its functionality.  The
  main problem with PG_VPTMAPPED is that it could not discern
  between mappings that had to be wired, and caching/mappings
  that might still be present that are not wired.  The pages
  would remain wired until the underlying VM object is completely
  destroyed, which is undesirable.

* Instead, we actually bump vm_page->wire_count.  This allows the
  related pages to become pageable again after the vkernel has exited
  (after all pmaps that wire them are gone), which means we aren't as
  dependent on the file fd/unlink sequence.

* Recode vm_page->wire_count and VM page wiring in general.  This
  impacts the whole kernel, not just vkernel support.  The following
  features:


    [17 lines not shown]
DeltaFile
+117-45sys/platform/pc64/x86_64/pmap.c
+58-36sys/vm/vm_map.c
+64-20sys/platform/vkernel64/platform/pmap.c
+46-10sys/vm/vm_fault.c
+4-9sys/vm/vm_mmap.c
+7-5sys/vm/vm_object.c
+296-1257 files not shown
+316-13413 files

DragonFlyBSD/src dcdf6bfsys/vm vm_zone.c

kernel - Vastly improve zalloc/zfree

* Vastly improve zalloc/zfree by shifting items from the zone pool
  to the zone's pcpu pool or back again opportunistically, and in
  smaller chunks.

  The opportunistic mechanism uses spin_trylock(), and so does not
  contend at all.  The regular spin_lock() is onl used when the counts
  exceed the opportunistic limits.

* Should improve regular kernel performance under heavy loads.

* Vastly improves vkernel performance under multi-cpu loads due to pvzone
  operation.  However, note that the host still has strong contention on
  the vkp->token that we need to address.
DeltaFile
+87-44sys/vm/vm_zone.c
+87-441 files

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-1test/stress/stress2/tools/ptyleak.sh
+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