Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docs/boot-time.md
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ them for boot time.
|---|---|---|---|---|
| Kernel patches 0001-0005, 0007, 0008, 0010 | kernel/patches | cold +67.5 [+62.5, +72.4], with 0006, 0009 and 0011 (since deleted, worth nothing) | group A | lab 44818953987 |
| Kernel 0012 (vmlinux BTF parsed on first use) and 0013 (the verifier asks for it only where a kernel type enters a program) | kernel/patches | cold −6.4 [−9.4, −1.0] at 60 a side (lab 45118194310, the kernel carried); before the review's fixes −10.0 [−12.7, −3.3] at 60 and −6.3 [−9.1, −4.6] at 120 (labs 45114405201, 45115330128); restored −1.0 [−6.0, +4.2] evicted, the state 1.3 MiB smaller (lab 45115341056) | measured | lab 45118194310 |
| Kernel 0021-0025, the boot's device-setup exits as one change (#627): the IOAPIC table read once (#590), the state save at add only where error recovery can restore it (#591 a), virtio-pci's vendor capabilities walked once (#591 b), `queue_select` written only on a change and an unchanged MSI message not rewritten (#592). 0022's gate has to grow with whatever calls error handlers next (its changelog). Alone each was within noise ("Measured and rejected") | kernel/patches | against v20261123.07: first login −9.4 [−14.2, −5.7], sshd accepting −9.5 [−14.4, −5.5], 120 a side (lab 45260781177); restored −0.4 [−2.0, +1.7] evicted and +0.2 [−6.6, +7.3] cached, the state +0.0 MiB [−0.1, +0.2], 60 a side (lab 45261629539); 838 exits fewer, 366 of them MMIO (3 a side, lab 45114428660) | measured | labs 45260781177, 45261629539 |
| `BLK_DEV_LOOP_MIN_COUNT=0`, `SERIAL_8250_RUNTIME_UARTS=1` | kernel/config-7.3-x86_64 | cold +5.3 [−3.2, +15.0]: inside the noise, but the upper bound does not rule out its ~2-4 ms ceiling | measured, 40 a side | lab 44839538785 |
| `KERNEL_LZ4` | kernel/config-7.3-x86_64 | since #645 the compression of the shipped bzImage only, which this machine boots for a release before it (#660). Before, the alternatives lost: an uncompressed payload, on QEMU 0007, −4.0 [−7.9, +0.3] at 40 a side, within noise, and QEMU's RSS +32 MiB (lab 45183618987); before 0007, +9 ms in copies (laptop) | measured, 40 a side | lab 45183618987, #326 |
| `VT=n`, `X86_MSR=n`, `X86_CPUID=n` | kernel/config-7.3-x86_64 | function: dead code, less surface | - | kernel/Dockerfile |
Expand Down Expand Up @@ -349,7 +350,7 @@ and a row measured in another shape than spin's has such a reason.
| x86's `msi_set_affinity` skips the message write when the vector and destination did not change (#592 lever 2, a kernel patch on branch `exp/592-l2-msix-once`) | 56 MMIO exits fewer (`__pci_write_msi_msg` 168 → 112, 3 a side, lab 45113437048), the first login −0.1 [−3.1, +4.5] at 60 a side (lab 45114405201) | spin | labs 45113437048, 45114405201 | 11-23 |
| `pci_save_state()` at a device's add kept only where an error handler can restore it (#591 a, a kernel patch on branch `exp/591a-no-save-state`) | 128 MMIO exits fewer, the host's handling −3.3 [−6.2, −2.1] ms (3 a side, lab 45113437048), but the first login −4.3 [−6.8, +0.5] at 60 a side (lab 45114405201) and −1.3 [−3.5, +1.3] at 120 (lab 45115330128). Its gate has to grow by hand: upstream a2f1e22390ac took out `pci_restore_state()`'s refusal of a state never saved | spin | labs 45113437048, 45114405201, 45115330128 | 11-23 |
| virtio-pci's vendor capabilities walked once per device (#591 b, a kernel patch on branch `exp/591b-virtio-caps-once`) | 114 MMIO exits fewer (3 a side, lab 45113437048). The first login −5.8 [−8.2, −0.6] at 60 a side (lab 45114405201), three times what 114 exits can cost, and +0.9 [−1.8, +2.7] at 120 (lab 45115330128) | spin | labs 45113437048, 45114405201, 45115330128 | 11-23 |
| The IOAPIC's redirection table read once at boot, and written back only where it was masked (#590, a kernel patch on branch `exp/590-ioapic-once`) | IOAPIC accesses 589 → 205 and the host's handling −3.1 [−6.2, −1.1] ms (3 a side, lab 45113437048), but the first login −4.5 [−7.8, +0.4] at 60 a side (lab 45114405201) and −2.0 [−4.3, +0.6] at 120 (lab 45115330128). With the four other exit patches of #591 and #592, as a bound, −7.4 [−12.1, −2.8] (#627) | spin | labs 45113437048, 45114405201, 45115330128 | 11-23 |
| The IOAPIC's redirection table read once at boot, and written back only where it was masked (#590, a kernel patch on branch `exp/590-ioapic-once`) | IOAPIC accesses 589 → 205 and the host's handling −3.1 [−6.2, −1.1] ms (3 a side, lab 45113437048), but the first login −4.5 [−7.8, +0.4] at 60 a side (lab 45114405201) and −2.0 [−4.3, +0.6] at 120 (lab 45115330128). With the four other exit patches of #591 and #592, as a bound, −7.4 [−12.1, −2.8], and as one change −9.4 [−14.2, −5.7] at 120 a side: carried as 0021-0025 (#627, "What the machine carries") | spin | labs 45113437048, 45114405201, 45115330128 | 11-23 |

### Firmware, QEMU and the machine

Expand Down
2 changes: 2 additions & 0 deletions docs/log.md
Original file line number Diff line number Diff line change
Expand Up @@ -673,6 +673,8 @@ Checked against the probe it replaced on the bench fleet, `lab dispatch ssh-firs

**11-23 · release · v20261123.07 holds #645's cold gain; its record's 20 a side did not see it (labs 45252584128, 45219785493, release run 45241645340, #694).** *Why:* the record read the cold first login at −3.5 [−12.9, +2.9], within noise, against #645's −16.8 [−20.9, −13.0], and spin was about to be told what the bump gains. *Ruled out* (read from the artefacts): the lab arm and the release boot the same machine. QEMU (`f271a946…`), qboot, `pvh.bin` and `linuxboot_dma.bin` are byte-identical, `spin-machine args` prints one command line but for paths, and both vmlinux files are stripped, 40,165,128 bytes, with the same two LOAD segments and the same config; the release's adds 0020. QEMU's RSS moves the same in both (anonymous −34.0 MiB, file +19.9/+20.1). *Measured* (bench, nested, spin's shape and login, both releases as published, each with its own spin-machine, 60 a side, interleaved): first login 378 → 359, −18.6 [−23.6, −14.0], sshd accepting −15.3 [−21.2, −12.6], the console prompt −18.7 [−24.0, −12.8] (lab 45252584128). The record's run disagreed with itself: its `restore-first` cold boot, the same boot at 40 a side, read −14.2 [−19.9, −8.6]; its 20 `.07` boots sat at a p50 of 370 where the lab's sit at 352-359, and 20 a side drawn from lab 45219785493's samples reach −3.5 in 5 of 100,000 draws. *Status:* the gain stands at ~−17 to −19 ms cold. How many boots the record takes is #694.

**11-23 · kernel · the boot's device-setup exits as one change: kernel 0021-0025 (#627, parts run 45256426877, labs 45260781177, 45261629539, this change).** *Why:* five patches each removed the VM exits their changelogs counted (#590, #591, #592), and none moved the first login alone; as a bound the five read −7.4 [−12.1, −2.8] at 60 a side (lab 45114405201). #627 asked whether "the boot's MMIO exits in device setup" is one change and, if so, for one arm at 120 a side, the set chosen before the run. *Changed:* the bound's five, from `archive/exp-batch2-bound`, as 0021-0025 after #645's 0014-0020; they apply to 7.3.6 with no fuzz. The build asserts each on its vmlinux (kernel/README.md); checkpatch `--strict` and sparse pass. 0022 keeps the risk #627 named: upstream a2f1e22390ac took out `pci_restore_state()`'s refusal of a state never saved, so its gate (AER, EEH, s390, Xen pcifront, `reset_root_port`) has to grow by hand with whatever calls error handlers next; it stayed in the set because the set was fixed before the run. *Measured* (bench, nested, spin's shape and login, against v20261123.07, interleaved): first login −9.4 [−14.2, −5.7], sshd accepting −9.5 [−14.4, −5.5], console prompt −10.4 [−14.2, −7.8], second login +0.3 [−0.1, +0.6], QEMU RSS −1.7 MiB [−1.8, −0.1], 120 a side (lab 45260781177). `restore-first`, 60 a side (lab 45261629539): restored login −0.4 [−2.0, +1.7] evicted and +0.2 [−6.6, +7.3] cached, the state +0.0 MiB [−0.1, +0.2], all within noise; its cold row −11.8 [−18.5, −3.2] evicted. The same set against v20261123.06 had read −9.2 [−12.2, −6.0] (lab 45231943664), before 7.3.6 and #645. *Status:* in place; reaches the goal number with the next release.

## 2. Rework cycles

Each cycle: the sequence, what each step measured, and the lesson.
Expand Down
27 changes: 26 additions & 1 deletion kernel/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -464,7 +464,8 @@ RUN <<EOT
dis() { objdump -d --no-show-raw-insn --disassemble="$1" vmlinux; }
lost() { echo "ERROR: patches/$1 is not in this vmlinux: $2"; failed=1; }
for f in vfs_read ftrace_check_for_weak_functions trace_eval_init trace_format_open \
raw_pci_read raw_pci_write pci_setup_device early_quirks btf_vmlinux_defer; do
raw_pci_read raw_pci_write pci_setup_device early_quirks btf_vmlinux_defer \
enable_IO_APIC pci_bus_add_device vp_modern_probe; do
dis "$f" | grep -q "<$f>:" || { echo "ERROR: no function $f in vmlinux; the check that names it reads nothing"; failed=1; }
done

Expand Down Expand Up @@ -564,6 +565,30 @@ RUN <<EOT
grep -A1 -F 'flag == X86_FEATURE_RDRAND' arch/x86/boot/startup/kaslr.c | grep -qF 'native_cpuid_ecx(0x1)' ||
lost 0020 "has_cpuflag reads RDRAND from a register that does not hold it"

# 0021: enable_IO_APIC() clears each pin from the read its ExtINT search made, so it no
# longer reads the whole redirection table again through clear_IO_APIC().
! dis enable_IO_APIC | grep -q '<clear_IO_APIC>' || lost 0021 "enable_IO_APIC still reads every pin again through clear_IO_APIC"

# 0022: a device's state is saved at add only where something can restore it unsaved; the
# check of the root bus's host bridge is the gate's, and the call is there only with it.
dis pci_bus_add_device | grep -q '<pci_find_host_bridge>' || lost 0022 "pci_bus_add_device saves every device's state"

# 0023: virtio-pci's vendor capabilities are walked once, not once for each of four types,
# so vp_modern_probe starts one walk.
[ "$(dis vp_modern_probe | grep -c '<pci_find_capability>')" = 1 ] ||
lost 0023 "vp_modern_probe walks the vendor capabilities once for each type"

# 0024: queue_select is written only when the queue changes. The helper is static and
# inlined into every accessor, so the source that was compiled is read.
grep -qF 'mdev->selected_queue == index' drivers/virtio/virtio_pci_modern_dev.c ||
lost 0024 "virtio-pci writes queue_select before every queue field"

# 0025: msi_set_affinity() returns before the message write when the vector and the
# destination did not change. A comparison in its machine code looks like any other, so the
# source that was compiled is read.
grep -qF 'cfg->dest_apicid == old_cfg.dest_apicid' arch/x86/kernel/apic/msi.c ||
lost 0025 "msi_set_affinity writes an unchanged message"

[ "$failed" = 0 ] || exit 1
echo "kernel patches: each is in this vmlinux"
EOT
Expand Down
5 changes: 5 additions & 0 deletions kernel/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,11 @@ every kernel bump.
| 0018 | the compiled decompressor reads its relocations from `.data.reloc` |
| 0019 | the compiled `arch/x86/boot/startup/kaslr.c` sets `KASLR_FLAG` |
| 0020 | the compiled `arch/x86/boot/startup/kaslr.c` reads RDRAND from CPUID leaf 1's ECX |
| 0021 | `enable_IO_APIC` does not call `clear_IO_APIC`: each pin is cleared from the read its ExtINT search made |
| 0022 | `pci_bus_add_device` calls `pci_find_host_bridge`, the gate on its state save |
| 0023 | `vp_modern_probe` calls `pci_find_capability` once |
| 0024 | the compiled `drivers/virtio/virtio_pci_modern_dev.c` writes `queue_select` only when `selected_queue` differs |
| 0025 | the compiled `arch/x86/kernel/apic/msi.c` compares the vector and the destination before the message write |

None of them is a guest check. What the patches save is CPU and VM exits, which a guest cannot
count, and the format files 0003 defers are behind lockdown. What 0012 and 0013 save is a parse of
Expand Down
Loading