better handling of very large memory maps
還沒有人認領這個 Issue。
評估
- 難度
- 5/5
- 預估耗時
- 一週以上
- 新手友好度
- 35/100
- Issue 類型
- 缺陷
- 描述清晰度
- 基本清楚
- 活躍度
- 停滯
- 技術堆疊
- rust
研究方向
從 src/main.rs 和 src/binary/level_4_entries.rs 中參照的程式碼開始,接著追蹤 bootloader 對 BIOS 記憶體對映區域的 identity-mapping 邏輯。將已經檢查過的改進與剩下的兩個提案進行比較:避免空洞,以及排除高位址處不可用的保留區域。完成的標準是選擇並實作一種安全的對映策略,且不會發生當機或產生不必要的開機時工作。
由索引模型根據 Issue 內容生成。
描述
Currently, the bootloader has some issues handling BIOS memory maps that contain very high addresses, such as around the 1TB mark, and/or very large regions (in excess of 500 GB). Depending on the bootloader version and configuration, memory maps with high addresses or large regions may result in crashes or degrade boot performance significantly.
In particular, the following issues have been observed:
- v0.9.x of
bootloadercontains an assertion that may be triggered when the memory map contains an address too big for a single PML4 entry if themap_physical_memoryfeature flag is enabled: https://github.com/rust-osdev/bootloader/blob/42da77b47558478c5a948d27cac80767b484eacc/src/main.rs#L289-L291 (see also phil-opp/blog_os#1138) - v0.10.x of
bootloaderdoesn't contain that assertion, but does have offset selection code that assumes no region will require multiple PML4 entries: https://github.com/rust-osdev/bootloader/blob/ac46d0455b41c11e5d316348d068df1c495ce0af/src/binary/level_4_entries.rs#L172-L174 - v0.10.x of
bootloaderexhibits very long boot times when a memory map contains a reserved region at a ~1TB offset. This is because the bootloader will identity map all pages up to the highest reserved address in the memory map using 4K pages, and does this twice (once for the bootloader itself, and a second time when setting up physical memory mappings for the kernel). This results in a very slow boot process.
These issues are relevant because AMD systems with an IOMMU have a reserved hole close to the 1TB mark. In recent QEMU versions (>= v7.1.0), QEMU will report this region as reserved in its e380 BIOS memory map, resulting in assertion failures or boot performance degradation. I would assume this would cause issues when booting on real AMD hardware, as well.
Some changes that would improve how bootloader handles high addresses in the memory map (many of which were suggested by @phil-opp on Gitter):
- Change the automatic offset selection to support regions that need multiple entries in the level 4 page table (v0.9.x, v0.10.x, and probably v0.11.x)
- Don't identity map reserved regions at all when performing the initial identity mapping for the bootloader itself (v0.10.x and probably v0.11.x)
- The framebuffer would still need to be identity mapped so that the bootloader can write to it.
- Use 2MB rather than 4KB pages when identity mapping the kernel address space, which would improve performance (v0.10.x and v0.11.x)
- Consider not identity mapping holes in the memory map at all, only the reserved regions that would need to be mapped for the kernel. This way, we wouldn't map every page between the second-highest reserved region and the 1TB hole on AMD systems.
- Consider not identity mapping that specific reserved region, at all. It's an unusable hole, not a MMIO region or BIOS structure that the kernel would actually want to access...
- 主要語言
- Rust
- 星號
- 1.7k
- 分支
- 241
- PR 合併指標
- 30 天內沒有已合併 PR
環境準備
這個專案沒有提供開發容器、Dockerfile 或貢獻指南,環境需要你自己搭建:先看它的 README,通用步驟見我們的新手貢獻指南。
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
rust-osdev/bootloader 的其他 Issue
-
help wanted
難度 3/5 1-2 天 新手友好度 67/100
rust-osdev/bootloader#581 · 2 則留言 ·
-
難度 4/5 3-5 天 新手友好度 35/100
rust-osdev/bootloader#573 · 5 則留言 ·
-
難度 5/5 一週以上 新手友好度 20/100
rust-osdev/bootloader#555 · 2 則留言 ·
-
難度 5/5 一週以上 新手友好度 30/100
rust-osdev/bootloader#534 ·
-
難度 3/5 1-2 天 新手友好度 38/100
rust-osdev/bootloader#525 ·
查看 rust-osdev/bootloader 的全部 Issue
相似的 Issue
-
難度 2/5 1-3 小時 新手友好度 66/100
home-assistant/installer#308 ·
維護者通常 1 天內回覆
-
bug
難度 2/5 1-3 小時 新手友好度 75/100
swc-project/swc-next#1053 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 78/100
nautechsystems/nautilus_trader#5387 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 76/100
NomicFoundation/edr#1872 ·
維護者通常 2 天內回覆
-
難度 2/5 1-3 小時 新手友好度 67/100
linebender/resvg#1179 · 1 則留言 ·
維護者通常 2 天內回覆