From nobody Fri May 17 04:49:34 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) client-ip=66.175.222.108; envelope-from=bounce+27952+105852+1787277+3901457@groups.io; helo=mail02.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+105852+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1686127061; cv=none; d=zohomail.com; s=zohoarc; b=mg2oxADUfmuUQf25fxgruysHdI73wvtZYOhxOESKtZyR6LZSttoKvRz2LfS5xDxoQb6HPHwFw26KQ+imELJZDonPUz3vISOrQFpML5gzgUI59KZnnqyEVU5as2QCpkozZBHOLCwn9YsnCBE6C0gHI0VOpG+HVkelWQFBgmA5Qo8= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1686127061; h=Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:Sender:Subject:To; bh=urrgNnD1nZl4ALc1jP5vUn9BsEFm/GRNgA008LS8gMQ=; b=NRCIarXld+bwBqfCMTeV3ja3h7uTrl+AahfIIRUg1RsAXcSA6Ev3LjChj+bUWq4zNf2aQPfrV2MXbnkS7pX4ufILm/cTmNG3hqsaWGxhbAl8OGHysjMxgirC6RAFxgtGIjU6g5H0hNX4FA9i1a0djOi6dd/X03RhnGr8BvLNYbM= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce+27952+105852+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by mx.zohomail.com with SMTPS id 1686127061191448.0220251798539; Wed, 7 Jun 2023 01:37:41 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id 5YtxYY1788612xaK8cUtLs3p; Wed, 07 Jun 2023 01:37:40 -0700 X-Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mx.groups.io with SMTP id smtpd.web10.3665.1686127060062106001 for ; Wed, 07 Jun 2023 01:37:40 -0700 X-IronPort-AV: E=McAfee;i="6600,9927,10733"; a="356937682" X-IronPort-AV: E=Sophos;i="6.00,223,1681196400"; d="scan'208";a="356937682" X-Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 07 Jun 2023 01:37:39 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10733"; a="956130104" X-IronPort-AV: E=Sophos;i="6.00,223,1681196400"; d="scan'208";a="956130104" X-Received: from shwdeopenlab706.ccr.corp.intel.com ([10.239.55.95]) by fmsmga006.fm.intel.com with ESMTP; 07 Jun 2023 01:37:38 -0700 From: "Ni, Ray" To: devel@edk2.groups.io Cc: Eric Dong , Rahul Kumar , Gerd Hoffmann Subject: [edk2-devel] [PATCH] UefiCpuPkg/SmmCpu: Add PcdSmmApPerfLogEnable control AP perf-logging Date: Wed, 7 Jun 2023 16:37:31 +0800 Message-Id: <20230607083731.1650-1-ray.ni@intel.com> MIME-Version: 1.0 Precedence: Bulk List-Unsubscribe: List-Subscribe: List-Help: 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,ray.ni@intel.com X-Gm-Message-State: Kqag2VHcHNQF0XRlGjw9zWjKx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1686127060; bh=qyGx7yLmWPw0u8m8B1xQwk7taEcClamW1RTETwCTmok=; h=Cc:Date:From:Reply-To:Subject:To; b=RaB88zlwK25b6XPzozsFvnb30UHBEQjlvGBXodEf+t9oMxK36CWp+yu69t7q+mRF5yQ 38ZeOplVjitncyCLM3LA4ftDLxjvGSwmNCedS7pdmta6W+4JnX0oN0QZSJLKinuljM6hW 0U+seron8MM82XWV3+8UqxtomCZ4W70qimk= X-ZohoMail-DKIM: pass (identity @groups.io) X-ZM-MESSAGEID: 1686127063406100003 Content-Type: text/plain; charset="utf-8" When a platform has lots of CPU cores/threads, perf-logging on every AP produces lots of records. When this multiplies with number of SMIs during post, the records are even more. So, this patch adds a new PCD PcdSmmApPerfLogEnable (default TRUE) to allow platform to turn off perf-logging on APs. Cc: Eric Dong Cc: Rahul Kumar Cc: Gerd Hoffmann --- UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c | 2 +- UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf | 1 + UefiCpuPkg/PiSmmCpuDxeSmm/SmmMpPerf.c | 11 ++++++++++- UefiCpuPkg/PiSmmCpuDxeSmm/SmmMpPerf.h | 4 +++- UefiCpuPkg/UefiCpuPkg.dec | 6 ++++++ 5 files changed, 21 insertions(+), 3 deletions(-) diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c b/UefiCpuPkg/PiSmmCpuDxe= Smm/MpService.c index bcd90f0671..8364b73242 100644 --- a/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c @@ -784,7 +784,7 @@ BSPHandler ( // Any SMM MP performance logging after this point will be migrated in n= ext SMI. // PERF_CODE ( - MigrateMpPerf (gSmmCpuPrivate->SmmCoreEntryContext.NumberOfCpus); + MigrateMpPerf (gSmmCpuPrivate->SmmCoreEntryContext.NumberOfCpus, CpuIn= dex); ); =20 // diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf b/UefiCpuPkg/PiSm= mCpuDxeSmm/PiSmmCpuDxeSmm.inf index 4864532c35..d864ae9101 100644 --- a/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf @@ -128,6 +128,7 @@ gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmProfileRingBuffer ## CONS= UMES gUefiCpuPkgTokenSpaceGuid.PcdCpuSmmFeatureControlMsrLock ## CONS= UMES gEfiMdeModulePkgTokenSpaceGuid.PcdDxeIplSwitchToLongMode ## CONS= UMES + gUefiCpuPkgTokenSpaceGuid.PcdSmmApPerfLogEnable ## CONS= UMES =20 [Pcd] gUefiCpuPkgTokenSpaceGuid.PcdCpuMaxLogicalProcessorNumber ## SOME= TIMES_CONSUMES diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmMpPerf.c b/UefiCpuPkg/PiSmmCpuDxe= Smm/SmmMpPerf.c index c13556af46..92c67f31bf 100644 --- a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmMpPerf.c +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/SmmMpPerf.c @@ -39,16 +39,25 @@ InitializeMpPerf ( Migrate MP performance data to standardized performance database. =20 @param NumberofCpus Number of processors in the platform. + @param BspIndex The index of the BSP. **/ VOID MigrateMpPerf ( - UINTN NumberofCpus + UINTN NumberofCpus, + UINTN BspIndex ) { UINTN CpuIndex; UINTN MpProcecureId; =20 for (CpuIndex =3D 0; CpuIndex < NumberofCpus; CpuIndex++) { + if ((CpuIndex !=3D BspIndex) && !FeaturePcdGet (PcdSmmApPerfLogEnable)= ) { + // + // Skip migrating AP performance data if AP perf-logging is disabled. + // + continue; + } + for (MpProcecureId =3D 0; MpProcecureId < SMM_MP_PERF_PROCEDURE_ID (Sm= mMpProcedureMax); MpProcecureId++) { if (mSmmMpProcedurePerformance[CpuIndex].Begin[MpProcecureId] !=3D 0= ) { PERF_START (NULL, gSmmMpPerfProcedureName[MpProcecureId], NULL, mS= mmMpProcedurePerformance[CpuIndex].Begin[MpProcecureId]); diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmMpPerf.h b/UefiCpuPkg/PiSmmCpuDxe= Smm/SmmMpPerf.h index b148a99e86..5ad1734cc8 100644 --- a/UefiCpuPkg/PiSmmCpuDxeSmm/SmmMpPerf.h +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/SmmMpPerf.h @@ -44,10 +44,12 @@ InitializeMpPerf ( Migrate MP performance data to standardized performance database. =20 @param NumberofCpus Number of processors in the platform. + @param BspIndex The index of the BSP. **/ VOID MigrateMpPerf ( - UINTN NumberofCpus + UINTN NumberofCpus, + UINTN BspIndex ); =20 /** diff --git a/UefiCpuPkg/UefiCpuPkg.dec b/UefiCpuPkg/UefiCpuPkg.dec index d31c3b127c..5b0ac64e33 100644 --- a/UefiCpuPkg/UefiCpuPkg.dec +++ b/UefiCpuPkg/UefiCpuPkg.dec @@ -175,6 +175,12 @@ # @Prompt Support SmmFeatureControl. gUefiCpuPkgTokenSpaceGuid.PcdSmmFeatureControlEnable|TRUE|BOOLEAN|0x3213= 2110 =20 + ## Indicates if SMM perf logging in APs will be enabled.

+ # TRUE - SMM perf logging in APs will be enabled.
+ # FALSE - SMM perf logging in APs will not be enabled.
+ # @Prompt Enable SMM perf logging in APs. + gUefiCpuPkgTokenSpaceGuid.PcdSmmApPerfLogEnable|TRUE|BOOLEAN|0x32132114 + [PcdsFixedAtBuild] ## List of exception vectors which need switching stack. # This PCD will only take into effect if PcdCpuStackGuard is enabled. --=20 2.39.1.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 (#105852): https://edk2.groups.io/g/devel/message/105852 Mute This Topic: https://groups.io/mt/99380509/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/leave/3901457/1787277/102458076= /xyzzy [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-