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 E45CD740038 for ; Wed, 4 Dec 2024 04:16:41 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=HRs77OjJWIhm9rRh35UOteEVC03npq//H9wVh5ECf9Y=; 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=1733285801; v=1; x=1733545000; b=oiWVVzEnXnYUfzK1EQbmq95Eenn5CEHJwnOHwjHEbzMMpFYRvyvP8LkxHpAVJOVXihXcLmT5 I9bvEevTxT0f+krcJQwO6n5LtvG4VRo/JECy9u3MLaL0SmBbbGdIw+Zx9vwbFtMhrDprOodbWiD PCjsoldK9xN/AUaZwUmDLaDdszBkWtuALqog3FkswF6pPjchhVNSyBKKw+vjiJZT0D6daNDGOLi WYARkF8DgS3qxvmN7VjERdE6x07BNhpWPaItK4b1fXoFo1QPBe3nnxOdC1w1H8OfDHjg8lAKRFy Ks5bEzRxgM1lpzGG044Bn+9yKprg8spBve2i/eGpvBUHg== X-Received: by 127.0.0.2 with SMTP id oznZYY7687511xju1zP2gQso; Tue, 03 Dec 2024 20:16:40 -0800 X-Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.16]) by mx.groups.io with SMTP id smtpd.web10.9193.1732190632473388838 for ; Thu, 21 Nov 2024 04:03:52 -0800 X-CSE-ConnectionGUID: gDm7uLxfQQ2CQnT/wss8GA== X-CSE-MsgGUID: P+Qm6rvVQS6hwEk/GOUvJw== X-IronPort-AV: E=McAfee;i="6700,10204,11263"; a="32433445" X-IronPort-AV: E=Sophos;i="6.12,172,1728975600"; d="scan'208,217";a="32433445" X-Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by orvoesa108.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Nov 2024 04:03:52 -0800 X-CSE-ConnectionGUID: nWH0YL0OSnaSJyIu0E1kKw== X-CSE-MsgGUID: hLPXcjsUSqqQa4lvRrMonA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.12,172,1728975600"; d="scan'208,217";a="121184040" X-Received: from fmsmsx603.amr.corp.intel.com ([10.18.126.83]) by fmviesa001.fm.intel.com with ESMTP/TLS/AES256-GCM-SHA384; 21 Nov 2024 04:03:51 -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 04:03:50 -0800 X-Received: from fmsedg601.ED.cps.intel.com (10.1.192.135) 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 04:03:50 -0800 X-Received: from NAM04-MW2-obe.outbound.protection.outlook.com (104.47.73.173) 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.39; Thu, 21 Nov 2024 04:03:30 -0800 X-Received: from DS7PR11MB7782.namprd11.prod.outlook.com (2603:10b6:8:e0::8) by DS0PR11MB6398.namprd11.prod.outlook.com (2603:10b6:8:c9::6) 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 12:03:25 +0000 X-Received: from DS7PR11MB7782.namprd11.prod.outlook.com ([fe80::c609:9b7:ea49:b061]) by DS7PR11MB7782.namprd11.prod.outlook.com ([fe80::c609:9b7:ea49:b061%6]) with mapi id 15.20.8158.021; Thu, 21 Nov 2024 12:03:25 +0000 From: "Zhao, Jason via groups.io" 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: [edk2-devel] UefiCpuPkg: Proposal to enable/disable AP parallel Thread-Topic: UefiCpuPkg: Proposal to enable/disable AP parallel Thread-Index: Ads7ENWFYT6OL6QbQl+cr51i2qWfsQA6MVzQAAS86RA= Date: Thu, 21 Nov 2024 12:03:25 +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: DS7PR11MB7782:EE_|DS0PR11MB6398:EE_ x-ms-office365-filtering-correlation-id: 670146df-510e-484c-9d9b-08dd0a248104 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam-message-info: =?us-ascii?Q?mnLam/7qyZoruV9Flmz3X61uXgvy+uuoblOU0WWtQ1cAP2LG6Bzgt0yIBcF3?= =?us-ascii?Q?CPjZVyW9hEGS7q+R3prxLfQIn5yDivl1IPSRxs1cp4lo3S/rCjqBwQ3+WOcr?= =?us-ascii?Q?oMbimwAGKOeZ/a3fp3WdQiFcX8LYeOCcRwkbFX8pbzCh1H4NHWztruGx1xNP?= =?us-ascii?Q?/Sn6CQ5It9KS1S+DYwsUP07xC9Q0DTxKNJVVXoXSCK4rscXd54Ixdj9QJHek?= =?us-ascii?Q?mlxprICU+lHKzWIxqQ/8Q7Cd5TuDehJNy/rGV/Uup2bHX1R+6zhIpWEhmUns?= =?us-ascii?Q?jc9F3lhk5nyvPS9N0HE4/P9QMiBVhJWEkXFCKjjqWNymK7u99906U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IJbvtYDLJXvkL9plpDFnsGNgf5cPbyiVw44PVSIJ2476/T?= =?us-ascii?Q?qw8mxpD2sKXymRjFk+H72VJgC5JrS5iS6T13fh4AM0Y/4zt9KraduR4SF18L?= =?us-ascii?Q?WDP2ladzb+NlhjKiAum7t/HFLuFe6Npw+MbkbvNRVmfRFhYduks0HQmqmHn/?= =?us-ascii?Q?KRGpBKGA8Qd/rlRs/W6BjBr0tiHsyzBLZn7XspmNvWNIjANOXs3w6dwhNVOe?= =?us-ascii?Q?qIHvoDwofhs=3D?= x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?+KuqGl/yDpvwakzPXaASrsNZbBZccS8bQSpcnNQkpMmmRQS+ZZISQ4ZHWyk1?= =?us-ascii?Q?NSRX5A5X4QAdOOx6492RLMy2Ruw0uJLIAYk1OPdQMGW6Bf9zLIQg6n3OE6HK?= =?us-ascii?Q?y0+vX6eW8aU8xdRPj3PxEfRfPJIjHAsqgPj5qxqH+4je3v/G1V3sUuulE/Rr?= =?us-ascii?Q?0vnG4otKcsv1UYxF6aGtmyRjU/FzaYs8bcEFzJe+EO3OYXyVyQ5jL1eqGQjD?= =?us-ascii?Q?sYgjOPPHPmQhEjngmQSPZYC0OnG2T9mewjFF73i/S4u2sfg573y14nRnHXEN?= =?us-ascii?Q?svmIEVdNbrlvAK/rqxsHxYSO0L11ofJjjuQliERKdda3GJ6njo0peFm73AHT?= =?us-ascii?Q?YJggf+RWNAnYnFQIItZkhRt/6og7AzuZkyCFUbUjMB59XK7avrPubkIRXpB9?= =?us-ascii?Q?EtDGPyrgmCPg/Yji8iBMHFz159yArlOh7vkrRI0u+pt5BuQcHVdhuUUVLiUS?= =?us-ascii?Q?d/GmEwdRpRBz4R7PlyjOZkfRd3xDXPAj9cq59kLjl71hmoawRtHN6CBLu+2b?= =?us-ascii?Q?L72bNVnK3atKSWXRiSK1sAK8ixlgdAbaIdj/D+YCHnJKm+LwtxaAA3Qztcf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ipiLWDo/V87T6fqKMW4BSeZgkDGPv/rKX?= =?us-ascii?Q?hVPsQcW6F6arn30S2szLHFVV9y102mipF155JSYy3piToWiJdw3okJ07OzGj?= =?us-ascii?Q?Nc5AJ37aLiT4p65yB9LWlBPYQEtG9hendVVrnU8e?= MIME-Version: 1.0 X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: DS7PR11MB7782.namprd11.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 670146df-510e-484c-9d9b-08dd0a248104 X-MS-Exchange-CrossTenant-originalarrivaltime: 21 Nov 2024 12:03:25.5894 (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: cSxIW8+bggDhZNKZzrvoF3McO1nZHEnriqaw1mm80rrclmG8ZgA8W4VMQ0IDmYdNSi/4WKad+GzK8DJF/KqHpg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DS0PR11MB6398 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: Tue, 03 Dec 2024 20:16:39 -0800 Resent-From: jason.zhao@intel.com Reply-To: devel@edk2.groups.io,jason.zhao@intel.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: iYPcXgEcUCpTAtTIZt0mneDyx7686176AA= Content-Language: en-US Content-Type: multipart/alternative; boundary="_000_DS7PR11MB7782109E32F895A037BC7EB584222DS7PR11MB7782namp_" X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20240830 header.b=oiWVVzEn; 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_DS7PR11MB7782109E32F895A037BC7EB584222DS7PR11MB7782namp_ Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable 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 <= ray.ni@intel.com>; Tan, Dun ; Kumar, Rahul R ; Gerd Hoffmann ; Kinney, 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 (#120864): https://edk2.groups.io/g/devel/message/120864 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_DS7PR11MB7782109E32F895A037BC7EB584222DS7PR11MB7782namp_ Content-Type: text/html; charset="us-ascii" Content-Transfer-Encoding: quoted-printable

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@intel.com>
Sent: Thursday, November 21, 2024 5:54 PM
To: Liu, Zhiguang <zhiguang.liu@intel.com>; devel@edk2.groups.= io; Ni, Ray <ray.ni@intel.com>; Tan, Dun <dun.tan@intel.com>; K= umar, Rahul R <rahul.r.kumar@intel.com>; Gerd Hoffmann <kraxel@red= hat.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, Jaso= n <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 (#120864) | =20 | Mute= This Topic | New Topic
Your Subscriptio= n | Contact Group Owner | Unsubscribe [rebecca@openfw.io]

_._,_._,_
--_000_DS7PR11MB7782109E32F895A037BC7EB584222DS7PR11MB7782namp_--