public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [edk2-devel] [PATCH v2] UefiCpuPkg/PiSmmCpuDxeSmm: Use NonSmm BSP as default SMM BSP.
@ 2023-11-20  3:10 Zhiguang Liu
  2023-11-22  9:02 ` Laszlo Ersek
  2023-11-28  8:36 ` Ni, Ray
  0 siblings, 2 replies; 3+ messages in thread
From: Zhiguang Liu @ 2023-11-20  3:10 UTC (permalink / raw)
  To: devel; +Cc: Zhiguang Liu, Ray Ni, Rahul Kumar, Gerd Hoffmann, Laszlo Ersek

Currently, if BSP election is not enabled, will use Core0 as SMM BSP.
However, Core0 does not always have the highest performance.
So, we can used NonSmm BSP as default BSP.
This will take effect in normal SMM init flow and S3 boot flow

Cc: Ray Ni <ray.ni@intel.com>
Cc: Rahul Kumar <rahul1.kumar@intel.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
---
 UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c b/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c
index 25d058c5b9..b279f5dfcc 100644
--- a/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c
+++ b/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c
@@ -1953,6 +1953,16 @@ InitializeMpSyncData (
       // Enable BSP election by setting BspIndex to -1
       //
       mSmmMpSyncData->BspIndex = (UINT32)-1;
+    } else {
+      //
+      // Use NonSMM BSP as SMM BSP
+      //
+      for (CpuIndex = 0; CpuIndex < gSmmCpuPrivate->SmmCoreEntryContext.NumberOfCpus; CpuIndex++) {
+        if (GetApicId () == gSmmCpuPrivate->ProcessorInfo[CpuIndex].ProcessorId) {
+          mSmmMpSyncData->BspIndex = (UINT32)CpuIndex;
+          break;
+        }
+      }
     }
 
     mSmmMpSyncData->EffectiveSyncMode = mCpuSmmSyncMode;
-- 
2.31.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111439): https://edk2.groups.io/g/devel/message/111439
Mute This Topic: https://groups.io/mt/102701170/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [edk2-devel] [PATCH v2] UefiCpuPkg/PiSmmCpuDxeSmm: Use NonSmm BSP as default SMM BSP.
  2023-11-20  3:10 [edk2-devel] [PATCH v2] UefiCpuPkg/PiSmmCpuDxeSmm: Use NonSmm BSP as default SMM BSP Zhiguang Liu
@ 2023-11-22  9:02 ` Laszlo Ersek
  2023-11-28  8:36 ` Ni, Ray
  1 sibling, 0 replies; 3+ messages in thread
From: Laszlo Ersek @ 2023-11-22  9:02 UTC (permalink / raw)
  To: devel, zhiguang.liu; +Cc: Ray Ni, Rahul Kumar, Gerd Hoffmann

On 11/20/23 04:10, Zhiguang Liu wrote:
> Currently, if BSP election is not enabled, will use Core0 as SMM BSP.
> However, Core0 does not always have the highest performance.
> So, we can used NonSmm BSP as default BSP.
> This will take effect in normal SMM init flow and S3 boot flow
> 
> Cc: Ray Ni <ray.ni@intel.com>
> Cc: Rahul Kumar <rahul1.kumar@intel.com>
> Cc: Gerd Hoffmann <kraxel@redhat.com>
> Cc: Laszlo Ersek <lersek@redhat.com>
> Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
> ---
>  UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c b/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c
> index 25d058c5b9..b279f5dfcc 100644
> --- a/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c
> +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c
> @@ -1953,6 +1953,16 @@ InitializeMpSyncData (
>        // Enable BSP election by setting BspIndex to -1
>        //
>        mSmmMpSyncData->BspIndex = (UINT32)-1;
> +    } else {
> +      //
> +      // Use NonSMM BSP as SMM BSP
> +      //
> +      for (CpuIndex = 0; CpuIndex < gSmmCpuPrivate->SmmCoreEntryContext.NumberOfCpus; CpuIndex++) {
> +        if (GetApicId () == gSmmCpuPrivate->ProcessorInfo[CpuIndex].ProcessorId) {
> +          mSmmMpSyncData->BspIndex = (UINT32)CpuIndex;
> +          break;
> +        }
> +      }
>      }
>  
>      mSmmMpSyncData->EffectiveSyncMode = mCpuSmmSyncMode;

