Hi All,
Could you help review the series patches in v2?
Thank you very much!
Jiaxin
> -Original Message-
> From: devel@edk2.groups.io On Behalf Of Wu,
> Jiaxin
> Sent: Thursday, November 30, 2023 2:32 PM
> To: devel@edk2.groups.io
> Cc: Laszlo Ersek ; Dong, Eric
> (1) Here's why I don't like this:
>
> we already have a function that is supposed to do this, and it is
> SmmWaitForApArrival().
>
> SmmWaitForApArrival() is called in two contexts. One, in BSPHandler().
> Two, here.
>
> Consider the following condition:
>
> (SyncMode == SmmCpuSyncModeTradi
> > +struct SMM_CPU_SYNC_CTX {
>
> 1. How about "SMM_CPU_SYNC_CONTEXT"?
Agree.
>
> > + ///
> > + /// All global semaphores' pointer in SMM CPU Sync
> > + ///
> > + SMM_CPU_SYNC_SEMAPHORE_GLOBAL*GlobalSem;
>
> 2. There is only one GlobalSem. Can you directly use "volatile UINT32
> *C
The series patches are to refine SMM CPU Sync flow.
After the refinement, SmmCpuSyncLib is abstracted for
any user to provide different SMM CPU Sync implementation.
Compared to V2, has following refinement & changes:
1. rename SMM_CPU_SYNC_CXT to SMM_CPU_SYNC_CONTEXT
2. rename SemBlock to SemBuffe
This patch is to define 3 new functions (WaitForBsp & ReleaseBsp &
ReleaseOneAp) used for the semaphore sync between BSP & AP. With the
change, BSP and AP Sync flow will be easy understand as below:
BSP: ReleaseAllAPs or ReleaseOneAp --> AP: WaitForBsp
BSP: WaitForAllAPs <-- AP: Rel
Intel is planning to provide different SMM CPU Sync implementation
along with some specific registers to improve the SMI performance,
hence need SmmCpuSyncLib Library for Intel.
This patch is to:
1.Adds SmmCpuSyncLib Library class in UefiCpuPkg.dec.
2.Adds SmmCpuSyncLib.h function declaration head
Implements SmmCpuSyncLib Library instance. The instance refers the
existing SMM CPU driver (PiSmmCpuDxeSmm) sync implementation
and behavior:
1.Abstract Counter and Run semaphores into SmmCpuSyncCtx.
2.Abstract CPU arrival count operation to
SmmCpuSyncGetArrivedCpuCount(), SmmCpuSyncCheckInCpu(),
S
This patch is to specify SmmCpuSyncLib instance for OvmfPkg.
Cc: Laszlo Ersek
Cc: Ard Biesheuvel
Cc: Jiewen Yao
Cc: Jordan Justen
Cc: Eric Dong
Cc: Ray Ni
Cc: Zeng Star
Cc: Rahul Kumar
Cc: Gerd Hoffmann
Signed-off-by: Jiaxin Wu
---
OvmfPkg/CloudHv/CloudHvX64.dsc | 2 ++
OvmfPkg/OvmfPkgI
This patch is to specify SmmCpuSyncLib instance for UefiPayloadPkg.
Cc: Laszlo Ersek
Cc: Guo Dong
Cc: Sean Rhodes
Cc: James Lu
Cc: Gua Guo
Cc: Ray Ni
Cc: Zeng Star
Signed-off-by: Jiaxin Wu
Reviewed-by: Gua Guo
---
UefiPayloadPkg/UefiPayloadPkg.dsc | 1 +
1 file changed, 1 insertion(+)
d
There is the SmmCpuSyncLib Library class define the SMM CPU sync
flow, which is aligned with existing SMM CPU driver sync behavior.
This patch is to consume SmmCpuSyncLib instance directly.
With this change, SMM CPU Sync flow/logic can be customized
with different implementation no matter for any
>
> Thanks. This documentation (in the commit message and the lib class
> header file) seems really good (especially with the formatting updates
> suggested by Ray).
>
> (1) I think there is one typo: exist <-> exits.
>
agree, I will fix this.
> > +RETURN_STATUS
> > +EFIAPI
> > +SmmCpuSyncCont
> > WaitForAllAPs() has two purpose:
> >1. Make sure all Aps have set the Present.
> >2. Get ready for programming MTRRs to make sure cpus in the same start
> line.
> >
> > if so, that will be better as existing logic, it can also save some time
> > for the
> Present flag check in SmmWai
Hi Laszlo,
Really appreciate your comments! I checked one by one and feedback as below,
thank you & Ray again & again for patch refinement
>
> (1) If / when you update the documentation in patch#2, please update
> this one as well.
>
Yes, I will do the alignment.
> (2) Please sort the #
> >
> > !if $(SOURCE_DEBUG_ENABLE) == TRUE
>
> All four DSC files already include "PiSmmCpuDxeSmm.inf" like this:
>
> UefiCpuPkg/PiSmmCpuDxeSmm/PiSmmCpuDxeSmm.inf {
>
> ...
> }
>
> Given that this new library class is again exclusively used by
> PiSmmCpuDxeSmm, can you please res
> > The code will be changed to:
> >
> > if ((INT32)InternalWaitForSemaphore (Context->CpuCount) < 0) {
> > return RETURN_ABORTED;
> > }
>
> I find this quite ugly. In the "semaphore post" operation, we already
> have code that prevents incrementing if the semaphore is "locked". Can
> we p
BTW, for SmmCpuSyncGetArrivedCpuCount ():
we can't check the CpuCount (Original is named as Counter Sem) is locked or
not, then decide return from the *Context->CpuCount or locked value for the
arrived CPU in SMI. Just like:
if (*Context->CpuCount == MAX_UINT32) {--> does not meet t
; -Original Message-
> From: Wu, Jiaxin
> Sent: Thursday, December 14, 2023 11:35 PM
> To: devel@edk2.groups.io; ler...@redhat.com
> Cc: Dong, Eric ; Ni, Ray ; Zeng, Star
> ; Gerd Hoffmann ; Kumar, Rahul R
>
> Subject: RE: [edk2-devel] [PATCH v3 3/6] UefiCpuPkg:
uCount no mater locked or not.
So, ignore below case.
Thanks,
Jiaxin
> -Original Message-
> From: Wu, Jiaxin
> Sent: Thursday, December 14, 2023 11:55 PM
> To: devel@edk2.groups.io; ler...@redhat.com
> Cc: Dong, Eric ; Ni, Ray ; Zeng, Star
> ; Gerd Hoffmann ; Kumar
The series patches are to refine SMM CPU Sync flow.
After the refinement, SmmCpuSyncLib is abstracted for
any user to provide different SMM CPU Sync implementation.
Jiaxin Wu (8):
UefiCpuPkg/PiSmmCpuDxeSmm: Optimize Semaphore Sync between BSP and AP
UefiCpuPkg: Adds SmmCpuSyncLib library clas
This patch is to define 3 new functions (WaitForBsp & ReleaseBsp &
ReleaseOneAp) used for the semaphore sync between BSP & AP. With the
change, BSP and AP Sync flow will be easy understand as below:
BSP: ReleaseAllAPs or ReleaseOneAp --> AP: WaitForBsp
BSP: WaitForAllAPs <-- AP: Rel
Intel is planning to provide different SMM CPU Sync implementation
along with some specific registers to improve the SMI performance,
hence need SmmCpuSyncLib Library for Intel.
This patch is to:
1.Adds SmmCpuSyncLib Library class in UefiCpuPkg.dec.
2.Adds SmmCpuSyncLib.h function declaration head
This patch is to add SafeIntLib in MdeLibs.dsc.inc
Cc: Michael D Kinney
Cc: Liming Gao
Cc: Zhiguang Liu
Cc: Laszlo Ersek
Cc: Ray Ni
Cc: Zeng Star
Signed-off-by: Jiaxin Wu
---
MdePkg/MdeLibs.dsc.inc | 1 +
1 file changed, 1 insertion(+)
diff --git a/MdePkg/MdeLibs.dsc.inc b/MdePkg/MdeLibs.
Implements SmmCpuSyncLib Library instance. The instance refers the
existing SMM CPU driver (PiSmmCpuDxeSmm) sync implementation
and behavior:
1.Abstract Counter and Run semaphores into SmmCpuSyncCtx.
2.Abstract CPU arrival count operation to
SmmCpuSyncGetArrivedCpuCount(), SmmCpuSyncCheckInCpu(),
S
This patch is to specify SmmCpuSyncLib instance for OvmfPkg.
Cc: Laszlo Ersek
Cc: Ard Biesheuvel
Cc: Jiewen Yao
Cc: Jordan Justen
Cc: Eric Dong
Cc: Ray Ni
Cc: Zeng Star
Cc: Rahul Kumar
Cc: Gerd Hoffmann
Signed-off-by: Jiaxin Wu
---
OvmfPkg/CloudHv/CloudHvX64.dsc | 1 +
OvmfPkg/OvmfPkgIa
This patch is to specify SmmCpuSyncLib instance for UefiPayloadPkg.
Cc: Laszlo Ersek
Cc: Guo Dong
Cc: Sean Rhodes
Cc: James Lu
Cc: Gua Guo
Cc: Ray Ni
Cc: Zeng Star
Signed-off-by: Jiaxin Wu
Reviewed-by: Gua Guo
---
UefiPayloadPkg/UefiPayloadPkg.dsc | 1 +
1 file changed, 1 insertion(+)
d
To decrease the count of RunningApCount, InterlockedDecrement is
enough to achieve that.
This patch is to simplify RunningApCount decrement.
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/MpS
There is the SmmCpuSyncLib Library class define the SMM CPU sync
flow, which is aligned with existing SMM CPU driver sync behavior.
This patch is to consume SmmCpuSyncLib instance directly.
With this change, SMM CPU Sync flow/logic can be customized
with different implementation no matter for any
Thanks Ray.
>
> 1. It's not "LockedCpuCount". It's "ArrivedCpuCountUponLock".
> Comments can be:
> Before the door is locked, CpuCount stores the arrived CPU count.
> After the door is locked, CpuCount is set to -1 indicating the door is
> locked.
> ArrivedCpuCpuntUponLock stores the a
The series patches are to refine SMM CPU Sync flow.
After the refinement, SmmCpuSyncLib is abstracted for
any user to provide different SMM CPU Sync implementation.
Jiaxin Wu (8):
UefiCpuPkg/PiSmmCpuDxeSmm: Optimize Semaphore Sync between BSP and AP
UefiCpuPkg: Adds SmmCpuSyncLib library class
This patch is to define 3 new functions (WaitForBsp & ReleaseBsp &
ReleaseOneAp) used for the semaphore sync between BSP & AP. With the
change, BSP and AP Sync flow will be easy understand as below:
BSP: ReleaseAllAPs or ReleaseOneAp --> AP: WaitForBsp
BSP: WaitForAllAPs <-- AP: Rel
Intel is planning to provide different SMM CPU Sync implementation
along with some specific registers to improve the SMI performance,
hence need SmmCpuSyncLib Library for Intel.
This patch is to:
1.Adds SmmCpuSyncLib Library class in UefiCpuPkg.dec.
2.Adds SmmCpuSyncLib.h function declaration head
This patch is to add SafeIntLib in MdeLibs.dsc.inc
Cc: Michael D Kinney
Cc: Liming Gao
Cc: Zhiguang Liu
Cc: Laszlo Ersek
Cc: Ray Ni
Cc: Zeng Star
Signed-off-by: Jiaxin Wu
Reviewed-by: Michael D Kinney
---
MdePkg/MdeLibs.dsc.inc | 1 +
1 file changed, 1 insertion(+)
diff --git a/MdePkg/Md
Implements SmmCpuSyncLib Library instance. The instance refers the
existing SMM CPU driver (PiSmmCpuDxeSmm) sync implementation
and behavior:
1.Abstract Counter and Run semaphores into SmmCpuSyncCtx.
2.Abstract CPU arrival count operation to
SmmCpuSyncGetArrivedCpuCount(), SmmCpuSyncCheckInCpu(),
S
This patch is to specify SmmCpuSyncLib instance for OvmfPkg.
Cc: Laszlo Ersek
Cc: Ard Biesheuvel
Cc: Jiewen Yao
Cc: Jordan Justen
Cc: Eric Dong
Cc: Ray Ni
Cc: Zeng Star
Cc: Rahul Kumar
Cc: Gerd Hoffmann
Signed-off-by: Jiaxin Wu
Reviewed-by: Ray Ni
---
OvmfPkg/CloudHv/CloudHvX64.dsc | 1
This patch is to specify SmmCpuSyncLib instance for UefiPayloadPkg.
Cc: Laszlo Ersek
Cc: Guo Dong
Cc: Sean Rhodes
Cc: James Lu
Cc: Gua Guo
Cc: Ray Ni
Cc: Zeng Star
Signed-off-by: Jiaxin Wu
Reviewed-by: Gua Guo
Reviewed-by: Ray Ni
---
UefiPayloadPkg/UefiPayloadPkg.dsc | 1 +
1 file chang
To decrease the count of RunningApCount, InterlockedDecrement is
enough to achieve that.
This patch is to simplify RunningApCount decrement.
Cc: Laszlo Ersek
Cc: Eric Dong
Cc: Ray Ni
Cc: Zeng Star
Cc: Gerd Hoffmann
Cc: Rahul Kumar
Signed-off-by: Jiaxin Wu
Reviewed-by: Ray Ni
---
UefiCpuP
There is the SmmCpuSyncLib Library class define the SMM CPU sync
flow, which is aligned with existing SMM CPU driver sync behavior.
This patch is to consume SmmCpuSyncLib instance directly.
With this change, SMM CPU Sync flow/logic can be customized
with different implementation no matter for any
Thanks all help review this series patches, I have created one PR integrated
all reviewed by tag for this series patches.
https://github.com/tianocore/edk2/pull/5092
Thanks,
Jiaxin
> -Original Message-
> From: Ni, Ray
> Sent: Tuesday, December 19, 2023 5:34 PM
> To
Jiaxin Wu (6):
SourceLevelDebugPkg/Library: Indicate SMM Debug Agent support or not
MdeModulePkg/DebugAgentLibNull: Indicate SMM Debug Agent support or
not
UefiCpuPkg/PiSmmCpuDxeSmm: Check SMM Debug Agent support or not
UefiCpuPkg/PiSmmCpuDxeSmm: Align MTRR sync logic between BSP and AP
This patch use the Context to indicate SMM Debug Agent support or
not if InitFlag is DEBUG_AGENT_INIT_SMM. Context must be the pointer
to the BOOLEAN value if it's not NULL.
Cc: Ray Ni
Cc: Liming Gao
Signed-off-by: Jiaxin Wu
---
MdeModulePkg/Library/DebugAgentLibNull/DebugAgentLibNull.c | 9 ++
This patch use the Context to indicate SMM Debug Agent support or
not if InitFlag is DEBUG_AGENT_INIT_SMM. Context must be the pointer
to the BOOLEAN value if it's not NULL.
Cc: Ray Ni
Signed-off-by: Jiaxin Wu
---
.../Library/DebugAgent/SmmDebugAgent/SmmDebugAgentLib.c| 14 ++
1
This patch is to check SMM Debug Agent support or not before
InitializeDebugAgent.
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/CpuS3.c | 4 +++-
UefiCpuPkg/PiSmmCpuDxeSmm/MpServic
Below piece of code is to sync logic in AP for MTRR programming:
if (SmmCpuFeaturesNeedConfigureMtrrs ()) {
SmmCpuSyncReleaseBsp ();
SmmCpuSyncWaitForBsp ();
...
}
SmmCpuSyncReleaseBsp ();
SmmCpuSyncWaitForBsp ();
This patch is to make BSP sync logic same as above coding style:
Below BSP & AP sync flow before exit SMI is to:
1. Make sure BSP and all APs finish the MTRR programming and start
later executing the same start line. This is the MTRR programming
requirement.
2. Make sure all APs finish the pending tasks, then BSP can stop
source level debug.
BSP: SmmCpuSyncWaitF
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
This patch is to specify SmmCpuSyncLib instance for MinPlatformPkg
Cc: Chasel Chiu
Cc: Nate DeSimone
Cc: Michael D Kinney
Cc: Liming Gao
Cc: Ray Ni
Signed-off-by: Jiaxin Wu
---
Platform/Intel/MinPlatformPkg/Include/Dsc/CoreCommonLib.dsc | 1 +
1 file changed, 1 insertion(+)
diff --git a/Pl
This version is updated according Ray's comments on
https://github.com/tianocore/edk2/pull/5175
Jiaxin Wu (6):
SourceLevelDebugPkg/Library: Indicate SMM Debug Agent support or not
MdeModulePkg/DebugAgentLibNull: Indicate SMM Debug Agent support or
not
UefiCpuPkg/PiSmmCpuDxeSmm: Check SMM
This patch is to use the Context to indicate SMM Debug Agent support
or not if InitFlag is DEBUG_AGENT_INIT_SMM. Context must point to a
BOOLEAN if it's not NULL.
Cc: Ray Ni
Signed-off-by: Jiaxin Wu
---
.../Library/DebugAgent/SmmDebugAgent/SmmDebugAgentLib.c| 14 ++
1 file chang
This patch is to use the Context to indicate SMM Debug Agent support or
not if InitFlag is DEBUG_AGENT_INIT_SMM. Context must point to a
BOOLEAN if it's not NULL.
Cc: Ray Ni
Cc: Liming Gao
Signed-off-by: Jiaxin Wu
---
MdeModulePkg/Library/DebugAgentLibNull/DebugAgentLibNull.c | 9 +
1
This patch is to check SMM Debug Agent support or not before
InitializeDebugAgent.
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/CpuS3.c | 4 +++-
UefiCpuPkg/PiSmmCpuDxeSmm/MpServic
Below piece of code is the BSP and AP sync logic for SMI exit.
1. AP after finish the scheduled procedure:
if (SmmCpuFeaturesNeedConfigureMtrrs ()) {
SmmCpuSyncReleaseBsp ();
SmmCpuSyncWaitForBsp ();
...
}
SmmCpuSyncReleaseBsp ();
SmmCpuSyncWaitForBsp ();
SmmCpuSyncReleaseBsp
Existing BSP handler stops source level debug, then call ReleaseAllAPs
to tell all APs can reset the Present flag to FALSE:
InitializeDebugAgent (); /// Stop source level debug
ReleaseAllAPs ();/// Tell APs can reset "Present" flag.
This patch is to invert ReleaseAllAPs & InitializeDeb
After BSP returned from SmmCoreEntry, there are several rounds BSP
and AP sync in BSP handler:
1 .ReleaseAllAPs(); /// Notify all APs to exit.
if (SmmCpuFeaturesNeedConfigureMtrrs()) {
2. SmmCpuSyncWaitForAPs(); /// Wait for all APs to program MTRRs.
3. ReleaseAllAPs(); /// Signal APs to rest
Shadow stack will stop update after CET disable (DisableCet in
DisableReadOnlyPageWriteProtect), but normal smi stack will be
continue updated with the function return and enter
(DisableReadOnlyPageWriteProtect & EnableReadOnlyPageWriteProtect),
thus leading stack mismatch after CET re-enabled (Ena
Hi Laszlo,
Thanks the feedback.
>
> Is this somehow related to
>
> [edk2-devel] [PATCH] UefiCpuPkg/PiSmmCpuDxeSmm: Clear CR4.CET before
> restoring MSR IA32_S_CET
>
> at
>
> https://edk2.groups.io/g/devel/message/110605
>
> ?
>
> I'm not familiar with control flow integrity, but both pa
ordan Justen
Cc: Guo Dong
Cc: Sean Rhodes
Cc: James Lu
Cc: Gua Guo
Signed-off-by: Jiaxin Wu
Jiaxin Wu (7):
UefiCpuPkg/PiSmmCpuDxeSmm: Optimize Semaphore Sync between BSP and AP
UefiCpuPkg/PiSmmCpuDxeSmm: Reduce times of BSP and AP Sync for SMM
Exit
UefiCpuPkg: Adds SmmCpuSyncLib li
This patch is to define 3 new functions (WaitForBsp & ReleaseBsp &
ReleaseOneAp) used for the semaphore sync between BSP & AP. With the
change, BSP and AP Sync flow will be easy understand as below:
BSP: ReleaseAllAPs or ReleaseOneAp --> AP: WaitForBsp
BSP: WaitForAllAPs <-- AP: Rel
After review, there are unnecessary steps for BSP and AP sync for SMM
exit. This patch is to reduce one round BSP and AP sync so as to improve
SMI performance:
BSP: WaitForAllAPs <-- AP: ReleaseBsp
BSP: ReleaseAllAPs --> AP: WaitForBsp
Change-Id: Ic33f42f3daa7ff1847e524d0c3d9cd4fcdefa61b
Cc: Eric
Intel is planning to provide different SMM CPU Sync implementation
along with some specific registers to improve the SMI performance,
hence need SmmCpuSyncLib Library for Intel.
This patch is to:
1.Adds SmmCpuSyncLib Library class in UefiCpuPkg.dec.
2.Adds SmmCpuSyncLib.h function declaration head
Implements SmmCpuSyncLib Library class. The instance follows the
existing SMM CPU driver (PiSmmCpuDxeSmm) sync implementation:
1.Abstract Counter and Run semaphores into SmmCpuSyncCtx.
2.Abstract CPU arrival count operation to
SmmCpuSyncGetArrivedCpuCount(), SmmCpuSyncCheckInCpu(),
SmmCpuSyncCheckO
The SmmCpuSyncLib instance is included in UefiCpuLibs.dsc.inc.
This patch is to specify SmmCpuSyncLib instance in OvmfPkg by
using "!include UefiCpuPkg/UefiCpuLibs.dsc.inc".
Change-Id: I2ab1737425e26a7bfc4f564b3b7f15ca5c2268fb
Cc: Ard Biesheuvel
Cc: Jiewen Yao
Cc: Jordan Justen
Cc: Eric Dong
C
The SmmCpuSyncLib instance is included in UefiCpuLibs.dsc.inc.
This patch is to specify SmmCpuSyncLib instance in UefiPayloadPkg
by using "!include UefiCpuPkg/UefiCpuLibs.dsc.inc".
Change-Id: Ib303a9cdf260ac1ffc146e5f2e68834dec00ff25
Cc: Guo Dong
Cc: Sean Rhodes
Cc: James Lu
Cc: Gua Guo
Cc: Ra
There is the SmmCpuSyncLib Library class define the SMM CPU sync
flow, which is aligned with existing SMM CPU driver sync behavior.
This patch is to consume SmmCpuSyncLib instance directly.
With this change, SMM CPU Sync flow/logic can be customized
with different implementation no matter for any
Shadow stack will stop update after CET disable (DisableCet in
DisableReadOnlyPageWriteProtect), but normal smi stack will be
continue updated with the function return and enter
(DisableReadOnlyPageWriteProtect & EnableReadOnlyPageWriteProtect),
thus leading stack mismatch after CET re-enabled (Ena
Hi Laszlo,
Thanks comments.
>
> I have two comments:
>
>
> (1) both the pre-patch code and the post-patch code have several
> instances of the following pattern:
>
> Boolean = (Expression != 0) ? TRUE : FALSE;
>
> This is an anti-pattern. It should only be:
>
> Boolean = Expression !=
Shadow stack will stop update after CET disable (DisableCet in
DisableReadOnlyPageWriteProtect), but normal smi stack will be
continue updated with the function return and enter
(DisableReadOnlyPageWriteProtect & EnableReadOnlyPageWriteProtect),
thus leading stack mismatch after CET re-enabled (Ena
Thanks Laszlo, all fixed in version 3.
> -Original Message-
> From: Laszlo Ersek
> Sent: Sunday, November 5, 2023 7:01 PM
> To: Wu, Jiaxin ; devel@edk2.groups.io
> Cc: Dong, Eric ; Ni, Ray ; Zeng, Star
> ; Gerd Hoffmann ; Kumar, Rahul R
>
> Subject: R
I will refine the commit log to include your great suggestion. Thank you very
much!
Jiaxin
From: Ni, Ray
Sent: Monday, November 6, 2023 5:41 PM
To: Wu, Jiaxin ; devel@edk2.groups.io
Cc: Dong, Eric ; Zeng, Star ; Gerd
Hoffmann ; Kumar, Rahul R ; Laszlo
Ersek
Subject: Re: [PATCH v3] Ue
Root cause:
1. Before DisableReadonlyPageWriteProtect() is called, the return
address (#1) is pushed in shadow stack.
2. CET is disabled.
3. DisableReadonlyPageWriteProtect() returns to #1.
4. Page table is modified.
5. EnableReadonlyPageWriteProtect() is called, but the return
address (#2) is not
Processor extended information is filled when
CPU_V2_EXTENDED_TOPOLOGY is set in parameter ProcessorNumber
from GetProcessorInfo() (See commit: 1fadd18d).
This filed value is retrieved from CPUID leaf 1FH, which is
a preferred superset to leaf 0BH.
Since Intel recommends first use the CPUID leaf
Thanks Laszlo, much appreciate all comments. I will check one by one for fix in
next version. /Jiaxin
> -Original Message-
> From: Laszlo Ersek
> Sent: Tuesday, November 7, 2023 7:01 PM
> To: devel@edk2.groups.io; Wu, Jiaxin
> Cc: Dong, Eric ; Ni, Ray ; Zeng, Star
&g
Hi Ray & Laszlo,
Any more comments to this?
Thanks,
Jiaxin
> -Original Message-
> From: devel@edk2.groups.io On Behalf Of Wu,
> Jiaxin
> Sent: Tuesday, November 7, 2023 9:25 AM
> To: devel@edk2.groups.io
> Cc: Dong, Eric ; Ni, Ray ; Zeng, Star
> ; Gerd
Ersek
> Sent: Wednesday, November 8, 2023 2:57 AM
> To: devel@edk2.groups.io; Wu, Jiaxin
> Cc: Dong, Eric ; Ni, Ray ; Zeng, Star
> ; Gerd Hoffmann ; Kumar, Rahul R
>
> Subject: Re: [edk2-devel] [PATCH v4] UefiCpuPkg/PiSmmCpuDxeSmm: Fix CP
> Exception when CET enable
>
Hi Laszlo,
> >
> > The patch looks OK to me, but:
> >
> > - I would like to test it with CPU hotplug (later, likely under v2), and
> >
Sure, I can wait the update from you.
> > - I think this should be two patches.
> >
> > First, the SmmAddProcessor() function should be extended just to
> > comp
nal Message-----
> From: Wu, Jiaxin
> Sent: Wednesday, November 8, 2023 9:17 AM
> To: Laszlo Ersek ; devel@edk2.groups.io; Gao, Liming
> ; Kinney, Michael D
>
> Cc: Dong, Eric ; Ni, Ray ; Zeng, Star
> ; Gerd Hoffmann ; Kumar, Rahul R
>
> Subject: RE: [edk2-devel] [PATCH
Thank you, Mike, the PR (https://github.com/tianocore/edk2/pull/4867) has been
synced & updated with reviewed by tag, and we can merge once pass the CI check.
> -Original Message-
> From: Kinney, Michael D
> Sent: Friday, November 10, 2023 8:25 AM
> To: Wu, Jiaxi
The series patches are to complete commits 170d4ce8 & 1fadd18d,
then SMM cpu driver will use the processor extended information.
Cc: Laszlo Ersek
Cc: Eric Dong
Cc: Ray Ni
Cc: Rahul Kumar
Cc: Gerd Hoffmann
Cc: Star Zeng
Signed-off-by: Jiaxin Wu
Jiaxin Wu (3):
UefiCpuPkg/BaseXApicLib:
This patch is to complete 170d4ce8, sync the change to BaseXApicLib.
Checking the max cpuid leaf is not enough to figure whenever
CPUID_V2_EXTENDED_TOPOLOGY is supported. Intel SDM says:
Software must detect the presence of CPUID leaf 1FH by verifying
(a) the highest leaf index supported by CPUI
This patch is to extend SmmAddProcessor function to get processor
extended information. It's to complete commit 1fadd18d.
Cc: Laszlo Ersek
Cc: Eric Dong
Cc: Ray Ni
Cc: Rahul Kumar
Cc: Gerd Hoffmann
Cc: Star Zeng
Signed-off-by: Jiaxin Wu
Reviewed-by: Laszlo Ersek
Regression-tested-by: Laszl
This patch changes to use the processor extended information,
which can reflect the value from CPUID leaf 1FH.
The reasons are listed as below:
1. The processor package ID retrieved from CPUID 0x0Bh may be
not correct/accurate if CPU has the module & die info, it depends
on the CPUID implementatio
ks,
Jiaxin
> -Original Message-
> From: joeyli
> Sent: Wednesday, November 15, 2023 3:35 PM
> To: devel@edk2.groups.io; Zhang, Hongbin1
> Cc: Dong, Eric ; Ni, Ray ; Kumar,
> Rahul R ; Gerd Hoffmann ;
> Zeng, Star ; Wu, Jiaxin
> Subject: Re: [edk2-devel] [PATCH v1]
domain is package.
With all above, I agree to drop this path, but other 2 patches in this set
should be ok. Thanks Ray help clarify this.
Thanks,
Jiaxin
From: Ni, Ray
Sent: Monday, November 20, 2023 9:45 AM
To: Laszlo Ersek ; devel@edk2.groups.io; Wu, Jiaxin
Cc: Dong, Eric ; Kumar, Rahul R
> //
> MM_CORE_MMI_HANDLERS mMmCoreMmiHandlers[] = {
> + { MmDriverDispatchHandler, &gEfiEventDxeDispatchGuid, NULL,
> TRUE },
Should we need define a new HandlerType name instead of using the
gEfiEventDxeDispatchGuid?
We just need a simple MM Dispatch Event, which is trigged by
afeIntLib for all calculations to prevent overflows.
i. Remove the UefiCpuPkg/UefiCpuLibs.dsc.inc
Cc: Laszlo Ersek
Cc: Eric Dong
Cc: Ray Ni
Cc: Zeng Star
Cc: Gerd Hoffmann
Cc: Rahul Kumar
Cc: Ard Biesheuvel
Cc: Jiewen Yao
Cc: Jordan Justen
Cc: Guo Dong
Cc: Sean Rhodes
Cc: James Lu
Cc: Gu
This patch is to define 3 new functions (WaitForBsp & ReleaseBsp &
ReleaseOneAp) used for the semaphore sync between BSP & AP. With the
change, BSP and AP Sync flow will be easy understand as below:
BSP: ReleaseAllAPs or ReleaseOneAp --> AP: WaitForBsp
BSP: WaitForAllAPs <-- AP: Rel
Intel is planning to provide different SMM CPU Sync implementation
along with some specific registers to improve the SMI performance,
hence need SmmCpuSyncLib Library for Intel.
This patch is to:
1.Adds SmmCpuSyncLib Library class in UefiCpuPkg.dec.
2.Adds SmmCpuSyncLib.h function declaration head
Implements SmmCpuSyncLib Library instance. The instance refers the
existing SMM CPU driver (PiSmmCpuDxeSmm) sync implementation
and behavior:
1.Abstract Counter and Run semaphores into SmmCpuSyncCtx.
2.Abstract CPU arrival count operation to
SmmCpuSyncGetArrivedCpuCount(), SmmCpuSyncCheckInCpu(),
S
This patch is to specify SmmCpuSyncLib instance for OvmfPkg.
Cc: Laszlo Ersek
Cc: Ard Biesheuvel
Cc: Jiewen Yao
Cc: Jordan Justen
Cc: Eric Dong
Cc: Ray Ni
Cc: Zeng Star
Cc: Rahul Kumar
Cc: Gerd Hoffmann
Signed-off-by: Jiaxin Wu
---
OvmfPkg/CloudHv/CloudHvX64.dsc | 2 ++
OvmfPkg/OvmfPkgI
This patch is to specify SmmCpuSyncLib instance for UefiPayloadPkg.
Cc: Laszlo Ersek
Cc: Guo Dong
Cc: Sean Rhodes
Cc: James Lu
Cc: Gua Guo
Cc: Ray Ni
Cc: Zeng Star
Signed-off-by: Jiaxin Wu
---
UefiPayloadPkg/UefiPayloadPkg.dsc | 1 +
1 file changed, 1 insertion(+)
diff --git a/UefiPayloa
There is the SmmCpuSyncLib Library class define the SMM CPU sync
flow, which is aligned with existing SMM CPU driver sync behavior.
This patch is to consume SmmCpuSyncLib instance directly.
With this change, SMM CPU Sync flow/logic can be customized
with different implementation no matter for any
> From C11 "5.1.2.4 Multi-threaded executions and data races":
>
> - paragraph 4: "Two expression evaluations conflict if one of them
> modifies a memory location and the other one reads or modifies the same
> memory location."
>
> - paragraph 25: "The execution of a program contains a data race
; From: gaoliming
> Sent: Thursday, February 22, 2024 10:48 PM
> To: Wu, Jiaxin
> Subject: 回复: [edk2-devel] [PATCH v3 0/2] SMM CPU Optimization
>
> Jiaxin:
> I see you merge this patch set in hard freeze. If you want this patch set
> to catch this stable tag 202402, you need to repl
Talked with Di & Liming,
Those 2 patches don't need to catch this stable tag 202402. Please ignore the
request here.
Thanks,
Jiaxin
> -Original Message-----
> From: Wu, Jiaxin
> Sent: Friday, February 23, 2024 8:47 AM
> To: gaoliming ; Kinney, Michael D
>
&g
The series patch are to improve the SMM MP service performance.
Cc: Ray Ni
Cc: Laszlo Ersek
Cc: Eric Dong
Cc: Zeng Star
Cc: Gerd Hoffmann
Cc: Rahul Kumar
Signed-off-by: Jiaxin Wu
Jiaxin Wu (2):
UefiCpuPkg/PiSmmCpuDxeSmm: Remove one round of Busy spinlock
UefiCpuPkg/PiSmmCpuDxeSmm
For both non blocking and blocking:
Remove unnecessary a pair of AcquireSpinLock and ReleaseSpinLock
for each AP. It's target to improve SmmStartupAllAPs performance.
No functional impact, see below analysis:
During first acquire spinLock, InternalSmmStartupAllAPs will
return EFI_NOT_READY if Acq
For non blocking mode during SmmMpBroadcastProcedure, multiple APs might
contended access the RunningApCount in the PROCEDURE_TOKEN:
Step1: RunningApCount is initialized to the mMaxNumberOfCpus
(See GetFreeToken).
Step2: Decrease RunningApCount if the AP is not present
(See InterlockedDecrement in
Hi Gerd,
With below OVMF build and QEMU command, OVMF hangs after SendSmiIpi
(mBspApicId) during SmmRelocateBases(), is there any issues with latest code to
support SMM on OVMF or my local command/configuration issue?
Build (latest edk2 code):
build -p OvmfPkg\OvmfPkgIa32X64.dsc -a IA32 -a X64
Thank you Michael & Gerd, it does the problem of
https://gitlab.com/qemu-project/qemu/-/issues/2064.
The issue is gone with latest QEMU version.
Thanks,
Jiaxin
> -Original Message-
> From: Michael Kubacki
> Sent: Tuesday, April 9, 2024 8:55 AM
> To: devel@edk2.group
Processor.
2. Execute the early SMM Init.
Cc: Ray Ni
Cc: Zeng Star
Cc: Gerd Hoffmann
Cc: Rahul Kumar
Cc: Guo Dong
Cc: Sean Rhodes
Cc: James Lu
Cc: Gua Guo
Cc: Ard Biesheuvel
Cc: Jiewen Yao
Signed-off-by: Jiaxin Wu
Jiaxin Wu (13):
UefiCpuPkg: Add SmmRelocationLib class
UefiCpuPkg
Intel plans to separate the smbase relocation logic from
PiSmmCpuDxeSmm driver, and the related behavior will be
moved to the new interface defined by the SmmRelocationLib
class.
The SmmRelocationLib class provides the SmmRelocationInit()
interface for platform to do the smbase relocation, which
s
1 - 100 of 417 matches
Mail list logo