Skip to content

Update memory map descriptor merging logic to honor the bucket type information#1429

Merged
kuqin12 merged 21 commits intomicrosoft:dev/202502from
kuqin12:fix_bucket_2
Jul 9, 2025
Merged

Update memory map descriptor merging logic to honor the bucket type information#1429
kuqin12 merged 21 commits intomicrosoft:dev/202502from
kuqin12:fix_bucket_2

Conversation

@kuqin12
Copy link
Copy Markdown
Contributor

@kuqin12 kuqin12 commented Jul 8, 2025

Description

The current memory map merging logic in CoreAddRange and MergeMemoryMapByAttribute only checks the memory type without considering the bucket type. However, the CoreGetMemoryMap routine will only report the entries that are entirely inside a specific bucket type. This will confuse the consumer and report false free memory that belongs to special memory buckets.

This change fixes the issue by gating the merging logic by checking the bucket type first. The merging is only allowed either if the bucket type is not one of the special types, or if the bucket type is the same for both entries.

For details on how to complete these options and their meaning refer to CONTRIBUTING.md.

  • Impacts functionality?
  • Impacts security?
  • Breaking change?
  • Includes tests?
  • Includes documentation?
  • Backport to release branch?

How This Was Tested

This was tested on proprietary hardware.

Integration Instructions

N/A

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Jul 8, 2025

Codecov Report

❌ Patch coverage is 0% with 191 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (dev/202502@866aa28). Learn more about missing BASE report.

Files with missing lines Patch % Lines
MdeModulePkg/Core/Dxe/Mem/Page.c 0.00% 191 Missing ⚠️
Additional details and impacted files
@@              Coverage Diff              @@
##             dev/202502    #1429   +/-   ##
=============================================
  Coverage              ?    1.56%           
=============================================
  Files                 ?      631           
  Lines                 ?   233114           
  Branches              ?      370           
=============================================
  Hits                  ?     3649           
  Misses                ?   229452           
  Partials              ?       13           
