From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mx.groups.io with SMTP id smtpd.web10.1935.1630390247940511247 for ; Mon, 30 Aug 2021 23:10:48 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=UZRHxIkF; spf=pass (domain: redhat.com, ip: 170.10.133.124, mailfrom: kraxel@redhat.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1630390247; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=ACuu5+U0wzol7CjQl4EjygZgCrFifdrGTg6Vv9svnMM=; b=UZRHxIkFoQKfOlaUOBnmyR3Buz5ohT3mdfWPsHqhFTXD+GryVTS8zp4pByiY31mdaGYf2W KIYG0fcC6s52XOsiWGFB0XHdsuAeU5Ah7j3Noibt4uyMdqkADXPFlQ8+29ctkE9qEcET5v ued2fDs4D3xPoeNy9tH7NGR5K07CSO0= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-380-yd1_q1DOP_q7foUgKijOPg-1; Tue, 31 Aug 2021 02:10:45 -0400 X-MC-Unique: yd1_q1DOP_q7foUgKijOPg-1 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 3FC061008065; Tue, 31 Aug 2021 06:10:41 +0000 (UTC) Received: from sirius.home.kraxel.org (unknown [10.39.192.91]) by smtp.corp.redhat.com (Postfix) with ESMTPS id E95C910016F4; Tue, 31 Aug 2021 06:10:39 +0000 (UTC) Received: by sirius.home.kraxel.org (Postfix, from userid 1000) id 0BB821800936; Tue, 31 Aug 2021 08:10:38 +0200 (CEST) Date: Tue, 31 Aug 2021 08:10:37 +0200 From: "Gerd Hoffmann" To: devel@edk2.groups.io, jiaqi.gao@intel.com Cc: "Wang, Jian J" , "Wu, Hao A" , "Bi, Dandan" , "gaoliming@byosoft.com.cn" , "Ni, Ray" , "Kinney, Michael D" , "Yao, Jiewen" , "Zimmer, Vincent" , "Justen, Jordan L" , "Xu, Min M" Subject: Re: [edk2-devel] [RFC] Design review for Lazy Page Accept in TDVF Message-ID: <20210831061037.7imk7cip2wh6q3vm@sirius.home.kraxel.org> References: MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=kraxel@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Mon, Aug 30, 2021 at 07:49:27AM +0000, Gao, Jiaqi 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) ? > 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