Re: [edk2-devel] Debug UEFI Event


Andrew Fish <afish@...>
 

Stanley,

There is not much to debug with EFI events and that is why there are not a lot of DEBUG_EVENT DEBUG prints. The only thing that can block your event is for the current TPL level being >= to the TPL level of your event, but that also blocks all forward progress in EFI. 

Usually the problem is one of these:
1) The event was no created properly and thus never gets signaled. 
2) The more generic issue is people code EFI events like threads, and that is not how it works. EFI has a cooperative event model and there is only one thread and that is the main thread. Events are dispatched when gBS->RestoreTPL() [1] is called. Higher priority (TPL) events dispatch 1st. So the only way your event can get blocked is for another chunk of code to gBS->RaiseTPL() to the level of your event or higher. If you put a while (TRUE) loop in an event it will deadlock the system. 

So hopefully it is 1) and you are not error checking the return codes when you create and hook in the event, or you are missing the call to hook in your event to get called. If it is a more subtle problem it is usually related to 2). 

On Apr 3, 2020, at 5:48 PM, Stanley Gan <stanley.ganyezu@...> wrote:

I have an event callback function not called. So, I want to track event execution in UEFI. There is a "DEBUG_EVENT" debug level in EDKII. But no module in EDKII actually use this debug level.
I add some debug print in "CoreCreateEventInternal" and "CoredispatchEventNotifies",it cause TPL ASSERT. Can anybody give me some constructive debug suggestion?

Join discuss@edk2.groups.io to automatically receive all group messages.