mirror of
https://github.com/pithings/unkernel.git
synced 2026-12-03 17:29:41 +08:00
guest: make /dev/fd, /dev/stdin, /dev/stdout and /dev/stderr in the kw layer's rc, and stop DRM's vblank timer 100 ms after its last use instead of 5 s
This commit is contained in:
@@ -600,7 +600,7 @@ gives the DRM nodes udev's groups and modes (kernel/guest.md).
|
||||
SMP only a short check: `page-check.mjs --cpus 0` (the page's default, 4
|
||||
CPUs, worker mode; 2026-11-21) ran `eglinfo -B -p gbm` on virgl and
|
||||
kmscube at 55 to 57 fps; the 2D device: `test/gpu/check.mjs --cpus 2`.
|
||||
- Guest notes: no `/dev/fd` in the guest, so bash's `<(...)` fails; kmscube
|
||||
- Guest notes: kmscube
|
||||
and glmark2-es2-drm stop at the first byte or EOF on stdin, so give them
|
||||
a stdin that stays open (`mkfifo /tmp/h; exec 3<>/tmp/h; kmscube <&3`).
|
||||
glmark2-es2-drm 2023.01 draws at the mode's size and never makes its
|
||||
|
||||
@@ -262,7 +262,8 @@ There is no udev: the kw layer's rc gives `card*` to video (0660) and
|
||||
(`DRM_CRTC_VBLANK_TIMER_FUNCS`, at the mode's refresh, 60 Hz from the
|
||||
EDID), so a page-flipping client runs at most at 60 frames a second
|
||||
(kmscube: 59.97, 2026-11-21), and so do DIRTYFB updates. The timer runs
|
||||
on for `drm.vblankoffdelay` (5 s) after its last use (`test/gpu/flip-check.mjs`
|
||||
on for `drm.vblankoffdelay` after its last use (100 ms: the kw layer's rc lowers
|
||||
the kernel's 5 s, kernel/guest.md) (`test/gpu/flip-check.mjs`
|
||||
counts the host's idles), then an idle guest has no periodic timer.
|
||||
No kthreads (its work items run on the system workqueue), so parking
|
||||
needs nothing new.
|
||||
|
||||
@@ -61,7 +61,9 @@ base's busybox (`#!/run/kw-lower/bin/busybox sh`) and only gain features.
|
||||
user's devices as udev's rules give them (no udev: `/dev/fb*` and
|
||||
`/dev/dri/card*` to video, `/dev/input/*` to input, `/dev/dsp*`,
|
||||
`/dev/snd/*` to audio, 0660, by group name; `/dev/fuse` and
|
||||
`/dev/dri/renderD*` 0666; the drivers make them at boot, none later).
|
||||
`/dev/dri/renderD*` 0666; the drivers make them at boot, none later),
|
||||
udev's links `/dev/fd`, `/dev/stdin`, `/dev/stdout` and `/dev/stderr`,
|
||||
and `drm.vblankoffdelay` 100 ms (kernel/devices.md, kwvirtio).
|
||||
- The image's user: every distro image has `user` (uid and gid 1000,
|
||||
`/home/user` mode 700, `install_user` in guest/lib/stage.sh; bash on
|
||||
Debian, `/bin/sh` on Alpine) in audio, video, input and users, plus sudo
|
||||
|
||||
@@ -14,7 +14,11 @@
|
||||
# to video, input devices to input, sound to audio (0660), /dev/fuse and
|
||||
# DRM's render nodes to everyone (0666); by group name, so on a root
|
||||
# without that group (the base shell) the device stays root's. The drivers
|
||||
# make these devices at boot; none comes later.
|
||||
# make these devices at boot; none comes later. It also makes udev's
|
||||
# links /dev/fd, /dev/stdin, /dev/stdout and /dev/stderr (bash's <(...)
|
||||
# needs /dev/fd), and has DRM's vblank timer stop 100 ms after its last use
|
||||
# instead of 5 s (drm.vblankoffdelay): the timer wakes the host about 120
|
||||
# times a second while it runs.
|
||||
|
||||
PATH=/run/kw-lower/bin
|
||||
m() { mountpoint -q "$2" || mount -t "$1" ${3:+-o "$3"} "$1" "$2"; }
|
||||
@@ -22,6 +26,8 @@ m cgroup2 /sys/fs/cgroup nosuid,nodev,noexec
|
||||
mkdir -p /dev/pts /dev/shm
|
||||
m devpts /dev/pts gid=5,mode=620,ptmxmode=666
|
||||
m tmpfs /dev/shm nosuid,nodev,mode=1777
|
||||
[ -e /dev/fd ] || ln -s /proc/self/fd /dev/fd
|
||||
for f in 0:stdin 1:stdout 2:stderr; do [ -e /dev/${f#*:} ] || ln -s /proc/self/fd/${f%:*} /dev/${f#*:}; done
|
||||
mkdir -p -m 1777 /run/lock
|
||||
h=$(head -n1 /etc/hostname 2>/dev/null)
|
||||
case $h in '' | localhost | localhost.*) h=unkernel ;; esac
|
||||
@@ -40,4 +46,6 @@ dev video 660 /dev/fb[0-9]* /dev/dri/card*
|
||||
dev input 660 /dev/input/event* /dev/input/mice /dev/input/mouse* /dev/input/js*
|
||||
dev audio 660 /dev/dsp* /dev/audio* /dev/mixer* /dev/snd/*
|
||||
for f in /dev/fuse /dev/dri/renderD*; do [ -e "$f" ] && chmod 666 "$f"; done
|
||||
f=/sys/module/drm/parameters/vblankoffdelay
|
||||
[ -w $f ] && echo 100 > $f
|
||||
exit 0
|
||||
|
||||
Reference in New Issue
Block a user