Reviewed-by: Laszlo Ersek <lersek@redhat.com>



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111599): https://edk2.groups.io/g/devel/message/111599
Mute This Topic: https://groups.io/mt/102701170/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/leave/12367111/7686176/1913456212/xyzzy [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [edk2-devel] [PATCH v2] UefiCpuPkg/PiSmmCpuDxeSmm: Use NonSmm BSP as default SMM BSP.
  2023-11-20  3:10 [edk2-devel] [PATCH v2] UefiCpuPkg/PiSmmCpuDxeSmm: Use NonSmm BSP as default SMM BSP Zhiguang Liu
  2023-11-22  9:02 ` Laszlo Ersek
@ 2023-11-28  8:36 ` Ni, Ray
  1 sibling, 0 replies; 3+ messages in thread
From: Ni, Ray @ 2023-11-28  8:36 UTC (permalink / raw)
  To: Liu, Zhiguang, devel@edk2.groups.io
  Cc: Kumar, Rahul R, Gerd Hoffmann, Laszlo Ersek

Reviewed-by: Ray Ni <ray.ni@intel.com>

Thanks,
Ray
> -----Original Message-----
> From: Liu, Zhiguang <zhiguang.liu@intel.com>
> Sent: Monday, November 20, 2023 11:10 AM
> To: devel@edk2.groups.io
> Cc: Liu, Zhiguang <zhiguang.liu@intel.com>; Ni, Ray <ray.ni@intel.com>;
> Kumar, Rahul R <rahul.r.kumar@intel.com>; Gerd Hoffmann
> <kraxel@redhat.com>; Laszlo Ersek <lersek@redhat.com>
> Subject: [PATCH v2] UefiCpuPkg/PiSmmCpuDxeSmm: Use NonSmm BSP as
> default SMM BSP.
> 
> Currently, if BSP election is not enabled, will use Core0 as SMM BSP.
> However, Core0 does not always have the highest performance.
> So, we can used NonSmm BSP as default BSP.
> This will take effect in normal SMM init flow and S3 boot flow
> 
> Cc: Ray Ni <ray.ni@intel.com>
> Cc: Rahul Kumar <rahul1.kumar@intel.com>
> Cc: Gerd Hoffmann <kraxel@redhat.com>
> Cc: Laszlo Ersek <lersek@redhat.com>
> Signed-off-by: Zhiguang Liu <zhiguang.liu@intel.com>
> ---
>  UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c
> b/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c
> index 25d058c5b9..b279f5dfcc 100644
> --- a/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c
> +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c
> @@ -1953,6 +1953,16 @@ InitializeMpSyncData (
>        // Enable BSP election by setting BspIndex to -1
>        //
>        mSmmMpSyncData->BspIndex = (UINT32)-1;
> +    } else {
> +      //
> +      // Use NonSMM BSP as SMM BSP
> +      //
> +      for (CpuIndex = 0; CpuIndex <
> gSmmCpuPrivate->SmmCoreEntryContext.NumberOfCpus; CpuIndex++) {
> +        if (GetApicId () ==
> gSmmCpuPrivate->ProcessorInfo[CpuIndex].ProcessorId) {
> +          mSmmMpSyncData->BspIndex = (UINT32)CpuIndex;
> +          break;
> +        }
> +      }
>      }
> 
>      mSmmMpSyncData->EffectiveSyncMode = mCpuSmmSyncMode;
> --
> 2.31.1.windows.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111801): https://edk2.groups.io/g/devel/message/111801
Mute This Topic: https://groups.io/mt/102701170/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/leave/12367111/7686176/1913456212/xyzzy [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-11-28  8:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-11-20  3:10 [edk2-devel] [PATCH v2] UefiCpuPkg/PiSmmCpuDxeSmm: Use NonSmm BSP as default SMM BSP Zhiguang Liu
2023-11-22  9:02 ` Laszlo Ersek
2023-11-28  8:36 ` Ni, Ray

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox