public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* debug UEFI Event
@ 2020-04-04  0:40 stanley.ganyezu
  0 siblings, 0 replies; 3+ messages in thread
From: stanley.ganyezu @ 2020-04-04  0:40 UTC (permalink / raw)
  To: devel

[-- Attachment #1: Type: text/plain, Size: 361 bytes --]

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?

[-- Attachment #2: Type: text/html, Size: 414 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Debug UEFI Event
@ 2020-04-04  0:48 Stanley Gan
  2020-04-04  1:20 ` [edk2-devel] " Andrew Fish
  0 siblings, 1 reply; 3+ messages in thread
From: Stanley Gan @ 2020-04-04  0:48 UTC (permalink / raw)
  To: discuss; +Cc: devel

[-- Attachment #1: Type: text/plain, Size: 361 bytes --]

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?

[-- Attachment #2: Type: text/html, Size: 414 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [edk2-devel] Debug UEFI Event
  2020-04-04  0:48 Debug UEFI Event Stanley Gan
@ 2020-04-04  1:20 ` Andrew Fish
  0 siblings, 0 replies; 3+ messages in thread
From: Andrew Fish @ 2020-04-04  1:20 UTC (permalink / raw)
  To: devel, stanley.ganyezu; +Cc: discuss

[-- Attachment #1: Type: text/plain, Size: 1694 bytes --]

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). 

[1] https://github.com/tianocore/edk2/blob/master/MdeModulePkg/Core/Dxe/Event/Tpl.c#L95

Thanks,

Andrew Fish


> On Apr 3, 2020, at 5:48 PM, Stanley Gan <stanley.ganyezu@gmail.com> 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?
> 


[-- Attachment #2: Type: text/html, Size: 2608 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-04-04  1:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-04-04  0:48 Debug UEFI Event Stanley Gan
2020-04-04  1:20 ` [edk2-devel] " Andrew Fish
  -- strict thread matches above, loose matches on Subject: below --
2020-04-04  0:40 debug " stanley.ganyezu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox