From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id C11DB7803CD for ; Thu, 21 Dec 2023 02:21:42 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=ks76BQENTyR8Mia5uad5dyGDiv9Yjzmj1RriIfolc7w=; c=relaxed/simple; d=groups.io; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe; s=20140610; t=1703125301; v=1; b=NUVvzceLbX1i6lkXTZKn4mMO1v5bEv87BmemhulVKOX7Taw/QKxUBbTuMiY/tVVwt0bGp5BL HjrOtwFbZ2vf1d2wQM6j9QnrKyM/3uPfixcNPSfurM/nYZTe8VF6yeuUexwLG/aCN+M/+/ZGfns ps2jmswqTOmwY5tleTxn5f98= X-Received: by 127.0.0.2 with SMTP id tbAwYY7687511xzMwClvuR1m; Wed, 20 Dec 2023 18:21:41 -0800 X-Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.9]) by mx.groups.io with SMTP id smtpd.web11.43009.1703125296922723837 for ; Wed, 20 Dec 2023 18:21:36 -0800 X-IronPort-AV: E=McAfee;i="6600,9927,10930"; a="14591379" X-IronPort-AV: E=Sophos;i="6.04,292,1695711600"; d="scan'208";a="14591379" X-Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Dec 2023 18:21:35 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10930"; a="920172826" X-IronPort-AV: E=Sophos;i="6.04,292,1695711600"; d="scan'208";a="920172826" X-Received: from sh1gapp1009.ccr.corp.intel.com ([10.239.189.219]) by fmsmga001.fm.intel.com with ESMTP; 20 Dec 2023 18:21:34 -0800 From: "Wu, Jiaxin" To: devel@edk2.groups.io Cc: Laszlo Ersek , Eric Dong , Ray Ni , Zeng Star , Gerd Hoffmann , Rahul Kumar Subject: [edk2-devel] [PATCH v1 6/6] UefiCpuPkg/PiSmmCpuDxeSmm: Reduce one round BSP & AP sync Date: Thu, 21 Dec 2023 10:21:21 +0800 Message-Id: <20231221022121.12224-7-jiaxin.wu@intel.com> In-Reply-To: <20231221022121.12224-1-jiaxin.wu@intel.com> References: <20231221022121.12224-1-jiaxin.wu@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 Reply-To: devel@edk2.groups.io,jiaxin.wu@intel.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: ZrxwVDi2Tl4Eof1sfUbiGMnzx7686176AA= X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=NUVvzceL; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=intel.com (policy=none); spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io One round BSP & AP sync for exit SMI is shown as below: BSP: SmmCpuSyncWaitForAPs <-- AP: SmmCpuSyncReleaseBsp BSP: ReleaseAllAPs --> AP: SmmCpuSyncWaitForBsp Above is only required if need configure MTRR and support SMM source level debug, So, reduce one round BSP & AP sync if both are unsupported. Cc: Laszlo Ersek Cc: Eric Dong Cc: Ray Ni Cc: Zeng Star Cc: Gerd Hoffmann Cc: Rahul Kumar Signed-off-by: Jiaxin Wu --- UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c | 36 +++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c b/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c index 04622c66a2..d0139228bb 100644 --- a/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c @@ -643,19 +643,21 @@ BSPHandler ( // SmmCpuFeaturesReenableSmrr (); MtrrSetAllMtrrs (&Mtrrs); } - // - // Wait for all APs to complete their pending tasks including MTRR programming if needed. - // - SmmCpuSyncWaitForAPs (mSmmMpSyncData->SyncContext, ApCount, CpuIndex); + if (SmmCpuFeaturesNeedConfigureMtrrs () || *mSmmDebugAgentSupport) { + // + // Wait for all APs to complete their pending tasks including MTRR programming if needed. + // + SmmCpuSyncWaitForAPs (mSmmMpSyncData->SyncContext, ApCount, CpuIndex); - // - // Signal APs to Reset states/semaphore for this processor - // - ReleaseAllAPs (); + // + // Signal APs to Reset states/semaphore for this processor + // + ReleaseAllAPs (); + } if (*mSmmDebugAgentSupport) { // // Stop source level debug in BSP handler, the code below will not be // debugged. @@ -894,19 +896,21 @@ APHandler ( // SmmCpuFeaturesReenableSmrr (); MtrrSetAllMtrrs (&Mtrrs); } - // - // Notify BSP the readiness of this AP to Reset states/semaphore for this processor - // - SmmCpuSyncReleaseBsp (mSmmMpSyncData->SyncContext, CpuIndex, BspIndex); + if (SmmCpuFeaturesNeedConfigureMtrrs () || *mSmmDebugAgentSupport) { + // + // Notify BSP the readiness of this AP to Reset states/semaphore for this processor + // + SmmCpuSyncReleaseBsp (mSmmMpSyncData->SyncContext, CpuIndex, BspIndex); - // - // Wait for the signal from BSP to Reset states/semaphore for this processor - // - SmmCpuSyncWaitForBsp (mSmmMpSyncData->SyncContext, CpuIndex, BspIndex); + // + // Wait for the signal from BSP to Reset states/semaphore for this processor + // + SmmCpuSyncWaitForBsp (mSmmMpSyncData->SyncContext, CpuIndex, BspIndex); + } // // Reset states/semaphore for this processor // *(mSmmMpSyncData->CpuData[CpuIndex].Present) = FALSE; -- 2.16.2.windows.1 -=-=-=-=-=-=-=-=-=-=-=- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#112797): https://edk2.groups.io/g/devel/message/112797 Mute This Topic: https://groups.io/mt/103293803/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io] -=-=-=-=-=-=-=-=-=-=-=-