From nobody Tue Nov 26 07:41:26 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+55846+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+55846+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1584105764; cv=none; d=zohomail.com; s=zohoarc; b=DWrhjljlNOHH2UwEPHVbr3RCmLYYNH/aZoHoaNcuJi5Cn5rF4ULy99XbY1aqKsufqBKLq835wdsupUbA++T7Ykfa/IvDao2ip1SKPUSOny5HIFAskdb1EVPobIhEZTo74/3UoLdJq0ZiVAw3i1KOEqFdyHhhTX+omeTCzBVlBYs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1584105764; h=Cc:Date:From:List-Id:List-Unsubscribe:Message-ID:Reply-To:Sender:Subject:To; bh=u7jcEcxDOrJ/JSTrwAjv2XyZGsjXyUboFbKD1l5B52A=; b=UbvHdCv7/1+vU+o5N/yXm+IfZ7QVqXt1wKA1qTJRg0XQKcLzIPLW/JQ51TdzcqMpJqAjtI4503E1X+k+pOPk0Jp6iYvyTASPsJe1VRX3hqOcg78ylT77zMH1GF6d4byLDGlxWGINJtGh2DcPuqiYVXSghVOC7YhPW262tgTvffM= 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+55846+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 1584105764185386.18997802447234; Fri, 13 Mar 2020 06:22:44 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id h51UYY1788612x1zWu3scc5L; Fri, 13 Mar 2020 06:22:43 -0700 X-Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) by mx.groups.io with SMTP id smtpd.web10.13643.1584105761478690481 for ; Fri, 13 Mar 2020 06:22:41 -0700 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-Received: from orsmga008.jf.intel.com ([10.7.209.65]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 13 Mar 2020 06:22:41 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,548,1574150400"; d="scan'208";a="237221678" X-Received: from shwdeopenpsi014.ccr.corp.intel.com ([10.239.9.8]) by orsmga008.jf.intel.com with ESMTP; 13 Mar 2020 06:22:38 -0700 From: "Wu, Hao A" To: devel@edk2.groups.io, rfc@edk2.groups.io Cc: Hao A Wu , Eric Dong , Ray Ni , Laszlo Ersek , Michael D Kinney , Star Zeng Subject: [edk2-devel] [RFC][PATCH v1] UefiCpuPkg/MpInitLib DXE: Reduce AP status check interval Date: Fri, 13 Mar 2020 21:22:29 +0800 Message-Id: <20200313132229.7628-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: slYpFDujTKuOllkLqrKMtm2hx1787277AA= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1584105763; bh=yBf/mFaE9BOFtZ90Wi3Byh3hvAiJsgraOKcIis+KPIQ=; h=Cc:Date:From:Reply-To:Subject:To; b=bewMQxcmVaVz2hT4+AYLSK5eohDL3xeum75G3yq2qWQzuqaIDErZVeFhUCkC5yZ0o5+ nm2xRLx5MJdaZ23dFyZS1GjLTkAhRGxISwyJQHpNL0cfWZwMJDTrYtRarK45geXFosSW7 QaobZcNSnplVRgzdRHIV14dyxmUI9CBS0tM= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This commit will reduce the interval of the AP status check event from 100 milliseconds to 10 milliseconds. (I searched the history of the 100ms interval, it seems no comment or log message was mentioned for the choice of this value. Looks like the value is selected by experience.) The purpose is to reduce the response time when the BSP calls below EFI_MP_SERVICES_PROTOCOL services in a non-blocking manner: * StartupAllAPs() * StartupThisAP() Reducing the check interval will 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. Impact: A. The impact is minimal when there is no non-blocking calls of the StartupAllAPs/StartupThisAp MP services, because the check function CheckAndUpdateApsStatus() will return directly when there is no registered wait event (i.e. no non-blocking request). B. There will be a performance tradeoff when BSP continues to proceed other tasks after submitting a non-blocking StartupAllAPs/StartupThisAP request. If the AP status check takes a good portion of the shortened interval, BSP will have less time slice working on its own task before all the APs complete their tasks. My investigation for Impact B is that it is a rare scenario in the edk2 code base. Unitests: A. OS boot successfully. B. System (with 24 threads) boot time reduced. Almost all the saved time comes from the above-mentioned case in CpuFeaturesInitialize(). Cc: Eric Dong Cc: Ray Ni Cc: Laszlo Ersek Cc: Michael D Kinney Cc: Star Zeng Signed-off-by: Hao A Wu --- UefiCpuPkg/Library/MpInitLib/DxeMpLib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c b/UefiCpuPkg/Library/M= pInitLib/DxeMpLib.c index a987c32109..9ba886e8ed 100644 --- a/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c +++ b/UefiCpuPkg/Library/MpInitLib/DxeMpLib.c @@ -15,7 +15,7 @@ =20 #include =20 -#define AP_CHECK_INTERVAL (EFI_TIMER_PERIOD_MILLISECONDS (100)) +#define AP_CHECK_INTERVAL (EFI_TIMER_PERIOD_MILLISECONDS (10)) #define AP_SAFE_STACK_SIZE 128 =20 CPU_MP_DATA *mCpuMpData =3D NULL; --=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 (#55846): https://edk2.groups.io/g/devel/message/55846 Mute This Topic: https://groups.io/mt/71925352/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-