Skip to content
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

Add Standalone MM Performance Support [Rebase & FF] #1268

Merged
merged 2 commits into from
Feb 12, 2025

Conversation

makubacki
Copy link
Member

@makubacki makubacki commented Feb 3, 2025

Description

This series is going to edk2 but it is being made available in parallel to Project Mu since the edk2 202502 soft freeze began today. The plan is to not backport this Mu series but keep in the "dev" branch. Once the changes are in edk2, the dev branch will be reconciled with those changes and that will be backported.

This gets performance records from most Standalone MM drivers. In a privilege separated environment like that of the Standalone MM Supervisor, this would cover user mode drivers. Additional changes specific to the supervisor would need to be made to also get performance records from the supervisor itself.


MdeModulePkg: Add Standalone MM Core performance support

Adds a new library instance to support MM core functionality for
performance in Standalone MM.

  • Add StandaloneMmCorePerformanceLib instance
  • Move common MM logic to a new file MmCorePerformanceLib.c
  • Define interfaces with implementation specific to MM environment
    type in SmmCorePerformanceLibInternal.h and implement those
    functions in the Standalone MM and Traditional MM specific C files

Note: StandaloneMmCorePerformanceLib supports both
MM_CORE_STANDALONE and MM_STANDALONE as some Standalone MM
environments need to link this functionality in a ring 3 driver
that is outside the ring 0 core driver.


MdeModulePkg: Add Standalone MM perf library support

Adds a new library instance to support logging performance data in
Standalone MM.

  • Add StandaloneMmPerformanceLib instance
  • Move common MM logic to a new file SmmPerformanceLibInternal.c
  • Since the library largely defers most logic to the performance
    measurement protocol a large degree of code can be shared between
    Standalone MM and Traditional MM.

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

How This Was Tested

  • Build and CI
  • Return performance records from Standalone MM (MM Supervisor)
  • Return performance records from Traditional MM (OVMF)

Integration Instructions

  • Traditional MM should be able to continue using the same libraries.
  • Standalone MM:
    • Link MdeModulePkg/Library/SmmCorePerformanceLib/StandaloneMmCorePerformanceLib.inf
      against a Standalone MM module that is loaded early and has MM Services available.
    • Link MdeModulePkg/Library/SmmPerformanceLib/StandaloneMmPerformanceLib.inf against
      all Standalone MM modules that have a PerformanceLib dependency and need to log
      MM performance data.

@makubacki makubacki requested a review from kuqin12 February 3, 2025 16:16
@makubacki makubacki self-assigned this Feb 3, 2025
@codecov-commenter
Copy link

codecov-commenter commented Feb 3, 2025

Codecov Report

Attention: Patch coverage is 0% with 926 lines in your changes missing coverage. Please review.

Project coverage is 1.60%. Comparing base (8fbee33) to head (b8cae80).

Files with missing lines Patch % Lines
...brary/SmmCorePerformanceLib/MmCorePerformanceLib.c 0.00% 590 Missing ⚠️
...rary/SmmPerformanceLib/SmmPerformanceLibInternal.c 0.00% 145 Missing ⚠️
...rary/DxeCorePerformanceLib/DxeCorePerformanceLib.c 0.00% 53 Missing ⚠️
...rary/SmmCorePerformanceLib/SmmCorePerformanceLib.c 0.00% 50 Missing ⚠️
...orePerformanceLib/StandaloneMmCorePerformanceLib.c 0.00% 44 Missing ⚠️
...ary/SmmPerformanceLib/StandaloneMmPerformanceLib.c 0.00% 33 Missing ⚠️
...ePkg/Library/SmmPerformanceLib/SmmPerformanceLib.c 0.00% 11 Missing ⚠️
Additional details and impacted files
@@              Coverage Diff               @@
##           dev/202405    #1268      +/-   ##
==============================================
- Coverage        1.60%    1.60%   -0.01%     
==============================================
  Files            1379     1383       +4     
  Lines          359710   359859     +149     
  Branches         5524     5524              
==============================================
  Hits             5760     5760              
- Misses         353843   353992     +149     
  Partials          107      107              
Flag Coverage Δ
MdeModulePkg 0.67% <0.00%> (-0.01%) ⬇️

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.

makubacki added a commit to makubacki/mu_feature_mm_supv that referenced this pull request Feb 3, 2025
Temporarily use this branch for testing.

This commit will be reverted after the following Mu Basecore PR is
merged:

microsoft/mu_basecore#1268

Signed-off-by: Michael Kubacki <[email protected]>
@makubacki makubacki force-pushed the add_standalonemm_perf_lib branch from e893f44 to 367a68d Compare February 3, 2025 21:33
@makubacki makubacki added the type:feature-request A new feature proposal label Feb 3, 2025
@makubacki makubacki force-pushed the add_standalonemm_perf_lib branch 3 times, most recently from e2d14db to f46a300 Compare February 3, 2025 23:45
makubacki added a commit to makubacki/mu_feature_mm_supv that referenced this pull request Feb 4, 2025
Temporarily use this branch for testing.

This commit will be reverted after the following Mu Basecore PR is
merged:

microsoft/mu_basecore#1268

Signed-off-by: Michael Kubacki <[email protected]>
@makubacki makubacki force-pushed the add_standalonemm_perf_lib branch from f46a300 to b9ed16c Compare February 11, 2025 19:50
Adds a new library instance to support MM core functionality for
performance in Standalone MM.

- Add StandaloneMmCorePerformanceLib instance
- Move common MM logic to a new file `MmCorePerformanceLib.c`
- Define interfaces with implementation specific to MM environment
  type in `SmmCorePerformanceLibInternal.h` and implement those
  functions in the Standalone MM and Traditional MM specific C files

Note: StandaloneMmCorePerformanceLib supports both
      `MM_CORE_STANDALONE` and `MM_STANDALONE` as some Standalone MM
	  environments need to link this functionality in a ring 3 driver
	  that is outside the ring 0 core driver.

Signed-off-by: Michael Kubacki <[email protected]>
Adds a new library instance to support logging performance data in
Standalone MM.

- Add StandaloneMmPerformanceLib instance
- Move common MM logic to a new file `SmmPerformanceLibInternal.c`
- Since the library largely defers most logic to the performance
  measurement protocol a large degree of code can be shared between
  Standalone MM and Traditional MM.

Signed-off-by: Michael Kubacki <[email protected]>
@makubacki makubacki force-pushed the add_standalonemm_perf_lib branch from b9ed16c to b8cae80 Compare February 12, 2025 00:00
@makubacki makubacki enabled auto-merge (rebase) February 12, 2025 00:01
@makubacki makubacki merged commit 069e167 into microsoft:dev/202405 Feb 12, 2025
31 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:feature-request A new feature proposal
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants