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 B4288D8030C for ; Fri, 19 Jan 2024 23:25:24 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=H5eI8/hLPZyteBm0L+iyJ5MQKDgnSzP4RH7KjShZdXs=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-ID: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=1705706723; v=1; b=nWrM+NijB8uIZ0S99Ve9if2MyWDy8uQ5AdtIDmZqJJBsk43Q7gxwXpPzQ/VNyCuhf0dXr9hD jCGLLG4kYHsyFbOsgRKgbHoZexo18LSQ9J4n1CVZWOxyGSFnzaz0DHP2lhfUZTVkWe2lmZ0ezVD dSfcab5E3RzABGKNpO71YU0k= X-Received: by 127.0.0.2 with SMTP id 0dLHYY7687511x3so1ioViMY; Fri, 19 Jan 2024 15:25:23 -0800 X-Received: from a7-18.smtp-out.eu-west-1.amazonses.com (a7-18.smtp-out.eu-west-1.amazonses.com [54.240.7.18]) by mx.groups.io with SMTP id smtpd.web11.7391.1705706722018491840 for ; Fri, 19 Jan 2024 15:25:22 -0800 From: "Michael Brown" To: devel@edk2.groups.io Cc: Michael Brown , Ray Ni , Laszlo Ersek , Gerd Hoffmann , Michael D Kinney Subject: [edk2-devel] [PATCH 1/1] MdeModulePkg: Move NestedInterruptTplLib to MdeModulePkg Date: Fri, 19 Jan 2024 23:25:20 +0000 Message-ID: <0102018d240b0ba0-b3b75cd0-d7bc-4505-bea7-db233fdcd82a-000000@eu-west-1.amazonses.com> 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.19-54.240.7.18 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: lkMDswFzG7HdKMlnx3P2MygPx7686176AA= 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=nWrM+Nij; 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=none NestedInterruptTplLib provides a way for timer interrupt handlers (which must support nested interrupts) to prevent unbounded stack consumption. The underlying issue was first observed in OvmfPkg, since interrupt storms can arise more easily in virtual machines due to CPU starvation. However, careful investigation shows that the unbounded stack consumption can also occur in physical machines. Move NestedInterruptTplLib from OvmfPkg to MdeModulePkg so that it can more easily be consumed by drivers outside of OvmfPkg. Cc: Ray Ni Cc: Laszlo Ersek Cc: Gerd Hoffmann Cc: Michael D Kinney Signed-off-by: Michael Brown --- MdeModulePkg/MdeModulePkg.dec | 4 ++++ OvmfPkg/OvmfPkg.dec | 4 ---- OvmfPkg/AmdSev/AmdSevX64.dsc | 2 +- OvmfPkg/CloudHv/CloudHvX64.dsc | 2 +- OvmfPkg/IntelTdx/IntelTdxX64.dsc | 2 +- OvmfPkg/Microvm/MicrovmX64.dsc | 2 +- OvmfPkg/OvmfPkgIa32.dsc | 2 +- OvmfPkg/OvmfPkgIa32X64.dsc | 2 +- OvmfPkg/OvmfPkgX64.dsc | 2 +- OvmfPkg/OvmfXen.dsc | 2 +- UefiPayloadPkg/UefiPayloadPkg.dsc | 2 +- .../Library/NestedInterruptTplLib/NestedInterruptTplLib.inf | 2 +- OvmfPkg/LocalApicTimerDxe/LocalApicTimerDxe.inf | 1 + .../Include/Library/NestedInterruptTplLib.h | 0 .../Library/NestedInterruptTplLib/Iret.h | 0 .../Library/NestedInterruptTplLib/Iret.c | 0 {OvmfPkg => MdeModulePkg}/Library/NestedInterruptTplLib/Tpl.c | 0 17 files changed, 15 insertions(+), 14 deletions(-) rename {OvmfPkg => MdeModulePkg}/Library/NestedInterruptTplLib/NestedInterruptTplLib.inf (91%) rename {OvmfPkg => MdeModulePkg}/Include/Library/NestedInterruptTplLib.h (100%) rename {OvmfPkg => MdeModulePkg}/Library/NestedInterruptTplLib/Iret.h (100%) rename {OvmfPkg => MdeModulePkg}/Library/NestedInterruptTplLib/Iret.c (100%) rename {OvmfPkg => MdeModulePkg}/Library/NestedInterruptTplLib/Tpl.c (100%) diff --git a/MdeModulePkg/MdeModulePkg.dec b/MdeModulePkg/MdeModulePkg.dec index a2cd83345f5b..d6fb729af5a7 100644 --- a/MdeModulePkg/MdeModulePkg.dec +++ b/MdeModulePkg/MdeModulePkg.dec @@ -169,6 +169,10 @@ [LibraryClasses] # ImagePropertiesRecordLib|Include/Library/ImagePropertiesRecordLib.h + ## @libraryclass Handle TPL changes within nested interrupt handlers + # + NestedInterruptTplLib|Include/Library/NestedInterruptTplLib.h + [Guids] ## MdeModule package token space guid # Include/Guid/MdeModulePkgTokenSpace.h diff --git a/OvmfPkg/OvmfPkg.dec b/OvmfPkg/OvmfPkg.dec index b44fa039f76c..05d43d5a6861 100644 --- a/OvmfPkg/OvmfPkg.dec +++ b/OvmfPkg/OvmfPkg.dec @@ -41,10 +41,6 @@ [LibraryClasses] # MemEncryptTdxLib|Include/Library/MemEncryptTdxLib.h - ## @libraryclass Handle TPL changes within nested interrupt handlers - # - NestedInterruptTplLib|Include/Library/NestedInterruptTplLib.h - ## @libraryclass Save and restore variables using a file # NvVarsFileLib|Include/Library/NvVarsFileLib.h diff --git a/OvmfPkg/AmdSev/AmdSevX64.dsc b/OvmfPkg/AmdSev/AmdSevX64.dsc index a31a89344a60..80456f878a22 100644 --- a/OvmfPkg/AmdSev/AmdSevX64.dsc +++ b/OvmfPkg/AmdSev/AmdSevX64.dsc @@ -354,7 +354,7 @@ [LibraryClasses.common.DXE_DRIVER] !endif PciLib|OvmfPkg/Library/DxePciLibI440FxQ35/DxePciLibI440FxQ35.inf MpInitLib|UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf - NestedInterruptTplLib|OvmfPkg/Library/NestedInterruptTplLib/NestedInterruptTplLib.inf + NestedInterruptTplLib|MdeModulePkg/Library/NestedInterruptTplLib/NestedInterruptTplLib.inf QemuFwCfgS3Lib|OvmfPkg/Library/QemuFwCfgS3Lib/DxeQemuFwCfgS3LibFwCfg.inf QemuLoadImageLib|OvmfPkg/Library/GenericQemuLoadImageLib/GenericQemuLoadImageLib.inf diff --git a/OvmfPkg/CloudHv/CloudHvX64.dsc b/OvmfPkg/CloudHv/CloudHvX64.dsc index b522fa10594d..9c6c68ae2c35 100644 --- a/OvmfPkg/CloudHv/CloudHvX64.dsc +++ b/OvmfPkg/CloudHv/CloudHvX64.dsc @@ -394,7 +394,7 @@ [LibraryClasses.common.DXE_DRIVER] !endif PciLib|OvmfPkg/Library/DxePciLibI440FxQ35/DxePciLibI440FxQ35.inf MpInitLib|UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf - NestedInterruptTplLib|OvmfPkg/Library/NestedInterruptTplLib/NestedInterruptTplLib.inf + NestedInterruptTplLib|MdeModulePkg/Library/NestedInterruptTplLib/NestedInterruptTplLib.inf QemuFwCfgS3Lib|OvmfPkg/Library/QemuFwCfgS3Lib/DxeQemuFwCfgS3LibFwCfg.inf QemuLoadImageLib|OvmfPkg/Library/X86QemuLoadImageLib/X86QemuLoadImageLib.inf diff --git a/OvmfPkg/IntelTdx/IntelTdxX64.dsc b/OvmfPkg/IntelTdx/IntelTdxX64.dsc index 82e3e41cfc57..5270c59e1279 100644 --- a/OvmfPkg/IntelTdx/IntelTdxX64.dsc +++ b/OvmfPkg/IntelTdx/IntelTdxX64.dsc @@ -310,7 +310,7 @@ [LibraryClasses.common.DXE_DRIVER] LockBoxLib|OvmfPkg/Library/LockBoxLib/LockBoxDxeLib.inf PciLib|OvmfPkg/Library/DxePciLibI440FxQ35/DxePciLibI440FxQ35.inf MpInitLib|UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf - NestedInterruptTplLib|OvmfPkg/Library/NestedInterruptTplLib/NestedInterruptTplLib.inf + NestedInterruptTplLib|MdeModulePkg/Library/NestedInterruptTplLib/NestedInterruptTplLib.inf QemuFwCfgS3Lib|OvmfPkg/Library/QemuFwCfgS3Lib/DxeQemuFwCfgS3LibFwCfg.inf QemuLoadImageLib|OvmfPkg/Library/X86QemuLoadImageLib/X86QemuLoadImageLib.inf diff --git a/OvmfPkg/Microvm/MicrovmX64.dsc b/OvmfPkg/Microvm/MicrovmX64.dsc index 063324cd0572..8ec00eaf2015 100644 --- a/OvmfPkg/Microvm/MicrovmX64.dsc +++ b/OvmfPkg/Microvm/MicrovmX64.dsc @@ -393,7 +393,7 @@ [LibraryClasses.common.DXE_DRIVER] PciPcdProducerLib|OvmfPkg/Fdt/FdtPciPcdProducerLib/FdtPciPcdProducerLib.inf PciExpressLib|OvmfPkg/Library/BaseCachingPciExpressLib/BaseCachingPciExpressLib.inf MpInitLib|UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf - NestedInterruptTplLib|OvmfPkg/Library/NestedInterruptTplLib/NestedInterruptTplLib.inf + NestedInterruptTplLib|MdeModulePkg/Library/NestedInterruptTplLib/NestedInterruptTplLib.inf QemuFwCfgS3Lib|OvmfPkg/Library/QemuFwCfgS3Lib/DxeQemuFwCfgS3LibFwCfg.inf QemuLoadImageLib|OvmfPkg/Library/X86QemuLoadImageLib/X86QemuLoadImageLib.inf diff --git a/OvmfPkg/OvmfPkgIa32.dsc b/OvmfPkg/OvmfPkgIa32.dsc index 28379961a78e..154afbbaf45d 100644 --- a/OvmfPkg/OvmfPkgIa32.dsc +++ b/OvmfPkg/OvmfPkgIa32.dsc @@ -401,7 +401,7 @@ [LibraryClasses.common.DXE_DRIVER] !endif PciLib|OvmfPkg/Library/DxePciLibI440FxQ35/DxePciLibI440FxQ35.inf MpInitLib|UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf - NestedInterruptTplLib|OvmfPkg/Library/NestedInterruptTplLib/NestedInterruptTplLib.inf + NestedInterruptTplLib|MdeModulePkg/Library/NestedInterruptTplLib/NestedInterruptTplLib.inf QemuFwCfgS3Lib|OvmfPkg/Library/QemuFwCfgS3Lib/DxeQemuFwCfgS3LibFwCfg.inf QemuLoadImageLib|OvmfPkg/Library/X86QemuLoadImageLib/X86QemuLoadImageLib.inf diff --git a/OvmfPkg/OvmfPkgIa32X64.dsc b/OvmfPkg/OvmfPkgIa32X64.dsc index 5e9eee628aea..0f6173607759 100644 --- a/OvmfPkg/OvmfPkgIa32X64.dsc +++ b/OvmfPkg/OvmfPkgIa32X64.dsc @@ -407,7 +407,7 @@ [LibraryClasses.common.DXE_DRIVER] !endif PciLib|OvmfPkg/Library/DxePciLibI440FxQ35/DxePciLibI440FxQ35.inf MpInitLib|UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf - NestedInterruptTplLib|OvmfPkg/Library/NestedInterruptTplLib/NestedInterruptTplLib.inf + NestedInterruptTplLib|MdeModulePkg/Library/NestedInterruptTplLib/NestedInterruptTplLib.inf QemuFwCfgS3Lib|OvmfPkg/Library/QemuFwCfgS3Lib/DxeQemuFwCfgS3LibFwCfg.inf QemuLoadImageLib|OvmfPkg/Library/X86QemuLoadImageLib/X86QemuLoadImageLib.inf diff --git a/OvmfPkg/OvmfPkgX64.dsc b/OvmfPkg/OvmfPkgX64.dsc index bf4c7906c460..93e7e9a18cd0 100644 --- a/OvmfPkg/OvmfPkgX64.dsc +++ b/OvmfPkg/OvmfPkgX64.dsc @@ -427,7 +427,7 @@ [LibraryClasses.common.DXE_DRIVER] !endif PciLib|OvmfPkg/Library/DxePciLibI440FxQ35/DxePciLibI440FxQ35.inf MpInitLib|UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf - NestedInterruptTplLib|OvmfPkg/Library/NestedInterruptTplLib/NestedInterruptTplLib.inf + NestedInterruptTplLib|MdeModulePkg/Library/NestedInterruptTplLib/NestedInterruptTplLib.inf QemuFwCfgS3Lib|OvmfPkg/Library/QemuFwCfgS3Lib/DxeQemuFwCfgS3LibFwCfg.inf QemuLoadImageLib|OvmfPkg/Library/X86QemuLoadImageLib/X86QemuLoadImageLib.inf diff --git a/OvmfPkg/OvmfXen.dsc b/OvmfPkg/OvmfXen.dsc index 976b795d41c9..c2472aca38aa 100644 --- a/OvmfPkg/OvmfXen.dsc +++ b/OvmfPkg/OvmfXen.dsc @@ -340,7 +340,7 @@ [LibraryClasses.common.DXE_DRIVER] !endif PciLib|OvmfPkg/Library/DxePciLibI440FxQ35/DxePciLibI440FxQ35.inf MpInitLib|UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf - NestedInterruptTplLib|OvmfPkg/Library/NestedInterruptTplLib/NestedInterruptTplLib.inf + NestedInterruptTplLib|MdeModulePkg/Library/NestedInterruptTplLib/NestedInterruptTplLib.inf QemuFwCfgS3Lib|OvmfPkg/Library/QemuFwCfgS3Lib/DxeQemuFwCfgS3LibFwCfg.inf [LibraryClasses.common.UEFI_APPLICATION] diff --git a/UefiPayloadPkg/UefiPayloadPkg.dsc b/UefiPayloadPkg/UefiPayloadPkg.dsc index 4f195c1e5212..51f18b5c0c2f 100644 --- a/UefiPayloadPkg/UefiPayloadPkg.dsc +++ b/UefiPayloadPkg/UefiPayloadPkg.dsc @@ -687,7 +687,7 @@ [Components.X64] !elseif $(TIMER_SUPPORT) == "LAPIC" OvmfPkg/LocalApicTimerDxe/LocalApicTimerDxe.inf { - NestedInterruptTplLib|OvmfPkg/Library/NestedInterruptTplLib/NestedInterruptTplLib.inf + NestedInterruptTplLib|MdeModulePkg/Library/NestedInterruptTplLib/NestedInterruptTplLib.inf } !else !error "Invalid TIMER_SUPPORT" diff --git a/OvmfPkg/Library/NestedInterruptTplLib/NestedInterruptTplLib.inf b/MdeModulePkg/Library/NestedInterruptTplLib/NestedInterruptTplLib.inf similarity index 91% rename from OvmfPkg/Library/NestedInterruptTplLib/NestedInterruptTplLib.inf rename to MdeModulePkg/Library/NestedInterruptTplLib/NestedInterruptTplLib.inf index 5eafb4197842..1e03e1364e0f 100644 --- a/OvmfPkg/Library/NestedInterruptTplLib/NestedInterruptTplLib.inf +++ b/MdeModulePkg/Library/NestedInterruptTplLib/NestedInterruptTplLib.inf @@ -24,7 +24,7 @@ [Sources] [Packages] MdePkg/MdePkg.dec - OvmfPkg/OvmfPkg.dec + MdeModulePkg/MdeModulePkg.dec [LibraryClasses] BaseLib diff --git a/OvmfPkg/LocalApicTimerDxe/LocalApicTimerDxe.inf b/OvmfPkg/LocalApicTimerDxe/LocalApicTimerDxe.inf index b85965c75ea3..8a992764fb98 100644 --- a/OvmfPkg/LocalApicTimerDxe/LocalApicTimerDxe.inf +++ b/OvmfPkg/LocalApicTimerDxe/LocalApicTimerDxe.inf @@ -20,6 +20,7 @@ [Defines] [Packages] MdePkg/MdePkg.dec + MdeModulePkg/MdeModulePkg.dec UefiCpuPkg/UefiCpuPkg.dec OvmfPkg/OvmfPkg.dec diff --git a/OvmfPkg/Include/Library/NestedInterruptTplLib.h b/MdeModulePkg/Include/Library/NestedInterruptTplLib.h similarity index 100% rename from OvmfPkg/Include/Library/NestedInterruptTplLib.h rename to MdeModulePkg/Include/Library/NestedInterruptTplLib.h diff --git a/OvmfPkg/Library/NestedInterruptTplLib/Iret.h b/MdeModulePkg/Library/NestedInterruptTplLib/Iret.h similarity index 100% rename from OvmfPkg/Library/NestedInterruptTplLib/Iret.h rename to MdeModulePkg/Library/NestedInterruptTplLib/Iret.h diff --git a/OvmfPkg/Library/NestedInterruptTplLib/Iret.c b/MdeModulePkg/Library/NestedInterruptTplLib/Iret.c similarity index 100% rename from OvmfPkg/Library/NestedInterruptTplLib/Iret.c rename to MdeModulePkg/Library/NestedInterruptTplLib/Iret.c diff --git a/OvmfPkg/Library/NestedInterruptTplLib/Tpl.c b/MdeModulePkg/Library/NestedInterruptTplLib/Tpl.c similarity index 100% rename from OvmfPkg/Library/NestedInterruptTplLib/Tpl.c rename to MdeModulePkg/Library/NestedInterruptTplLib/Tpl.c -- 2.43.0 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#114101): https://edk2.groups.io/g/devel/message/114101 Mute This Topic: https://groups.io/mt/103841406/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-