From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail05.groups.io (mail05.groups.io [45.79.224.7]) by spool.mail.gandi.net (Postfix) with ESMTPS id B1FA3941A0E for ; Thu, 21 Nov 2024 18:44:03 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=vYMPipJ51Pvn0YLE/xgjvhtRjDGZysFNByd+D/gC2zQ=; c=relaxed/simple; d=groups.io; h=From:To:CC:Subject:Thread-Topic:Thread-Index:Date:Message-ID:References:In-Reply-To:Accept-Language:MIME-Version:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Resent-Date:Resent-From:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Language:Content-Type; s=20240830; t=1732214643; v=1; x=1732473842; b=wfen3sayL7+3V22dR7Xpy+ljmTqn+xxSJ3xCKDQvS+mw97TbjyO9R/ESJhATAjfqF1jrurAM clNjykRoMBf+9oIWp/pqVHpXXSt2k9oEU2pP38iHzNhF/MAvDK/4XmdplVA3mV19g2tnn6qrzkh FLqLKZRlIl+PQGo/AjWxTfk03JAEpQ4zchtNtP1TGcu/S/c51HVGOJo7tdu4+Z1KQo7KXpZF19P nPUQsDKEYDFVa8RSqRrAKwvZgIA/OdGZDJ9/pg0bNiRmphJN3UzmLaddSr2YLfx7Kn1UQc2frCS wMgFEqcJ4t0aPMJ45jINWKHuju8j6ID/B4nVX9rIex2IQ== X-Received: by 127.0.0.2 with SMTP id yQbNYY7687511xMuBwn2RlHP; Thu, 21 Nov 2024 10:44:02 -0800 X-Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.9]) by mx.groups.io with SMTP id smtpd.web10.6059.1732214641514314405 for ; Thu, 21 Nov 2024 10:44:01 -0800 X-CSE-ConnectionGUID: 4lWw1twZTWeCT5cboEpFSQ== X-CSE-MsgGUID: c37Tc1//RWOeedW6ANOKUQ== X-IronPort-AV: E=McAfee;i="6700,10204,11263"; a="54856545" X-IronPort-AV: E=Sophos;i="6.12,173,1728975600"; d="scan'208,217";a="54856545" X-Received: from fmviesa010.fm.intel.com ([10.60.135.150]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Nov 2024 10:44:01 -0800 X-CSE-ConnectionGUID: zQDoCHInSS+oL6w58CIh6w== X-CSE-MsgGUID: /zADH1B0RkqzxC9qzD79Ug== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,173,1728975600"; d="scan'208,217";a="90720652" X-Received: from fmsmsx603.amr.corp.intel.com ([10.18.126.83]) by fmviesa010.fm.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 21 Nov 2024 10:44:01 -0800 X-Received: from fmsmsx603.amr.corp.intel.com (10.18.126.83) by fmsmsx603.amr.corp.intel.com (10.18.126.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Thu, 21 Nov 2024 10:44:00 -0800 X-Received: from fmsedg602.ED.cps.intel.com (10.1.192.136) by fmsmsx603.amr.corp.intel.com (10.18.126.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39 via Frontend Transport; Thu, 21 Nov 2024 10:44:00 -0800 X-Received: from NAM10-DM6-obe.outbound.protection.outlook.com (104.47.58.46) 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.39; Thu, 21 Nov 2024 10:44:00 -0800 X-Received: from CO1PR11MB4929.namprd11.prod.outlook.com (2603:10b6:303:6d::19) by CY5PR11MB6161.namprd11.prod.outlook.com (2603:10b6:930:2a::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8158.23; Thu, 21 Nov 2024 18:43:56 +0000 X-Received: from CO1PR11MB4929.namprd11.prod.outlook.com ([fe80::a886:6510:729d:f9d0]) by CO1PR11MB4929.namprd11.prod.outlook.com ([fe80::a886:6510:729d:f9d0%5]) with mapi id 15.20.8182.014; Thu, 21 Nov 2024 18:43:56 +0000 From: "Michael D Kinney via groups.io" To: "Zhao, Jason" , "Wu, Jiaxin" , "Liu, Zhiguang" , "devel@edk2.groups.io" , "Ni, Ray" , "Tan, Dun" , "Kumar, Rahul R" , "Gerd Hoffmann" , "Gao, Liming" CC: "Kumar, Chandana C" , "Kuo, Donald" , "Kinney, Michael D" Subject: Re: [edk2-devel] UefiCpuPkg: Proposal to enable/disable AP parallel Thread-Topic: UefiCpuPkg: Proposal to enable/disable AP parallel Thread-Index: Ads7ENWFYT6OL6QbQl+cr51i2qWfsQA6MVzQAAS86RAADhWKAA== Date: Thu, 21 Nov 2024 18:43:56 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-ms-publictraffictype: Email x-ms-traffictypediagnostic: CO1PR11MB4929:EE_|CY5PR11MB6161:EE_ x-ms-office365-filtering-correlation-id: dec58ff3-edd1-44f0-008a-08dd0a5c7478 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam-message-info: =?us-ascii?Q?0i5OjVQ4t/kIkaOU7vS68pbFIvlYDQL8iIWDAug2iR9MR/yZ+xa/VVD1+LxH?= =?us-ascii?Q?kdwN8qR6ciTMjUBwcT4VrIt/BsJwsQGBQfysX+imshKUyUUchkBZJZbuIHKl?= =?us-ascii?Q?7IbzWeJ8Q6R21gEQ9nUwLQk3kHNspMDvvoC0jWrL3jiPzBrUf/6jvPyjvhWv?= =?us-ascii?Q?jBWfdBr0yQ87iX8CEx81LAjlcYz5kRUjmyYEtKcc06+euorS8X5sbApKuMXY?= =?us-ascii?Q?x45e/n3GbTjZklCl2wnwuvMefytsRbAgQb4GHQOG4SYyKMXjtPaqFrA3fZqe?= =?us-ascii?Q?DxXR+RNvznywmtscY1JPWWDuMEPFkVG6Qn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NxOgugPuafSv8e6GQlXTBBz6x+4tOUeOAx/Hintkf4FEAvcHWbgVqv7y21B1?= =?us-ascii?Q?Pgpsaj4KJR4j0ZlbCvl7B4dxrkpYEI+I/ClMPKYJp0a3WQQvB3G1bWkvZeVn?= =?us-ascii?Q?dwZ4MZMFzkr9gUtBFgafXGIToOJDa+CN/pRsnj+IpYAg80xEkFeIKKCVldJP?= =?us-ascii?Q?wVnoJAYUprHD45QpYj03r0R5BmdzC8KUKEAAe9B7MdQFUmenFPMFQnGcxwZw?= =?us-ascii?Q?rdgRDebrvMM=3D?= x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?ILqLb5et+IAr0cEBhz+yzu8Iv0LBDTjQZ0U42fx9BvOjY8gKup3/KHLpwvqj?= =?us-ascii?Q?Vil0UoFGtA9Z4gOOJWclrjrQbL4Dvmd6lWgw79nlLx9Y+tL0BM5fd5y4MEK0?= =?us-ascii?Q?Dv20Y90AQp4KsGqz6PHGG6u9Y8rn03X8ViGaKnAuKte4nN9Xx9/8ww0jwGwa?= =?us-ascii?Q?VCHB1wpibNz5BdmBdSn9Oqx19G4vgCs4xKMLn8S6PLhFKDtke9MZ+K1kGaFx?= =?us-ascii?Q?j6bh+m/v0yyHebVT2CInLwf00ug3mjj1GXOXUN6SisH3l/bs7/w2XkdaFD5/?= =?us-ascii?Q?Qt/MBj9Ms1VbOW3d3zZxxyE8NjHZYUyAS3Ghfe6biKbOxZSroxe0fBKBgAx6?= =?us-ascii?Q?ZTrKu3apqTNw4lPMeEMdwkl7oEGP1QU73YNNzt2NwT4Uy4s8cvCYZrL+qxkK?= =?us-ascii?Q?nRkqG4jDWFYdvPwbJDCSqgq0BldxYs5bo4i07TVL6bPIad7aBMiD2DDwY9/w?= =?us-ascii?Q?9T7FykeM9v39DNdd7zbQ66ECri6CLxIMPtXbAC+dPZFiw/bKIshGXufy90sz?= =?us-ascii?Q?duI9qJ2t3g8ZVdKFZRJhas5w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mlaK9zFMzFx?= =?us-ascii?Q?mhiuXGNrYu/QhK7bdM0ZRLvUSfSLx3ag/N6Y7jrNH9KRiotgtuWyVsaUtYC5?= =?us-ascii?Q?HaJ2Rzn2TndK3qbkq7FkRqfroguzgLIL9L3TdKEg9uZatNkOrm5trwZe+Dgu?= =?us-ascii?Q?pIHWDjdH3VMQ+TCPIy30KmDLjYXBRjtghk+UMr5Z+YtqcJBSAaRDF6dHZM0q?= =?us-ascii?Q?CA=3D=3D?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: CO1PR11MB4929.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: dec58ff3-edd1-44f0-008a-08dd0a5c7478 X-MS-Exchange-CrossTenant-originalarrivaltime: 21 Nov 2024 18:43:56.3361 (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: vp0nUT5iYisE8Yfd9qcX91DP6Bjp9mKzFhgJrile4Eq/uUqcDUB6Gzh9P7gxaTfvv0Nfmbt9Z/ZbhZPnYrC/NBBTiSJGNPI+RcSi2fVY+Bg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY5PR11MB6161 X-OriginatorOrg: intel.com Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Resent-Date: Thu, 21 Nov 2024 10:44:01 -0800 Resent-From: michael.d.kinney@intel.com Reply-To: devel@edk2.groups.io,michael.d.kinney@intel.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: MV6YIJkeWssqMOsdK36pPQ0Mx7686176AA= Content-Language: en-US Content-Type: multipart/alternative; boundary="_000_CO1PR11MB49290C6B9EEC364C1200D893D2222CO1PR11MB4929namp_" X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20240830 header.b=wfen3say; dmarc=pass (policy=none) header.from=groups.io; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 45.79.224.7 as permitted sender) smtp.mailfrom=bounce@groups.io --_000_CO1PR11MB49290C6B9EEC364C1200D893D2222CO1PR11MB4929namp_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable If an AP has been disabled on purpose due to a failure and is expected to n= ever be enabled, then a broadcast mechanism would not be a good idea. Instead, we should consider enhancing EFI_MP_SERVICES_ENABLEDISABLEAP to su= pport a non-blocking operation so it can be called in a loop for a group of= target APs. Or a new API that allows a bitmask of APs to enable. Mike From: Zhao, Jason Sent: Thursday, November 21, 2024 4:03 AM To: Wu, Jiaxin ; Liu, Zhiguang ; devel@edk2.groups.io; Ni, Ray ; Tan, Dun ; Kumar, Rahul R ; Gerd Hoffmann ; Kinney, Michael D ; Gao, Liming Cc: Kumar, Chandana C ; Kuo, Donald ; Zhao, Jason Subject: RE: UefiCpuPkg: Proposal to enable/disable AP parallel Hi Zhiguang, May be a fool question. If we follow the 1st solution, do we still have any API to enable/disable A= P one by one? How can we handle any scenario like only enable all Aps with specific core = type (only big cores or only Atoms) if this API is changed to enable all Ap= s. BRs/Jason From: Wu, Jiaxin > Sent: Thursday, November 21, 2024 5:54 PM To: Liu, Zhiguang >; = devel@edk2.groups.io; Ni, Ray >; Tan, Dun >; Kumar, Rahul R >; Gerd Hoffmann >; Kinne= y, Michael D = >; Gao, Liming > Cc: Kumar, Chandana C >; Zhao, Jason >= ; Kuo, Donald > Subject: RE: UefiCpuPkg: Proposal to enable/disable AP parallel Solution 1, it's not kind of spec violating. Instead, it's to add a new cap= ability to the existing interface, and it's a compatible change, no impact = to existing interface usage. I recall we have a guideline that prioritizes = code-first approaches if there are no compatibility issues. Mike and Ray ca= n comment on this. If no objection, I also prefer this way. Solution 2 cannot handle the PPI case, leading to inconsistent behavior bet= ween the protocol and PPI for the mpservice2. Solutions 3 and 4 are more like workarounds to address the specific issue. Thanks, Jiaxin From: Liu, Zhiguang > Sent: Wednesday, November 20, 2024 3:13 PM To: devel@edk2.groups.io; Ni, Ray >; Wu, Jiaxin >; Liu, Zhiguang >; Tan, Dun >; Kum= ar, Rahul R >; Gerd= Hoffmann >; Kinney, Michael D = >; Gao, Limin= g > Cc: Kumar, Chandana C >; Zhao, Jason >= ; Kuo, Donald > Subject: UefiCpuPkg: Proposal to enable/disable AP parallel Hi MdePkg and UefiCpuPkg maintainers and reviewers Recently, we met a performance issue when waking up disabled APs. There is usage where BIOS needs to disable all APs, do something and then e= nable all APs. Now, we are using the MpService PPI/Protocol EnableDisableAP(). This functi= on can only enable/disable one AP each time. To enable one AP, MP service needs to send INIT-SIPI-SIPI, which takes arou= nd 10ms. And now, we will have more than 10 APs in a client platform, and it will ta= ke more than 100ms. The function definition of EnableDisableAP is: typedef EFI_STATUS (EFIAPI *EFI_MP_SERVICES_ENABLEDISABLEAP)( IN EFI_MP_SERVICES_PROTOCOL *This, IN UINTN ProcessorNumber, IN BOOLEAN EnableAP, IN UINT32 *HealthFlag OPTIONAL ); The input parameter ProcessorNumber accepts a range from 0 to the total num= ber of logical processors minus 1. To support enable/disable AP parallel, I have below solutions: Solution1: Let input parameter ProcessorNumber accept a MAX_UINTN also. MAX_UINTN mean= s to enable/disable all APs. The draft PR is at https://github.com/tianocore/edk2/pull/6453 When the par= ameter is MAX_UINTN, EnableDisableAP() will enable/disable APs in a paralle= l way. However, we need to change below header files MdePkg\Include\Protocol\MpService.h MdePkg\Include\Ppi\MpServices.h UefiCpuPkg\Include\Ppi\MpServices2.h The above two follow PI spec. We need to modify the PI spec= first. Solution2: Similar with solution1, but to avoid violating spec, add a = new Protocol named MpServices2. Only change below header files. UefiCpuPkg\Include\Ppi\MpServices2.h UefiCpuPkg\Include\Protocol\MpServices2.h (new) The MdePkg part remains no change. Solution3: MpService create new PPI/Protocol to only contain one funct= ion EnableDisableAllAps(), which will enable/disable all APs in a parallel = way. Solution4: Add PPI/Protocol notify in MpLib. The notify call back func= tion will set WakeUpByInitSipiSipi to True. Similar code is removed in http= s://github.com/tianocore/edk2/pull/6303/commits/f1f8374381019169d421a65a896= ab42ed5338c1e When users need to disable and then enable cores, the flow = will be: 1. Send Init to all APs. (to disable all APs) 2. Do things that user need to do when all APs are disabled 3. Notify callback function 4. Use StartupAllAPs() from existing PPI/Protocol to wake up all APs. The flow is similar with how S3 SMM code take control APs and then give the= control back in old days. Personally, I prefer solution1. It is simpler, but it does violate spec. Please let me know your comments or any new idea, please share. Thanks Zhiguang -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#120813): https://edk2.groups.io/g/devel/message/120813 Mute This Topic: https://groups.io/mt/109680758/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- --_000_CO1PR11MB49290C6B9EEC364C1200D893D2222CO1PR11MB4929namp_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

If an AP has been d= isabled on purpose due to a failure and is expected to never be enabled, th= en a broadcast mechanism would not be a good idea.

 

Instead, we should = consider enhancing EFI_MP_SERVICES_ENABLEDISABLEAP to support a non-blocking operation = so it can be called in a loop for a group of target APs.  Or a new API= that allows a bitmask of APs to enable.

 

Mike

 

From: Zhao, Jason <jason.zhao@intel.com>
Sent: Thursday, November 21, 2024 4:03 AM
To: Wu, Jiaxin <jiaxin.wu@intel.com>; Liu, Zhiguang <zhigua= ng.liu@intel.com>; devel@edk2.groups.io; Ni, Ray <ray.ni@intel.com>= ;; Tan, Dun <dun.tan@intel.com>; Kumar, Rahul R <rahul.r.kumar@int= el.com>; Gerd Hoffmann <kraxel@redhat.com>; Kinney, Michael D <michael.d.kinney@intel.com>; Gao, Liming <gaoliming@byosoft.co= m.cn>
Cc: Kumar, Chandana C <chandana.c.kumar@intel.com>; Kuo, Donal= d <donald.kuo@intel.com>; Zhao, Jason <jason.zhao@intel.com> Subject: RE: UefiCpuPkg: Proposal to enable/disable AP parallel=

 

Hi Zhiguang,

 

May be a fool quest= ion.

If we follow the 1<= sup>st solution, do we still have any API to enable/disable AP one by= one?

How can we handle a= ny scenario like only enable all Aps with specific core type (only big core= s or only Atoms) if this API is changed to enable all Aps.

 

BRs/Jason

From: Wu, Jiaxin <jiaxin.wu@i= ntel.com>
Sent: Thursday, November 21, 2024 5:54 PM
To: Liu, Zhiguang <zhig= uang.liu@intel.com>; devel@edk2.groups.io; Ni, Ray &= lt;ray.ni@intel.com>; Tan, Dun &= lt;dun.tan@intel.com>; Kumar, R= ahul R <rahul.r.kumar@intel.c= om>; Gerd Hoffmann <kraxel@redhat.com>; Kinney, Michael D <michael.d.kinney@intel.com>; Gao, Liming <gaoliming@byosoft.com.cn>
Cc: Kumar, Chandana C <chandana.c.kumar@intel.com>; Zhao, Jason <jason.zhao@intel.com>; Kuo, Donald <donald.kuo@intel.com>
Subject: RE: UefiCpuPkg: Proposal to enable/disable AP parallel=

 

Solution 1, it’s not kind of spec violating. I= nstead, it’s to add a new capability to the existing interface, and i= t’s a compatible change, no impact to existing interface usage. I rec= all we have a guideline that prioritizes code-first approaches if there are no compatibility issues. Mike and Ray can comment = on this. If no objection, I also prefer this way.

 

Solution 2 cannot handle the PPI case, leading to in= consistent behavior between the protocol and PPI for the mpservice2.

 

Solutions 3 and 4 are more like workarounds to addre= ss the specific issue.

 

Thanks,<= /span>

Jiaxin <= /span>

 

From: Liu, Zhiguang <zhigu= ang.liu@intel.com>
Sent: Wednesday, November 20, 2024 3:13 PM
To: devel@edk2.groups.io= ; Ni, Ray <ray.ni@intel.com>;= Wu, Jiaxin <jiaxin.wu@intel.com<= /a>>; Liu, Zhiguang <zhigua= ng.liu@intel.com>; Tan, Dun <dun.tan@intel.com>= ;; Kumar, Rahul R <rahul.r.ku= mar@intel.com>; Gerd Hoffmann <kraxel@redhat.com>; Kinney, Michael D <michael.d.kinney@intel.com>; Gao, Liming <gaoliming@byos= oft.com.cn>
Cc: Kumar, Chandana C <chandana.c.kumar@intel.com>; Zhao, Jason <jason.zhao@intel.com>; Kuo, Donald <donald.kuo@intel.com>
Subject: UefiCpuPkg: Proposal to enable/disable AP parallel

 

Hi MdePkg and UefiCpuPkg maintainers and reviewers

 

Recently, we met a performance issue when waking up = disabled APs.

There is usage where BIOS needs to disable all APs, = do something and then enable all APs.

Now, we are using the MpService PPI/Protocol EnableD= isableAP(). This function can only enable/disable one AP each time.

To enable one AP, MP service needs to send INIT-SIPI= -SIPI, which takes around 10ms.

And now, we will have more than 10 APs in a client p= latform, and it will take more than 100ms.

The function definition of EnableDisableAP is:<= /o:p>

typedef

EFI_STATUS

(EFIAPI *EFI_MP_SERVICES= _ENABLEDISABLEAP)(

  IN  EFI_MP_S= ERVICES_PROTOCOL  *This,

  IN  UINTN &n= bsp;                   Process= orNumber,

  IN  BOOLEAN =                   EnableAP,

  IN  UINT32 &= nbsp;                  *Health= Flag OPTIONAL

  );

The input parameter ProcessorNumber accepts a range = from 0 to the total number of logical processors minus 1.

 

To support enable/disable AP parallel, I have below = solutions:

 

Solution1:

Let input parameter Proce= ssorNumber accept a MAX_UINTN also. MAX_UINTN means to enable/disable all A= Ps.

The draft PR is at https://github.com/tianocore/edk2/pull/6453 When the parameter is MAX_U= INTN, EnableDisableAP() will enable/disable APs in a parallel way.

        &nbs= p;       However, we need to change below hea= der files

        &nbs= p;            &= nbsp;          MdePkg\Include\= Protocol\MpService.h

        &nbs= p;            &= nbsp;          MdePkg\Include\= Ppi\MpServices.h

        &nbs= p;            &= nbsp;          UefiCpuPkg\Incl= ude\Ppi\MpServices2.h

        &nbs= p;       The above two follow PI spec. We nee= d to modify the PI spec first.

 

Solution2:

        &nbs= p;       Similar with solution1, but to avoid= violating spec, add a new Protocol named MpServices2. Only change below he= ader files.

        &nbs= p;            &= nbsp;          UefiCpuPkg\Incl= ude\Ppi\MpServices2.h

UefiCpuP= kg\Include\Protocol\MpServices2.h (new)

        &nbs= p;       The MdePkg part remains no change.

 

Solution3:

        &nbs= p;       MpService create new PPI/Protocol to= only contain one function EnableDisableAllAps(), which will enable/disable= all APs in a parallel way.

 

Solution4:

        &nbs= p;       Add PPI/Protocol notify in MpLib. Th= e notify call back function will set WakeUpByInitSipiSipi to True. Similar = code is removed in https://github.com/tianocore/edk2/pull/6303/commits/f1f8374381019169d421a65= a896ab42ed5338c1e

        &nbs= p;       When users need to disable and then = enable cores, the flow will be:

  1. Send Init to all APs. (to disable all APs)
  2. D= o things that user need to do when all APs are disabled
  3. Notify callback function
  4. Use StartupAllAPs() fro= m existing PPI/Protocol to wake up all APs.

The flow is similar with = how S3 SMM code take control APs and then give the control back in old days= .

 

Personally, I prefer solution1. It is simpler, but i= t does violate spec.

Please let me know your comments or any new idea, pl= ease share.

 

Thanks

Zhiguang       &n= bsp;  

 

_._,_._,_

Groups.io Links:

=20 You receive all messages sent to this group. =20 =20

View/Reply Online (#120813) | =20 | Mute= This Topic | New Topic
Your Subscriptio= n | Contact Group Owner | Unsubscribe [rebecca@openfw.io]

_._,_._,_
--_000_CO1PR11MB49290C6B9EEC364C1200D893D2222CO1PR11MB4929namp_--