public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Ni, Ruiyu" <ruiyu.ni@intel.com>
To: "Dong, Eric" <eric.dong@intel.com>,
	"Yao, Jiewen" <jiewen.yao@intel.com>,
	 "edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Cc: Laszlo Ersek <lersek@redhat.com>
Subject: Re: [Patch 1/3] UefiCpuPkg/RegisterCpuFeaturesLib: Avoid AP calls PeiService.
Date: Thu, 20 Dec 2018 02:06:34 +0000	[thread overview]
Message-ID: <734D49CCEBEEF84792F5B80ED585239D5BF673E1@SHSMSX104.ccr.corp.intel.com> (raw)
In-Reply-To: <ED077930C258884BBCB450DB737E662259D647B1@shsmsx102.ccr.corp.intel.com>

Can you just change the AcquireSpinLock() behavior to remove the Timeout PCD consumption?

I haven't seen a real case that the timed acquisition of spin lock is needed.


Thanks/Ray

> -----Original Message-----
> From: Dong, Eric <eric.dong@intel.com>
> Sent: Thursday, December 20, 2018 9:23 AM
> To: Yao, Jiewen <jiewen.yao@intel.com>; edk2-devel@lists.01.org
> Cc: Ni, Ruiyu <ruiyu.ni@intel.com>; Laszlo Ersek <lersek@redhat.com>
> Subject: RE: [edk2] [Patch 1/3] UefiCpuPkg/RegisterCpuFeaturesLib: Avoid
> AP calls PeiService.
> 
> 
> Agreed, Maybe it's time to add a new API like
> AcquireSpinLockWithoutTimeOut?
> 
> Thanks,
> Eric
> > -----Original Message-----
> > From: Yao, Jiewen
> > Sent: Thursday, December 20, 2018 9:19 AM
> > To: Dong, Eric <eric.dong@intel.com>; edk2-devel@lists.01.org
> > Cc: Ni, Ruiyu <ruiyu.ni@intel.com>; Laszlo Ersek <lersek@redhat.com>
> > Subject: RE: [edk2] [Patch 1/3] UefiCpuPkg/RegisterCpuFeaturesLib:
> > Avoid AP calls PeiService.
> >
> > Hi
> > If we think below code is generic, can we have an API for that?
> >
> > +      //
> > +      // Wait for the AP to release the MSR spin lock.
> > +      //
> > +      while (!AcquireSpinLockOrFail (&CpuFlags->ConsoleLogLock)) {
> > +        CpuPause ();
> > +      }
> >
> >
> >
> >
> > > -----Original Message-----
> > > From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf
> > > Of Eric Dong
> > > Sent: Thursday, December 20, 2018 9:16 AM
> > > To: edk2-devel@lists.01.org
> > > Cc: Ni, Ruiyu <ruiyu.ni@intel.com>; Laszlo Ersek <lersek@redhat.com>
> > > Subject: [edk2] [Patch 1/3] UefiCpuPkg/RegisterCpuFeaturesLib: Avoid
> > > AP calls PeiService.
> > >
> > > In AcquireSpinLock function, it calls GetPerformanceCounter which
> > > final calls PeiService service. This patch avoid to call
> > > AcquireSpinLock function.
> > >
> > > BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1411
> > >
> > > Cc: Ruiyu Ni <ruiyu.ni@intel.com>
> > > Cc: Laszlo Ersek <lersek@redhat.com>
> > > Contributed-under: TianoCore Contribution Agreement 1.1
> > > Signed-off-by: Eric Dong <eric.dong@intel.com>
> > > ---
> > >  UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c |
> > > 7
> > > ++++++-
> > >  1 file changed, 6 insertions(+), 1 deletion(-)
> > >
> > > diff --git
> > > a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
> > > b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
> > > index 624ddee055..a64326239f 100644
> > > ---
> > > a/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.c
> > > +++ b/UefiCpuPkg/Library/RegisterCpuFeaturesLib/CpuFeaturesInitialize.
> > > +++ c
> > > @@ -832,7 +832,12 @@ ProgramProcessorRegister (
> > >      RegisterTableEntry = &RegisterTableEntryHead[Index];
> > >
> > >      DEBUG_CODE_BEGIN ();
> > > -      AcquireSpinLock (&CpuFlags->ConsoleLogLock);
> > > +      //
> > > +      // Wait for the AP to release the MSR spin lock.
> > > +      //
> > > +      while (!AcquireSpinLockOrFail (&CpuFlags->ConsoleLogLock)) {
> > > +        CpuPause ();
> > > +      }
> > >        ThreadIndex = ApLocation->Package * CpuStatus->MaxCoreCount *
> > > CpuStatus->MaxThreadCount +
> > >                ApLocation->Core * CpuStatus->MaxThreadCount +
> > >                ApLocation->Thread;
> > > --
> > > 2.15.0.windows.1
> > >
> > > _______________________________________________
> > > edk2-devel mailing list
> > > edk2-devel@lists.01.org
> > > https://lists.01.org/mailman/listinfo/edk2-devel


  reply	other threads:[~2018-12-20  2:06 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-20  1:15 [Patch 0/3] Avoid AP calls PeiService Eric Dong
2018-12-20  1:15 ` [Patch 1/3] UefiCpuPkg/RegisterCpuFeaturesLib: " Eric Dong
2018-12-20  1:19   ` Yao, Jiewen
2018-12-20  1:22     ` Dong, Eric
2018-12-20  2:06       ` Ni, Ruiyu [this message]
2018-12-20  2:08         ` Yao, Jiewen
2018-12-20 16:36           ` Brian J. Johnson
2018-12-21  2:06             ` Dong, Eric
2019-01-09  5:26             ` Dong, Eric
2019-01-09 10:35               ` Laszlo Ersek
2019-01-10  5:53                 ` Dong, Eric
     [not found]                 ` <734D49CCEBEEF84792F5B80ED585239D5BFAE3BF@SHSMSX103.ccr.corp.intel.com>
2019-01-10 12:51                   ` Laszlo Ersek
2018-12-20  1:15 ` [Patch 2/3] " Eric Dong
2018-12-20  1:15 ` [Patch 3/3] UefiCpuPkg/RegisterCpuFeaturesLib: Remove useless function Eric Dong
2018-12-20  2:03   ` Ni, Ruiyu

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=734D49CCEBEEF84792F5B80ED585239D5BF673E1@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