public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Andrew Fish" <afish@apple.com>
To: devel@edk2.groups.io, stanley.ganyezu@gmail.com
Cc: discuss@edk2.groups.io
Subject: Re: [edk2-devel] Debug UEFI Event
Date: Fri, 03 Apr 2020 18:20:52 -0700	[thread overview]
Message-ID: <84142A31-26DB-42BB-A20C-B0EEA9CC2FFB@apple.com> (raw)
In-Reply-To: <CAP5XhjBjROrDtd65HpTzQxjps98-sAsESjbE8vUOozBeTAf4tw@mail.gmail.com>

[-- 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 --]

      reply	other threads:[~2020-04-04  1:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-04-04  0:48 Debug UEFI Event Stanley Gan
2020-04-04  1:20 ` Andrew Fish [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=84142A31-26DB-42BB-A20C-B0EEA9CC2FFB@apple.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox