From: "Min Xu" <min.m.xu@intel.com>
To: "devel@edk2.groups.io" <devel@edk2.groups.io>,
"Gao, Liming" <gaoliming@byosoft.com.cn>,
"Wang, Jian J" <jian.j.wang@intel.com>,
"Liu, Zhiguang" <zhiguang.liu@intel.com>,
"Kinney, Michael D" <michael.d.kinney@intel.com>
Cc: "Gao, Zhichao" <zhichao.gao@intel.com>,
"Ni, Ray" <ray.ni@intel.com>,
"Aktas, Erdem" <erdemaktas@google.com>,
Gerd Hoffmann <kraxel@redhat.com>,
James Bottomley <jejb@linux.ibm.com>,
"Yao, Jiewen" <jiewen.yao@intel.com>,
Tom Lendacky <thomas.lendacky@amd.com>,
"Gao, Jiaqi" <jiaqi.gao@intel.com>
Subject: Re: [PATCH V4 00/10] Introduce Lazy-accept for Tdx guest
Date: Thu, 22 Sep 2022 05:25:26 +0000 [thread overview]
Message-ID: <PH0PR11MB506497AB2592527DC08732ECC54E9@PH0PR11MB5064.namprd11.prod.outlook.com> (raw)
In-Reply-To: <cover.1663026445.git.min.m.xu@intel.com>
Hi, Liming/Jian/Zhiguang/Michael
Can you help to review below patches for the lazy-accept feature? Because you're the maintainer/reviewer of the related modules.
Any comment is welcome.
[PATCH V4 01/10] MdeModulePkg: Add PrePiHob.h
https://edk2.groups.io/g/devel/message/93671
[PATCH V4 02/10] MdePkg: Increase EFI_RESOURCE_MAX_MEMORY_TYPE
https://edk2.groups.io/g/devel/message/93672
[PATCH V4 04/10] MdePkg: Add UEFI Unaccepted memory definition
https://edk2.groups.io/g/devel/message/93674
[PATCH V4 05/10] MdeModulePkg: Update Dxe to handle unaccepted memory type
https://edk2.groups.io/g/devel/message/93675
[PATCH V4 08/10] MdePkg: The prototype definition of EdkiiMemoryAcceptProtocol
https://edk2.groups.io/g/devel/message/93678
Thanks!
Min
> -----Original Message-----
> From: Xu, Min M <min.m.xu@intel.com>
> Sent: Tuesday, September 13, 2022 8:02 AM
> To: devel@edk2.groups.io
> Cc: Xu, Min M <min.m.xu@intel.com>; Gao, Zhichao
> <zhichao.gao@intel.com>; Kinney, Michael D <michael.d.kinney@intel.com>;
> Liu, Zhiguang <zhiguang.liu@intel.com>; Wang, Jian J
> <jian.j.wang@intel.com>; Gao, Liming <gaoliming@byosoft.com.cn>; Ni, Ray
> <ray.ni@intel.com>; Aktas, Erdem <erdemaktas@google.com>; Gerd
> Hoffmann <kraxel@redhat.com>; James Bottomley <jejb@linux.ibm.com>;
> Yao, Jiewen <jiewen.yao@intel.com>; Tom Lendacky
> <thomas.lendacky@amd.com>; Gao, Jiaqi <jiaqi.gao@intel.com>
> Subject: [PATCH V4 00/10] Introduce Lazy-accept for Tdx guest
>
> RFC: https://bugzilla.tianocore.org/show_bug.cgi?id=3937
>
> UnacceptedMemory is one of the four defined types of TD memory in Intel
> TDX guest. TDVF must invoke TDCALL [TDG.MEM.PAGE.ACCEPT] the
> unaccepted memory before use it. See [TDVF] Section 7.1.
> TDVF: https://www.intel.com/content/dam/develop/external/us/en/
> documents/tdx-virtual-firmware-design-guide-rev-1.01.pdf
>
> It is a time-consuming task which impacts the boot performance badly.
> One of the mitigation is the lazy-accept mechanism. That the whole system
> memory is divided into 2 parts, one is accepted in bios phase, the other is
> tagged as EfiGcdMemoryTypeUnaccepted and OS will handle these
> "unaccepted" memories.
> See "UEFI Spec v2.9 Table 7-5 Memory Type Usage before
> ExitBootServices()"
>
> As the first stage we accept all the memory under 4G. Please see the
> discussion in https://edk2.groups.io/g/devel/message/93086
>
> This patch-set is related to code first, so there is a edk2-staging branch.
> Please see https://github.com/tianocore/edk2-staging/tree/TDVF
>
> Patch 1-4:
> Introduce lazy-accept related definitions.
>
> Patch 5-6:
> Update Dxe and shell for unaccepted memory.
>
> Patch 7:
> Update OvmfPkg for unaccepted memory.
>
> Patch 8 - 10:
> Introduce EfiMemoryAcceptProtocol and realize it in TdxDxe.
>
> Code: https://github.com/mxu9/edk2/tree/lazyaccept.v4
>
> v4 changes:
> - To follow the name convention of EDKII code first, the name of
> EFI_RESOURCE_MEMORY_UNACCEPTED is updated to
> BZ3937_EFI_RESOURCE_MEMORY_UNACCEPTED.
> - Remove the definition of MaxAcceptedMemoryAddress because in current
> stage we will accept all the memory under 4G. So
> MaxAcceptedMemoryAddress is not useable in this assumption.
> - Because this is related to code first, there is edk2-staging branch.
> The branch link is attached.
> https://github.com/tianocore/edk2-staging/tree/TDVF
>
> v3 changes:
> - As the first stage we accept all the memory under 4G. See the
> discussion in https://edk2.groups.io/g/devel/message/93086
> - "Pool and page functions accept memory when OOM occurs" is dropped.
> See the discussion in https://edk2.groups.io/g/devel/message/93086
> - PlatformAdjustSystemMemorySizeBelow4gbForLazyAccep is deleted
> because in current stage we accept all the memory under 4G.
>
> v2 changes:
> - Fix a typo that change EfiUnacceptedMemory to
> EfiUnacceptedMemoryType.
> - Define EFI_GCD_MEMORY_TYPE_UNACCEPTED in PrePiDxeCis.h because it
> has
> not been defined in PI spec.
> - AllocatePages should return EFI_INVALID_PARAMETERS if input
> MemoryType
> is EfiUnacceptedMemoryType.
> - Use EDKII_ prefix instead of EFI_ prefix in the protocol name of
> EDKII_MEMORY_ACCEPT_PROTOCOL_GUID. Because this protocol is not
> EFI
> defined.
> - Accept memory under 4G even if the PcdLazyAcceptPartialMemorySize is
> bigger than 4G. So with this setting, even if the
> PcdLazyAcceptPartialMemorySize is 0 (which means to accept all
> memories), only the memory under 4G will be accepted. This is to
> optimize the performance.
>
> Cc: Zhichao Gao <zhichao.gao@intel.com>
> Cc: Michael D Kinney <michael.d.kinney@intel.com>
> Cc: Zhiguang Liu <zhiguang.liu@intel.com>
> Cc: Jian J Wang <jian.j.wang@intel.com>
> Cc: Liming Gao <gaoliming@byosoft.com.cn>
> Cc: Ray Ni <ray.ni@intel.com>
> Cc: Erdem Aktas <erdemaktas@google.com>
> Cc: Gerd Hoffmann <kraxel@redhat.com>
> Cc: James Bottomley <jejb@linux.ibm.com>
> Cc: Jiewen Yao <jiewen.yao@intel.com>
> Cc: Tom Lendacky <thomas.lendacky@amd.com>
> Signed-off-by: Jiaqi Gao <jiaqi.gao@intel.com>
> Signed-off-by: Min Xu <min.m.xu@intel.com>
>
> Jiaqi Gao (1):
> MdePkg: The prototype definition of EdkiiMemoryAcceptProtocol
>
> Min M Xu (9):
> MdeModulePkg: Add PrePiHob.h
> MdePkg: Increase EFI_RESOURCE_MAX_MEMORY_TYPE
> OvmfPkg: Use BZ3937_EFI_RESOURCE_MEMORY_UNACCEPTED defined in
> MdeModulePkg
> MdePkg: Add UEFI Unaccepted memory definition
> MdeModulePkg: Update Dxe to handle unaccepted memory type
> ShellPkg: Update shell command memmap to show unaccepted memory
> OvmfPkg: Introduce lazy accept in PlatformInitLib and PlatformPei
> OvmfPkg: Realize EdkiiMemoryAcceptProtocol in TdxDxe
> OvmfPkg: Call gEdkiiMemoryAcceptProtocolGuid to accept pages
>
> MdeModulePkg/Core/Dxe/Gcd/Gcd.c | 6 +
> MdeModulePkg/Core/Dxe/Mem/Page.c | 63 ++++++++---
> MdeModulePkg/Include/Pi/PrePiDxeCis.h | 25 +++++
> MdeModulePkg/Include/Pi/PrePiHob.h | 20 ++++
> MdePkg/Include/Pi/PiDxeCis.h | 10 +-
> MdePkg/Include/Pi/PiHob.h | 11 +-
> MdePkg/Include/Protocol/MemoryAccept.h | 37 +++++++
> MdePkg/Include/Uefi/UefiMultiPhase.h | 5 +
> MdePkg/MdePkg.dec | 3 +
> .../BaseMemEncryptTdxLib.inf | 3 +
> .../BaseMemEncryptTdxLib/MemoryEncryption.c | 12 +-
> OvmfPkg/Library/PeilessStartupLib/Hob.c | 5 +-
> OvmfPkg/Library/PlatformInitLib/IntelTdx.c | 98 ++++++++++++++---
> OvmfPkg/Library/PlatformInitLib/MemDetect.c | 2 +
> OvmfPkg/TdxDxe/TdxDxe.c | 103 ++++++++++++++++++
> OvmfPkg/TdxDxe/TdxDxe.inf | 2 +
> .../UefiShellDebug1CommandsLib/MemMap.c | 13 +++
> .../UefiShellDebug1CommandsLib.uni | 3 +-
> 18 files changed, 381 insertions(+), 40 deletions(-) create mode 100644
> MdeModulePkg/Include/Pi/PrePiDxeCis.h
> create mode 100644 MdeModulePkg/Include/Pi/PrePiHob.h
> create mode 100644 MdePkg/Include/Protocol/MemoryAccept.h
>
> --
> 2.29.2.windows.2
next prev parent reply other threads:[~2022-09-22 5:25 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-13 0:02 [PATCH V4 00/10] Introduce Lazy-accept for Tdx guest Min Xu
2022-09-13 0:02 ` [PATCH V4 01/10] MdeModulePkg: Add PrePiHob.h Min Xu
2022-09-13 0:02 ` [PATCH V4 02/10] MdePkg: Increase EFI_RESOURCE_MAX_MEMORY_TYPE Min Xu
2022-09-21 8:10 ` Gerd Hoffmann
2022-09-13 0:02 ` [PATCH V4 03/10] OvmfPkg: Use BZ3937_EFI_RESOURCE_MEMORY_UNACCEPTED defined in MdeModulePkg Min Xu
2022-09-13 0:02 ` [PATCH V4 04/10] MdePkg: Add UEFI Unaccepted memory definition Min Xu
2022-09-13 0:02 ` [PATCH V4 05/10] MdeModulePkg: Update Dxe to handle unaccepted memory type Min Xu
2022-09-13 0:02 ` [PATCH V4 06/10] ShellPkg: Update shell command memmap to show unaccepted memory Min Xu
2022-09-13 0:02 ` [PATCH V4 07/10] OvmfPkg: Introduce lazy accept in PlatformInitLib and PlatformPei Min Xu
2022-09-21 8:11 ` Gerd Hoffmann
2022-09-13 0:02 ` [PATCH V4 08/10] MdePkg: The prototype definition of EdkiiMemoryAcceptProtocol Min Xu
2022-09-13 0:02 ` [PATCH V4 09/10] OvmfPkg: Realize EdkiiMemoryAcceptProtocol in TdxDxe Min Xu
2022-09-13 0:02 ` [PATCH V4 10/10] OvmfPkg: Call gEdkiiMemoryAcceptProtocolGuid to accept pages Min Xu
2022-09-22 5:25 ` Min Xu [this message]
2022-09-29 6:56 ` [PATCH V4 00/10] Introduce Lazy-accept for Tdx guest Min Xu
2022-10-10 2:27 ` 回复: " gaoliming
2022-10-10 3:08 ` [edk2-devel] " Min Xu
2022-10-10 3:18 ` Ni, Ray
2022-10-10 15:50 ` Dionna Glaze
2022-10-12 5:29 ` Min Xu
2022-10-13 5:27 ` Dionna Glaze
2022-10-18 1:13 ` Min Xu
2022-10-19 1:17 ` 回复: " gaoliming
2022-10-19 2:02 ` Min Xu
2022-10-21 15:58 ` Dionna Glaze
2022-10-25 1:07 ` Min Xu
2022-10-26 1:27 ` 回复: " gaoliming
2022-10-26 13:35 ` Min Xu
2022-11-01 1:18 ` 回复: " gaoliming
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=PH0PR11MB506497AB2592527DC08732ECC54E9@PH0PR11MB5064.namprd11.prod.outlook.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox