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 v4] UefiCpuPkg/PiSmmCpuDxeSmm: Avoid allocate Token every time
Date: Thu, 5 Dec 2019 05:24:34 +0000	[thread overview]
Message-ID: <734D49CCEBEEF84792F5B80ED585239D5C39021F@SHSMSX104.ccr.corp.intel.com> (raw)
In-Reply-To: <20191205015023.607-1-eric.dong@intel.com>

Some comments.
> +  //
> 
> +  // Not free the buffer, just clear the UsedTokenNum. In order to
> 
> +  // avoid triggering allocate action when we need to use the token,
> 
> +  // do not free the buffer.
1.  Can you reword to below?
"Only free the token buffer recorded in the OldTOkenBufList upon exiting SMI.
Current token buffer stays allocated so next SMI doesn't need to re-allocate."

> +  ASSERT_EFI_ERROR (TokenCountPerChunk != 0);

2. This is not right. Should use ASSERT().

> +  DEBUG ((DEBUG_INFO, "CpuSmm: SpinLock Size = 0x%x,
> PreAllocateTokenNum = 0x%x\n", SpinLockSize, TokenCountPerChunk));

3. "PreAllocateTokenNum" -> "PcdTokenCountPerChunk". Please directly use the PCD name in debug log.

> 
> +  UINT8                           *CurrentTokenBuf;
> 
> +  UINTN                           UsedTokenNum;     // Only record tokens used in
> CurrentTokenBuf.

4. I see a mismatch between types of UsedTokenNum and the PCD. One is UINTN, the other is UINT32.
Better to use UINT32 here.

> gUefiCpuPkgTokenSpaceGuid.PcdTokenCountPerChunk|64|UINT32|0x30002002

5. The PCD name is too generic. It's hard to tell when/where the PCD is used by reading
the name only.
Maybe "PcdCpuSmmMpTokenCountPerChunk"?

> +#string
> STR_gUefiCpuPkgTokenSpaceGuid_PcdTokenCountPerChunk_PROMPT
> #language en-US "Specify the size of pre allocated token count per chunk.\n"

6. "Size of pre allocated token count per chunk" is a bit confusing.
How about "Count of pre allocated SMM MP tokens"?
Then maybe the PCD name can be "PcdCpuSmmMpPreAllocateTokenCount"?

Thanks,
Ray


  reply	other threads:[~2019-12-05  5:24 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-05  1:50 [PATCH v4] UefiCpuPkg/PiSmmCpuDxeSmm: Avoid allocate Token every time Dong, Eric
2019-12-05  5:24 ` Ni, Ray [this message]
2019-12-05  6:09   ` 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=734D49CCEBEEF84792F5B80ED585239D5C39021F@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