perf(kernel): QEMU sorts 42k guest symbols on every boot and never reads one - #76
Merged
Conversation
…improve boot time
Dockerfile.qemusym was scaffolding: the production QEMU is built stripped, so a perf profile of it names only raw addresses, and the symbol table work this branch removes was invisible until QEMU itself had symbols. It configures the same build with --disable-strip --enable-debug-info, out of the shared source and build caches so neither is disturbed. It served its purpose and does not belong in the tree - the finding is in the commit that strips the guest kernel, and the file is reproducible from Dockerfile.qemu by swapping those two flags. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014fdjKufitSmytkon6wZDCb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
QEMU's
load_elf()reads the symbol table of the kernel it loads andqsort()s it, so it can name addresses for its own debugging. Nothing in this stack ever asks it: the guest resolves its own names throughCONFIG_KALLSYMS, which lives in the loaded image data and has nothing to do with the ELF.symtab. The image is a 39.4 MBvmlinuxof which 30.7 MB isPT_LOAD; most of the rest is that table.How it was found
A
perfprofile of QEMU's main thread — once the binary had symbols to profile with. The production build is stripped, which is why an earlier profile of the same window named nothing but raw addresses:Why stripping is a clean cut
It removes nothing the machine loads:
PT_LOADMeasured
A/B/A/B, eight runs per arm, same shim/initrd/QEMU/image, host-quiet gated. Medians with [min–max]:
qemu_launchguest_bootfirst-acceptBOOT_TIMELINEtotal−11.8 ms, entirely host-side. The guest boot is unchanged, as it must be — the bits it runs are the same. The saving lands before QMP answers, which is also why it shows up in
qemu_launchand not anywhere in the kernel profile.This is not a step toward bzImage
The same A/B settles that question: the transfer cost tracks
PT_LOAD, not file size. 5.1 MB less file at constantPT_LOADmoved the pre-kernel window not at all (37.5 → 38.5 ms, noise). A compressed image would still expand to the same ~30 MB in guest RAM, paid as in-guest decompression instead of a host copy, and would need thelinuxboot_dmaoption ROM this firmware set deliberately does not ship (Dockerfile.qemu:203).Validation
/proc/kallsymsinside the guest still resolves (acpi_initialize_hp_context, …).nmreports no symbols,readelf -nstill finds the PVH notes,PT_LOADis 30.68 MB.🤖 Generated with Claude Code