From: "Michael Brown" <mcb30@ipxe.org>
To: devel@edk2.groups.io
Cc: Michael Brown <mcb30@ipxe.org>, Laszlo Ersek <lersek@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>
Subject: [PATCH 1/3] OvmfPkg: Send EOI before RestoreTPL() in timer interrupt handlers
Date: Fri, 9 Dec 2022 10:20:21 +0000 [thread overview]
Message-ID: <01020184f6667735-4133d40a-5b87-4762-8816-85577f0e7f1e-000000@eu-west-1.amazonses.com> (raw)
In-Reply-To: <cover.1670328507.git.mcb30@ipxe.org>
Deferring the EOI until after the call to RestoreTPL() means that any
callbacks invoked by RestoreTPL() will run with timer interrupt
delivery disabled. If any such callbacks themselves rely on timers to
implement timeout loops, then the callbacks will get stuck in an
infinite loop from which the system will never recover.
This reverts commit 239b50a86 ("OvmfPkg: End timer interrupt later to
avoid stack overflow under load").
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=4162
Signed-off-by: Michael Brown <mcb30@ipxe.org>
---
OvmfPkg/8254TimerDxe/Timer.c | 5 ++---
OvmfPkg/LocalApicTimerDxe/LocalApicTimerDxe.c | 5 ++---
2 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/OvmfPkg/8254TimerDxe/Timer.c b/OvmfPkg/8254TimerDxe/Timer.c
index e49a438b44..7feaaaba2b 100644
--- a/OvmfPkg/8254TimerDxe/Timer.c
+++ b/OvmfPkg/8254TimerDxe/Timer.c
@@ -80,6 +80,8 @@ TimerInterruptHandler (
OriginalTPL = gBS->RaiseTPL (TPL_HIGH_LEVEL);
+ mLegacy8259->EndOfInterrupt (mLegacy8259, Efi8259Irq0);
+
if (mTimerNotifyFunction != NULL) {
//
// @bug : This does not handle missed timer interrupts
@@ -88,9 +90,6 @@ TimerInterruptHandler (
}
gBS->RestoreTPL (OriginalTPL);
-
- DisableInterrupts ();
- mLegacy8259->EndOfInterrupt (mLegacy8259, Efi8259Irq0);
}
/**
diff --git a/OvmfPkg/LocalApicTimerDxe/LocalApicTimerDxe.c b/OvmfPkg/LocalApicTimerDxe/LocalApicTimerDxe.c
index cbc17c979c..3e04b49d6b 100644
--- a/OvmfPkg/LocalApicTimerDxe/LocalApicTimerDxe.c
+++ b/OvmfPkg/LocalApicTimerDxe/LocalApicTimerDxe.c
@@ -62,6 +62,8 @@ TimerInterruptHandler (
OriginalTPL = gBS->RaiseTPL (TPL_HIGH_LEVEL);
+ SendApicEoi ();
+
if (mTimerNotifyFunction != NULL) {
//
// @bug : This does not handle missed timer interrupts
@@ -70,9 +72,6 @@ TimerInterruptHandler (
}
gBS->RestoreTPL (OriginalTPL);
-
- DisableInterrupts ();
- SendApicEoi ();
}
/**
--
2.38.1
next parent reply other threads:[~2022-12-09 10:20 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <cover.1670328507.git.mcb30@ipxe.org>
2022-12-09 10:20 ` Michael Brown [this message]
2022-12-09 10:20 ` [PATCH 2/3] OvmfPkg: Add library to handle TPL from within nested interrupt handlers Michael Brown
2022-12-09 15:02 ` [edk2-devel] " Gerd Hoffmann
2022-12-09 15:22 ` Michael Brown
[not found] ` <ac60f07a-df27-bcfd-4129-0d6bfcf7ac77@ipxe.org>
2022-12-20 15:02 ` Michael Brown
2022-12-21 8:06 ` Laszlo Ersek
2022-12-23 14:25 ` Ard Biesheuvel
2022-12-09 10:20 ` [PATCH 3/3] OvmfPkg: Use NestedInterruptTplLib in " Michael Brown
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=01020184f6667735-4133d40a-5b87-4762-8816-85577f0e7f1e-000000@eu-west-1.amazonses.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