From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mx.groups.io with SMTP id smtpd.web11.3787.1687770622521553968 for ; Mon, 26 Jun 2023 02:10:22 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=JEQPMzjC; spf=pass (domain: intel.com, ip: 192.55.52.136, mailfrom: ray.ni@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1687770622; x=1719306622; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=wFlSrZ/U+F396Jf1PXqYkbdxeEBnIzBhlgCU0GahYAw=; b=JEQPMzjCLEft+Tkos0hbkZoH/CVC2cryNas1nNCg4U1LaC9J8thNltOE uqi2Po8WtF8bwqY1DmQ0fejH8hAX6n9oerL6dnAE28b+Ggwc7tzn+EnWL 3H3vhQlmHfCmxUAGsHn/hZQSf8nT4jYDp/DY5CWees/5FExOOMOQa4Qvv 9SFFDfLgc6tNHnO5sltLN769MExlDDKgevVWHN6yuqVT42+7M1ah88DRo AA16XAZlxFWbeBJGfL1JGccNll1M1UFX+b/FSfkObUwAInQ88hA4xcjT1 6DJNe4zwjN0v/upT3sK9rJNLRr8pOLds112ANSMiMVIUFCobUauxRTxH0 g==; X-IronPort-AV: E=McAfee;i="6600,9927,10752"; a="340811370" X-IronPort-AV: E=Sophos;i="6.01,159,1684825200"; d="scan'208";a="340811370" Received: from fmsmga007.fm.intel.com ([10.253.24.52]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Jun 2023 02:10:20 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10752"; a="719274373" X-IronPort-AV: E=Sophos;i="6.01,159,1684825200"; d="scan'208";a="719274373" Received: from fmsmsx601.amr.corp.intel.com ([10.18.126.81]) by fmsmga007.fm.intel.com with ESMTP; 26 Jun 2023 02:10:20 -0700 Received: from fmsmsx612.amr.corp.intel.com (10.18.126.92) 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.27; Mon, 26 Jun 2023 02:10:19 -0700 Received: from fmsmsx610.amr.corp.intel.com (10.18.126.90) by fmsmsx612.amr.corp.intel.com (10.18.126.92) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Mon, 26 Jun 2023 02:10:18 -0700 Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) 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.27 via Frontend Transport; Mon, 26 Jun 2023 02:10:18 -0700 Received: from NAM11-BN8-obe.outbound.protection.outlook.com (104.47.58.168) 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.2507.23; Mon, 26 Jun 2023 02:10:18 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=NCtCY/Q0n9qTT8BfhVjdLsxD6GOaybA6TK0GP5QoQVu0gI+7xz9aBN3A8OCUn+NgwVLPqQM7ekjo21Xe4GPWpdclHC2Iz/2S6PPsofdcg20EdaOXsB6ulYqcVvrbcIVILLeLH1JyD/p4NjxH7HDaTMSRbMl8nJSv3oLz39JWxPJpJhS7tcR+v9h8B7ZtdlglvMxrnpHNHdFSSfatcc/9dOjkBoFgaWy3FJyrHH+g+t/Ns7tjuaV9ZV0dDsdrJImludZX4ny6KRzROue77i+SqtNwXyyhhEbWLhYk6McD+yuwGb7FAmK4VNwzKbjpJwQUyJRkR+hAP2KZxnHUNeRrqw== 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=FW8EsXKliHwHuVkFmdaplPLkIXS9kcXLmhI4Sbcl+88=; b=PrLoc3HWmd/Xw7CyRlIsdkZJCBTB+JdQwA3XgaR2W9nwjiB/3cCxl8TKCkHi4ixdJlfbUbHWlUKzYBd4Ztbbyqm+ukQD//+7LXGb23Bof4Hw3N6/R8Yt/TM8uJmy66D04oTzePp7c4ZOPB4mWAedL17g5mW1PnRHEb+NAjyme4qTHs8XURFiCitJELppRD+Re7zsaWP6ROeoc4u+BJccD4i2++pQGrquFgbsED7DrtJZJLMGH/ZlXvjYV+XmbIxTp+NFQ5G0RqW+liz8izmjh1qnO9GGNU9q09aeicXU0QHRRntTfGXXyXsBrJKy95OFwjzTdbgAMElizwoetaWw1Q== 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 MN6PR11MB8244.namprd11.prod.outlook.com (2603:10b6:208:470::14) by DS0PR11MB8161.namprd11.prod.outlook.com (2603:10b6:8:164::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6521.23; Mon, 26 Jun 2023 09:10:16 +0000 Received: from MN6PR11MB8244.namprd11.prod.outlook.com ([fe80::892b:b8e6:bab7:635d]) by MN6PR11MB8244.namprd11.prod.outlook.com ([fe80::892b:b8e6:bab7:635d%2]) with mapi id 15.20.6521.023; Mon, 26 Jun 2023 09:10:16 +0000 From: "Ni, Ray" To: "Xie, Yuanhao" , "devel@edk2.groups.io" CC: Gerd Hoffmann , "Dong, Eric" , "Kumar, Rahul R" , Tom Lendacky Subject: Re: [Patch V3 1/5] UefiCpuPkg: Refactor the logic for placing APs in HltLoop. Thread-Topic: [Patch V3 1/5] UefiCpuPkg: Refactor the logic for placing APs in HltLoop. Thread-Index: AQHZp/MXvD5FPwJo2k+EgV2kw2wfYK+czA+g Date: Mon, 26 Jun 2023 09:10:15 +0000 Message-ID: References: <20230626055705.57145-1-yuanhao.xie@intel.com> <20230626055705.57145-2-yuanhao.xie@intel.com> In-Reply-To: <20230626055705.57145-2-yuanhao.xie@intel.com> Accept-Language: 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: MN6PR11MB8244:EE_|DS0PR11MB8161:EE_ x-ms-office365-filtering-correlation-id: a84d5a70-6c76-464b-c877-08db762527cb x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: H3o+w2gVA9aJLwZPxwBHKJHPLcoKZAGs1uKuRGL0+dc8F4fE3HnZ/m73qGYExdgLU+sW2QuTFbmjkEPjPDM0TqSssghCGmqcHa1lZZTpwJuEjBc5xiyOgjCQNaG19+OsOVESDbGQAlXowyJQRFEL9tG3noSRpHsT80uKqN2TIBNieFC9U6yX5pPh7HLo4efrHJiz/dESn7e+z63yy1n/GT3P3P2wxkN+GyDuSxmDMkLdLhD9ZM5xD2xWJzV84ANT2hKGDSMxcflT/kIDxLSE8yt4dwqGryj+OAIkwxIX1a/v/6hseX80kRzUB9TLhKizgI16g64o2kf2/Mannj/VRXjz3nP5yWDc5oZWw3Rr957EBy7+JMHe0b/A5i+4jU+bnN6XR/vu6NFztWcnljwEJsd97OTDVMW1GIKzK8IXzC++OoK1AzAY97k6BDLBmY5W41qbr/tIHRwwxBrPbjNDSWlaEC/AQqQ2SAj31S/kVQEcLPxaxDUjOe8diRsqTAcCW/Q2jiJ9kjD5Nu7aqU+4HdN+yNddGXTuvl7ahHd26JUi82Yg7+2Wd7e11JmWe/r4uQPkAVVkMrxUelHI7ThlaTgbtVDXRBGjZeQuBsaBUMLfoyyWX5RqvaTmJmLnh09v x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MN6PR11MB8244.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(346002)(376002)(39860400002)(396003)(136003)(366004)(451199021)(478600001)(54906003)(7696005)(71200400001)(110136005)(83380400001)(26005)(186003)(9686003)(6506007)(53546011)(66446008)(2906002)(5660300002)(52536014)(33656002)(38100700002)(122000001)(76116006)(4326008)(66946007)(55016003)(82960400001)(316002)(86362001)(8936002)(8676002)(41300700001)(38070700005)(66476007)(66556008)(64756008);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?QIpKYnnXw9IWMBaDNU/nizV4Lra834jbUjXZ9M+I6Q085yL+50yAk5WZTGM5?= =?us-ascii?Q?upjMnkxTrdjdF1r8v16z4QLmafYxuOQSo625+z5C5hi7647WEU2kJaBzBuFD?= =?us-ascii?Q?x88IxY24llldVYLoM7DBX6vBrw5UD8KWCczp2phzaZNaXXPFmnPiaOdQ0emp?= =?us-ascii?Q?akRl4J5zMHOelA4jhK7pMjIdbs8ouyPC2iTmz75rrkHERZA7SDseN44aqmm6?= =?us-ascii?Q?PVQp59fPEvK66vHvK5YkjRvYMq6/fAfPoxo1qt0VW+b9Y56qzndXBw0H6ICl?= =?us-ascii?Q?SMnG8vgp6T6cOYJ/t/H/J4zlKlUesn4sRdwK1GmH8qH1mX8KutUxQspj+Hn6?= =?us-ascii?Q?JQHhXEqMiCQY/H7/AobcEKM0HN7hPbeNcMFid2pcu8GVcaz8N43v1LFsq4Rm?= =?us-ascii?Q?VeJ41RsFEm8MPyjoxcj+0Du0Tbf0uiMYTQ7ZQx6eexNgfZqKrZFB3EIfpN+X?= =?us-ascii?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+++jDSpqWJ/i?= =?us-ascii?Q?mnz22WHIw7BYqQXgGvsWbitjz3Tnls0Sfc4YKYNBuoae0PgMLbJfYcs3B5yM?= =?us-ascii?Q?VpHjF91sLGLFdFyKQB/Q9+cd9wF7gS/xQDbNMSZVwvniXo62QmNXNrTH6JaO?= =?us-ascii?Q?TF15tOHLEH+3zLu3tvV1D0z/YBR0pVNSSWGK2RkpD9Eywg1PhZzb0leggIZn?= =?us-ascii?Q?cMblaoVVRZLuTz1uQ3U=3D?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MN6PR11MB8244.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: a84d5a70-6c76-464b-c877-08db762527cb X-MS-Exchange-CrossTenant-originalarrivaltime: 26 Jun 2023 09:10:15.6102 (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: I3A9pJKTV06J6lSm5AkII4q5Wdec5XrMrZ1LGZVtiLNIzWUKn8qY2rIFPsUlvAfCSE2UHzj3aoLAr97zh8iBhg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR11MB8161 Return-Path: ray.ni@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Ray Ni > -----Original Message----- > From: Xie, Yuanhao > Sent: Monday, June 26, 2023 1:57 PM > To: devel@edk2.groups.io > Cc: Gerd Hoffmann ; Dong, Eric ; = Ni, > Ray ; Kumar, Rahul R ; Tom > Lendacky ; Xie, Yuanhao > > Subject: [Patch V3 1/5] UefiCpuPkg: Refactor the logic for placing APs in= HltLoop. >=20 > Refactor the logic for placing APs in HltLoop into a separate function. >=20 > Cc: Gerd Hoffmann > Cc: Eric Dong > Cc: Ray Ni > Cc: Rahul Kumar > Cc: Tom Lendacky > Signed-off-by: Yuanhao Xie > --- > UefiCpuPkg/Library/MpInitLib/MpLib.c | 35 ++++++++++++++++++++++++------= - > ---- > 1 file changed, 24 insertions(+), 11 deletions(-) >=20 > diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c > b/UefiCpuPkg/Library/MpInitLib/MpLib.c > index f1f2840714..9560b39220 100644 > --- a/UefiCpuPkg/Library/MpInitLib/MpLib.c > +++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c > @@ -636,6 +636,28 @@ InitializeApData ( > SetApState (&CpuMpData->CpuData[ProcessorNumber], CpuStateIdle); > } >=20 > +/** > + This function place APs in Halt loop. > + > + @param[in] CpuMpData Pointer to CPU MP Data > +**/ > +VOID > +PlaceAPInHltLoop ( > + IN CPU_MP_DATA *CpuMpData > + ) > +{ > + while (TRUE) { > + DisableInterrupts (); > + if (CpuMpData->UseSevEsAPMethod) { > + SevEsPlaceApHlt (CpuMpData); > + } else { > + CpuSleep (); > + } > + > + CpuPause (); > + } > +} > + > /** > This function will be called from AP reset code if BSP uses WakeUpAP. >=20 > @@ -812,19 +834,10 @@ ApWakeupFunction ( > // Place AP is specified loop mode > // > if (CpuMpData->ApLoopMode =3D=3D ApInHltLoop) { > + PlaceAPInHltLoop (CpuMpData); > // > - // Place AP in HLT-loop > + // Never run here > // > - while (TRUE) { > - DisableInterrupts (); > - if (CpuMpData->UseSevEsAPMethod) { > - SevEsPlaceApHlt (CpuMpData); > - } else { > - CpuSleep (); > - } > - > - CpuPause (); > - } > } >=20 > while (TRUE) { > -- > 2.36.1.windows.1