From 1b52d34ca5ace8bb404af7bd8b750c9964208954 Mon Sep 17 00:00:00 2001 From: dylanneve1 Date: Fri, 23 Oct 2026 12:17:35 +0100 Subject: [PATCH] console_quiet=1: user space's console output dropped, on by default under avfboot Phone profile (install 2, 20:51): Scion's avf-console thread at 27% of a host core, handling the 8250's traps for launchd's log of SpringBoard's failed lookups (some 40,000 log events a second, 'Last log repeated'), the daemons' standard error and os_log mirrored to the console. 1003: kmwrite() (behind /dev/console) drops what user space writes when console_quiet=1; kernel printf and panics are not written that way and still come out. avfboot adds console_quiet=1 unless the parameters say console_quiet= themselves (console_quiet=0 for a verbose session). Co-Authored-By: Claude Opus 5.5 --- avf/shim/avfboot.c | 6 +++++ xnu/patches/1003-avf-console-quiet.patch | 28 ++++++++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 xnu/patches/1003-avf-console-quiet.patch diff --git a/avf/shim/avfboot.c b/avf/shim/avfboot.c index c03dcbeab..788689b81 100644 --- a/avf/shim/avfboot.c +++ b/avf/shim/avfboot.c @@ -809,6 +809,12 @@ void avfboot_main(uint64_t fdt_pa) if (!has_arg(pi.cmdline, "cpus=") && !has_arg(pi.cmdline, "cpumask=") && !has_arg(m.bootargs, "cpus=") && !has_arg(m.bootargs, "cpumask=")) cmd_append(cl, &n, "cpus=1 "); + /* + * User space quiet on the console unless asked otherwise (console_quiet=0): every console byte + * is a trap to crosvm, and launchd alone writes thousands of lines a minute (patch 1003). + */ + if (!has_arg(pi.cmdline, "console_quiet=") && !has_arg(m.bootargs, "console_quiet=")) + cmd_append(cl, &n, "console_quiet=1 "); if (rd_size && !has_arg(pi.cmdline, "rd=") && !has_arg(m.bootargs, "rd=")) cmd_append(cl, &n, "rd=md0 "); cmd_append(cl, &n, pi.cmdline); diff --git a/xnu/patches/1003-avf-console-quiet.patch b/xnu/patches/1003-avf-console-quiet.patch new file mode 100644 index 000000000..fc96aa604 --- /dev/null +++ b/xnu/patches/1003-avf-console-quiet.patch @@ -0,0 +1,28 @@ +diff --git a/bsd/dev/arm/km.c b/bsd/dev/arm/km.c +index 69eacee..9e244fc 100644 +--- a/bsd/dev/arm/km.c ++++ b/bsd/dev/arm/km.c +@@ -175,6 +175,23 @@ kmwrite(dev_t dev, struct uio * uio, int ioflag) + int ret; + struct tty *tp = km_tty[minor(dev)]; + ++ /* ++ * Boot-arg console_quiet=1: what user space writes to the console (launchd's own log, the ++ * daemons' standard error, os_log mirrored there) is dropped; the kernel's printf and panics ++ * are not written this way and still come out. Under a hypervisor every console byte is a ++ * trap to the VMM: on the Pixel (AVF), launchd's log of SpringBoard's failed lookups kept the ++ * host's console thread a quarter busy. ++ */ ++ static int quiet = -1; ++ if (quiet < 0) { ++ uint32_t v = 0; ++ quiet = PE_parse_boot_argn("console_quiet", &v, sizeof(v)) && v != 0; ++ } ++ if (quiet) { ++ uio_update(uio, uio_resid(uio)); ++ return 0; ++ } ++ + tty_lock(tp); + ret = (*linesw[tp->t_line].l_write)(tp, uio, ioflag); + tty_unlock(tp);