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 40EB8D8110E for ; Tue, 23 Jan 2024 16:32:56 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=uI2ysL9YTywoJomXPiN3+nFyNpH4550X+hbCqiHNceA=; c=relaxed/simple; d=groups.io; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From:In-Reply-To:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Language:Content-Type:Content-Transfer-Encoding; s=20140610; t=1706027574; v=1; b=wjFl0slXAKVcxYAAyxRhHrUbr0rNPnbwlMHi6KtP5GsOGg2U9dfPHfU2RnR1vze/wljVt8sX xz47cOQKooU/31UjLjMyPiGm+6a/GfXkmTbDnSa8u3C5Qn/L5S+Z1Bg1B0HbOZkRZKDzvRfPLUl 1fGIyrHfVKg6TS71ozz672DI= X-Received: by 127.0.0.2 with SMTP id JUEjYY7687511xF10oBCpOKN; Tue, 23 Jan 2024 08:32:54 -0800 X-Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mx.groups.io with SMTP id smtpd.web11.17537.1706027574008639166 for ; Tue, 23 Jan 2024 08:32:54 -0800 X-Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-529-qr210OYDO52plgWGJWP0cw-1; Tue, 23 Jan 2024 11:32:49 -0500 X-MC-Unique: qr210OYDO52plgWGJWP0cw-1 X-Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7A26210133C1; Tue, 23 Jan 2024 16:32:49 +0000 (UTC) X-Received: from [10.39.194.212] (unknown [10.39.194.212]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C7BBF2166B32; Tue, 23 Jan 2024 16:32:48 +0000 (UTC) Message-ID: Date: Tue, 23 Jan 2024 17:32:47 +0100 MIME-Version: 1.0 Subject: Re: [edk2-devel] [PATCH v3 3/5] MdeModulePkg: Do nothing on NestedInterruptRestoreTPL(TPL_HIGH_LEVEL) To: devel@edk2.groups.io, mcb30@ipxe.org Cc: Ray Ni , Gerd Hoffmann References: <17ACFF3FDD20CD9A.13754@groups.io> <20240123153104.2451759-1-mcb30@ipxe.org> <0102018d36f278b0-4977df10-4482-4420-bee2-0dee150a9df0-000000@eu-west-1.amazonses.com> From: "Laszlo Ersek" In-Reply-To: <0102018d36f278b0-4977df10-4482-4420-bee2-0dee150a9df0-000000@eu-west-1.amazonses.com> X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.6 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com 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,lersek@redhat.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: LFKzzGBrOU6Z8hTUq0RXepf6x7686176AA= Content-Language: en-US Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=wjFl0slX; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=redhat.com (policy=none) On 1/23/24 16:31, Michael Brown wrote: > 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. >=20 > 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. >=20 > Signed-off-by: Michael Brown > --- > MdeModulePkg/Library/NestedInterruptTplLib/Tpl.c | 13 +++++++++++++ > 1 file changed, 13 insertions(+) >=20 > diff --git a/MdeModulePkg/Library/NestedInterruptTplLib/Tpl.c b/MdeModule= Pkg/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; > =20 > + // > + // At TPL_HIGH_LEVEL, CPU interrupts are disabled (as per the UEFI > + // specification) and so we should never encounter a situation in > + // which InterruptedTPL=3D=3DTPL_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 >=3D 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 Feels like the handling logic might as well be "panic" here (except edk2 does not have a central panic API that's suitable for all platforms). I probably missed the previous discussion that led to this patch. Either way, it seems reasonable. Acked-by: Laszlo Ersek -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#114215): https://edk2.groups.io/g/devel/message/114215 Mute This Topic: https://groups.io/mt/103911606/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/leave/12367111/7686176/19134562= 12/xyzzy [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-