Hi Eugene,
your patch is valid. I committed it into svn revision @ 14469.
In addition to your changes, I also removed some additional dependencies to the 
CPU protocol and fixed some comments.
Thanks for your contribution,
Olivier
________________________________________
From: Cohen, Eugene [[email protected]]
Sent: 15 July 2013 23:20
To: [email protected]
Cc: Ramakrishnan, Senthil
Subject: [edk2] [PATCH] ArmPkg: Fix UncachedFreeAlignedPages in 
UncachedMemoryAllocationLib

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 <[email protected]<mailto:[email protected]>>

Reviewed-by: Senthil Ramakrishnan 
<[email protected]<mailto:[email protected]>>

Thanks,

Eugene


-- IMPORTANT NOTICE: The contents of this email and any attachments are 
confidential and may also be privileged. If you are not the intended recipient, 
please notify the sender immediately and do not disclose the contents to any 
other person, use it for any purpose, or store or copy the information in any 
medium.  Thank you.


------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to