public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Ni, Ray" <ray.ni@intel.com>
To: "Dong, Eric" <eric.dong@intel.com>,
	"devel@edk2.groups.io" <devel@edk2.groups.io>
Cc: Laszlo Ersek <lersek@redhat.com>
Subject: Re: [PATCH] UefiCpuPkg/PiSmmCpuDxeSmm: Remove dependence between APs.
Date: Fri, 20 Dec 2019 06:15:03 +0000	[thread overview]
Message-ID: <734D49CCEBEEF84792F5B80ED585239D5C3A3FA1@SHSMSX104.ccr.corp.intel.com> (raw)
In-Reply-To: <20191220053446.1532-1-eric.dong@intel.com>

> 
> +  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.

> +    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.

> 
> @@ -1170,10 +1120,12 @@ CreateToken (

3. With the comment #1, CreateToken() can carry additional parameter which specifies
the RunningApCount.

>    ASSERT (ProcToken != NULL);
> 
>    ProcToken->Signature = PROCEDURE_TOKEN_SIGNATURE;
> 
>    ProcToken->ProcedureToken = CpuToken;

4. ProcToken->ProcedureToken looks a bit strange.
Can we use "ProcToken->Spinlock"?

> 
> +    *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

  reply	other threads:[~2019-12-20  6:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-20  5:34 [PATCH] UefiCpuPkg/PiSmmCpuDxeSmm: Remove dependence between APs Dong, Eric
2019-12-20  6:15 ` Ni, Ray [this message]
2019-12-23  6:58   ` Dong, Eric

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=734D49CCEBEEF84792F5B80ED585239D5C3A3FA1@SHSMSX104.ccr.corp.intel.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