From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mx.groups.io with SMTP id smtpd.web10.3688.1630672492808968800 for ; Fri, 03 Sep 2021 05:34:53 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@intel.onmicrosoft.com header.s=selector2-intel-onmicrosoft-com header.b=cgT9wutS; spf=pass (domain: intel.com, ip: 192.55.52.115, mailfrom: jiaqi.gao@intel.com) X-IronPort-AV: E=McAfee;i="6200,9189,10095"; a="219113852" X-IronPort-AV: E=Sophos;i="5.85,265,1624345200"; d="scan'208";a="219113852" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Sep 2021 05:34:51 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.85,265,1624345200"; d="scan'208";a="500345130" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by fmsmga008.fm.intel.com with ESMTP; 03 Sep 2021 05:34:51 -0700 Received: from fmsmsx608.amr.corp.intel.com (10.18.126.88) by fmsmsx601.amr.corp.intel.com (10.18.126.81) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12; Fri, 3 Sep 2021 05:34:51 -0700 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx608.amr.corp.intel.com (10.18.126.88) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2242.12 via Frontend Transport; Fri, 3 Sep 2021 05:34:51 -0700 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (104.47.70.100) by edgegateway.intel.com (192.55.55.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2242.10; Fri, 3 Sep 2021 05:34:51 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=GRJbdW2so+oHP+WsvJklQJWd0yBBTxBVX4o8Ck5fBGUyjIvksJr+JUdz2DUZRa5chyufUcIcYPX1FxVL5HIk+kr/VHLTDzIYVBL3fblklgnMgxVb2o5lrHDvafG6J/oU1gySnQuKnN/o+9htV6V36suyEFvHk3Jf4dg900324m+OltFRlYV/XNnAEHPnR3TaFmAGG4tHmF0YIv44AKciJ/nia6UddW5UTAgn+5oPiLRQOsfNKiMs/03xF1SDxLi82bB5UAZjRXgN0dqoOfZh6Yp4xjY+uVqK4viBMUJ9o0BP4k99Icy20XCw50aFFrPXEt6OdCxxE1bjeGEu80s4Kw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=p21qJuiBNdPx1zzeMwNLEn4/x2sTVEJlPnQHZ90AfkI=; b=K6zL6cE3BrtQhiJzY26cCSR2k14IAzpFk6XAadMIaMMiSwgQbDgUy3IOZx3ittd3akHHsLq7xBbJ0798yuZ5WQs2KMERZwxsyZ1Wrm+Y+T4UgCYTfodJWKGU01AZ4sNyNvH9NuE+vTm4xJdtMoYs8iQ5oGdDEu/ABsPZ87RlbkOUnEJwsidEXiupdWSMdozOR7mahkyCgO7rx9bz0XXoFU2h9zw1c9IW15KAGuDqJKKMs8xwpyC4S+UdRzQGbhJOIMiaKxOrSWFCWKb7nBnJe8XXlLX65I83Ufx01+wA0cnLbv+s2h5g3MhHaPgvwX2oaid1QpFMwZqxnNn6rE6UkA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=intel.com; dmarc=pass action=none header.from=intel.com; dkim=pass header.d=intel.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.onmicrosoft.com; s=selector2-intel-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=p21qJuiBNdPx1zzeMwNLEn4/x2sTVEJlPnQHZ90AfkI=; b=cgT9wutSKwXoXP9ME0ddS5nubuFu1Nu8ujjMWHSd1N+wJ6mDQwFyacjjwuXcDnweBL5HPEWfElCET11D2yVAHyGboGzNzbgHD8DrjLPEBIpPT2hg8g3uRe2eex/nHHGl/apAhdee65NxgGOgoHmgZVY1OMjo/jt2s7vFrwdLpN0= Received: from BN9PR11MB5484.namprd11.prod.outlook.com (2603:10b6:408:105::16) by BN6PR1101MB2274.namprd11.prod.outlook.com (2603:10b6:405:4d::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4478.22; Fri, 3 Sep 2021 12:34:36 +0000 Received: from BN9PR11MB5484.namprd11.prod.outlook.com ([fe80::f954:8df:981f:5b77]) by BN9PR11MB5484.namprd11.prod.outlook.com ([fe80::f954:8df:981f:5b77%5]) with mapi id 15.20.4457.024; Fri, 3 Sep 2021 12:34:36 +0000 From: "Gao, Jiaqi" To: "Yao, Jiewen" , "devel@edk2.groups.io" , "kraxel@redhat.com" CC: "Wang, Jian J" , "Wu, Hao A" , "Bi, Dandan" , "gaoliming@byosoft.com.cn" , "Ni, Ray" , "Kinney, Michael D" , "Zimmer, Vincent" , "Justen, Jordan L" , "Xu, Min M" Subject: Re: [edk2-devel] [RFC] Design review for Lazy Page Accept in TDVF Thread-Topic: [edk2-devel] [RFC] Design review for Lazy Page Accept in TDVF Thread-Index: AdedbiDItZYG7+qFSi+EURejkaV4ogAwMmuAADJg3rAAWAqlYAAJF4KQ Date: Fri, 3 Sep 2021 12:34:35 +0000 Message-ID: References: <20210831061037.7imk7cip2wh6q3vm@sirius.home.kraxel.org> In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-product: dlpe-windows dlp-version: 11.5.1.3 dlp-reaction: no-action authentication-results: intel.com; dkim=none (message not signed) header.d=none;intel.com; dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: ec7edcdf-629f-48b4-ad12-08d96ed73099 x-ms-traffictypediagnostic: BN6PR1101MB2274: x-ld-processed: 46c98d88-e344-4ed4-8496-4ed7712e255d,ExtAddr x-ms-exchange-transport-forked: True x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:9508; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: ONdhYQhDSuAiwYlEoIYV1e7c997Mi8B2Tn9+XXb8VUcMxZG8LNPyG1Bxz0Yppp1ofAx5BdW3mQXZMQS4/MsP0Dlq3CqXLwUwuwm1I8L4Vx7S0gEvIu2xo5yuC474QweRjIRtvve07DmqXvGPRDJQBbI6hVG1/hMdCnbnghZGjV+jRp4g9zMFlSkmhDbtYP3xIHeiPenfus1ZdPTPcwNYEO9tuG1JJeXr7pFPlsRZGtuuDYZSal7U/++7U4Odi0T+8ztraUxXemjAbrAg6IfC5FOm3EY+c2qzDMXsB/FCoJf3mo3doJHfMnFJBMUStplDtzzsmC3VYoxEOVZTrXtvMfLcUhuZbty2rmUpZdr+yx9F8gDT5B2vwocUfrddDNfsiaTPOmKk8Bn0MX8VG+aQAPl6JIR0hRK26LMx83ZKfD2kGJVhrYvEAeGCYdaAOykrIvKcVc269LaITCfmkwkSDM4lrlzkHNO75LuRF/IzLi/KhOgTw9r2lo1KnaHGzJaqyLvsoFifo6goG31+T2KTVqY41Z7d6uKJ9s2Zn+IcjPRJZaNhT6XcCHm8DZWBhAeMNqz5lpfQdYyP/7eUr7QZJsRKUb1K3Fh+j3D8tflkFp+0hl2cgeWekRMnD6fSCUqrO9W7S1IetsTXynx3jkpEV7gDBSI9Pg7RsdC/bZyp4wdhzLgFQlU8lcLMKlUo5toVbvaWNO/AnuRMFP7ggtqlA/eUYJXRXFxYvHErtTJu0zKoiZCbWn8N1JI0RThq9GWB0dTkwHxTEZx1EL9unxmDpUhuV4nut4PriYs/qi09I2QF656BGN6h9F84pi+9AXMP/OgjaTqHeXhjdHNungcP0w== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BN9PR11MB5484.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(4636009)(366004)(38100700002)(55016002)(508600001)(76116006)(7696005)(26005)(54906003)(33656002)(38070700005)(110136005)(6506007)(316002)(9686003)(4326008)(66446008)(107886003)(66476007)(8676002)(64756008)(66556008)(52536014)(2906002)(122000001)(66946007)(5660300002)(71200400001)(8936002)(966005)(86362001)(186003)(83380400001);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?FlFZjwe7WYcJudkyMAQDj5+MR7fZJuD0Is/hY1YC/J/FnfsCOyzaGjqaO2o4?= =?us-ascii?Q?YpMDseA/WkUkb0zrWmIxXiB+xA3CMmvKRzCNPFuGwVoLK9YNM4nWBXNWcoE7?= =?us-ascii?Q?IQnLX4lChYsKfC9lYy2GkGQBiZtkTStNX3dxzLoiPhqGYrjCX+9w2JheBFjP?= =?us-ascii?Q?/vEzC8oEmnpD+pPJxFZsjH+2CQqlT994UzZRTsBqdW7zFj9QWlC7i9TOUCFQ?= =?us-ascii?Q?qssEgDsnXR8Bv0rPU7kUw0lfeNCCCBEL7mtkpawsuOMvU0JpZD0pS/Shs7Q2?= =?us-ascii?Q?7LRC9JIAJ8zsRa0gDtQZikv9L6oPw+A7Yro+tp3m1scboGIZyO4xx/MGGXhT?= =?us-ascii?Q?sJ42vahb6UO/e/wszkyaSTxU1TDIdBf0iPGjFoopvLrP2v21nI4FMmhu0N+T?= =?us-ascii?Q?5Ra4fx4Ro4al5yJcoUKofevy4DBftyjXfPLoF0GRyMf+1DB+4t2rR21Nml4b?= =?us-ascii?Q?2zalrm8XDab0pVmpYyAI/wLnnaHUXJShxq+qwJNIBDr1JYo/FypHejiZD50O?= =?us-ascii?Q?F/HVmYPhfpAMku1AYZuPg0Rwai3XXaLUr104PZMg02CLOepzCMSAvbturt3F?= =?us-ascii?Q?8cXDme71kPw8ccGu1ldIgQY0CHGzCLg9Z6mnBjwvE4FRiA9A1WncHpMOHJ/y?= =?us-ascii?Q?c7MsKWbtNB/mAGfXxGsokIEIEjppnjVsSRuu2ZCMoBRmUvSeg9k4Tw8fn+Wp?= =?us-ascii?Q?259ugYSySrJMhwQNl3ABhBJ27NOAeIvkATCvFMn4k7b4bnB9kSJH2uMLT5M8?= =?us-ascii?Q?tuD4uou1bdTUfDDUZ4ikhWVlSCsZjT8digLP2J7VcRqOO8nnFA47Yc3tefCP?= =?us-ascii?Q?pSvMQPn72CYNkPrmXSEFMxnvun1U8C3Esw4LIowNgNDTfh3dEsT2uqp1k1Ts?= =?us-ascii?Q?qQCvlEO5SZ5VmCPoX2TGLUw0uxt/Os/izUpjkDcN3T3BUJwhw3zQRl/Cs9g4?= =?us-ascii?Q?nm7FDqlFzW8q0xJb/ZR3kkLiBq2FCEZOroo0MKjVamjCUoi4clPdr1rRJfY9?= =?us-ascii?Q?gKR6ZorzoMBMaQUkK2aNIG2J07S65QtTJsoo1bwcRhBBuTPOkY4kEqRm1mGL?= =?us-ascii?Q?kFPhuWgmx4lqAu9edmGYncUMFXQQAhyryuAMCxqFx6bn6DRVKcwgQ79q1Hzv?= =?us-ascii?Q?B8d+y4q9Preqy/bvEfVYKGgpA7oo37QKSo1msyi5ca9jkYx+va1MOWckJstd?= =?us-ascii?Q?pXzx7Def1394YTfnCuHLa0jE3CDMpysMWiI7cQ65quUmaTjt4QC52fQj9wHB?= =?us-ascii?Q?DpVYwi6LEKu5tk4e/scfTSn1Fbju/nGQ/0mWtvsO8dvtJ9isaQv+vB62zbUT?= =?us-ascii?Q?Xhctn37Pw4KSEJ0vDfvIhHL9?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: BN9PR11MB5484.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: ec7edcdf-629f-48b4-ad12-08d96ed73099 X-MS-Exchange-CrossTenant-originalarrivaltime: 03 Sep 2021 12:34:36.0026 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 46c98d88-e344-4ed4-8496-4ed7712e255d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: IHQMN2gw/28a1DGO9mKNfG9dP8QcohFWJg15bIOGs5O5+NW7gdY314NnlJ5oHbaYUc/WpW4GS1OgrfHg8mcsrw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR1101MB2274 Return-Path: jiaqi.gao@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Hi, >=20 > I think we need clearly document what service can be used in > EFI_ACCEPT_MEMORY. > For example, can we use memory allocation service, GCD service, or MP > service? GCD service is provided by EFI_DXE_SERVICES, it can be used by EFI_ACCEPT_M= EMORY (So updating the GCD memory map in the protocol is an option).=20 Memory allocation service can be used too. We are not using MP service for now. If we need to use MP service, I think = we can register a protocol notify to install EFI_ACCEPT_MEMORY when EFI_MP_= SERVICE_PROTOCOL is ready. > > In https://github.com/mxu9/edk2/pull/9/commits, I do not find the > producer of EFI_ACCEPT_MEMORY, would you please give me some hint? >=20 EFI_ACCEPT_MEMORY is installed by TdxDxe in our POC: https://github.com/mxu= 9/edk2/pull/9/commits/45974892883847f9c0397ca8efcc86a0318b2c6e > Couple of dependency issue: > If EFI_ACCEPT_MEMORY cannot use MP service, then there might be > performance concern. > If it uses MP service, then we need ensure MP service is installed earlie= r and > before memory accept request. > I think we need a way to ensure there is enough memory *before* the > protocol is installed, right? >=20 Since the memory needed by protocol is the *certain* part and it will not c= hange, I think it can be ensured. >=20 > Also, would you please clarify how to fix below comment? > // > // Fix me! CoreAddMemorySpace() should not be called in the allocation > process > // because it will allocate memory for GCD map entry. > // >=20 A possible solution is to split the update of Memory Map and GCD Memory Spa= ce Map, newly accepted memory range can be added to Memory Map (through Cor= eAddRange(), an internal function in page management) for memory allocation= firstly, then CoreAddMemorySpace() can be called safely. This method will cause an duplicate entry in memory map. We have to do some= fix in CoreAddRange() to avoid adding same range repeatedly. Or we can use similarly way as mMapStack[] in page management for GCD map e= ntry allocation too. I'm not sure these are reasonable and logical solutions, so I'm trying to f= ind another way. Thank you, Jiaqi