From: "Ni, Ray" <ray.ni@intel.com>
To: "devel@edk2.groups.io" <devel@edk2.groups.io>,
"Ni, Ray" <ray.ni@intel.com>, "Tan, Dun" <dun.tan@intel.com>
Cc: "Dong, Eric" <eric.dong@intel.com>,
"Kumar, Rahul R" <rahul.r.kumar@intel.com>,
Gerd Hoffmann <kraxel@redhat.com>,
"Chen, Xiao X" <xiao.x.chen@intel.com>
Subject: Re: [edk2-devel] [PATCH 1/3] UefiCpuPkg: Update code to support enable ProcTrace only on BSP
Date: Tue, 25 Apr 2023 06:05:56 +0000 [thread overview]
Message-ID: <MN6PR11MB824474816352313EB7556E828C649@MN6PR11MB8244.namprd11.prod.outlook.com> (raw)
In-Reply-To: <1759183F15FD97B2.10313@groups.io>
By the way, I know that ProcTraceInitialize() runs on BSP so it's safe to access the PCD database.
But to be consistent with the old logic, can you please cache the PCD value in ProcTraceGetConfigData()?
It has slight benefit that the PCD is only accessed once not multiple times depending on cpu count.
> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Ni, Ray
> Sent: Tuesday, April 25, 2023 2:03 PM
> To: Tan, Dun <dun.tan@intel.com>; devel@edk2.groups.io
> Cc: Dong, Eric <eric.dong@intel.com>; Kumar, Rahul R
> <rahul.r.kumar@intel.com>; Gerd Hoffmann <kraxel@redhat.com>; Chen,
> Xiao X <xiao.x.chen@intel.com>
> Subject: Re: [edk2-devel] [PATCH 1/3] UefiCpuPkg: Update code to support
> enable ProcTrace only on BSP
>
> > - gUefiCpuPkgTokenSpaceGuid.PcdCpuClockModulationDutyCycle ##
> > SOMETIMES_CONSUMES
> > - gUefiCpuPkgTokenSpaceGuid.PcdIsPowerOnReset ##
> > SOMETIMES_CONSUMES
> > - gUefiCpuPkgTokenSpaceGuid.PcdCpuProcTraceOutputScheme ##
> > SOMETIMES_CONSUMES
> > - gUefiCpuPkgTokenSpaceGuid.PcdCpuProcTraceMemSize ##
> > SOMETIMES_CONSUMES
> > + gUefiCpuPkgTokenSpaceGuid.PcdCpuClockModulationDutyCycle ##
> > SOMETIMES_CONSUMES
> > + gUefiCpuPkgTokenSpaceGuid.PcdIsPowerOnReset ##
> > SOMETIMES_CONSUMES
> > + gUefiCpuPkgTokenSpaceGuid.PcdCpuProcTraceOutputScheme ##
> > SOMETIMES_CONSUMES
> > + gUefiCpuPkgTokenSpaceGuid.PcdCpuProcTraceMemSize ##
> > SOMETIMES_CONSUMES
> > + gUefiCpuPkgTokenSpaceGuid.PcdEnableProcessorTraceOnBspOnly ##
>
> 1. PcdCpuProcTraceBspOnly? This is to use the same prefix as other
> ProcTrace PCDs.
>
>
> >
> > + IsBsp = (CpuInfo->ProcessorInfo.StatusFlag & BIT0) ? TRUE : FALSE;
> 2. Can you use PROCESSOR_AS_BSP_BIT instead of BIT0?
>
>
> > + EnableOnBspOnly = (PcdGetBool (PcdEnableProcessorTraceOnBspOnly)) ?
> > TRUE : FALSE;
>
> 3. why not directly use PcdGetBool (PcdEnableProcessorTraceOnBspOnly) in
> below if-check?
>
> > +
> > + if (EnableOnBspOnly && (IsBsp == FALSE)) {
>
> 4. Change "IsBsp == FALSE" to "!IsBsp".
>
>
>
>
> > + if (EnableOnBspOnly) {
> > AlignedAddress = (UINTN)AllocateAlignedReservedPages (Pages,
> > Alignment);
> > if (AlignedAddress == 0) {
> > - DEBUG ((DEBUG_ERROR, "ProcTrace: Out of mem, allocated only
> for %d
> > threads\n", ProcTraceData->AllocatedThreads));
> > - if (Index == 0) {
> > - //
> > - // Could not allocate for BSP even
> > - //
> > - FreePool ((VOID *)ThreadMemRegionTable);
> > - ThreadMemRegionTable = NULL;
> > - return RETURN_OUT_OF_RESOURCES;
> > + //
> > + // Could not allocate for BSP even
> > + //
> > + DEBUG ((DEBUG_ERROR, "ProcTrace: Out of mem, failed to allocate
> > buffer for BSP\n"));
> > + return RETURN_OUT_OF_RESOURCES;
> > + }
> > +
> > + DEBUG ((DEBUG_INFO, "ProcTrace: Allocated PT mem for BSP
> only.\n"));
>
> 5. AlignedAddress is the proc trace buffer for BSP. But it seems the value is
> not used in
> later MSR_IA32_RTIT_OUTPUT_BASE programming.
> Similar comments to the Topa code path.
>
>
>
>
>
next prev parent reply other threads:[~2023-04-25 6:06 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-25 5:47 [PATCH 0/3] Update ProcTrace feature code for new requirements duntan
2023-04-25 5:47 ` [PATCH 1/3] UefiCpuPkg: Update code to support enable ProcTrace only on BSP duntan
2023-04-25 6:03 ` Ni, Ray
[not found] ` <1759183F15FD97B2.10313@groups.io>
2023-04-25 6:05 ` Ni, Ray [this message]
2023-04-25 6:45 ` [edk2-devel] " duntan
2023-04-25 5:47 ` [PATCH 2/3] UefiCpuPkg: Update PT code to support enable collect performance duntan
2023-04-25 6:13 ` Ni, Ray
2023-04-25 6:45 ` duntan
2023-04-25 5:47 ` [PATCH 3/3] UefiCpuPkg: Disable MTC packet by default duntan
2023-04-25 6:14 ` [edk2-devel] " Ni, Ray
2023-04-25 6:45 ` duntan
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=MN6PR11MB824474816352313EB7556E828C649@MN6PR11MB8244.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