public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Ni, Ray" <ray.ni@intel.com>
To: "devel@edk2.groups.io" <devel@edk2.groups.io>,
	"Xie, Yuanhao" <yuanhao.xie@intel.com>
Cc: "Dong, Eric" <eric.dong@intel.com>,
	"Kumar, Rahul R" <rahul.r.kumar@intel.com>
Subject: Re: [edk2-devel] [PATCH] UefiCpuPkg: Use Top of each AP's stack to save CpuMpData
Date: Tue, 16 Aug 2022 09:14:58 +0000	[thread overview]
Message-ID: <MWHPR11MB16313D33D99FE74792C663EB8C6B9@MWHPR11MB1631.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20220816075715.932-1-yuanhao.xie@intel.com>

> -  MpBuffer    = AllocatePages (EFI_SIZE_TO_PAGES (BufferSize));
> +  //
> +  // Allocate extra ApStackSize to let stack align on ApStackSize bounday
> +  //
> +  MpBuffer = AllocatePages (EFI_SIZE_TO_PAGES (BufferSize));

1. Above comments are not necessary. Can you please remove them?

>    ASSERT (
> -    (CpuMpData->CpuInfoInHob + sizeof (CPU_INFO_IN_HOB) *
> MaxLogicalProcessorNumber) ==
> -    Buffer + BufferSize
> +    (CpuMpData->CpuInfoInHob + sizeof (CPU_INFO_IN_HOB) *
> MaxLogicalProcessorNumber) <=
> +    (UINTN)MpBuffer + BufferSize
>      );

2. Can you try changing "<=" back to "=="? I agree that "Buffer" should
be changed to "MpBuffer" in above check.


> -  For AP, the structure is just after IDT.
> +  For AP, the structure is stored in the top of each AP's stack.

3. Can you change it to "For AP, the pointer of CPU_MP_DATA is
stored in top of each AP's stack."?

> +    ;
> +    ; Reserve 8 bytes for storing CpuMpData.
> +    ; Using sub rsp instead of push rbp to avoid overwriting existed
> CpuMpData

4. Can you explain a bit more in which case the overwritten may happen?
I guess the overwritten may happen when the PcdCpuApLoopMode is
ApInHltLoop but pointer of CpuMpData is only stored in top of AP stack
in first time INIT-SIPI-SIPI.
 


  reply	other threads:[~2022-08-16  9:15 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-16  7:57 [PATCH] UefiCpuPkg: Use Top of each AP's stack to save CpuMpData Yuanhao Xie
2022-08-16  9:14 ` Ni, Ray [this message]
2022-08-26 14:27 ` [edk2-devel] " Lendacky, Thomas

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=MWHPR11MB16313D33D99FE74792C663EB8C6B9@MWHPR11MB1631.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