From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from a7-11.smtp-out.eu-west-1.amazonses.com (a7-11.smtp-out.eu-west-1.amazonses.com [54.240.7.11]) by mx.groups.io with SMTP id smtpd.web11.9913.1670581223200903505 for ; Fri, 09 Dec 2022 02:20:23 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@ipxe.org header.s=cphpx6z2rfcgehlykjjh3gknqe3hsoe2 header.b=iTOfpBAZ; spf=pass (domain: eu-west-1.amazonses.com, ip: 54.240.7.11, mailfrom: 01020184f6667735-4133d40a-5b87-4762-8816-85577f0e7f1e-000000@eu-west-1.amazonses.com) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=cphpx6z2rfcgehlykjjh3gknqe3hsoe2; d=ipxe.org; t=1670581221; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:MIME-Version:Content-Transfer-Encoding; bh=FBA4JSR17N3LMfuPKdF+3Ag8mygVK58OHu8eVCyhj3o=; b=iTOfpBAZJ4XdM2G4FGNLnHLM2w82+keZzp8l5jOvvN6YJzsCVaDqTFqCMJuVnIjY 1ZI+BvsyNflCkstCJSa4ZlLE9H2ndin8pw4Ii6TlpZK2N8lWn3k0I6H8lSn5Fn/nqWx S7GCZaTKYFn/x/t+liB03nAdfOPB7y4bcFb65KjJnpbh/hgvlKDSVOCxyiUZz+afWXS ZyLweWogTEJXxONM2189Jn2BEt0iZKFuqg/q1egx9XFJm8O/onWD6SVhY61hpFutVam kGYzoOx2uFv5LlfYrEz23CtF7TpY0+0LfZtDrG3hfnOZgAezYBC3Uh8u0QmE/+7JIb4 hnoHl1QI2A== DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=ihchhvubuqgjsxyuhssfvqohv7z3u4hn; d=amazonses.com; t=1670581221; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:MIME-Version:Content-Transfer-Encoding:Feedback-ID; bh=FBA4JSR17N3LMfuPKdF+3Ag8mygVK58OHu8eVCyhj3o=; b=t28caiJasQTPtQ8FqHtqbl9PgaqSkVKWsTgvfSTX5gdRdmVGrvGCH0flJqTm2Ujs ILhHWCjGJzG0H9B+L/pA/0oHPNTufNe5bJJp9xjl+W4YmlV63cpQ3wX4ErwKDhN7iWH 0T3zBu2WJ6k2L+Ib6da+8HQ+7ceC8LiB0il7YJgk= From: "Michael Brown" To: devel@edk2.groups.io Cc: Michael Brown , Laszlo Ersek , Paolo Bonzini Subject: [PATCH 1/3] OvmfPkg: Send EOI before RestoreTPL() in timer interrupt handlers Date: Fri, 9 Dec 2022 10:20:21 +0000 Message-ID: <01020184f6667735-4133d40a-5b87-4762-8816-85577f0e7f1e-000000@eu-west-1.amazonses.com> X-Mailer: git-send-email 2.38.1 In-Reply-To: References: MIME-Version: 1.0 X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00, URIBL_DBL_BLOCKED_OPENDNS,URIBL_ZEN_BLOCKED_OPENDNS autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on blyat.fensystems.co.uk Feedback-ID: 1.eu-west-1.fspj4M/5bzJ9NLRzJP0PaxRwxrpZqiDQJ1IF94CF2TA=:AmazonSES X-SES-Outgoing: 2022.12.09-54.240.7.11 Content-Transfer-Encoding: 8bit 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 Cc: Paolo Bonzini Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=4162 Signed-off-by: Michael Brown --- 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