patina-v0.1.1
What's Changed
-
Makefile: Move `cargo doc --open` to `cargo make doc-open` @makubacki (#452)
Change Details
## Description
Closes #451
Allows
cargo make allto usecargo make docwhich doesn't open the Web browser with documentation when running the command.- Impacts functionality?
- Impacts security?
- Breaking change?
- Includes tests?
- Includes documentation?
How This Was Tested
cargo make doccargo make doc-opencargo make all
Integration Instructions
Review the readme to understand what command to use for your use case.
-
Move GCD interaction from FixedSizeBlockAllocator to SpinLockedFixedSizeBlockAllocator @kouchekiniad (#435)
Change Details
## Description
To avoid interacting with the GCD in the FSB's locked regions (which can potentially cause an FSB lock re-entrancy if the GCD allocates memory), this change moves all interaction with the GCD outside of the locked regions of the FSB and into the spin-locked FSB. As such, new memory allocations from the GCD are now either requested by the FSB then allocated from the spin-locked FSB (in the case of alloc/dealloc) or made by the spin-locked FSB, which then informs the FSB of the change.
Main changes include:
-
Rather than expanding by allocating memory from the GCD directly, the FSB's
expandis now passed-in a region of memory to expand itself with which is allocated from the GCD by the spin-locked FSB- Attempted allocations in the FSB will return
FixedSizeBlockAllocatorError::OutOfMemory(additional_mem_requested)if the FSB is unable to fit the allocation, prompting the spin-locked FSB to allocate additional memory with the GCD and callexpandon the FSB - Note: This has the side effect that the FSB's
pool_allocation_callsstat would be incremented twice in the case that additional memory needs to be allocated by the spin-locked FSB
- Attempted allocations in the FSB will return
-
As there is no longer a direct analogue for the
alloc/deallocfunctions ofGlobalAllocand theallocate/deallocatefunctions ofAllocator, the FSB now defines only oneallocanddeallocwhich are shared by both trait implementations -
The bulk of the allocation logic for
allocate_pagesandfree_pageshave been moved into the spin-locked FSB, which then notifies the FSB of any page allocations made/freed withnotify_page_allocationandnotify_pages_freed -
preferred_rangehas been renamed toreserved_rangeas the FSB itself makes no preference for putting new allocations into thepreferred_range, and any preference the GCD would show for allocating memory in that region would be solely predicated by the "preferred_range" being allocated earlier in the boot process -
GCD interaction as part of
reserve_memory_regionhas been moved to the spin-locked FSB, with the reserved memory region being registered in the FSB withset_reserved_range(range). Rather than calling intoallocate_pagesthenfree_pagesto reserve the memory region,reserve_memory_regionnow reserves memory in the GCD by directly callinggcd.allocate_memory_spacethengcd.free_memory_space_preserving_ownershipto avoid having to undo the stats side-effects of theallocate_pagesandfree_pagesfunctions.- Note: This has the effect of not iterating
page_allocation_callsandpage_free_callswhen callingreserve_memory_pages
- Note: This has the effect of not iterating
-
To keep things consistent, raw pointers and raw pointers + usize lengths have been largely replaced with
NonNull<u8>andNonNull<[u8]>respectively. -
Impacts functionality?
-
Impacts security?
-
Breaking change?
-
Includes tests?
-
Includes documentation?
How This Was Tested
Booted to Windows on x64 physical platform.
Integration Instructions
N/A
</blockquote> <hr> </details> -
-
EventDb: Allow re-entrance to tpl\_restore from event notify functions. @joschock (#446)
Change Details
## Description
The present implementation of
restore_tpluses an atomic flagEVENT_NOTIFIES_IN_PROGRESSto handle the issue where locking the EVENT DB triggers arestore_tplthat would result in an endless loop. The implementation currently holds that flag while invoking the event notification function which has the effect of preventing notification callbacks during the execution of event notifies.Generally this is not an issue, but there are some corner cases where this can violate expectations of code that expects to manipulate the TPL within the event callback to trigger other event notifies. An example of where this is in the UsbBusDxe driver here: https://github.com/microsoft/mu_basecore/blob/3fd74e217a1e6c72f90efb1517f7da610c42d074/MdeModulePkg/Bus/Usb/UsbBusDxe/UsbHub.c#L1009
This while loop will hang unless timer events fire while it is looping - and the
EVENT_NOTIFIES_IN_PROGRESSimplementation presently prevents that.This PR reworks the
restore_tplimplementation such that theEVENT_NOTIFIES_IN_PROGRESSflag is released before executing the notification functions - this allows re-entrancy torestore_tplfrom the notification functions while still addressing the infinite regress issue from the event db lock.In addition, this PR removes the EventNotificationIterator object as it is no longer required given the rework of the code. An equivalent iterator can be generated with the
core::iter::from_fnfunction (as is demo'd in the updated test code).- Impacts functionality?
- Impacts security?
- Breaking change?
- Includes tests?
- Includes documentation?
How This Was Tested
Basic functional testing to ensure that pathological case from UsbBusDxe above is addressed functionally, updated unit tests
Integration Instructions
N/A - no public APIs changed.
-
Support for Hoblist with dxe core in allocation hob @HappyCoding-2025 (#402)
Change Details
Fixes https://github.com//issues/323 This is already reviewed code and was asked to move this code as part of another PR as per Michael. Hence raising another PR for this.
Also - this addresses the comments given from #326.
The current hoblist in testsupport crate is not sufficient and does not contain the dxe-core HOB with dxe core efi filled in expected by our initiatlisation. When existing hoblist is used, it panics.
Hence there was a need to create another hoblist with dxe-core and fill in with dxe EFI.
Based on comments from #326.
The comment mentioned on taking only the hoblist part and push to main.
Hence creating this issue for tracking.</blockquote> <hr> </details>
-
RFC: Consolidate SDK Crates into `patina_sdk` and `patina_sdk_macro` as Modules @vineelko (#437)
Change Details
## Description
This RFC proposes consolidating the existing crates inside the Patina
sdk
directory into thepatina_sdkandpatina_sdk_macrocrates, organized by
modules. No functional changes to the modules are intended.Tracks: #418
- Impacts functionality?
- Impacts security?
- Breaking change?
- Includes tests?
- Includes documentation?
How This Was Tested
NA
Integration Instructions
NA
-
Minor doc url updates @vineelko (#438)
Change Details
## Description
Update references to patina-paging and patina-mtrr repositories in the documentation
- Impacts functionality?
- Impacts security?
- Breaking change?
- Includes tests?
- Includes documentation?
How This Was Tested
NA
Integration Instructions
NA
-
mm\_communicator: Remove comm buffer trace message @makubacki (#439)
Change Details
## Description
Some platforms always have tracing on and this is noisy. Can be viewed in debugger if needed.
- Impacts functionality?
- Impacts security?
- Breaking change?
- Includes tests?
- Includes documentation?
How This Was Tested
cargo make all
Integration Instructions
- Comm buffer dump no longer present in trace level by default
-
chore: Release v0.1.0 @makubacki (#440)
Change Details
## Description
Some crates such as
patina_dxe_corewere missing inpatina-fwuntil the publishing changes were included (in this release).
📖 Documentation Updates
-
[REBASE\&FF] uefi\_sdk: support Service const instantiation @Javagedes (#433)
Change Details
## Description
Adds support for const instantiation of a service (in an uninitialized state) to support using services in const contexts without the need of wrapping it in some type of container object.
This is done by using a
OnceCell, which does come with a performance cost, which was mitigated (to almost exactly the same performance) by updating theDerefimplementation to hint to the compiler that one path is unreachable (which it is, per the safety notes).This also comes with a commit to add service benchmarks to benchmark performance of calling a services function, and the performance impact of using a dyn object service vs a concrete service. For anyone curious, these were the performance numbers:
description dyn concrete Prior Art ~3.7ns ~2.5ns With const ~3.6ns ~2.4ns - Impacts functionality?
- Impacts security?
- Breaking change?
- Includes tests?
- Includes documentation?
How This Was Tested
Multiple Tests and new benchmarks
Integration Instructions
N/A
</blockquote> <hr> </details>
Full Changelog: patina-v0.1.0...v0.1.1