The block fuzz now emits them (S and D, signed and unsigned), and the
JIT's scalar FP test generator draws the W/X forms of FCVTZS/FCVTZU
again: its picks of them had all gone to the V-register forms.
The scalar AdvSIMD forms (scvtf d0, d0; fcvtzs d0, d0) took the generic
interpreter call from compiled code: 1.17M calls per run of a Perl
kernel. They now share the W/X forms' fast paths (perl-k6 about 6%
faster, 2026-12-04).
markCode scanned the whole write TLB each time a page got its first
decoded chunk, about 40K times per npm --version run (again after every
nursery reset), so a larger TLB made npm 18% slower. The reverse map
finds a page's write entries through one short chain, so markCode and
resetNursery no longer depend on the TLB size; a log of the last 256
fills lets flushAll clear only those. The 544.5 KiB this takes per CPU
comes out of the nursery (35K of 320K ops): KW_CPU_SIZE and the ABI stay.
Unit tests check the map and the code_flag invariant after every fill,
flush and mark change (rmapCheck), and two new tests cover write entries
cached before a page gains code, on one CPU and on two.
iOS: the + in a window's navigation bar now takes its presses (its
wrapper's larger target covered it), and in a home screen app the status
bar's controls no longer reach below its 24 pt row over the navigation
bar. iOS and Android: the home bar's strip is taller, its target nearly
the strip's width and only 10 px over the window, with no text selection
or callout on a long press; a swipe up the browser cancels after it went
far enough still goes home or to the switcher. Android: a folder's small
icons fill their square cells instead of drawing as flat ovals.
A theme is a stylesheet under :root[data-desktop] and React parts in place of the top bar, the Dock, the launcher and a window's title bar (web/src/themes); it loads when first shown and switches without a reload. Without a choice the device picks it: iOS, Android, else KDE.
Also: the desktop's headless core (window manager, commands, apps, pins) moves to web/src/core with its tests; terminal tabs are drawn by the theme's title bar; Settings and System get a sidebar drawer in narrow windows; the first paint is a minimal splash; the console's auto-hide is removed.
exec() and spawn() run programs as the account "user" by default, and kwtty falls back to root where /etc/passwd has no such account. On an image of your own that lacks it, programs ran as root without any sign of it.
For a kernel that boots a distro image, the first program that names no user now asks kwtty for "user" by name (not critical, so a guest from before the USER option runs it as root as before). When kwtty answers "no user user", the SDK logs one warning through createKernel's log and opens the same session with the default, so the account used does not change. Later programs send the default as before. The base shell, which has root only, gets no check and no warning.
Co-authored-by: Pooya Parsa <pooya@pi0.io>
exec() and spawn() reject with PtyError EREMOTE and only the guest's
message when a program cannot start, so a caller that must map this to a
shell exit status or tell a missing program from a missing directory has to
parse the text. PtyError now has stage ("exec", "chdir" or "user") and
guestCode (the errno name, e.g. "ENOENT", "EACCES", "ENOTDIR"),
derived on the host from kwtty's fixed message formats, with the strerror
texts of musl and glibc. No protocol change: it works with every existing
image and snapshot. A message that does not match, or an unknown errno
text, leaves the fields undefined; code and message are unchanged.
Co-authored-by: Pooya Parsa <pooya@pi0.io>
stats().cpus said what createKernel() was asked for, not what the guest
got: cpus above the kernel's NR_CPUS (16) left the guest on 16 while
stats().cpus and snapshots said more. A kernel without SMP, or a thread
that cannot start CPU threads, booted on one CPU with only a log line.
The host now offers the SMP kernel at most MAX_CPUS (exported), so
stats().cpus and the snapshot's count are what the guest runs on;
snapshotCpuMismatch() compares counts as the kernel takes them. When the
guest gets fewer CPUs than asked, stats().cpuLimit is { requested, reason }
("max", "module-not-smp", "kernel-not-smp", "not-isolated",
"not-worker", "unsupported"), in worker mode too. createKernel() still
boots, and the log line stays.
Co-authored-by: Pooya Parsa <pooya@pi0.io>
* test: expect the JIT host's fused multiply-add, tail call and chaining caps, and export jitTail() beside jitSimd() and jitFma()
The JIT rework added caps bits 6 (fused relaxed multiply-adds), 7 (cheap
tail calls), 8 (module format v2, KW_JIT_V2=1) and 9 (chaining, unless
KW_JIT_CHAIN=0), but the JitHost test still expected bits 0-5 only, so it
failed on every run (755, not 51, on Node 24 on x86-64). The test now
derives the expected caps from the same probes and variables.
* test: expect shm views in place in worker mode with an SMP kernel
With UNKERNEL_TEST_CPUS=2 the worker shares the kernel's memory with this
thread (shm.ts, In place), so views() works there instead of failing with
EOPNOTSUPP; the shm test failed on every 2-CPU run. It now checks the
views on the shared memory there, and the EOPNOTSUPP on the UP kernel.
* test: find the forced H.264 key frame by the source's request, not by a chunk window
The camera H.264 test wanted the key frame kwcap forces after the 16th
chunk among chunks 16 to 22. The source makes it next, but the chunks it
made before reach the guest first: the host's queue and the guest's
filled buffers, as many as the guest lags behind the source's clock. With
the full suite at once the inline kernel's timer ran late, the pattern
source caught up several frames at a time, and the forced key frame came
later (or on the GOP's own key frame at 24). The test now records the
chunk the source makes after each key frame request, checks that the
guest gets that chunk as a key frame, with only the GOP's key frames
before it and the GOP counting from it, and streams 60 chunks, enough for
the queue's 32 and the guest's buffers.
* test: judge shm reads through the ring by the reads during which this thread was free
The ring's answer comes as a message to this thread, which also runs the
suite's inline kernels. The check skipped itself when this thread's timer
delay was high, but it measured that delay only after the 25 reads, so a
busy spell during the reads failed it (median 32.5 ms with a delay of
1.4 ms measured afterwards). Each read now records this thread's longest
timer delay while it runs, and the median is asserted over the reads that
saw no delay of 3 ms or more (when there are at least 3 of them).
* test: run worker-mode capture from a read() source after the concurrent suite
In worker mode the sound in and camera tests' read() sources answer on this
thread, and the worker records silence or a black frame wherever the
answer comes late. With the whole suite at once this thread runs every
inline kernel, and the source fell 200 ms or more behind at the start of a
stream: kwrec got 2357 and 2854 of its 3000 samples (worker; worker with
messages), the camera 3 of 8 pictures (worker with messages). Those four
tests now run in a suite of their own after the concurrent one, alongside
each other only, with their assertions unchanged; the inline ones and the
onRing ones (a producer on a thread of its own) stay in the concurrent
suite.
* test: read a guest's background counter again when its file is empty
The snapshot and session tests' guests count in the background with
echo $i > FILE, which truncates the file before it writes, so a cat in
between reads nothing, 0, and fails a "counts on" check (or weakens the
next one). The host now reads the counter again while its file is empty,
at most 50 times. A rename per write in the guest would also do, but at a
fork per write it loads the guest (and, inline, this thread) twice as
much.
* test: let a restored recording end before boot() returns in the snapshot capture test
A restore hides the stopped time from the guest's clock, so the restored
guest has what was left of its 3 s recording. Where the snapshot landed
late in it (a busy host), kwrec's own stop and close came before boot()
returned, and the test, which wanted nothing after the replayed open,
prepare and start, failed. It now asserts the replay first, then nothing
or the guest's stop and close, with capturing to match.
* test: derive the SMP kernel once for UNKERNEL_TEST_CPUS runs instead of at every boot
Given the bundle and more than one CPU, createKernel() derives the SMP
kernel from it on the calling thread at every boot (about 0.2 s of
patching), and in a 2-CPU run every boot() did that. The suite's boots at
once held this thread, which runs the inline kernels and the device
sources, for over 3 s: glimmer's 3 s of sound took 6.3 to 6.8 s, the PCM
ring from the worker CPU (2.97 s of that stream) overflowed and dropped
346 to 890 frames glimmer had written without an underrun, and the H.264
source made too few chunks during the guest's stall to overflow the
queue. With UNKERNEL_TEST_CPUS > 1, boot() now boots the SMP kernel that
compileTestKernel() derives once wherever it runs on more than one CPU;
sharedKernel() still boots the bundle.
---------
Co-authored-by: Pooya Parsa <pooya@pi0.io>
BPF_SYSCALL with CGROUP_BPF was 70% of what the options cost, for runc's device filter. A new generic patch, BPF_CGDEV_ONLY, loads and attaches cgroup device programs only and runs them on the interpreter, with a verifier of its own: the SMP kernel grows 128 KB gzip instead of 460 KB. Checked with a runc container on cgroup v2.
A match more than 4 KiB away from where the current one continues now has to be 32 bytes longer instead of 8. New code otherwise became tens of thousands of short copies from unrelated places, each a seek a compressor cannot predict. The SMP patch with the Kubernetes options goes from 1.51 to 1.30 MB gzip; the format, the loader and the time to make it are unchanged.
The cgroup v2 memory, CPU and cpuset controllers with CPU limits, bpf(2)
with cgroup BPF, keys, bridge netfilter, the iptables pieces kube-proxy and
flannel use, nft ct and masq, the conntrack table in procfs, and VXLAN, in
kw_smp.config only: k3s needs cpuset, which needs SMP, so the UP kernel
stays as it is.
Co-authored-by: Greg Bell <code@gregbell.ca>
* docs: document snapshots, host commands, Tailscale, VA-API, fetchRoutes, UDP, the microphone and the camera in the SDK docs and README, and list the newer devices and uses in the README's introduction
* docs: split the Display page into Display and Input, and Sound and Camera
---------
Co-authored-by: Pooya Parsa <pooya@pi0.io>
A BPF arena needs get_vm_area(), which VMALLOC_FLAT does not have; with
the patch, arena maps fail with EINVAL as on kernels without an MMU.
BPF_SYSCALL stays off in kw_defconfig, so the patch is dormant by
default; it lets a kernel turn BPF on without importing get_vm_area.
Co-authored-by: Greg Bell <code@gregbell.ca>