public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Yao, Jiewen" <jiewen.yao@intel.com>
To: "devel@edk2.groups.io" <devel@edk2.groups.io>,
	"jejb@linux.ibm.com" <jejb@linux.ibm.com>,
	"Xu, Min M" <min.m.xu@intel.com>
Cc: "Kinney, Michael D" <michael.d.kinney@intel.com>,
	"Gao, Liming" <gaoliming@byosoft.com.cn>,
	"Liu, Zhiguang" <zhiguang.liu@intel.com>,
	"Gerd Hoffmann" <kraxel@redhat.com>,
	Brijesh Singh <brijesh.singh@amd.com>,
	"Aktas, Erdem" <erdemaktas@google.com>,
	Tom Lendacky <thomas.lendacky@amd.com>
Subject: Re: [edk2-devel] [PATCH 0/4] Introduce TdProbe in MdePkg
Date: Wed, 13 Apr 2022 13:12:06 +0000	[thread overview]
Message-ID: <MW4PR11MB5872CF45DBAE44E71B8E60C08CEC9@MW4PR11MB5872.namprd11.prod.outlook.com> (raw)
In-Reply-To: <eac3e00436afd40cc4cdabd49ce883666cc9b26c.camel@linux.ibm.com>

Thank you very much, James and Min, for the quick response.

I have one small concern on the naming - TdProbeLib.
Would it be better if we create a generic CcProbeLib, and just return the CC_GUEST_TYPE?
The benefit is that just in case SEV has some usage in the future, we don’t need create SevProbeLib.

BTW: I also propose to change name BaseIoLibIntrinsicSev.inf to BaseIoLibIntrinsicCc.inf.
It is very confusing to me, that a Sev.inf include a TdProbeLib. :-(
That can be done in a separate patch.

Thank you
Yao Jiewen


> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of James
> Bottomley
> Sent: Wednesday, April 13, 2022 8:55 PM
> To: Xu, Min M <min.m.xu@intel.com>; devel@edk2.groups.io
> Cc: Kinney, Michael D <michael.d.kinney@intel.com>; Gao, Liming
> <gaoliming@byosoft.com.cn>; Liu, Zhiguang <zhiguang.liu@intel.com>; Yao,
> Jiewen <jiewen.yao@intel.com>; Gerd Hoffmann <kraxel@redhat.com>; Brijesh
> Singh <brijesh.singh@amd.com>; Aktas, Erdem <erdemaktas@google.com>;
> Tom Lendacky <thomas.lendacky@amd.com>
> Subject: Re: [edk2-devel] [PATCH 0/4] Introduce TdProbe in MdePkg
> 
> 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 <jejb@linux.ibm.com>
> 
> James
> 
> 
> 
> 
> 
> 


  reply	other threads:[~2022-04-13 13:12 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-04-13  9:08 [PATCH 0/4] Introduce TdProbe in MdePkg Min Xu
2022-04-13  9:08 ` [PATCH 1/4] MdePkg: Add TdProbeLib Min Xu
2022-04-13  9:08 ` [PATCH 2/4] OvmfPkg/IntelTdx: " Min Xu
2022-04-13  9:08 ` [PATCH 3/4] MdePkg: Probe Td guest in BaseIoLibIntrinsicSev Min Xu
2022-04-13  9:08 ` [PATCH 4/4] OvmfPkg: Add TdProbeLib in *.dsc Min Xu
2022-04-13 12:55 ` [PATCH 0/4] Introduce TdProbe in MdePkg James Bottomley
2022-04-13 13:12   ` Yao, Jiewen [this message]
2022-04-13 13:27     ` [edk2-devel] " Min Xu

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=MW4PR11MB5872CF45DBAE44E71B8E60C08CEC9@MW4PR11MB5872.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