Flag Coverage Δ
MdeModulePkg 1.56% <0.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@kuqin12 kuqin12 requested review from apop5, cfernald, makubacki and os-d July 8, 2025 16:33
Comment thread MdeModulePkg/Core/Dxe/Mem/Page.c
Comment thread MdeModulePkg/Core/Dxe/Mem/Page.c Outdated
Comment thread MdeModulePkg/Core/Dxe/Mem/Page.c
Comment thread MdeModulePkg/Core/Dxe/Mem/Page.c
Comment thread MdeModulePkg/Core/Dxe/Mem/Page.c Outdated
Comment thread MdeModulePkg/Core/Dxe/Mem/Page.c Outdated
Comment thread MdeModulePkg/Core/Dxe/Mem/Page.c Outdated
kuqin12 and others added 4 commits July 8, 2025 14:19
Co-authored-by: Michael Kubacki <michael.kubacki@microsoft.com>
Signed-off-by: kuqin12 <42554914+kuqin12@users.noreply.github.com>
Co-authored-by: Michael Kubacki <michael.kubacki@microsoft.com>
Signed-off-by: kuqin12 <42554914+kuqin12@users.noreply.github.com>
Co-authored-by: Michael Kubacki <michael.kubacki@microsoft.com>
Signed-off-by: kuqin12 <42554914+kuqin12@users.noreply.github.com>
Comment thread MdeModulePkg/Core/Dxe/Mem/Page.c Outdated
Comment thread MdeModulePkg/Core/Dxe/Mem/Page.c
@mu-automation mu-automation bot added the type:backport Backport changes in a dev branch PR to its release branch. label Jul 9, 2025
@kuqin12 kuqin12 enabled auto-merge (squash) July 9, 2025 18:26
@kuqin12 kuqin12 added the type:bug Something isn't working label Jul 9, 2025
@kuqin12 kuqin12 merged commit addb749 into microsoft:dev/202502 Jul 9, 2025
31 checks passed
mu-automation bot pushed a commit that referenced this pull request Jul 9, 2025
…nformation (#1429)

## Description

The current memory map merging logic in `CoreAddRange` and
`MergeMemoryMapByAttribute` only checks the memory type without
considering the bucket type. However, the `CoreGetMemoryMap` routine
will only report the entries that are entirely inside a specific bucket
type. This will confuse the consumer and report false free memory that
belongs to special memory buckets.

This change fixes the issue by gating the merging logic by checking the
bucket type first. The merging is only allowed either if the bucket type
is not one of the special types, or if the bucket type is the same for
both entries.

For details on how to complete these options and their meaning refer to
[CONTRIBUTING.md](https://github.com/microsoft/mu/blob/HEAD/CONTRIBUTING.md).

- [x] Impacts functionality?
- [ ] Impacts security?
- [ ] Breaking change?
- [ ] Includes tests?
- [ ] Includes documentation?
- [x] Backport to release branch?

## How This Was Tested

This was tested on proprietary hardware.

## Integration Instructions

N/A

---------

Signed-off-by: kuqin12 <42554914+kuqin12@users.noreply.github.com>
Co-authored-by: Michael Kubacki <michael.kubacki@microsoft.com>
@kuqin12 kuqin12 deleted the fix_bucket_2 branch July 9, 2025 20:03
@kuqin12 kuqin12 restored the fix_bucket_2 branch July 11, 2025 02:50
apop5 pushed a commit to apop5/mu_basecore that referenced this pull request Dec 2, 2025
…nformation (microsoft#1429)

## Description

The current memory map merging logic in `CoreAddRange` and
`MergeMemoryMapByAttribute` only checks the memory type without
considering the bucket type. However, the `CoreGetMemoryMap` routine
will only report the entries that are entirely inside a specific bucket
type. This will confuse the consumer and report false free memory that
belongs to special memory buckets.

This change fixes the issue by gating the merging logic by checking the
bucket type first. The merging is only allowed either if the bucket type
is not one of the special types, or if the bucket type is the same for
both entries.

For details on how to complete these options and their meaning refer to
[CONTRIBUTING.md](https://github.com/microsoft/mu/blob/HEAD/CONTRIBUTING.md).

- [x] Impacts functionality?
- [ ] Impacts security?
- [ ] Breaking change?
- [ ] Includes tests?
- [ ] Includes documentation?
- [x] Backport to release branch?

## How This Was Tested

This was tested on proprietary hardware.

## Integration Instructions

N/A

---------

Signed-off-by: kuqin12 <42554914+kuqin12@users.noreply.github.com>
Co-authored-by: Michael Kubacki <michael.kubacki@microsoft.com>
apop5 pushed a commit to apop5/mu_basecore that referenced this pull request Dec 15, 2025
…nformation (microsoft#1429)

## Description

The current memory map merging logic in `CoreAddRange` and
`MergeMemoryMapByAttribute` only checks the memory type without
considering the bucket type. However, the `CoreGetMemoryMap` routine
will only report the entries that are entirely inside a specific bucket
type. This will confuse the consumer and report false free memory that
belongs to special memory buckets.

This change fixes the issue by gating the merging logic by checking the
bucket type first. The merging is only allowed either if the bucket type
is not one of the special types, or if the bucket type is the same for
both entries.

For details on how to complete these options and their meaning refer to
[CONTRIBUTING.md](https://github.com/microsoft/mu/blob/HEAD/CONTRIBUTING.md).

- [x] Impacts functionality?
- [ ] Impacts security?
- [ ] Breaking change?
- [ ] Includes tests?
- [ ] Includes documentation?
- [x] Backport to release branch?

## How This Was Tested

This was tested on proprietary hardware.

## Integration Instructions

N/A

---------

Signed-off-by: kuqin12 <42554914+kuqin12@users.noreply.github.com>
Co-authored-by: Michael Kubacki <michael.kubacki@microsoft.com>
apop5 pushed a commit to apop5/mu_basecore that referenced this pull request Dec 16, 2025
…nformation (microsoft#1429)

## Description

The current memory map merging logic in `CoreAddRange` and
`MergeMemoryMapByAttribute` only checks the memory type without
considering the bucket type. However, the `CoreGetMemoryMap` routine
will only report the entries that are entirely inside a specific bucket
type. This will confuse the consumer and report false free memory that
belongs to special memory buckets.

This change fixes the issue by gating the merging logic by checking the
bucket type first. The merging is only allowed either if the bucket type
is not one of the special types, or if the bucket type is the same for
both entries.

For details on how to complete these options and their meaning refer to
[CONTRIBUTING.md](https://github.com/microsoft/mu/blob/HEAD/CONTRIBUTING.md).

- [x] Impacts functionality?
- [ ] Impacts security?
- [ ] Breaking change?
- [ ] Includes tests?
- [ ] Includes documentation?
- [x] Backport to release branch?

## How This Was Tested

This was tested on proprietary hardware.

## Integration Instructions

N/A

---------

Signed-off-by: kuqin12 <42554914+kuqin12@users.noreply.github.com>
Co-authored-by: Michael Kubacki <michael.kubacki@microsoft.com>
apop5 pushed a commit to apop5/mu_basecore that referenced this pull request Dec 17, 2025
…nformation (microsoft#1429)

## Description

The current memory map merging logic in `CoreAddRange` and
`MergeMemoryMapByAttribute` only checks the memory type without
considering the bucket type. However, the `CoreGetMemoryMap` routine
will only report the entries that are entirely inside a specific bucket
type. This will confuse the consumer and report false free memory that
belongs to special memory buckets.

This change fixes the issue by gating the merging logic by checking the
bucket type first. The merging is only allowed either if the bucket type
is not one of the special types, or if the bucket type is the same for
both entries.

For details on how to complete these options and their meaning refer to
[CONTRIBUTING.md](https://github.com/microsoft/mu/blob/HEAD/CONTRIBUTING.md).

- [x] Impacts functionality?
- [ ] Impacts security?
- [ ] Breaking change?
- [ ] Includes tests?
- [ ] Includes documentation?
- [x] Backport to release branch?

## How This Was Tested

This was tested on proprietary hardware.

## Integration Instructions

N/A

---------

Signed-off-by: kuqin12 <42554914+kuqin12@users.noreply.github.com>
Co-authored-by: Michael Kubacki <michael.kubacki@microsoft.com>
apop5 pushed a commit to apop5/mu_basecore that referenced this pull request Dec 19, 2025
…nformation (microsoft#1429)

## Description

The current memory map merging logic in `CoreAddRange` and
`MergeMemoryMapByAttribute` only checks the memory type without
considering the bucket type. However, the `CoreGetMemoryMap` routine
will only report the entries that are entirely inside a specific bucket
type. This will confuse the consumer and report false free memory that
belongs to special memory buckets.

This change fixes the issue by gating the merging logic by checking the
bucket type first. The merging is only allowed either if the bucket type
is not one of the special types, or if the bucket type is the same for
both entries.

For details on how to complete these options and their meaning refer to
[CONTRIBUTING.md](https://github.com/microsoft/mu/blob/HEAD/CONTRIBUTING.md).

- [x] Impacts functionality?
- [ ] Impacts security?
- [ ] Breaking change?
- [ ] Includes tests?
- [ ] Includes documentation?
- [x] Backport to release branch?

## How This Was Tested

This was tested on proprietary hardware.

## Integration Instructions

N/A

---------

Signed-off-by: kuqin12 <42554914+kuqin12@users.noreply.github.com>
Co-authored-by: Michael Kubacki <michael.kubacki@microsoft.com>
apop5 pushed a commit to apop5/mu_basecore that referenced this pull request Dec 22, 2025
…nformation (microsoft#1429)

## Description

The current memory map merging logic in `CoreAddRange` and
`MergeMemoryMapByAttribute` only checks the memory type without
considering the bucket type. However, the `CoreGetMemoryMap` routine
will only report the entries that are entirely inside a specific bucket
type. This will confuse the consumer and report false free memory that
belongs to special memory buckets.

This change fixes the issue by gating the merging logic by checking the
bucket type first. The merging is only allowed either if the bucket type
is not one of the special types, or if the bucket type is the same for
both entries.

For details on how to complete these options and their meaning refer to
[CONTRIBUTING.md](https://github.com/microsoft/mu/blob/HEAD/CONTRIBUTING.md).

- [x] Impacts functionality?
- [ ] Impacts security?
- [ ] Breaking change?
- [ ] Includes tests?
- [ ] Includes documentation?
- [x] Backport to release branch?

## How This Was Tested

This was tested on proprietary hardware.

## Integration Instructions

N/A

---------

Signed-off-by: kuqin12 <42554914+kuqin12@users.noreply.github.com>
Co-authored-by: Michael Kubacki <michael.kubacki@microsoft.com>
apop5 pushed a commit to apop5/mu_basecore that referenced this pull request Dec 30, 2025
…nformation (microsoft#1429)

## Description

The current memory map merging logic in `CoreAddRange` and
`MergeMemoryMapByAttribute` only checks the memory type without
considering the bucket type. However, the `CoreGetMemoryMap` routine
will only report the entries that are entirely inside a specific bucket
type. This will confuse the consumer and report false free memory that
belongs to special memory buckets.

This change fixes the issue by gating the merging logic by checking the
bucket type first. The merging is only allowed either if the bucket type
is not one of the special types, or if the bucket type is the same for
both entries.

For details on how to complete these options and their meaning refer to
[CONTRIBUTING.md](https://github.com/microsoft/mu/blob/HEAD/CONTRIBUTING.md).

- [x] Impacts functionality?
- [ ] Impacts security?
- [ ] Breaking change?
- [ ] Includes tests?
- [ ] Includes documentation?
- [x] Backport to release branch?

## How This Was Tested

This was tested on proprietary hardware.

## Integration Instructions

N/A

---------

Signed-off-by: kuqin12 <42554914+kuqin12@users.noreply.github.com>
Co-authored-by: Michael Kubacki <michael.kubacki@microsoft.com>
apop5 pushed a commit to apop5/mu_basecore that referenced this pull request Jan 7, 2026
…nformation (microsoft#1429)

## Description

The current memory map merging logic in `CoreAddRange` and
`MergeMemoryMapByAttribute` only checks the memory type without
considering the bucket type. However, the `CoreGetMemoryMap` routine
will only report the entries that are entirely inside a specific bucket
type. This will confuse the consumer and report false free memory that
belongs to special memory buckets.

This change fixes the issue by gating the merging logic by checking the
bucket type first. The merging is only allowed either if the bucket type
is not one of the special types, or if the bucket type is the same for
both entries.

For details on how to complete these options and their meaning refer to
[CONTRIBUTING.md](https://github.com/microsoft/mu/blob/HEAD/CONTRIBUTING.md).

- [x] Impacts functionality?
- [ ] Impacts security?
- [ ] Breaking change?
- [ ] Includes tests?
- [ ] Includes documentation?
- [x] Backport to release branch?

## How This Was Tested

This was tested on proprietary hardware.

## Integration Instructions

N/A

---------

Signed-off-by: kuqin12 <42554914+kuqin12@users.noreply.github.com>
Co-authored-by: Michael Kubacki <michael.kubacki@microsoft.com>
apop5 pushed a commit that referenced this pull request Jan 10, 2026
…nformation (#1429)

## Description

The current memory map merging logic in `CoreAddRange` and
`MergeMemoryMapByAttribute` only checks the memory type without
considering the bucket type. However, the `CoreGetMemoryMap` routine
will only report the entries that are entirely inside a specific bucket
type. This will confuse the consumer and report false free memory that
belongs to special memory buckets.

This change fixes the issue by gating the merging logic by checking the
bucket type first. The merging is only allowed either if the bucket type
is not one of the special types, or if the bucket type is the same for
both entries.

For details on how to complete these options and their meaning refer to
[CONTRIBUTING.md](https://github.com/microsoft/mu/blob/HEAD/CONTRIBUTING.md).

- [x] Impacts functionality?
- [ ] Impacts security?
- [ ] Breaking change?
- [ ] Includes tests?
- [ ] Includes documentation?
- [x] Backport to release branch?

## How This Was Tested

This was tested on proprietary hardware.

## Integration Instructions

N/A

---------

Signed-off-by: kuqin12 <42554914+kuqin12@users.noreply.github.com>
Co-authored-by: Michael Kubacki <michael.kubacki@microsoft.com>
apop5 pushed a commit that referenced this pull request Jan 12, 2026
…nformation (#1429)

## Description

The current memory map merging logic in `CoreAddRange` and
`MergeMemoryMapByAttribute` only checks the memory type without
considering the bucket type. However, the `CoreGetMemoryMap` routine
will only report the entries that are entirely inside a specific bucket
type. This will confuse the consumer and report false free memory that
belongs to special memory buckets.

This change fixes the issue by gating the merging logic by checking the
bucket type first. The merging is only allowed either if the bucket type
is not one of the special types, or if the bucket type is the same for
both entries.

For details on how to complete these options and their meaning refer to
[CONTRIBUTING.md](https://github.com/microsoft/mu/blob/HEAD/CONTRIBUTING.md).

- [x] Impacts functionality?
- [ ] Impacts security?
- [ ] Breaking change?
- [ ] Includes tests?
- [ ] Includes documentation?
- [x] Backport to release branch?

## How This Was Tested

This was tested on proprietary hardware.

## Integration Instructions

N/A

---------

Signed-off-by: kuqin12 <42554914+kuqin12@users.noreply.github.com>
Co-authored-by: Michael Kubacki <michael.kubacki@microsoft.com>
apop5 pushed a commit that referenced this pull request Jan 13, 2026
…nformation (#1429)

## Description

The current memory map merging logic in `CoreAddRange` and
`MergeMemoryMapByAttribute` only checks the memory type without
considering the bucket type. However, the `CoreGetMemoryMap` routine
will only report the entries that are entirely inside a specific bucket
type. This will confuse the consumer and report false free memory that
belongs to special memory buckets.

This change fixes the issue by gating the merging logic by checking the
bucket type first. The merging is only allowed either if the bucket type
is not one of the special types, or if the bucket type is the same for
both entries.

For details on how to complete these options and their meaning refer to
[CONTRIBUTING.md](https://github.com/microsoft/mu/blob/HEAD/CONTRIBUTING.md).

- [x] Impacts functionality?
- [ ] Impacts security?
- [ ] Breaking change?
- [ ] Includes tests?
- [ ] Includes documentation?
- [x] Backport to release branch?

## How This Was Tested

This was tested on proprietary hardware.

## Integration Instructions

N/A

---------

Signed-off-by: kuqin12 <42554914+kuqin12@users.noreply.github.com>
Co-authored-by: Michael Kubacki <michael.kubacki@microsoft.com>
apop5 pushed a commit that referenced this pull request Jan 15, 2026
…nformation (#1429)

## Description

The current memory map merging logic in `CoreAddRange` and
`MergeMemoryMapByAttribute` only checks the memory type without
considering the bucket type. However, the `CoreGetMemoryMap` routine
will only report the entries that are entirely inside a specific bucket
type. This will confuse the consumer and report false free memory that
belongs to special memory buckets.

This change fixes the issue by gating the merging logic by checking the
bucket type first. The merging is only allowed either if the bucket type
is not one of the special types, or if the bucket type is the same for
both entries.

For details on how to complete these options and their meaning refer to
[CONTRIBUTING.md](https://github.com/microsoft/mu/blob/HEAD/CONTRIBUTING.md).

- [x] Impacts functionality?
- [ ] Impacts security?
- [ ] Breaking change?
- [ ] Includes tests?
- [ ] Includes documentation?
- [x] Backport to release branch?

## How This Was Tested

This was tested on proprietary hardware.

## Integration Instructions

N/A

---------

Signed-off-by: kuqin12 <42554914+kuqin12@users.noreply.github.com>
Co-authored-by: Michael Kubacki <michael.kubacki@microsoft.com>
apop5 pushed a commit that referenced this pull request Jan 28, 2026
…nformation (#1429)

## Description

The current memory map merging logic in `CoreAddRange` and
`MergeMemoryMapByAttribute` only checks the memory type without
considering the bucket type. However, the `CoreGetMemoryMap` routine
will only report the entries that are entirely inside a specific bucket
type. This will confuse the consumer and report false free memory that
belongs to special memory buckets.

This change fixes the issue by gating the merging logic by checking the
bucket type first. The merging is only allowed either if the bucket type
is not one of the special types, or if the bucket type is the same for
both entries.

For details on how to complete these options and their meaning refer to
[CONTRIBUTING.md](https://github.com/microsoft/mu/blob/HEAD/CONTRIBUTING.md).

- [x] Impacts functionality?
- [ ] Impacts security?
- [ ] Breaking change?
- [ ] Includes tests?
- [ ] Includes documentation?
- [x] Backport to release branch?

## How This Was Tested

This was tested on proprietary hardware.

## Integration Instructions

N/A

---------

Signed-off-by: kuqin12 <42554914+kuqin12@users.noreply.github.com>
Co-authored-by: Michael Kubacki <michael.kubacki@microsoft.com>
apop5 pushed a commit that referenced this pull request Feb 5, 2026
…nformation (#1429)

## Description

The current memory map merging logic in `CoreAddRange` and
`MergeMemoryMapByAttribute` only checks the memory type without
considering the bucket type. However, the `CoreGetMemoryMap` routine
will only report the entries that are entirely inside a specific bucket
type. This will confuse the consumer and report false free memory that
belongs to special memory buckets.

This change fixes the issue by gating the merging logic by checking the
bucket type first. The merging is only allowed either if the bucket type
is not one of the special types, or if the bucket type is the same for
both entries.

For details on how to complete these options and their meaning refer to
[CONTRIBUTING.md](https://github.com/microsoft/mu/blob/HEAD/CONTRIBUTING.md).

- [x] Impacts functionality?
- [ ] Impacts security?
- [ ] Breaking change?
- [ ] Includes tests?
- [ ] Includes documentation?
- [x] Backport to release branch?

## How This Was Tested

This was tested on proprietary hardware.

## Integration Instructions

N/A

---------

Signed-off-by: kuqin12 <42554914+kuqin12@users.noreply.github.com>
Co-authored-by: Michael Kubacki <michael.kubacki@microsoft.com>
os-d added a commit to os-d/mu_basecore that referenced this pull request Apr 10, 2026
…t type information (microsoft#1429)"

This reverts commit b79a6ef as it
was rejected upstream in favor a different solution.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type:backport Backport changes in a dev branch PR to its release branch. type:bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants