Hi Ray,

> -----Original Message-----
> From: Ni, Ray
> Sent: Friday, December 20, 2019 2:15 PM
> To: Dong, Eric <eric.d...@intel.com<mailto:eric.d...@intel.com>>; 
> devel@edk2.groups.io<mailto:devel@edk2.groups.io>
> Cc: Laszlo Ersek <ler...@redhat.com<mailto:ler...@redhat.com>>
> Subject: RE: [PATCH] UefiCpuPkg/PiSmmCpuDxeSmm: Remove dependence
> between APs.
>
> >
> > +  if (!Token->SingleAp) {
> >
> > +    ReleaseSemaphore (&Token->FinishedApCount);
>
> 1. If the FinishedApCount is renamed to RunningApCount and
> InterlockedDecrement() is called for it.
>
> SingleAp flag is unneeded.
>
> For StartupAllAps(), RunningApCount = mMaxNumberOfCpus - 1; For
> StartupThisAps(), RunningApCount = 1;
>
> When RunningApCount == 0, the spinlock is released.
>
[[Eric]] good idea, will update the logic.


> > +    if (mSmmMpSyncData->CpuData[CpuIndex].Token != NULL) {
> >
> > +      ReleaseToken (CpuIndex);
>
> 2. Can you directly pass in mSmmMpSyncData->CpuData[CpuIndex].Token?
> It simplifies the ReleaseToken() and also make people understand that
> ReleaseToken() will only modifies the Token but other states in
> CpuData[Index] is NOT changed.
>
[[Eric]] ReleaseToken also set mSmmMpSyncData->CpuData[CpuIndex].Token to NULL
at the end. So can't directly input Token.

> >
> > @@ -1170,10 +1120,12 @@ CreateToken (
>
> 3. With the comment #1, CreateToken() can carry additional parameter which
> specifies the RunningApCount.
>
[[Eric]] yes, will update the logic.

> >    ASSERT (ProcToken != NULL);
> >
> >    ProcToken->Signature = PROCEDURE_TOKEN_SIGNATURE;
> >
> >    ProcToken->ProcedureToken = CpuToken;
>
> 4. ProcToken->ProcedureToken looks a bit strange.
> Can we use "ProcToken->Spinlock"?
[[Eric]] yes, will update the name.

Thanks,
Eric
>
> >
> > +    *Token = (MM_COMPLETION) mSmmMpSyncData-
> > >CpuData[CpuIndex].Token->ProcedureToken;
>
> 5. It will become
> *Token = (MM_COMPLETION) mSmmMpSyncData-
> >CpuData[CpuIndex].Token->Spinlock;
>
> >
> > +      ReleaseSemaphore (&ProcToken->FinishedApCount);
>
> 6. I can now understand why "FinishedApCount is directly compared against
> mMaxNumberOfCpus because the FinishedApCount is already increased for
> BSP. It's not a comment for code change.
>
>
> Thanks,
> Ray

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#52496): https://edk2.groups.io/g/devel/message/52496
Mute This Topic: https://groups.io/mt/68844978/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to