Repository navigation
fix(x86_64-linux): only hand free RAM to the kernel - #650
Draft
martijnhoekstra wants to merge 1 commit into
Draft
martijnhoekstra wants to merge 1 commit into
martijnhoekstra wants to merge 1 commit into
Conversation
The Linux boot path passed every E820 entry to the kernel as memory, including reserved ones, and didn't reserve the loader's own memory. Under Firecracker the kernel then handed out frames from the reserved range at 0xeec00000 and from the page tables and boot stack it still uses. Pass only E820 RAM entries, and reserve the loader image, boot stack and PhysAlloc allocations in the FDT. Assisted-by: Claude:claude-opus-5-5
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.
Fixes #649.
The Linux boot path now passes only E820 RAM entries to the kernel as
/memorynodes. It also adds an FDT memory reservation from the loader's start to the end of the boot stack or ofPhysAlloc's allocations, whichever is higher. That covers the loader image with its page tables, the boot stack, page tables allocated without 1-GiB page support, and the kernel image. The kernel already honours FDT memory reservations. The multiboot and UEFI paths pass none.Tested with kernel main:
rusty_demo) passes on Firecracker v1.12.0. On v1.17.0,rusty_demogets toexit status 0, but Firecracker then reports the guest's shutdown as an error. That is a separate problem.0x802000.virtio-netand withoutpcipasses TCP and UDP tests on both Firecracker versions.pcion QEMU q35 (TCG).cargo fmtis clean, andcargo xtask clippygives the same warnings as on main for all five targets.Not tested: the loader's
xtask cijobs, UEFI boot, more than one vCPU, and a CPU without 1-GiB pages. That last case is the only one where the loader allocates page tables fromPhysAlloc.