public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Gao, Jiaqi" <jiaqi.gao@intel.com>
To: "devel@edk2.groups.io" <devel@edk2.groups.io>,
	"kraxel@redhat.com" <kraxel@redhat.com>
Cc: "Wang, Jian J" <jian.j.wang@intel.com>,
	"Wu, Hao A" <hao.a.wu@intel.com>,
	"Bi, Dandan" <dandan.bi@intel.com>,
	"gaoliming@byosoft.com.cn" <gaoliming@byosoft.com.cn>,
	"Ni, Ray" <ray.ni@intel.com>,
	"Kinney, Michael D" <michael.d.kinney@intel.com>,
	"Yao, Jiewen" <jiewen.yao@intel.com>,
	"Zimmer, Vincent" <vincent.zimmer@intel.com>,
	"Justen, Jordan L" <jordan.l.justen@intel.com>,
	"Xu, Min M" <min.m.xu@intel.com>
Subject: Re: [edk2-devel] [RFC] Design review for Lazy Page Accept in TDVF
Date: Wed, 1 Sep 2021 07:23:04 +0000	[thread overview]
Message-ID: <BN9PR11MB5484CCC25DA5D9C83170E0A1F2CD9@BN9PR11MB5484.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20210831061037.7imk7cip2wh6q3vm@sirius.home.kraxel.org>


On Tuesday, August 31, 2021 2:11 PM, Gerd Hoffmann wrote:
> > Motivation: Intel TDX provides memory encryption and integrity
> > multi-tenancy for hardware protection. A TD-guest uses TDCALL to
> > accept shared memory as private. However, accept whole system memory
> > may take a long time which will have an adverse impact on the boot
> > time performance.
> 
> Which order of magnitude do we talk about?
> How long would it take to accept 2G of memory (all memory below 4g on
> qemu q35) ?

Here is some data using different guest configurations, it will take less time with more cpu cores.
For 2048MB memory it takes about 4 ~ 1.5 seconds using 1 ~ 4 cores guest to accept all.
For 4096MB memory it takes about 8 ~ 3 seconds using 1 ~ 4 cores guest.

> > We propose three options to address this issue:
> 
> >   1.  Modifying the memory allocation (MdeModulePkg/Core/Dxe/Mem)
> logic to accept memory when OUT_OF_RESOURCE occurs.
> >   2.  Changing the process flow of QEMU direct boot and GRUB to accept
> memory when loading the image fails and returns OUT_OF_RESOURCE.
> >   3.  Adding AcceptMemory() as a boot service interface to simplify the
> implementation of option 2.
> > Underlying implementation of accepting memory is provided by a protocol
> which can be installed by architecture-specific drivers such as TdxDxe.
> 
> (1) Looks best to me.  From a design point of view it is a very reasonable
> thing for the core memory manager to also manage the
> accepted/unaccepted state of memory.  It avoids duplicating the "oom -> try
> AcceptMemoryRessource()" logic in bootloaders and will also cover other
> oom situations.
> 
> take care,
>   Gerd
> 


  reply	other threads:[~2021-09-01  7:23 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-30  7:49 [edk2-devel] [RFC] Design review for Lazy Page Accept in TDVF jiaqi.gao
2021-08-31  6:10 ` Gerd Hoffmann
2021-09-01  7:23   ` Gao, Jiaqi [this message]
2021-09-03  0:31     ` Yao, Jiewen
2021-09-03  5:56       ` Gerd Hoffmann
2021-09-03 12:34         ` Gao, Jiaqi
2021-09-03 12:34       ` Gao, Jiaqi

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=BN9PR11MB5484CCC25DA5D9C83170E0A1F2CD9@BN9PR11MB5484.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