From: "Laszlo Ersek" <lersek@redhat.com>
To: devel@edk2.groups.io, yuanhao.xie@intel.com
Cc: Ray Ni <ray.ni@intel.com>, Eric Dong <eric.dong@intel.com>,
Rahul Kumar <rahul1.kumar@intel.com>,
Tom Lendacky <thomas.lendacky@amd.com>
Subject: Re: [edk2-devel] [Patch V2 2/3] UefiCpuPkg/MpInitLib: Detect microcode and store MTRR when CpuCount > 1
Date: Wed, 22 Nov 2023 18:06:39 +0100 [thread overview]
Message-ID: <9f2bf026-e473-dcab-c5a0-085810ff34aa@redhat.com> (raw)
In-Reply-To: <c4f5c015-8530-e9e9-8532-8ae96858ca60@redhat.com>
On 11/22/23 18:03, Laszlo Ersek wrote:
> On 11/21/23 08:39, Yuanhao Xie wrote:
>> Detect and apply Microcode on BSP, store BSP's MTRR setting only when
>> CpuCount > 1.
>>
>> The purpose of this patch is to enhance the review process.
>> The separation in this patch is aimed at facilitating a more
>> straightforward review, with the ultimate goal of eliminating the
>> microcode loading functionality for the second time Mp initialization
>>
>> Cc: Ray Ni <ray.ni@intel.com>
>> Cc: Eric Dong <eric.dong@intel.com>
>> Cc: Rahul Kumar <rahul1.kumar@intel.com>
>> Cc: Tom Lendacky <thomas.lendacky@amd.com>
>> Cc: Laszlo Ersek <lersek@redhat.com>
>> Signed-off-by: Yuanhao Xie <yuanhao.xie@intel.com>
>> ---
>> UefiCpuPkg/Library/MpInitLib/MpLib.c | 18 +++++++++---------
>> 1 file changed, 9 insertions(+), 9 deletions(-)
>>
>> diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c b/UefiCpuPkg/Library/MpInitLib/MpLib.c
>> index e8ffb99874..bb5d4188f0 100644
>> --- a/UefiCpuPkg/Library/MpInitLib/MpLib.c
>> +++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c
>> @@ -2236,19 +2236,19 @@ MpInitLibInitialize (
>> ShadowMicrocodeUpdatePatch (CpuMpData);
>> }
>>
>> - //
>> - // Detect and apply Microcode on BSP
>> - //
>> - MicrocodeDetect (CpuMpData, CpuMpData->BspNumber);
>> - //
>> - // Store BSP's MTRR setting
>> - //
>> - MtrrGetAllMtrrs (&CpuMpData->MtrrTable);
>> -
>> //
>> // Wakeup APs to do some AP initialize sync (Microcode & MTRR)
>> //
>> if (CpuMpData->CpuCount > 1) {
>> + //
>> + // Detect and apply Microcode on BSP
>> + //
>> + MicrocodeDetect (CpuMpData, CpuMpData->BspNumber);
>> + //
>> + // Store BSP's MTRR setting
>> + //
>> + MtrrGetAllMtrrs (&CpuMpData->MtrrTable);
>> +
>> if (MpHandOff != NULL) {
>> //
>> // Only needs to use this flag for DXE phase to update the wake up
>
> I can't very well gauge the effect that this patch has on
> MicrocodeDetect(). MicrocodeDetect() is a function that is not obvious
> to me. However, microcode detection is disabled on OVMF, both via HOB
> and via PCD (zero region size). So, I have nothing against *restricting*
> microcode detection "further".
>
> Regarding MtrrTable: it seems that this field is only consumed in
> ApMtrrSync() and ApInitializeSync(). I suppose those functions never run
> when CpuMpData->CpuCount is 1. Thus restricting MtrrGetAllMtrrs() should
> be fine as well.
sorry, small mistake: when writing this, I was already looking at the
final state of the tree. Right after this patch is applied, only
ApInitializeSync() exists!
But that fact only makes my argument stronger -- so my R-b for this
patch stands.
>
> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
>
Thanks
Laszlo
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#111619): https://edk2.groups.io/g/devel/message/111619
Mute This Topic: https://groups.io/mt/102724547/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/leave/12367111/7686176/1913456212/xyzzy [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-
next prev parent reply other threads:[~2023-11-22 17:06 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-21 7:39 [edk2-devel] [Patch V2 0/3] Eliminate redundant microcode loading in DXE Yuanhao Xie
2023-11-21 7:39 ` [edk2-devel] [Patch V2 1/3] UefiCpuPkg/MpInitLib:Repeat WakeUpAp of loading microcode,Syncing MTRR Yuanhao Xie
2023-11-21 7:58 ` Ni, Ray
2023-11-22 16:58 ` Laszlo Ersek
2023-11-21 7:39 ` [edk2-devel] [Patch V2 2/3] UefiCpuPkg/MpInitLib: Detect microcode and store MTRR when CpuCount > 1 Yuanhao Xie
2023-11-22 17:03 ` Laszlo Ersek
2023-11-22 17:06 ` Laszlo Ersek [this message]
2023-11-22 17:11 ` Laszlo Ersek
2023-11-21 7:39 ` [edk2-devel] [Patch V2 3/3] UefiCpuPkg/MpInitLib: Eliminate redundant microcode loading in DXE Yuanhao Xie
2023-11-22 17:24 ` Laszlo Ersek
2023-11-24 2:58 ` Yuanhao Xie
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=9f2bf026-e473-dcab-c5a0-085810ff34aa@redhat.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