On Wed, 2022-04-13 at 17:08 +0800, Min Xu wrote: > BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=3902 > > Bad IO performance in SEC phase is observed after TDX features was > introduced. (after commit b6b2de884864 - "MdePkg: Support mmio for > Tdx guest in BaseIoLibIntrinsic"). > > This is because IsTdxGuest() will be called in each MMIO operation. > It is trying to cache the result of the probe in the efi data > segment. However, that doesn't work in SEC, because the data segment > is read only (so the write seems to succeed but a read will always > return the original value), leading to us calling TdIsEnabled() check > for every mmio we do, which is causing the slowdown because it's very > expensive. > > TdProbe is introduced in this patch-set. It is called in > BaseIoLibIntrinsicSev instead of IsTdxGuest. There are 2 versions of > the TdProbeLib. Null instance of TdProbe always returns TD_PROBE_NON. > Its OvmfPkg version checks the Ovmf work area to determine the Td > guest type.
I tested this out with the TPM code: it restores pretty much all of the lost performance, thanks! Tested-by: James Bottomley <j...@linux.ibm.com> James -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#88867): https://edk2.groups.io/g/devel/message/88867 Mute This Topic: https://groups.io/mt/90436749/21656 Group Owner: devel+ow...@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [arch...@mail-archive.com] -=-=-=-=-=-=-=-=-=-=-=-