From: "Duran, Leo" <leo.duran@amd.com>
To: "Ni, Ray" <ray.ni@intel.com>, Laszlo Ersek <lersek@redhat.com>,
"devel@edk2.groups.io" <devel@edk2.groups.io>,
"Wu, Hao A" <hao.a.wu@intel.com>,
"Fu, Siyuan" <siyuan.fu@intel.com>
Cc: "Dong, Eric" <eric.dong@intel.com>
Subject: Re: [edk2-devel] [PATCH 0/2] UefiCpuPkg/Library: Fix bug in MpInitLib
Date: Wed, 26 Feb 2020 15:46:27 +0000 [thread overview]
Message-ID: <BN6PR12MB19227C6161676E3D74706610F9EA0@BN6PR12MB1922.namprd12.prod.outlook.com> (raw)
In-Reply-To: <BN6PR12MB1922399E3AD30CDE5AE36A80F9EA0@BN6PR12MB1922.namprd12.prod.outlook.com>
BTW,
I also considered adding a flag to CPU_MP_DATA to make the usage of PlatformId a bit more explicit.
E.g., something like CpuMpData->CpuData[ProcessorNumber].IsValidPlatformId... So the init code would look like this:
//
// NOTE: PlatformId is not relevant on AMD platforms.
//
if (StandardSignatureIsAuthenticAMD ()) {
CpuMpData->CpuData[ProcessorNumber].IsValidPlatformId = FALSE;
else {
PlatformIdMsr.Uint64 = AsmReadMsr64 (MSR_IA32_PLATFORM_ID);
CpuMpData->CpuData[ProcessorNumber].PlatformId = (UINT8)PlatformIdMsr.Bits.PlatformId;
CpuMpData->CpuData[ProcessorNumber].IsValidPlatformId = TRUE;
}
This way "IsValidPlatformId" could be checked prior to using "PlatformId".
Anyway, that seemed a bit overkill, so I opted against it... thoughts?
Leo.
> -----Original Message-----
> From: Duran, Leo
> Sent: Wednesday, February 26, 2020 10:25 AM
> To: Ni, Ray <ray.ni@intel.com>; Laszlo Ersek <lersek@redhat.com>;
> devel@edk2.groups.io; Wu, Hao A <hao.a.wu@intel.com>; Fu, Siyuan
> <siyuan.fu@intel.com>
> Cc: Dong, Eric <eric.dong@intel.com>
> Subject: RE: [edk2-devel] [PATCH 0/2] UefiCpuPkg/Library: Fix bug in
> MpInitLib
>
>
>
> > -----Original Message-----
> > From: Ni, Ray [mailto:ray.ni@intel.com]
> > Sent: Wednesday, February 26, 2020 2:57 AM
> > To: Laszlo Ersek <lersek@redhat.com>; devel@edk2.groups.io; Duran, Leo
> > <leo.duran@amd.com>; Wu, Hao A <hao.a.wu@intel.com>; Fu, Siyuan
> > <siyuan.fu@intel.com>
> > Cc: Dong, Eric <eric.dong@intel.com>
> > Subject: RE: [edk2-devel] [PATCH 0/2] UefiCpuPkg/Library: Fix bug in
> > MpInitLib
> >
> > Leo,
> >
> > > > BTW, reading the PlatformId MSR was already being done by
> > > > MicrocodeDetect(), but it never affected AMD-based platforms as
> > > > the flow never gets that far, since the Detect routine bails out
> > > > early when it
> > finds the size of the patch is zero.
> >
> > You are saying that PlatformId MSR access is not performed by CPU in
> > old code because of the zero size uCode.
> > But now with Hao or Siyuan's change, the PlatformId MSR access is
> > always performed even when there is no uCode. It sounds like a
> > regression to optimization to me.
> > Did you evaluate the path to avoid accessing PlatformID MSR when uCode
> > doesn't exist? So that the API to detect AMD processor is not needed at all.
> [Duran, Leo]
> Hi Ray,
> I think your summary is pretty accurate, except that I'd say that avoiding a
> READ from the PlatformId MSR should happen solely based on the fact that
> the MSR simply does not exist on AMD processors.
> Then as a result of that, the usage of the PlatformId (as it relates to microcode
> or anything else) must then be dealt with separately.
>
> To that end, I think I covered all cases where the MSR is being read, and also
> where PlatformId is being used.
> (I also added comments for each case)
>
> Thanks,
> Leo.
>
> >
> > Thanks,
> > Ray
next prev parent reply other threads:[~2020-02-26 15:46 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-02-25 19:39 [PATCH 0/2] UefiCpuPkg/Library: Fix bug in MpInitLib Leo Duran
2020-02-25 19:39 ` [PATCH 1/2] UefiCpuPkg: LocalApicLib: Export StandardSignatureIsAuthenticAMD function Leo Duran
2020-02-26 1:13 ` Dong, Eric
2020-02-26 2:41 ` Duran, Leo
2020-02-26 5:05 ` Dong, Eric
2020-02-26 10:13 ` [edk2-devel] " Laszlo Ersek
2020-02-26 15:03 ` Duran, Leo
2020-02-26 16:19 ` Laszlo Ersek
2020-02-26 15:59 ` Duran, Leo
2020-02-25 19:39 ` [PATCH 2/2] UefiCpuPkg: MpInitLib: Exclude code no pertinent to AMD processors Leo Duran
2020-02-26 7:45 ` Ni, Ray
2020-02-26 7:56 ` Siyuan, Fu
2020-02-26 0:54 ` [edk2-devel] [PATCH 0/2] UefiCpuPkg/Library: Fix bug in MpInitLib Laszlo Ersek
2020-02-26 7:57 ` Ni, Ray
2020-02-26 8:56 ` Liming Gao
2020-02-26 15:11 ` Duran, Leo
2020-02-26 16:24 ` Laszlo Ersek
2020-02-26 16:35 ` Duran, Leo
2020-02-26 15:25 ` Duran, Leo
2020-02-26 15:46 ` Duran, Leo [this message]
2020-02-26 16:20 ` Laszlo Ersek
2020-02-26 16:39 ` Duran, Leo
2020-02-26 16:46 ` Duran, Leo
2020-02-26 17:45 ` Laszlo Ersek
2020-02-26 17:51 ` Duran, Leo
2020-02-27 5:55 ` Ni, Ray
2020-02-27 18:17 ` Duran, Leo
2020-02-28 6:47 ` Ni, Ray
2020-02-28 16:38 ` Duran, Leo
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=BN6PR12MB19227C6161676E3D74706610F9EA0@BN6PR12MB1922.namprd12.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