public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Gerd Hoffmann" <kraxel@redhat.com>
To: Michael Brown <mcb30@ipxe.org>
Cc: devel@edk2.groups.io, Oliver Steffen <osteffen@redhat.com>,
	 Jiewen Yao <jiewen.yao@intel.com>,
	Ard Biesheuvel <ardb+tianocore@kernel.org>,
	 Pawel Polawski <ppolawsk@redhat.com>,
	Jordan Justen <jordan.l.justen@intel.com>,
	 Laszlo Ersek <lersek@redhat.com>
Subject: Re: [edk2-devel] [PATCH 1/1] OvmfPkg/NestedInterruptTplLib: replace ASSERT() with a warning logged.
Date: Wed, 3 May 2023 08:27:30 +0200	[thread overview]
Message-ID: <t53bids4ssp5qwgfpv3zlwhkbqbnjjq66ie5fnjd2nixus5gbi@3gzimclyvbdl> (raw)
In-Reply-To: <01020187c857b5fe-3dbe7e11-e052-4b37-a477-5b12ccc253fc-000000@eu-west-1.amazonses.com>

On Fri, Apr 28, 2023 at 02:50:04PM +0000, Michael Brown wrote:
> On 28/04/2023 14:38, Gerd Hoffmann wrote:
> > I suspect the windows boot loader does something fishy here, but I can't
> > proof it, I have not yet pinned down the exact location where interrupts
> > get enabled while running at IPL=TPL_HIGH_LEVEL (which is what I suspect
> > is happening, but of course this is not the only possible theory how
> > that ASSERT got triggered).
> > 
> > Not fully sure how to best continue debugging this, I don't think gdb
> > can set an watchpoint on eflags.if ...
> 
> In the absence of any better ideas, I'd be tempted to run QEMU via TCG
> instead of KVM, and hack the STI instruction definition to check the
> location in guest memory where gEfiCurrentTpl gets stored in your test
> build.  (It's brute force debugging, but it should find the culprit.)

Not so easy as tcg generates code for cli+sti, so there isn't a function
I could add logging hacks to.

> From a quick check of the implementation, I'm pretty sure this will be the
> case.  However, the logic is already (necessarily) pretty complex and so I
> am not 100% sure of this.  The reasoning behind the logic in
> NestedInterruptTplLib relies on certain axioms and invariants (e.g. that
> there are a finite number of distinct TPLs, and that there are certain
> places within the code that further interrupts provably cannot occur), and
> so it gets very difficult to reason about when one of those invariants is
> violated, as it seems to be in this situation.
> 
> If it seems to work,

It seems to work, and the warning is printed exactly once during boot.

> with a warning message, and to return with InterruptedTPL unmodified. But
> I'd prefer to understand how this invariant violation arises in the first
> place.

Root cause not found yet, but all debugging so far didn't found any
problems in edk2/ovmf, so my theory still is that windows does something
fishy here.

take care,
  Gerd


      reply	other threads:[~2023-05-03  6:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-28  9:10 [PATCH 1/1] OvmfPkg/NestedInterruptTplLib: replace ASSERT() with a warning logged Gerd Hoffmann
2023-04-28 11:26 ` Michael Brown
2023-04-28 13:38   ` Gerd Hoffmann
2023-04-28 14:50     ` [edk2-devel] " Michael Brown
2023-05-03  6:27       ` Gerd Hoffmann [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=t53bids4ssp5qwgfpv3zlwhkbqbnjjq66ie5fnjd2nixus5gbi@3gzimclyvbdl \
    --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