audk/MdeModulePkg/Core/Dxe
Ruiyu Ni ae6945b61b MdeModulePkg/DxeCore: Avoid assertion in CoreLocateProtocol
The patch uses CoreAcquireLockOrFail() instead of
CoreAcquireProtocolLock() in CoreLocateProtocol() to avoid
assertion when CoreLocateProtocol() is called with the
protocol database locked.

The issue was found when changing PcdDebugPrintErrorLevel to
enable page/pool allocation debug message.
Nt32 platform hangs immediately after DxeCore is loaded.
Investigation shows the following calling stacks:

DxeCore entry point (Install a certain protocol)
0 DxeCore::CoreInstallProtocolInterface  // Protocol DB is locked
1 DxeCore::AllocatePool
2 PeiDxeDebugLibReportStatusCode::DebugPrint
3 DxeReportStatusCodeLib::ReportStatusCodeEx // <-------------------|
4 DxeReportStatusCodeLib::InternalGetReportStatusCode               |
5 DxeCore::LocateProtocol(StatusCodeRuntimeProtocol)                |
                     // Assertion when locking Protocol DB 2nd time |
6 DxeCore::CoreAcquireProtocolLock                                  |
7 PeiDxeDebugLibReportStatusCode::DebugAssert                       |
8 DxeReportStatusCodeLib::ReportSatusCodeEx  // loop begins ---------

In frame #6 the assertion is triggered due to the protocol database
is already locked. #8 calls #4 and the loop begins.
After changing #6 to CoreAcquireLockOrFail(), the assertion is
avoided and the loop is broken.

With the fix, NT32 can boot to Shell even setting
PcdDebugPrintErrorLevel to 0xFFFFFFFF, with all error levels turned
on.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
2016-04-25 13:36:37 +08:00
..
Dispatcher MdeModulePkg: Update DxeCore dispatcher to ignore PEI and SMM depex for FV. 2016-02-05 12:21:25 +08:00
DxeMain MdeModulePkg DxeCore: Enhance MemoryAttributesTable installation 2016-04-22 13:39:56 +08:00
Event MdeModulePkg DxeCore: Avoid the closed event to be signaled wrongly 2016-01-27 10:15:15 +00:00
FwVol MdeModulePkg DxeCore: Fix potential FV overflow of 4GB boundary on a 32-bit systems. 2014-12-17 00:39:51 +00:00
FwVolBlock
Gcd MdeModulePkg/Core/Dxe/Gcd: remove set but not used variables 2015-09-21 00:50:32 +00:00
Hand MdeModulePkg/DxeCore: Avoid assertion in CoreLocateProtocol 2016-04-25 13:36:37 +08:00
Image MdeModulePkg: Update DxeCore to handle LoadFile DevicePath 2015-07-02 04:28:21 +00:00
Library
Mem MdeModulePkg DxeCore: Enhance MemoryAttributesTable installation 2016-04-22 13:39:56 +08:00
Misc MdeModulePkg DxeCore: Enhance MemoryAttributesTable installation 2016-04-22 13:39:56 +08:00
SectionExtraction
DxeCore.uni MdeModulePkg: Convert all .uni files to utf-8 2015-12-15 04:56:23 +00:00
DxeCoreExtra.uni MdeModulePkg: Convert all .uni files to utf-8 2015-12-15 04:56:23 +00:00
DxeMain.h MdeModulePkg DxeCore: Enhance MemoryAttributesTable installation 2016-04-22 13:39:56 +08:00
DxeMain.inf MdePkg: Update DxeCore INF for MemoryAttributesTable. 2016-02-17 07:32:22 +08:00