public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Benjamin Doron" <benjamin.doron00@gmail.com>
To: devel@edk2.groups.io
Cc: "Desimone, Nathaniel L" <nathaniel.l.desimone@intel.com>,
	"Sinha, Ankit" <ankit.sinha@intel.com>
Subject: [GSoC 2022] Implementing S3 resume for MinPlatform
Date: Mon, 18 Jul 2022 16:33:35 -0400	[thread overview]
Message-ID: <CAONYkK962hAyywgNSukcSihucVKkhEwv5Ao_DxtiYz57OC5GKg@mail.gmail.com> (raw)

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

Hi all,
I've been working on implementing S3 resume support for MinPlatform during
the past few weeks. Presently, the last line of code that I know will
execute on resume flows is
https://github.com/tianocore/edk2/blob/master/UefiCpuPkg/Universal/Acpi/S3Resume2Pei/S3Resume.c#L878
- right before transferring control to BootScriptExecutorDxe.

I had added a debug print at
https://github.com/tianocore/edk2/blob/master/MdeModulePkg/Universal/Acpi/BootScriptExecutorDxe/ScriptExecute.c#L47
to ensure that control was successfully passed here, but it never executes
and the platform doesn't resume. I've considered that it may be a debug
library-specific issue, and I've been fixing some of those (but that
certainly may still require debugging). However, after addressing that, the
bug still too predictably occurs here. Therefore, what other assumptions
are made for the jump here to succeed?

So far, I've considered:
- DxePcdLib could try calling the protocol after exit-BS, which is
guaranteed to fail (then page fault). However, I've checked the disassembly
and it's not used on resume flow. This is fine.
- DebugLibSerialPort is used for this module, because RSC's serial port
handler is unregistered at exit-BS. This should now be fine.

Some (potentially) plausible architectural issues:
- Page tables are used in long mode. Maybe I could verify these are sane by
looking up the structure and printing each entry's fields, but they are
probably fine.
- Maybe BootScriptStackSize is too small? I sort of doubt it from looking
at the disassembly. Also, even if the stack overflows, I'd expect the
earlier debug prints to succeed.
- Maybe my added debug print in S3BootScriptExecutorEntryFunction() is a
problem? However, it's the IDTR that's written, not the GDTR. I'd expect
that to only be an issue if an interrupt is fired. Also, SmmRestoreCpu()
does the same. As I understand, normally there is an enormous difference
between DXE and SMM, because SMM has some resume state in some CPU MSRs
(etc), but I think here PiSmmCpuDxeSmm is being entered as if it were mere
64-bit code, like DXE.

Best regards,
Benjamin

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

             reply	other threads:[~2022-07-18 20:33 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-18 20:33 Benjamin Doron [this message]
2022-07-18 23:38 ` [GSoC 2022] Implementing S3 resume for MinPlatform Benjamin Doron

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=CAONYkK962hAyywgNSukcSihucVKkhEwv5Ao_DxtiYz57OC5GKg@mail.gmail.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