From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by mx.groups.io with SMTP id smtpd.web10.4859.1675302113835686209 for ; Wed, 01 Feb 2023 17:41:54 -0800 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=N6gfsIyc; spf=pass (domain: intel.com, ip: 134.134.136.100, mailfrom: jiaxin.wu@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1675302113; x=1706838113; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=QcmjVvsbsU3C4QPyxPwd71bSJuR7LoaA+4wMcx2Pz7k=; b=N6gfsIycegcYhqDxq9aKpWCb6x9ko9e+bmz5LGIFli9QysFEblj6aFIh kKtxrBYrhr3S3cq+i3YhlbtKe5orgajlHYcHkGnwKvoGmldas3tsfK1aw WEEdZ5ymn+CyFtgNRTcrf1n3SYTQpmOfkmExl39yL/2O2fPqwnqKt3sGS V/iah6YUMtTqPfujYnsag6Cb4AUfbq2qr700BxNd+I1waR3uR6nATRldO iY+gEwBwQMNvxbqs+tO4B7zNO0IAAAeKPToWP/L1um4oAE5I3/dvMRzeF dScIpwY2D1SeDh5DTZXPK+3vYGTOtI3OpK94DEg5TxYdvDSCwHQRT5t8E g==; X-IronPort-AV: E=McAfee;i="6500,9779,10608"; a="392903958" X-IronPort-AV: E=Sophos;i="5.97,266,1669104000"; d="scan'208";a="392903958" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Feb 2023 17:41:52 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6500,9779,10608"; a="667113317" X-IronPort-AV: E=Sophos;i="5.97,266,1669104000"; d="scan'208";a="667113317" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by fmsmga007.fm.intel.com with ESMTP; 01 Feb 2023 17:41:49 -0800 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) 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.2507.16; Wed, 1 Feb 2023 17:41:49 -0800 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) by fmsmsx610.amr.corp.intel.com (10.18.126.90) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.16 via Frontend Transport; Wed, 1 Feb 2023 17:41:49 -0800 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (104.47.58.105) by edgegateway.intel.com (192.55.55.70) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.16; Wed, 1 Feb 2023 17:41:47 -0800 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Upu2VTFWHsHSAsP7k7S9aldNus22GCIjyFpextu2lhDX/OGXtNegTjrBtqy1tBLtXaSMioRzYpvpF3miA0Q+33Gjq9qFbAScef3K/fV6g7pWAd2qPO/maMFShnI6stKUowELEloUhXOFy7Ei2HpCEY3atHxQfpPs7TYkNFcJLxrGiWA+fTfMVerm1R/7zTdaDICIuFokgHlCnOpBwJYtlktjt54x5kHPTBBPxRCK2YDF2xidwb7SHh//HQduhedKuPQfC2KIJkLSMWWCPEfu+x+mLHLnriz3GmrAQ81caAUJZ4CfRJNuAgnTzphsUDPnG1Tsi+RzReRTw69kAk/2TQ== 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:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=H2ackwdbJUWnKtL7U5zKwV3hCsul3ZXBZqEde0WZwsM=; b=adCc9Z1M1rawOPk45zVhS64GXo7tWN7tMTz+kPJG/WFOx2g3auxuhH4ebPYqFnkbDMs+epi3KBsMOhsmzIlAzvVJmMIBfX9GHS3tWKya3YMeN7NjOHS+3Jko+fByUuSctBMZdn0asmWnSsC69qwC0dfc3YjUABIz+oGzQvyMO4nuWeGcm7oHRnxa5nxNgdG48uDGmQu8mtIOeRtEjxP2PDCqZfm34ZKTEon5Z5qCX0Ofs8DIQ+IKecg4qDQnXWJHcK7MhO0MEG3c9DrRAFyzZSFxgiTcbmA/LQXugmKxb4j6hVDFeGWkQERom5kT44JCO1fVcfwPImI1sIMaZEm/tQ== 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 Received: from MN0PR11MB6158.namprd11.prod.outlook.com (2603:10b6:208:3ca::18) by SA1PR11MB5946.namprd11.prod.outlook.com (2603:10b6:806:23a::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6064.27; Thu, 2 Feb 2023 01:41:38 +0000 Received: from MN0PR11MB6158.namprd11.prod.outlook.com ([fe80::e5d9:d16e:172b:aa01]) by MN0PR11MB6158.namprd11.prod.outlook.com ([fe80::e5d9:d16e:172b:aa01%3]) with mapi id 15.20.6043.036; Thu, 2 Feb 2023 01:41:38 +0000 From: "Wu, Jiaxin" To: Gerd Hoffmann CC: "Ni, Ray" , "devel@edk2.groups.io" , "Dong, Eric" , "Zeng, Star" , Laszlo Ersek , "Kumar, Rahul R" Subject: Re: [PATCH v3 5/5] OvmfPkg/SmmCpuFeaturesLib: Skip SMBASE configuration Thread-Topic: [PATCH v3 5/5] OvmfPkg/SmmCpuFeaturesLib: Skip SMBASE configuration Thread-Index: AQHZKzdA9HccjY1A/kmC90tX3dYbUK6kPkSAgAEha4CAD46lQIAFQNaAgAC5UoA= Date: Thu, 2 Feb 2023 01:41:38 +0000 Message-ID: References: <20230118095620.9860-1-jiaxin.wu@intel.com> <20230118095620.9860-6-jiaxin.wu@intel.com> <20230118121958.cxbfh3fljedvebis@sirius.home.kraxel.org> <20230119075303.nkyno36h25xscwkn@sirius.home.kraxel.org> <20230201134051.7jlc7a74cogcskw5@sirius.home.kraxel.org> In-Reply-To: <20230201134051.7jlc7a74cogcskw5@sirius.home.kraxel.org> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: MN0PR11MB6158:EE_|SA1PR11MB5946:EE_ x-ms-office365-filtering-correlation-id: 83bbc8d4-b366-4c94-736f-08db04bea043 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: VApZgTZBd8xscP+42O7V4Mx8rlGmJL+cQ8xbtNeYLlju1lwdpYSf8pz/dqB2pTqagb+FFYXq/jfl/pPX9TxMirocXp/WmXEEqHFw/RzEVjbfD9SD49zGQ9AyJkVu7DX8HDaBKesVDPlsPQfIOSN3/VrJ7PZeuBwpfBUdyP2APykqd4qmNKrasQmcgOTvijvTxZzmhjrgjuEQWg0z8VGngpIrBPlMrZWn+G9LQEzjEyGQ7XXG/Z8bgpU/9yCtGdC6mgNNUzAzIY4I5d5Bah8+l03ewrMIOIPJqpljqHA/of69K5SzkZtfR7H3MCAG3Ge/WHqCwyjFqogxf6VySJ32IZr7Lyny96nsihsmuqKSoVWH+oKy8qsDOUo3sLlFNhwyzun6SuLY+oi2eWtkKIRkBYpLeLXBAPmWF370zqKU7RKMYcW/27F81BubbCEGaSTIfuj5mp/FBTiSuzpYl8m5Wnydc6vvt1illNi1WsUv+JeHJhEe7N/YTg6mWq6atFHUb2BLPvrkJOcWnpDxKAHs7S3x7k9yqifHxEVo9StR99qMT0N3k37DeYEe/qt0GtIZ/IaE2/8hJkl1H33ucD8cr5lL5gmGZcYqWavyzonG5ySFeMiWgB+QVDSsUP+Z4bBWnQpe4vdAj2LQrfFkGfN0zCufjGumqB0slg0R47/XbPoXVPfaw5EWKtmHI0IKmO/YM8maZOUAdSlQNC2LNu4D/w== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MN0PR11MB6158.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230025)(346002)(376002)(366004)(136003)(396003)(39860400002)(451199018)(33656002)(86362001)(38100700002)(122000001)(38070700005)(8676002)(4326008)(76116006)(66946007)(6916009)(66476007)(66556008)(64756008)(66446008)(71200400001)(7696005)(316002)(54906003)(52536014)(41300700001)(8936002)(5660300002)(2906002)(478600001)(55016003)(82960400001)(6506007)(186003)(9686003)(26005)(107886003);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?A64G5zQvzVAHg6zXA0ohIDYpY//vMQYQEbDir7bxv3bcH+JltaStkRhugqRy?= =?us-ascii?Q?oWvMKBLMnZ2ohDv4vB5DoyQgiKZkzbQYQ9ud5X0SIy7I3BhkZUP4oF90fJlG?= =?us-ascii?Q?1yo9gYDwMND+J77RQWi8D8RFkSbG9Ej7zsb93lUOQTBXB3XpoucOgIfiA3qV?= =?us-ascii?Q?ACDwz3rsmADtPvQvsVL4DZqK6KEz7EjfpvPgar1s5WXOdGnhNpa0YtFZTBfY?= =?us-ascii?Q?5fkX/XcALJlH33A6FbmriDE9WDlCuteWg+R8YBiG6UkxgyaS4t1PH1RnTaMK?= =?us-ascii?Q?bGnsPKZGTJF9zyJVRdX5bQWmBDUzJGBeenQeFM+0AtGlpojjPbMZP8muhRJR?= =?us-ascii?Q?QRt4tJa/Abo6jdzcSUy2YafJFd7BAaUdgOwaAPKhuSzTwgQ/sCFB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nlvVp+3+X64sEYNRlNd8sOG79w/ooPn?= =?us-ascii?Q?HLiTidsQg+Yu1ikTlve2fvKlbiqYPo/5LDagziRFS5najdKG5gBc4OUczCSi?= =?us-ascii?Q?12CHDgR6P2MS2tygykByQu8XXCk5hnwezhq8p2tCckAqjY+Z486wldZYq1lE?= =?us-ascii?Q?agL+QZ+GMNGaItRWluI9638mWxLlGBQcD+HSoXolM6i2Qam/RQ2eaKxRykD+?= =?us-ascii?Q?GLV5JgtaJgWgrPknO4UyQVY9LYW9THlYtlJQ3YJeNB+/wsNLgqyS15ZDBBYw?= =?us-ascii?Q?5rI9wuO2AZkZCCyn/MpcviJsMxhfMHRMcw1wqlJU?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MN0PR11MB6158.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 83bbc8d4-b366-4c94-736f-08db04bea043 X-MS-Exchange-CrossTenant-originalarrivaltime: 02 Feb 2023 01:41:38.1660 (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: Us71cXRGMrlLY0+A6HzpHaotMw8pSpBqrg3BYGPkGLKxYFQNiUURBxmqSU8srdWsfThnCHtaZqcKW0kImEkhwQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA1PR11MB5946 Return-Path: jiaxin.wu@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable >=20 > Current state: >=20 > * PiSmmCpuDxeSmm does SMM initialization, including programming > SMBASE, > serialized. >=20 Yes.=20 > With this series applied: >=20 > * Some PEI module programs SMBASE, serialized. PEI module can also programs SMBASE in parallel. It depends on the implemen= tation. both is fine.=20 > * PiSmmCpuDxeSmm does SMM initialization, but NOT programming SMBASE, > in parallel. >=20 Yes. > Sure PiSmmCpuDxeSmm alone will run faster because it can run parallel > now. >=20 > But the serialized SMBASE programming still happens, now in the PEI > module, and I don't see a good reason why the runtime the new PEI module > and the runtime of PiSmmCpuDxeSmm combined is faster than before. As I said, PEI module can also programs SMBASE in parallel, for example pro= gram the some register directly instead of depending the existing RSM instr= uction to reload the SMBASE register with the new allocated SMBASE each tim= e when it exits SMM. Different vender might has different implementation. = Another benefit with this series will make the smbase relocation more indep= endent & more simple compared with existing process in smm cpu driver.=20 As you can see, this patch doesn't break existing code functionality& work = flow, which means it's the compatible changes, which will bring the new app= roach for the pre-allocated smbase solution. >=20 > > > * Where is the code? > > See the design of existing function: SemaphoreHook (Index, > &mRebased[Index]); >=20 > I mean the PEI module code. Gerd, different user (hob producer) might have different implementation for= the pre-allocated smbase in the hob. It's flexible for the producer to imp= lement the pre-allocated smbase and make sure it has take effect in the sys= tem. PEI module code is not in this series. >=20 > > > * It is totally unclear whenever it is possible and/or useful to > > > initialize SMM that way on OVMF. >=20 > > Add the same handing logic code in OVMF is necessary to make sure it > > work. If someone produced such hob in OVMF platform, >=20 > Do you intent submitting code for OVMF producing such a HOB? > There isn't any in this series. No, we won't do that.=20 >=20 > > Changes in OVMF is make sure it runs into right way. >=20 > As it stands you are only adding dead code for no reason. >=20 I'm not looking for trouble for the OVMF part, as I also explained the OVMF= patch:=20 This patch is to avoid configure SMBASE if SmBase relocation has been done. If gSmmBaseHobGuid found, means SmBase info has been relocated and recorded in the SmBase array. No need to do the relocation in SmmCpuFeaturesInitializeProcessor(). Change the SmmCpuFeaturesLib in OVMF is also follow the Laszlo suggestion, = and I also think it's the right way instead of adding dead code. Laszlo is = the OVMF 'D' for ovmf part, I'm fine with the decision if we want to remove= it (but I still hold the opinion keep it even no producer for OVMF). =20 > How is the SMM initialization of hotplugged CPUs > supposed to work with the new mode of operation? >=20 Yes, that's already considered. For hot plugged CPU supported, the max numb= er of CPUs should be defined in the PcdCpuMaxLogicalProcessorNumber, and al= l CPU Hot Plug Data is recorded in the PcdCpuHotPlugDataAddress, which cont= ains the smbase info pre-allocated in the hob (filling the value in pi smm = cpu driver), then CPU Hotplug MMI handler will relocate the SMBASE for new = CPUs.=20 > take care, > Gerd