From: "Wu, Jiaxin" <jiaxin.wu@intel.com>
To: "Kinney, Michael D" <michael.d.kinney@intel.com>,
"devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: "Ni, Ray" <ray.ni@intel.com>, Laszlo Ersek <lersek@redhat.com>,
"Dong, Eric" <eric.dong@intel.com>,
"Zeng, Star" <star.zeng@intel.com>,
"Gerd Hoffmann" <kraxel@redhat.com>,
"Kumar, Rahul R" <rahul.r.kumar@intel.com>
Subject: Re: [edk2-devel] [PATCH v1 2/2] UefiCpuPkg/PiSmmCpuDxeSmm: Check BspIndex first before lock cmpxchg
Date: Fri, 2 Feb 2024 06:33:24 +0000 [thread overview]
Message-ID: <MN0PR11MB615829BA4193F72DD137B036FE422@MN0PR11MB6158.namprd11.prod.outlook.com> (raw)
In-Reply-To: <CO1PR11MB49298883BD6B146C3FC6A4E1D2432@CO1PR11MB4929.namprd11.prod.outlook.com>
Yes, thanks Mike, I will update the patch.
> -----Original Message-----
> From: Kinney, Michael D <michael.d.kinney@intel.com>
> Sent: Friday, February 2, 2024 2:21 AM
> To: devel@edk2.groups.io; Wu, Jiaxin <jiaxin.wu@intel.com>
> Cc: Ni, Ray <ray.ni@intel.com>; Laszlo Ersek <lersek@redhat.com>; Dong, Eric
> <eric.dong@intel.com>; Zeng, Star <star.zeng@intel.com>; Gerd Hoffmann
> <kraxel@redhat.com>; Kumar, Rahul R <rahul.r.kumar@intel.com>; Kinney,
> Michael D <michael.d.kinney@intel.com>
> Subject: RE: [edk2-devel] [PATCH v1 2/2] UefiCpuPkg/PiSmmCpuDxeSmm:
> Check BspIndex first before lock cmpxchg
>
>
>
> > -----Original Message-----
> > From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Wu,
> > Jiaxin
> > Sent: Thursday, February 1, 2024 3:20 AM
> > To: devel@edk2.groups.io
> > Cc: Ni, Ray <ray.ni@intel.com>; Laszlo Ersek <lersek@redhat.com>; Dong,
> > Eric <eric.dong@intel.com>; Zeng, Star <star.zeng@intel.com>; Gerd
> > Hoffmann <kraxel@redhat.com>; Kumar, Rahul R
> <rahul.r.kumar@intel.com>
> > Subject: [edk2-devel] [PATCH v1 2/2] UefiCpuPkg/PiSmmCpuDxeSmm:
> Check
> > BspIndex first before lock cmpxchg
> >
> > This patch is to check BspIndex first before lock cmpxchg operation.
> > It's the optimization to lower the resource contention caused by the
> > atomic compare exchange operation, so as to improve the SMI
> > performance for BSP election.
> >
> > Cc: Ray Ni <ray.ni@intel.com>
> > Cc: Laszlo Ersek <lersek@redhat.com>
> > Cc: Eric Dong <eric.dong@intel.com>
> > Cc: Zeng Star <star.zeng@intel.com>
> > Cc: Gerd Hoffmann <kraxel@redhat.com>
> > Cc: Rahul Kumar <rahul1.kumar@intel.com>
> > Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com>
> > ---
> > UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c | 12 +++++++-----
> > 1 file changed, 7 insertions(+), 5 deletions(-)
> >
> > diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c
> > b/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c
> > index e988ce0542..479024d294 100644
> > --- a/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c
> > +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/MpService.c
> > @@ -1652,15 +1652,17 @@ SmiRendezvous (
> > }
> > } else {
> > //
> > // Platform hook fails to determine, use default BSP
> > election method
> > //
> > - InterlockedCompareExchange32 (
> > - (UINT32 *)&mSmmMpSyncData->BspIndex,
> > - (UINT32)-1,
> > - (UINT32)CpuIndex
> > - );
> > + if (mSmmMpSyncData->BspIndex == (UINT32)-1) {
>
> If the field is UINT32, prefer to use MAX_UINT32 instead of typecase from
> signed to unsigned value.
>
> > + InterlockedCompareExchange32 (
> > + (UINT32 *)&mSmmMpSyncData->BspIndex,
> > + (UINT32)-1,
>
> If the parameter is UINT32, prefer to use MAX_UINT32 instead of typecase
> from signed to unsigned value.
>
> > + (UINT32)CpuIndex
> > + );
> > + }
> > }
> > }
> > }
> >
> > //
> > --
> > 2.16.2.windows.1
> >
> >
> >
> >
> >
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#115023): https://edk2.groups.io/g/devel/message/115023
Mute This Topic: https://groups.io/mt/104094808/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-
next prev parent reply other threads:[~2024-02-02 6:33 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-01 11:19 [edk2-devel] [PATCH v1 0/2] SMM CPU Optimization for SMM Init & SMI Process Wu, Jiaxin
2024-02-01 11:20 ` [edk2-devel] [PATCH v1 1/2] UefiCpuPkg/PiSmmCpuDxeSmm: Execute CET and XD check only on BSP Wu, Jiaxin
2024-02-02 6:03 ` Ni, Ray
2024-02-02 6:35 ` Wu, Jiaxin
2024-02-02 14:05 ` Laszlo Ersek
2024-02-04 0:50 ` Wu, Jiaxin
2024-02-02 10:47 ` Laszlo Ersek
2024-02-01 11:20 ` [edk2-devel] [PATCH v1 2/2] UefiCpuPkg/PiSmmCpuDxeSmm: Check BspIndex first before lock cmpxchg Wu, Jiaxin
2024-02-01 18:20 ` Michael D Kinney
2024-02-02 6:33 ` Wu, Jiaxin [this message]
2024-02-02 10:37 ` Laszlo Ersek
2024-02-06 1:40 ` Ni, Ray
2024-02-06 12:46 ` Laszlo Ersek
2024-02-20 3:41 ` Wu, Jiaxin
2024-02-20 16:21 ` Laszlo Ersek
2024-02-19 7:12 ` Ni, Ray
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=MN0PR11MB615829BA4193F72DD137B036FE422@MN0PR11MB6158.namprd11.prod.outlook.com \
--to=devel@edk2.groups.io \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox