[REBASE & FF] Add PEI Memory Bins#1759
Open
os-d wants to merge 9 commits intomicrosoft:release/202511from
Open
[REBASE & FF] Add PEI Memory Bins#1759os-d wants to merge 9 commits intomicrosoft:release/202511from
os-d wants to merge 9 commits intomicrosoft:release/202511from
Conversation
…t type information (microsoft#1429)" This reverts commit b79a6ef as it was rejected upstream in favor a different solution.
This commits splits out logic currently contained in Gcd.c and Page.c to a new file called MemoryBin.c. This is set up in preparation to add support to PEI for memory bins (an S4 resume stability feature). MemoryBin.c takes all global state in as parameters so that DXE core can use globals and PEI core can use HOBs. This was requested not to be a library. Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
Currently, there is no guarantee that the memory bins will be allocated contiguously. However, this is a requirement to use the resource descriptor HOB that describes the memory bin range. This commit updates AllocateMemoryTypeInformationBins() to allocate a contiguous range. Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
CoreSetMemoryTypeInformationRange() currently calculates the bin size needed independently from the CalculateTotalMemoryBinSizeNeeded() function. This commit updates to use that function and remove the duplication. Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
In order to prepare for PEI core to use the memory bin feature, add a DefaultBin field to the stats structure to track which bins simply point to the default bin. This also adds a helper function to initialize the statistics. Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
This commit adds a parameter to the memory bin allocation function to tell it whether it should create the Resource Descriptor HOB owned by gMemoryTypeInformationGuid. This will be used by PEI to tell DXE where the memory bins are. Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
This commit adds opt-in support for post-mem PEI memory bins. See the README for full details. MemoryBin.c is duplicated to PeiCore per request. Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
If memory bins are enabled for PEI, PEI will produce Memory Allocation HOBs marked with gEfiMemoryTypeInformationGuid. If these exist, DXE core will now process the stats from them to have accurate numbers. Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
This commit adds unit tests and documentation for the Memory Bin feature. Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
Contributor
✅ QEMU Validation PassedSource Dependencies
Results
Workflow run: https://github.com/microsoft/mu_basecore/actions/runs/24257963960 This comment was automatically generated by the Mu QEMU PR Validation workflow. |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## release/202511 #1759 +/- ##
=================================================
Coverage ? 1.88%
=================================================
Files ? 1152
Lines ? 376482
Branches ? 3282
=================================================
Hits ? 7097
Misses ? 369322
Partials ? 63
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
Description
Due to the slow speed of review in edk2 and the platform need for this feature now, tianocore/edk2#12086 is being brought to Mu first.
This also reverts a Mu change around memory bins that was rejected upstream in favor of a different approach brought in with the PEI bins.
How This Was Tested
Physical and virtual platforms with a variety of scenarios, detailed in edk2 PR.
Integration Instructions
To opt into PEI memory bins a platform must, in any order:
gEfiMdeModulePkgTokenSpaceGuid.PcdPeiMemoryBinsEnabletoTRUEin their DSC.not be produced post-mem or DXE will ignore the PEI memory bins because of conflicting Resource Descriptor HOBs.