-
Notifications
You must be signed in to change notification settings - Fork 161
openhcl_boot: introduce a simple bump allocator for mesh decode #2031
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces a simple bump allocator to openhcl_boot to enable protobuf payload decoding using mesh decode. The allocator is designed for limited use during boot operations, particularly for servicing boot scenarios where protobuf data needs to be parsed from previous instances.
- Adds a new
BumpAllocatorimplementation with strict allocation controls - Reserves 16 pages of memory for the bootloader heap in both paravisor configurations
- Introduces nightly Rust configuration support for allocator API features
Reviewed Changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
vm/loader/src/paravisor.rs |
Reserves 16 pages for bootshim heap and passes heap parameters to both paravisor configurations |
vm/loader/loader_defs/src/shim.rs |
Adds heap offset and size fields to ShimParamsRaw structure |
openhcl/openhcl_boot/src/main.rs |
Enables nightly feature gate and adds allocator/bump_alloc module |
openhcl/openhcl_boot/src/host_params/shim_params.rs |
Processes heap parameters and creates MemoryRange for heap allocation |
openhcl/openhcl_boot/src/host_params/dt.rs |
Initializes heap allocator and includes debug test code |
openhcl/openhcl_boot/src/bump_alloc.rs |
Implements the complete bump allocator with safety controls and testing |
openhcl/openhcl_boot/build.rs |
Adds cargo configuration for nightly feature support |
The implementation for intrinsics in minimal_rt was incorrect. For example, the inline asm block for `memcpy` correctly describes that `rdi` will be clobbered by `rep movsb`, but `memcpy`'s API requires that the return value is the _original_ destination pointer, not the incremented pointer. Fix this by removing the mut on `dest` and indicating to the compiler to discard the clobbered value. It seems that in most cases, the compiler ignored the return value of memcpy, except when #2031 was being added. Certain compilation options or function implementations would cause the compiler to use the inlined returned value of `memcpy` directly from the call to realloc, which would then cause a later an assertion failure due to the pointer not being what was expected and overlapping with the new destination. Fix all the intrinsics in `minimal_rt` to correctly return the unmodified `dest` or `ptr` as they should.
f1e390e to
ce495a5
Compare
…osoft#2041) The implementation for intrinsics in minimal_rt was incorrect. For example, the inline asm block for `memcpy` correctly describes that `rdi` will be clobbered by `rep movsb`, but `memcpy`'s API requires that the return value is the _original_ destination pointer, not the incremented pointer. Fix this by removing the mut on `dest` and indicating to the compiler to discard the clobbered value. It seems that in most cases, the compiler ignored the return value of memcpy, except when microsoft#2031 was being added. Certain compilation options or function implementations would cause the compiler to use the inlined returned value of `memcpy` directly from the call to realloc, which would then cause a later an assertion failure due to the pointer not being what was expected and overlapping with the new destination. Fix all the intrinsics in `minimal_rt` to correctly return the unmodified `dest` or `ptr` as they should.
…osoft#2031) Add a simple bump allocator to allow `openhcl_boot` to decode protobuf payloads using mesh decode. Note that this PR only introduces the allocator, a follow up change will use it. Add a new nightly cfg gate to allow running miri tests with nightly. For now, add a small debug assertion enabled section that uses the allocator. This will be removed in the next change.
Add a simple bump allocator to allow
openhcl_bootto decode protobuf payloads using mesh decode. Note that this PR only introduces the allocator, a follow up change will use it.Add a new nightly cfg gate to allow running miri tests with nightly.
For now, add a small debug assertion enabled section that uses the allocator. This will be removed in the next change.