From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by mx.groups.io with SMTP id smtpd.web12.8101.1654764810179077324 for ; Thu, 09 Jun 2022 01:53:30 -0700 Authentication-Results: mx.groups.io; dkim=fail reason="unable to parse pub key" header.i=@intel.com header.s=intel header.b=a/HZ1Xis; spf=pass (domain: intel.com, ip: 192.55.52.93, mailfrom: jiewen.yao@intel.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1654764810; x=1686300810; h=from:to:cc:subject:date:message-id:references: in-reply-to:content-transfer-encoding:mime-version; bh=Z8R4zrU2iKAgUX/Z1JYYVcnh2DCqmp+weF6fERKLv1s=; b=a/HZ1XisUCkg2FBmF46Ylxwf3ePctZZY8QtoU8Po6PC5mWAhAE6TCnav DOLHWyLRhnV8GDkqc+aXm1pEHQi0J0bPsuHkGZqg/wSrCTxpFdRSRKZ6q E3KI8iYkjnbKpT2OKUimh0E+6vEqSedvvVLOOJhyoydM7Q5pLt+x04UwE wmSKmoTLYnn8KZU5SJpSGedkH028OPSfnQzLOHvGdSX/dHvnxaS6WYwue 3BpUkpSKSGT+4sBOKowIAc2gjiQK1I1iXdmirwRQb08XDWSdNep22wpCI Dj+XEKRqxWffSBRG2fS4sd+oGAlTOedNlHV95rx0BakfEmMZaHICNnW5K Q==; X-IronPort-AV: E=McAfee;i="6400,9594,10372"; a="274730777" X-IronPort-AV: E=Sophos;i="5.91,287,1647327600"; d="scan'208";a="274730777" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 09 Jun 2022 01:53:29 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.91,287,1647327600"; d="scan'208";a="908163767" Received: from fmsmsx605.amr.corp.intel.com ([10.18.126.85]) by fmsmga005.fm.intel.com with ESMTP; 09 Jun 2022 01:53:29 -0700 Received: from fmsmsx609.amr.corp.intel.com (10.18.126.89) by fmsmsx605.amr.corp.intel.com (10.18.126.85) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Thu, 9 Jun 2022 01:53:28 -0700 Received: from fmsmsx608.amr.corp.intel.com (10.18.126.88) by fmsmsx609.amr.corp.intel.com (10.18.126.89) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2308.27; Thu, 9 Jun 2022 01:53:28 -0700 Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) 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.2308.27 via Frontend Transport; Thu, 9 Jun 2022 01:53:28 -0700 Received: from NAM11-CO1-obe.outbound.protection.outlook.com (104.47.56.168) 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.2308.27; Thu, 9 Jun 2022 01:53:28 -0700 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nEqtsWX7O/iDdUWz3GS+VrzYtCu0Y6zEMDSbirGhJqzz5+y6p1oVEzAKEdkIpZkk7xfE3+I+IcVRzxKRxk3zimtQ/mreYRMWXQseqxjSo/t5NEUPEygJVrRQ2ncPlPoB02wpcFss6yl1vlHr4JZGVDKAHuUlRhk7pYqDeMA0JYScr6zzY6qRfx/edCmini2r58MMwwQnS/BnpU9cALwwZ1zpuG4vkN7qZOS3DPGL44PZOXQc6l4yiAeRrFXO3601iWpWl9mMf3MQg3JdwnF38iFRqsxcS0VKxNYx6BmZpvpy/lLVQacfi1T8VHbJa1TxKAgBgANoiyqbrAQu6xcOrw== 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=Z8R4zrU2iKAgUX/Z1JYYVcnh2DCqmp+weF6fERKLv1s=; b=NfkuwbpCJLu5ty0m27ZMGwJJKUN/39eQi9oUqxPWjzUkx8ZKLsV63/KBjroHv9dck7P/NiduPyPHCEYB6odqJx2bMrt0ZQl4u+hAXSYxX6kLKV8mOZ/45D9tHCbiMfnPA8VjLlT9/wnq1wKrvd4YRfAyVL4l+dBqdoygzCqF8udTAda6UubOKKSX9phFC6iHsyaRKeBAXakOnIFq2LWs++duke07rmF0BuVOBG05UXYi2aiR1q3Yx3YIamLijrwxhSxTO7OvfjQ0iNh2y6hwT6r5HH8OKI3YaMH4pZrc7otUCjgdpd9Rq/XXn8pmIUDwmcUWJnereGQN4jb2Bq9D2Q== 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 MW4PR11MB5872.namprd11.prod.outlook.com (2603:10b6:303:169::14) by BN6PR11MB3970.namprd11.prod.outlook.com (2603:10b6:405:7a::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5332.13; Thu, 9 Jun 2022 08:53:26 +0000 Received: from MW4PR11MB5872.namprd11.prod.outlook.com ([fe80::24ae:1cd3:3192:4c7e]) by MW4PR11MB5872.namprd11.prod.outlook.com ([fe80::24ae:1cd3:3192:4c7e%5]) with mapi id 15.20.5314.019; Thu, 9 Jun 2022 08:53:26 +0000 From: "Yao, Jiewen" To: "Ni, Ray" , "devel@edk2.groups.io" CC: "Kinney, Michael D" , Tom Lendacky Subject: Re: Why need to put AP in HLT/MWAIT in ExitBootServices callback Thread-Topic: Why need to put AP in HLT/MWAIT in ExitBootServices callback Thread-Index: Adh73Ci5/a/VIhtjS/qQMjtq/jHcGAAAa0mw Date: Thu, 9 Jun 2022 08:53:26 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: dlp-version: 11.6.500.17 dlp-product: dlpe-windows dlp-reaction: no-action authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=intel.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 007eb018-ed82-422e-1581-08da49f58498 x-ms-traffictypediagnostic: BN6PR11MB3970:EE_ x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: gVLIZAFV2rktORa3z8L6XSID2CIRkZNjNKOU/zEgZ3uF1XUheWjafvAndZm8iRHN2A5uouhPg8JD5DE/g7p3atfG4UUaqJgMLwHzlMRZtBMTzZhY9TY3GTemf+bBIwqX1LYSWNCVJ44US+YQAd1VDPr6TrQqenuop2nH/6LMfX4986GDA92+K5luKGYxD7BC3ahc2vJ6OQta3WZg9hLHbJ9BjCWT/7IEdGZdWQzpHoVxz4aScM5zzwtsI2iobn1DOPUrzTcTHCd5RFpKWea7Su3D8hFyuBTGCIqVu4XYZ6gUCRv26MY2izpR2mtXcLQW9yNq1821fhasbPNOhPRLIIRjjkWO4gTbP9PqgT+JEnuX366aPW11Bd/YoMUsFTNDhLlrQluHaTzSCv6IevE4tsOm58XZMNuRDYYlAru+enuF2FoOlZ0pLVM8PNU/cg0rGD1Axo6WruwSGp1cuYKeVymP7nBY57UxeEPkwT85KKmoAMgnONziHTQpVa8BW6LFFyPQnwB4OFM7P5UNnmApAyoVo566Mu2oFMwR6jtGpYNNr6uqaTEhPRm2YgUyiVXs47Ik/+Sj5rbMYE/UUcGKeeT/bnjN+iCUBkbJX0UeeIHM8ldWSwD7LD/XC6wyyw19CbwvZmk61Gw825j3fkx+5LdeUh00yGonRKm92l56fYTpIQnbFQ8kO67bZxUGMUw5JgzxI8bGYHpssjt04gvgMwbkTUngfxGU7OAvTCGN0ii/ENLY35nymd2cJttHbA/4HHYbYZdomZDHkP4mzvcY1v2Kr2S65z3/Oo3zURRaMWU= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MW4PR11MB5872.namprd11.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230001)(366004)(2906002)(966005)(508600001)(86362001)(82960400001)(52536014)(316002)(122000001)(64756008)(76116006)(66946007)(66556008)(66476007)(66446008)(4326008)(8676002)(38100700002)(55016003)(71200400001)(83380400001)(8936002)(38070700005)(5660300002)(54906003)(110136005)(186003)(33656002)(9686003)(26005)(7696005)(53546011)(6506007);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?FeSLS5EJPA5AFIqldTN/gpNNS3/GCFenezVGqWg7krwMOdcbL5h9CPHPagTV?= =?us-ascii?Q?e9CW8WtScbCFMxF/3RrjjVHJr7sD7tITYxKhVrAFrkrF0lz1chXlbN7vghRd?= =?us-ascii?Q?6QAX9HzTppj4BL1TGUibl3zdD6wH3VkkGiZPl2qNO6FwVhbINznqNs11QwgW?= =?us-ascii?Q?iVs48Spgb2ttMUFUKx4vEMGdqbQaSHJYeBno4InJLji3psgQt11BM4NWQzOq?= =?us-ascii?Q?J6+bWe0iMDcDxC+cb+YuKjc17fM78ZS+8d11UDo7kgSLS8etLaJUPb+SV8wU?= =?us-ascii?Q?vld41vHgkCVQ2uQv1v520emdXqIX1pdatW0tjHguLODEVB3WFoXfbrss/nxI?= =?us-ascii?Q?IywckJaGstpsbL9Gm+0VZfaiaQy8Pg8LaK2FAwomnWfMWQjL7vyTdZl/Tepz?= =?us-ascii?Q?u5kYddZ/c6toaRs/e+o7fLaC9eLBh79B/SxI6Fnv3jOIGqhkdbpwujawC+N8?= =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cvN1kxHGq9ZxVoDovZGt8G3XrdTZIua8Q/TJbDh?= =?us-ascii?Q?asHjC8vl/GasMXu1+KePjxY1jb8++9wm4GHN7/t7rmLTaMDywsYEKDHJ7t/v?= =?us-ascii?Q?aQxHeK1qX2q0G0SOmQao/jne9JLZhW4nIx9Mx7Z6w/2ifcaTy9sN3W/U/6BD?= =?us-ascii?Q?FqjOXFxz2h8mrVzLQ8g+sT+wYMA90PnqQYdQ++fDCdQfXLsWWf4GwANpBtF7?= =?us-ascii?Q?pTeTlzl6XVOPqMYF8fCN4Q64DclaJejgQx359YqRRmqngENWsKgYgVBQPwRi?= =?us-ascii?Q?e9FNas5RUkfwIEXq1Es5QmqFWn6fG0d0gNsHc7GUcYHihIf93yUWFMo04z5X?= =?us-ascii?Q?7UI2h/nFe7yfyZC9GyUN8pFHpz9WOhce65tC6XVc0/yyZMfC8Z//X9dbiE1d?= =?us-ascii?Q?op1HPtSrmA=3D=3D?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MW4PR11MB5872.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 007eb018-ed82-422e-1581-08da49f58498 X-MS-Exchange-CrossTenant-originalarrivaltime: 09 Jun 2022 08:53:26.6252 (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: dUO85eltkkbStLdYWPnWfsrPxkYxlbI+1/Ls4oAxCN+uMTmLFNvMG4UUo+VOwxJKY84jnRKrfw124T/J5dZjkA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR11MB3970 Return-Path: jiewen.yao@intel.com X-OriginatorOrg: intel.com Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable I remember a wait-for-SIPI CPU cannot response to SMI. We do want to let AP response SMI to perform some action, because some SMM = code will rely on all APs in SMM. Thank you Yao Jiewen > -----Original Message----- > From: Ni, Ray > Sent: Thursday, June 9, 2022 4:46 PM > To: devel@edk2.groups.io > Cc: Ni, Ray ; Kinney, Michael D > ; Tom Lendacky ; > Yao, Jiewen > Subject: Why need to put AP in HLT/MWAIT in ExitBootServices callback >=20 > All, > When I am reviewing today's MpInitLib code, I don't understand why below > complex logic is there to put AP in HLT or MWAIT on a ExitBootServices ev= ent > callback. > https://github.com/tianocore/edk2/blob/ff36b2550f94dc5fac838cf298ae5a23c > fddf204/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c#L423 > https://github.com/tianocore/edk2/blob/ff36b2550f94dc5fac838cf298ae5a23c > fddf204/UefiCpuPkg/Library/MpInitLib/X64/MpFuncs.nasm#L424 >=20 > The above code is to put AP in a state that when it's woken up by interru= pts or > SMIs, it's executing code and using stack in reserved memory. > (not in BootServices memory which might be overwritten by OS.) >=20 > But according to the SDM content below, we can simply send a INIT IPI to = all APs > to let AP enter a wait-for-SIPI state. > Then a simple SendInitIpiAllExcludingSelf() from BSP can replace all the > complicated code above. >=20 > * The MP protocol will be executed only after a power-up or RESET. If the= MP > protocol has been completed and a > * BSP has been chosen, subsequent INITs (either to a specific processor o= r > system wide) do not cause the MP > * protocol to be repeated. Instead, each processor examines its BSP flag = (in the > APIC_BASE MSR) to determine > * whether it should execute the BIOS boot-strap code (if it is the BSP) o= r enter a > wait-for-SIPI state (if it is an > * AP). >=20 > Did I miss something here? >=20 > Thanks, > Ray