From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 818A4AC0FDB for ; Tue, 23 Jan 2024 15:31:20 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=u66LmpWP5wyvsue3EYXmnqxYvfK+layoExmLKSX0P48=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:MIME-Version:Feedback-ID:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Transfer-Encoding; s=20140610; t=1706023879; v=1; b=hZ+ZokojwiLc/fVwHKUoyCN67S4qmXRwVdfQ7/XzAQIVDAo3gb0RN/zye+S8LU85y0Q35Df8 xFInxgB/pvibRyEWsIQCaZaoAxHKNPPgckPxVMuL2VUZToJ8sCsTrmx1oM9tlskhJ+Zomr4mE2Y QaVbBEMcooXCM7cFsLDkO2U4= X-Received: by 127.0.0.2 with SMTP id u6r7YY7687511xQzc1XTbqsD; Tue, 23 Jan 2024 07:31:19 -0800 X-Received: from a7-17.smtp-out.eu-west-1.amazonses.com (a7-17.smtp-out.eu-west-1.amazonses.com [54.240.7.17]) by mx.groups.io with SMTP id smtpd.web10.15400.1706023878467848717 for ; Tue, 23 Jan 2024 07:31:18 -0800 From: "Michael Brown" To: devel@edk2.groups.io Cc: Ray Ni , Gerd Hoffmann , Laszlo Ersek , Michael Brown Subject: [edk2-devel] [PATCH v3 3/5] MdeModulePkg: Do nothing on NestedInterruptRestoreTPL(TPL_HIGH_LEVEL) Date: Tue, 23 Jan 2024 15:31:16 +0000 Message-ID: <0102018d36f278b0-4977df10-4482-4420-bee2-0dee150a9df0-000000@eu-west-1.amazonses.com> In-Reply-To: <20240123153104.2451759-1-mcb30@ipxe.org> References: <17ACFF3FDD20CD9A.13754@groups.io> <20240123153104.2451759-1-mcb30@ipxe.org> 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: 2024.01.23-54.240.7.17 Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,mcb30@ipxe.org List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: k5ui6VI4z1O0MOSGntRGiti0x7686176AA= Content-Transfer-Encoding: 8bit X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=hZ+Zokoj; dmarc=none; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io At TPL_HIGH_LEVEL, CPU interrupts are disabled (as per the UEFI specification) and so we should never encounter a situation in which an interrupt occurs at TPL_HIGH_LEVEL. Restoring TPL to TPL_HIGH_LEVEL is always a no-op. Return immediately from NestedInterruptRestoreTPL(TPL_HIGH_LEVEL), so that we do not need to consider the effect of this possible invariant violation on the remainder of the logic. Signed-off-by: Michael Brown --- MdeModulePkg/Library/NestedInterruptTplLib/Tpl.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/MdeModulePkg/Library/NestedInterruptTplLib/Tpl.c b/MdeModulePkg/Library/NestedInterruptTplLib/Tpl.c index d56c12a44529..99af553ab189 100644 --- a/MdeModulePkg/Library/NestedInterruptTplLib/Tpl.c +++ b/MdeModulePkg/Library/NestedInterruptTplLib/Tpl.c @@ -99,6 +99,19 @@ NestedInterruptRestoreTPL ( EFI_TPL SavedInProgressRestoreTPL; BOOLEAN DeferredRestoreTPL; + // + // At TPL_HIGH_LEVEL, CPU interrupts are disabled (as per the UEFI + // specification) and so we should never encounter a situation in + // which InterruptedTPL==TPL_HIGH_LEVEL. + // + // Restoring TPL to TPL_HIGH_LEVEL is always a no-op. Return + // immediately so that we do not need to consider the effect of this + // possible invariant violation in the logic below. + // + if (InterruptedTPL >= TPL_HIGH_LEVEL) { + return; + } + // // If the TPL at which this interrupt occurred is equal to that of // the in-progress RestoreTPL() for an outer instance of the same -- 2.43.0 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#114209): https://edk2.groups.io/g/devel/message/114209 Mute This Topic: https://groups.io/mt/103911606/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-