From: Johan Hovold <johan@kernel.org>
To: Ard Biesheuvel <ardb@kernel.org>
Cc: Leif Lindholm <leif.lindholm@oss.qualcomm.com>,
Bjorn Andersson <andersson@kernel.org>,
Ricardo Salveti <ricardo@foundries.io>,
Marc Zyngier <maz@kernel.org>,
linux-efi@vger.kernel.org, linux-arm-msm@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: UEFI EBS() failures on Lenovo T14s
Date: Thu, 28 Nov 2024 10:59:56 +0100 [thread overview]
Message-ID: <Z0g_HL01eqXu4cwQ@hovoldconsulting.com> (raw)
In-Reply-To: <CAMj1kXGjiA1HydMaY82MQsYvkchpN7v7CMOB5i3NEdqcYGn19Q@mail.gmail.com>
On Thu, Nov 28, 2024 at 09:52:33AM +0100, Ard Biesheuvel wrote:
> On Thu, 28 Nov 2024 at 09:20, Johan Hovold <johan@kernel.org> wrote:
> > We've run into a buggy UEFI implementation on the Qualcomm Snapdragon
> > based Lenovo ThinkPad T14s where ExitBootServices() often fails.
> > Based on your comments to a similar report for an older Snapdragon based
> > Lenovo UEFI implementation [1], I discovered that allocating an event
> > before calling ExitBootServices() can make the call succeed. There is
> > often no need to actually signal the event group, but the event must
> > remain allocated (i.e. CloseEvent() must not be called).
> >
> > (Raising TPL or disabling interrupts does not seem to help.)
> >
> > Also with the event signalling, ExitBootServices() sometimes fails when
> > starting the kernel automatically from a shell startup.nsh, while
> > systemd-boot seems to always work. This was only observed after removing
> > some efi_printk() used during the experiments from the stub..
.
> So the error code is EFI_INVALID_PARAMETER in all cases? In the
> upstream implementation, the only thing that can make
> ExitBootServices() return an error is a mismatch of the map key, and
> so there is something changing the memory map.
Yes, it's always EFI_INVALID_PARAMETER.
> This might be due to a handler of the
> gEfiEventBeforeExitBootServicesGuid event group that fails to close
> the event, and so it gets signaled every time. This is a fairly recent
> addition, though, so I'm not sure it even exists in QCOM's tree.
>
> In upstream EDK2, the map key is just a monotonic counter that gets
> incremented on every memory map update, so one experiment worth
> conducting is to repeat the second call to ExitBootServices() a couple
> of times, increasing the map key each time.
I had already tried repeating the second call (GMM + EBS) by running it
in a loop, and I do see the map_key increasing for each iteration (e.g.
by 0x1a).
> Or use GetMemoryMap() to
> just grab the map key without the actual memory map, and printing it
> to the console (although the timer is disabled on the first call so
> anything that relies on that will be shut down at this point)
I just tried adding another inner loop just calling GetMemoryMap() a few
times and I see the map_key increasing there too for each iteration
(e.g. by 0x6).
(The map size remains constant.)
I do get the feeling that efi_printk() contributes to the memory map
updates, and I can indeed get the reference design fw to similarly fail
if I try to print the map_key after each call to GetMemoryMap() in a
retry loop.
Johan
next prev parent reply other threads:[~2024-11-28 10:00 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-28 8:20 UEFI EBS() failures on Lenovo T14s Johan Hovold
2024-11-28 8:52 ` Ard Biesheuvel
2024-11-28 9:59 ` Johan Hovold [this message]
2024-11-28 10:21 ` Ard Biesheuvel
2024-11-28 11:05 ` Ard Biesheuvel
2024-11-28 14:46 ` Johan Hovold
2024-11-28 15:21 ` Ard Biesheuvel
2024-11-28 16:42 ` Johan Hovold
2024-12-10 13:49 ` Johan Hovold
2025-05-07 7:21 ` Juerg Haefliger
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-all 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=Z0g_HL01eqXu4cwQ@hovoldconsulting.com \
--to=johan@kernel.org \
--cc=andersson@kernel.org \
--cc=ardb@kernel.org \
--cc=leif.lindholm@oss.qualcomm.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-efi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maz@kernel.org \
--cc=ricardo@foundries.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