From nobody Fri Apr 26 17:05:08 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+56130+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+56130+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1585031615; cv=none; d=zohomail.com; s=zohoarc; b=ivHAOI4fXljw7LqnlBQCyeEc4vptwPE8Dvo+WmzRe1Vv9Pl7a7PNHffrA7wAKjiCKoCdM6uHYs1UZXx03FX/7AFv6dsBIvtbtzPlTXqnIHppVx4WCSYs4pRTIojkRetCB3SOzhJ0ZkvE9fEOXfmTmLrxOiQMSLSalyZ2J0qD2/I= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1585031615; h=Cc:Date:From:List-Id:List-Unsubscribe:Message-ID:Reply-To:Sender:Subject:To; bh=Z4UcC6jdMBU1SlhkitRQdxGGM99RWdfE+KavcDjBiTQ=; b=KdwONx7/B8yi1q7mCaw1jKmRdlIqgxpEcYjJCKU8BHG0wTXkSPr2dkyJRmuerndCsBUTwWxSJNcXUWzIYg4ugkPieqiEV3HhMecD67pV8tFhO6oJLitRT8USgh2hU6ph0bdr98PxLnrDAufXhORgYLA3HHMmq0+fPu3379T13bA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+56130+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 158503161515818.2914569237729; Mon, 23 Mar 2020 23:33:35 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id oB3dYY1788612xQdshCfe2Z7; Mon, 23 Mar 2020 23:33:34 -0700 X-Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mx.groups.io with SMTP id smtpd.web12.908.1585031614432536188 for ; Mon, 23 Mar 2020 23:33:34 -0700 IronPort-SDR: YvUvI+RxlbfCZAstewnYaq5IlDfAcd0P9rPtYRkAZu5Knr2DhnrmAjiO61R4qT3isrUt8w8BMn ihyPF2KDKNjw== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Mar 2020 23:33:33 -0700 IronPort-SDR: 03b1Vm/+yR3aEiXo3lWdbPDHzJ09Ze9XKtlX5Sjhjf9y7rIxR4L6U2pnsSYtkOiDrxuFlZRVjf lu0AsyW9mclA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,299,1580803200"; d="scan'208";a="249889765" X-Received: from shwdeopenpsi014.ccr.corp.intel.com ([10.239.9.4]) by orsmga006.jf.intel.com with ESMTP; 23 Mar 2020 23:33:31 -0700 From: "Wu, Hao A" To: devel@edk2.groups.io Cc: Hao A Wu , Eric Dong , Ray Ni , Laszlo Ersek , Michael D Kinney , Star Zeng , "Brian J . Johnson" Subject: [edk2-devel] [PATCH v2] UefiCpuPkg/MpInitLib DXE: Add PCD to control AP status check interval Date: Tue, 24 Mar 2020 14:33:28 +0800 Message-Id: <20200324063328.8812-1-hao.a.wu@intel.com> Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,hao.a.wu@intel.com X-Gm-Message-State: yX2wDSwSHBbexWqC2tVtNAeqx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1585031614; bh=D6TuUjaa9KcnE0HHKZC7MPnoXA9lS0OnGt3SfJCUfDA=; h=Cc:Date:From:Reply-To:Subject:To; b=wxjfEDsJla4y6UeHpMjGV3FX0viLLxBP/NPTwkHAkknLKl6X9RIKN8X1FrsUAhdaCP4 m0sv7vYo01MFKEqxGFxmV2TtWa4j2P6Wt2/od1Q/fZFutPdIeEq6fb1L+dVaow/C6nKm8 w0J0I8JPzDw/jtagZz3aIX5+hRy+57jN6g4= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" REF:https://bugzilla.tianocore.org/show_bug.cgi?id=3D2627 The commit will introduce a static PCD to specify the periodic interval for checking the AP status when MP services StartupAllAPs() and StartupThisAP() are being executed in a non-blocking manner. Or in other words, specifies the interval for callback function CheckApsStatus(). The purpose is to provide the platform owners with the ability to choose the proper interval value to trigger CheckApsStatus() according to: A) The number of processors in the system; B) How MP services (StartupAllAPs & StartupThisAP) being used. Setting the PCD to a small value means the AP status check callback will be trigerred more frequently, it can benefit the performance for the case when the BSP uses WaitForEvent() or uses CheckEvent() in a loop to wait for AP(s) to complete the task, especially when the task can be finished considerably fast on AP(s). An example is within function CpuFeaturesInitialize() under UefiCpuPkg/Library/RegisterCpuFeaturesLib/DxeRegisterCpuFeaturesLib.c, where BSP will perform the same task with APs and requires all the processors to finish the task before BSP proceeds to its next task. Setting the PCD to a big value, on the other hand, can reduce the impact on BSP by the time being consumed in CheckApsStatus(), especially when the number of processors is huge so that the time consumed in CheckApsStatus() is not negligible. For least impact, the default value of the new PCD will be the same with the current interval value, which is 100 milliseconds. Unitest done: OS boot successfully. Cc: Eric Dong Cc: Ray Ni Cc: Laszlo Ersek Cc: Michael D Kinney Cc: Star Zeng Cc: Brian J. Johnson Signed-off-by: Hao A Wu --- UefiCpuPkg/UefiCpuPkg.dec | 6 ++++++ UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf | 2 +- UefiCpuPkg/Library/MpInitLib/DxeMpLib.c | 3 +-- UefiCpuPkg/UefiCpuPkg.uni | 5 ++++- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/UefiCpuPkg/UefiCpuPkg.dec b/UefiCpuPkg/UefiCpuPkg.dec index e91dc68cbe..06a3d52060 100644 --- a/UefiCpuPkg/UefiCpuPkg.dec +++ b/UefiCpuPkg/UefiCpuPkg.dec @@ -230,6 +230,12 @@ [PcdsFixedAtBuild, PcdsPatchableInModule] # @Prompt This PCD is the nominal frequency of the core crystal clock in= Hz as is CPUID Leaf 0x15:ECX gUefiCpuPkgTokenSpaceGuid.PcdCpuCoreCrystalClockFrequency|24000000|UINT6= 4|0x32132113 =20 + ## Specifies the periodic interval value in milliseconds for the status = check + # of APs for StartupAllAPs() and StartupThisAP() executed in non-blocki= ng + # mode in DXE phase. + # @Prompt Periodic interval value in milliseconds for AP status check in= DXE. + gUefiCpuPkgTokenSpaceGuid.PcdCpuApStatusCheckInterval|100|UINT64|0x00000= 01E + [PcdsFixedAtBuild, PcdsPatchableInModule, PcdsDynamic, PcdsDynamicEx] ## Specifies max supported number of Logical Processors. # @Prompt Configure max supported number of Logical Processors diff --git a/UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf b/UefiCpuPkg/Lib= rary/MpInitLib/DxeMpInitLib.inf index 45aaa179ff..05e004dc3c 100644 --- a/UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf +++ b/UefiCpuPkg/Library/MpInitLib/DxeMpInitLib.inf @@ -69,5 +69,5 @@ [Pcd] gUefiCpuPkgTokenSpaceGuid.PcdCpuMicrocodePatchRegionSize ## CONS= UMES gUefiCpuPkgTokenSpaceGuid.PcdCpuApLoopMode ## CONS= UMES gUefiCpuPkgTokenSpaceGuid.PcdCpuApTargetCstate ## SOME= TIMES_CONSUMES + gUefiCpuPkgTokenSpaceGuid.PcdCpuApStatusCheckInterval ## CONS= UMES gEfiMdeModulePkgTokenSpaceGuid.PcdCpuStackGuard ## CONS= UMES - diff --git a/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c b/UefiCpuPkg/Library/M= pInitLib/DxeMpLib.c index a987c32109..683547dc99 100644 --- a/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c +++ b/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c @@ -15,7 +15,6 @@ =20 #include =20 -#define AP_CHECK_INTERVAL (EFI_TIMER_PERIOD_MILLISECONDS (100)) #define AP_SAFE_STACK_SIZE 128 =20 CPU_MP_DATA *mCpuMpData =3D NULL; @@ -451,7 +450,7 @@ InitMpGlobalData ( Status =3D gBS->SetTimer ( mCheckAllApsEvent, TimerPeriodic, - AP_CHECK_INTERVAL + PcdGet64 (PcdCpuApStatusCheckInterval) ); ASSERT_EFI_ERROR (Status); =20 diff --git a/UefiCpuPkg/UefiCpuPkg.uni b/UefiCpuPkg/UefiCpuPkg.uni index c0d6ed5136..08d9b45f76 100644 --- a/UefiCpuPkg/UefiCpuPkg.uni +++ b/UefiCpuPkg/UefiCpuPkg.uni @@ -3,7 +3,7 @@ // // This Package provides UEFI compatible CPU modules and libraries. // -// Copyright (c) 2007 - 2015, Intel Corporation. All rights reserved.
+// Copyright (c) 2007 - 2020, Intel Corporation. All rights reserved.
// // SPDX-License-Identifier: BSD-2-Clause-Patent // @@ -275,3 +275,6 @@ #string STR_gUefiCpuPkgTokenSpaceGuid_PcdCpuSmmMpTokenCountPerChunk_PROMPT= #language en-US "Specify the count of pre allocated SMM MP tokens per chu= nk.\n" =20 #string STR_gUefiCpuPkgTokenSpaceGuid_PcdCpuSmmMpTokenCountPerChunk_HELP = #language en-US "This value used to specify the count of pre allocated SM= M MP tokens per chunk.\n" + +#string STR_gUefiCpuPkgTokenSpaceGuid_PcdCpuApStatusCheckInterval_PROMPT = #language en-US "Periodic interval value in milliseconds for AP status chec= k in DXE.\n" +#string STR_gUefiCpuPkgTokenSpaceGuid_PcdCpuApStatusCheckInterval_HELP = #language en-US "Periodic interval value in milliseconds for the status che= ck of APs for StartupAllAPs() and StartupThisAP() executed in non-blocking = mode in DXE phase.\n" --=20 2.12.0.windows.1 -=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 (#56130): https://edk2.groups.io/g/devel/message/56130 Mute This Topic: https://groups.io/mt/72512073/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-