Repository navigation
patina_internal_cpu: Update Paging API to Always Return Cache Attrs - #984
Conversation
|
Note, CI will fail until OpenDevicePartnership/patina-paging#137 is merged and released. |
82e6b2b to
84081db
Compare
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
|
@cfernald @makubacki @Javagedes do you want to take one more look? I realized that on ARM64, where the paging attributes are always controlled by the page table (and where this event is not needed at all) we would fire the event every time we map a page because we would see So, I refactored the return type to be a CacheAttributeValue enum that tells us whether the attributes are Valid (and what they are), Unmapped, or NotSupported. In the case of NotSupported, we won't needlessly fire the event. |
Currently patina_internal_cpu will not return MTRR cache attributes if a page is unmapped; it will simply return an error. However, the GCD code needs to send the cache attribute changed event to MpDxe to wake up the APs and sync MTRRs whenever the cache attributes change. The GCD took the approach of always sending the event when a page was unmapped and is getting mapped; that resulted in large numbers of the event getting fired, each having to wake up the APs. This changes the patina_internal_cpu API to return the cache attributes if covered by MTRRs even when the page is unmapped. For ARM64, where the cache attributes are entirely contained within the page table and the MP code starts cores fresh every time with the BSP page table, so syncing is not required, cache attributes will never be returned if the page is unmapped. This greatly reduces the number of times the event is fired to only the times it needs to. This PR also updates to paging v10, which just included a breaking change to update the API to not use a custom Result type. Signed-off-by: Oliver Smith-Denny <osde@microsoft.com>
Description
Currently patina_internal_cpu will not return MTRR cache attributes if a page is unmapped; it will simply return an error. However, the GCD code needs to send the cache attribute changed event to MpDxe to wake up the APs and sync MTRRs whenever the cache attributes change. The GCD took the approach of always sending the event when a page was unmapped and is getting mapped; that resulted in large numbers of the event getting fired, each having to wake up the APs.
This changes the patina_internal_cpu API to return the cache attributes if covered by MTRRs even when the page is unmapped. For ARM64, where the cache attributes are entirely contained within the page table and the MP code starts cores fresh every time with the BSP page table, so syncing is not required, cache attributes will never be returned if the page is unmapped.
This greatly reduces the number of times the event is fired to only the times it needs to.
This PR also updates to paging v10, which just included a breaking change to update the API to not use a custom Result type.
Closes #899 .
How This Was Tested
Tested booting Q35, SBSA, and a physical Intel platform to Windows and observing the number of cache attribute change events decreasing (on Q35 from 403 -> 2).
Integration Instructions
N/A.