summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Brown <mcb30@ipxe.org>2022-12-09 10:20:21 +0000
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2022-12-23 14:44:48 +0000
commit9bf473da4c1d6d3656beca3a914861dcd1fe8a25 (patch)
tree964b1f7633c3dbe97b924a17f544243d498cc66e
parentbf65d7ee8842a93116534f727abcad235dd3e233 (diff)
downloadedk2-9bf473da4c1d6d3656beca3a914861dcd1fe8a25.tar.gz
edk2-9bf473da4c1d6d3656beca3a914861dcd1fe8a25.tar.bz2
edk2-9bf473da4c1d6d3656beca3a914861dcd1fe8a25.zip
OvmfPkg: Send EOI before RestoreTPL() in timer interrupt handlers
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: Paolo Bonzini <pbonzini@redhat.com> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=4162 Signed-off-by: Michael Brown <mcb30@ipxe.org> Acked-by: Laszlo Ersek <lersek@redhat.com>
-rw-r--r--OvmfPkg/8254TimerDxe/Timer.c5
-rw-r--r--OvmfPkg/LocalApicTimerDxe/LocalApicTimerDxe.c5
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 ();
}
/**