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>,
"Kumar, Chandana C" <chandana.c.kumar@intel.com>
Subject: Re: [PATCH v2 1/2] UefiCpuPkg/MpInitLib: Restore IDT context for APs.
Date: Wed, 22 Apr 2020 11:47:33 +0000 [thread overview]
Message-ID: <734D49CCEBEEF84792F5B80ED585239D5C5087DB@SHSMSX104.ccr.corp.intel.com> (raw)
In-Reply-To: <20200422090111.423-1-eric.dong@intel.com>
Eric,
It's natural to use the volatile registers value derived from BSP in ApInitReconfig path.
So I still prefer to use the code I suggested in the review comment to the v1 patch.
We can remove the below line that specially for ApInitReconfig path in MpInitLbInitialize().
https://github.com/tianocore/edk2/blob/master/UefiCpuPkg/Library/MpInitLib/MpLib.c#L1783:
CopyMem (&CpuMpData->CpuData[Index].VolatileRegisters, &VolatileRegisters, sizeof (CPU_VOLATILE_REGISTERS));
Thanks,
Ray
> -----Original Message-----
> From: Dong, Eric <eric.dong@intel.com>
> Sent: Wednesday, April 22, 2020 5:01 PM
> To: devel@edk2.groups.io
> Cc: Ni, Ray <ray.ni@intel.com>; Laszlo Ersek <lersek@redhat.com>; Kumar,
> Chandana C <chandana.c.kumar@intel.com>
> Subject: [PATCH v2 1/2] UefiCpuPkg/MpInitLib: Restore IDT context for APs.
>
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2683
>
> This patch fixes an assertion because AP can't find the CpuMpData.
> When AP is waken up through Init-Sipi-Sipi, AP's IDT should
> be restored to pre-allocated buffer so AP can get the CpuMpData
> through the IDT base address.
> Current code already has logic to handle this when CpuMpData->
> InitFlag is ApInitConfig but misses the logic
> when CpuMpData->InitFlag is ApInitReconfig.
> This patch fixes this gap.
>
> Cc: Ray Ni <ray.ni@intel.com>
> Cc: Laszlo Ersek <lersek@redhat.com>
> Cc: Chandana Kumar <chandana.c.kumar@intel.com>
> Signed-off-by: Eric Dong <eric.dong@intel.com>
> ---
>
> V2:
>
> 1. Enhance code comments.
>
>
> UefiCpuPkg/Library/MpInitLib/MpLib.c | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c
> b/UefiCpuPkg/Library/MpInitLib/MpLib.c
> index 64a4c3546e..2e87aa1f06 100644
> --- a/UefiCpuPkg/Library/MpInitLib/MpLib.c
> +++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c
> @@ -692,6 +692,16 @@ ApWakeupFunction (
> //
>
> RestoreVolatileRegisters (&CpuMpData-
> >CpuData[ProcessorNumber].VolatileRegisters, TRUE);
>
> } else {
>
> + if (CpuMpData->InitFlag == ApInitReconfig) {
>
> + //
>
> + // Initialize AP volatile registers in ApInitReconfig path.
>
> + // ApInitReconfig happens when:
>
> + // 1. AP is re-enabled after it's disabled, in either PEI or DXE phase.
>
> + // 2. AP is initialized in DXE phase.
>
> + //
>
> + RestoreVolatileRegisters (&CpuMpData->CpuData[0].VolatileRegisters,
> FALSE);
>
> + }
>
> +
>
> //
>
> // The CPU driver might not flush TLB for APs on spot after updating
>
> // page attributes. AP in mwait loop mode needs to take care of it
> when
>
> --
> 2.23.0.windows.1
next prev parent reply other threads:[~2020-04-22 11:47 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-04-22 9:01 [PATCH v2 1/2] UefiCpuPkg/MpInitLib: Restore IDT context for APs Dong, Eric
2020-04-22 9:01 ` [PATCH v2 2/2] UefiCpuPkg/MpInitLib: Avoid ApInitReconfig in PEI Dong, Eric
2020-04-22 11:23 ` Ni, Ray
2020-04-24 16:39 ` [edk2-devel] " Laszlo Ersek
2020-04-22 11:47 ` Ni, Ray [this message]
2020-04-24 16:37 ` [edk2-devel] [PATCH v2 1/2] UefiCpuPkg/MpInitLib: Restore IDT context for APs Laszlo Ersek
2020-04-22 21:41 ` Laszlo Ersek
2020-04-23 0:58 ` Dong, Eric
2020-04-24 16:37 ` Laszlo Ersek
-- strict thread matches above, loose matches on Subject: below --
2020-04-22 8:45 [PATCH v2 0/2] UefiCpuPkg/MpInitLib: Fix ASSERT in AP procedure Dong, Eric
2020-04-22 8:45 ` [PATCH v2 1/2] UefiCpuPkg/MpInitLib: Restore IDT context for APs 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=734D49CCEBEEF84792F5B80ED585239D5C5087DB@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