Dear ArmPkg maintainer,

Way back in SVN rev 12024 (July 18 2011!) a change was made to the 
UncachedMemoryAllocationLib to use DXE Services instead of the CPU AP driver to 
change the cacheability of allocated pages.  However the function to free these 
pages was not updated and still called the CPU AP driver directly to restore 
cacheability.  This causes the DXE GCD and page tables to get out of sync.

When the library was first created, a choice was made to store the previous 
cacheability attributes in a global variable (gAttributes).  This global stores 
the old attributes from the last allocation, obtained from 
gDS->GetMemorySpaceAttributes, overwriting the previous value.  Since the GCD 
still thinks these pages are uncacheable, the next time 
gDS->GetMemorySpaceAttributes is called for the address, it returns an 
uncacheable value and stores it in gAttributes.  Then any subsequent calls to 
UncachedFreeAlignedPages will "restore" the cacheability value to an uncached 
value.  These pages are returned to the free page pool but are really still 
uncached causing serious performance degradation in a non-deterministic manner.

The fix is simple, route both the setting and restoring of cacheability through 
DXE Services/GCD and stop using the CPU AP directly.  The patch also removes 
all references to the CPU AP which eliminates the need for a library 
constructor.


Contributed-under: TianoCore Contribution Agreement 1.0

Signed-off-by: Eugene Cohen <eug...@hp.com<mailto:eug...@hp.com>>

Reviewed-by: Senthil Ramakrishnan 
<senthil.ramakrish...@hp.com<mailto:senthil.ramakrish...@hp.com>>

Thanks,

Eugene

Attachment: arm_uncached_free_fix.patch
Description: arm_uncached_free_fix.patch

------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to