public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Laszlo Ersek <lersek@redhat.com>
To: Rafael Machado <rafaelrodrigues.machado@gmail.com>,
	Andrew Fish <afish@apple.com>
Cc: "Ni, Ruiyu" <ruiyu.ni@intel.com>,
	"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>,
	"Yao, Jiewen" <jiewen.yao@intel.com>
Subject: Re: Question about memory map entries
Date: Thu, 2 Aug 2018 16:44:16 +0200	[thread overview]
Message-ID: <40832a91-0eca-3b9f-f533-f98666295a25@redhat.com> (raw)
In-Reply-To: <CACgnt7-hW4+gQ5JMj5bYnb8HgJA796kncdifPYT9kthnxU6u2g@mail.gmail.com>

On 08/02/18 14:39, Rafael Machado wrote:
> Hi everyone
> 
> After some other tasks I am back to this case :)
> 
> After some debug, we detected the moment where things start to go wrong,
> but I am not sure what may cause this.
> 
> What we noticed is that the following assert is reached:
> https://github.com/tianocore/edk2/blob/87acb6e298e718250dd8b741b6888a3a54c7cb5a/MdeModulePkg/Core/Dxe/Gcd/Gcd.c#L2199
> 
> Just to remember, this assert is reached with the following steps:
> 1 - Boot the application (renamed to BOOTX64.efi) from a usb stick
> 2 - Execute the application tasks
> 3 - exit the application (free everything, all events closed and  no memory
> leaks detected as suggested to check by Andrew on the previous e-mail, then
> return efi_success)
> 4 - the system will reboot and reach the assert

Is the reboot automatic (from the platform firmware), or application /
user initiated?

> But it does not happen with the following scenario:
> 1 - Boot the application (renamed to BOOTX64.efi) from a usb stick
> 2 - Execute the application tasks
> 3 - Power off the system

Do you exit the application before the system is powered off?

> 
> As far as I could understand (please correct my understanding that may be
> wrong since is the first time I look at this part of the code), at this
> point the HOBs passed from sec phase are processed by PEI so the memory
> could be "detected/mapped/initialized" correctly. But for some reason the
> required HOB is no present at the list.
> 
> Could someone with more experience at this part of the code please confirm
> my understanding, and if possible give some guesses about what could cause
> this scenario?

PEI may act differently (produce different HOBs) dependent on boot mode.
The PI spec defines several boot modes; it's platform-dependent what
hardware states / transitions are mapped to what PI boot modes by the
firmware.

> My guess is that some memory cleanup that should be done by the bios after
> the application exits is not being done correctly. So I believe the problem
> is not at the application, but at the BIOS. A friend here mentioned about
> the MemoryTypeInformation efi var, that may be corrupted, and considering
> it's used to guide the boot process it may impact the boot, but I am not
> sure if this is the case and also I didn't find to much information about
> this var and it's usage, so any help about this would be well received also.

MemoryTypeInformation measures peak usage (of various UEFI memory types)
during boot, so that at next boot, the internal allocation "bins" can be
primed with large enough sizes. The goal is to reduce fragmentation due
to "unforeseen" allocations.

If you exit the application gracefully in both scenarios (and the only
difference is whether you reboot the system, or power it down,
afterwards, e.g. by passing different options to the RESET command of
the UEFI shell), then I don't see how MemoryTypeInformation could be
relevant.

Thanks
Laszlo


  parent reply	other threads:[~2018-08-02 14:44 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-29 19:05 Question about memory map entries Rafael Machado
2018-06-29 19:27 ` Yao, Jiewen
2018-06-30  1:31   ` Ni, Ruiyu
2018-06-30 12:02     ` Rafael Machado
2018-06-30 19:23       ` Andrew Fish
2018-08-02 12:39         ` Rafael Machado
2018-08-02 14:37           ` Andrew Fish
2018-08-02 14:44           ` Laszlo Ersek [this message]
2018-08-02 16:42             ` Rafael Machado
2018-08-02 17:48               ` Laszlo Ersek
2018-08-02 19:02                 ` Rafael Machado
2018-08-02 19:18                   ` Rafael Machado
2018-08-02 20:38                     ` Laszlo Ersek
2018-08-07 19:12                       ` Rafael Machado
2018-08-07 22:42                         ` Yao, Jiewen
2018-08-08 11:55                           ` Rafael Machado
2018-08-08 17:31                             ` Rafael Machado
2018-08-08 19:13                               ` Andrew Fish
2018-08-08 19:43                                 ` Rafael Machado

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=40832a91-0eca-3b9f-f533-f98666295a25@redhat.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