public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [Patch] UefiCpuPkg/MpInitLib: Keep compatible with former solution.
@ 2017-10-26  5:59 Eric Dong
  2017-10-26  8:25 ` Laszlo Ersek
  0 siblings, 1 reply; 4+ messages in thread
From: Eric Dong @ 2017-10-26  5:59 UTC (permalink / raw)
  To: edk2-devel; +Cc: Ruiyu Ni, Laszlo Ersek, Jeff Fan

For some special platforms (such as Ovmf), it is possible
that, some APs start up *and finish* before the remaining
APs not start up *at all*. In this case, the enhance
solution by changes 0594ec41 not works as expected.

This change remove check CpuMpData->CpuCount logic to let old
solution still workable if platform owner still set a long
time for PcdCpuApInitTimeOutInMicroSeconds. It's platform
owner's response to decide which solution to use.

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Jeff Fan <vanjeff_919@hotmail.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Eric Dong <eric.dong@intel.com>
---
 UefiCpuPkg/Library/MpInitLib/MpLib.c | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c b/UefiCpuPkg/Library/MpInitLib/MpLib.c
index 48f930b..18060fd 100644
--- a/UefiCpuPkg/Library/MpInitLib/MpLib.c
+++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c
@@ -936,15 +936,20 @@ WakeUpAP (
     }
     if (CpuMpData->InitFlag == ApInitConfig) {
       //
-      // Wait for one potential AP waken up in one specified period
+      // Here support two methods to collect AP count through adjust
+      // PcdCpuApInitTimeOutInMicroSeconds values.
       //
-      if (CpuMpData->CpuCount == 0) {
-        TimedWaitForApFinish (
-          CpuMpData,
-          PcdGet32 (PcdCpuMaxLogicalProcessorNumber) - 1,
-          PcdGet32 (PcdCpuApInitTimeOutInMicroSeconds)
-          );
-      }
+      // one way is set a value to just let the first AP to start the
+      // initialization, then through the later while loop to wait all Aps
+      // finsh the initialization.
+      // The other way is set a value to let all APs finished the initialzation.
+      // In this case, the later while loop is useless.
+      //
+      TimedWaitForApFinish (
+        CpuMpData,
+        PcdGet32 (PcdCpuMaxLogicalProcessorNumber) - 1,
+        PcdGet32 (PcdCpuApInitTimeOutInMicroSeconds)
+        );
 
       while (CpuMpData->MpCpuExchangeInfo->NumApsExecuting != 0) {
         CpuPause();
-- 
2.7.0.windows.1



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Patch] UefiCpuPkg/MpInitLib: Keep compatible with former solution.
@ 2017-10-26  7:17 Fan Jeff
  0 siblings, 0 replies; 4+ messages in thread
From: Fan Jeff @ 2017-10-26  7:17 UTC (permalink / raw)
  To: eric.dong@intel.com, edk2-devel@lists.01.org; +Cc: Ruiyu Ni, Laszlo Ersek

Reviewed-by: Jeff Fan <vanjeff_919@hotmail.com<mailto:vanjeff_919@hotmail.com>>



发自我的小米手机
在 Eric Dong <eric.dong@intel.com>,2017年10月26日 下午1:59写道:

For some special platforms (such as Ovmf), it is possible
that, some APs start up *and finish* before the remaining
APs not start up *at all*. In this case, the enhance
solution by changes 0594ec41 not works as expected.

This change remove check CpuMpData->CpuCount logic to let old
solution still workable if platform owner still set a long
time for PcdCpuApInitTimeOutInMicroSeconds. It's platform
owner's response to decide which solution to use.

Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Jeff Fan <vanjeff_919@hotmail.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Eric Dong <eric.dong@intel.com>
---
 UefiCpuPkg/Library/MpInitLib/MpLib.c | 21 +++++++++++++--------
 1 file changed, 13 insertions(+), 8 deletions(-)

diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c b/UefiCpuPkg/Library/MpInitLib/MpLib.c
index 48f930b..18060fd 100644
--- a/UefiCpuPkg/Library/MpInitLib/MpLib.c
+++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c
@@ -936,15 +936,20 @@ WakeUpAP (
     }
     if (CpuMpData->InitFlag == ApInitConfig) {
       //
-      // Wait for one potential AP waken up in one specified period
+      // Here support two methods to collect AP count through adjust
+      // PcdCpuApInitTimeOutInMicroSeconds values.
       //
-      if (CpuMpData->CpuCount == 0) {
-        TimedWaitForApFinish (
-          CpuMpData,
-          PcdGet32 (PcdCpuMaxLogicalProcessorNumber) - 1,
-          PcdGet32 (PcdCpuApInitTimeOutInMicroSeconds)
-          );
-      }
+      // one way is set a value to just let the first AP to start the
+      // initialization, then through the later while loop to wait all Aps
+      // finsh the initialization.
+      // The other way is set a value to let all APs finished the initialzation.
+      // In this case, the later while loop is useless.
+      //
+      TimedWaitForApFinish (
+        CpuMpData,
+        PcdGet32 (PcdCpuMaxLogicalProcessorNumber) - 1,
+        PcdGet32 (PcdCpuApInitTimeOutInMicroSeconds)
+        );

       while (CpuMpData->MpCpuExchangeInfo->NumApsExecuting != 0) {
         CpuPause();
--
2.7.0.windows.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Patch] UefiCpuPkg/MpInitLib: Keep compatible with former solution.
  2017-10-26  5:59 [Patch] UefiCpuPkg/MpInitLib: Keep compatible with former solution Eric Dong
@ 2017-10-26  8:25 ` Laszlo Ersek
  2017-10-27  1:38   ` Dong, Eric
  0 siblings, 1 reply; 4+ messages in thread
From: Laszlo Ersek @ 2017-10-26  8:25 UTC (permalink / raw)
  To: Eric Dong, edk2-devel; +Cc: Ruiyu Ni, Jeff Fan

On 10/26/17 07:59, Eric Dong wrote:
> For some special platforms (such as Ovmf), it is possible
> that, some APs start up *and finish* before the remaining
> APs not start up *at all*. In this case, the enhance

(1) I think the word "not" should be removed from the above line, so
that we get: "some APs start up *and finish* before the remaining APs []
start up *at all*".

(2) For the subject line: can we add "AP counting" or "AP collection"
somehow? For example:

UefiCpuPkg/MpInitLib: Keep compatible with former AP counting solution.


I don't insist, but I think these changes would improve the commit
message. They can be implemented before pushing. Either way,

Reviewed-by: Laszlo Ersek <lersek@redhat.com>

Thank you for the quick update, Eric and Jeff!
Laszlo

> solution by changes 0594ec41 not works as expected.
> 
> This change remove check CpuMpData->CpuCount logic to let old
> solution still workable if platform owner still set a long
> time for PcdCpuApInitTimeOutInMicroSeconds. It's platform
> owner's response to decide which solution to use.
> 
> Cc: Ruiyu Ni <ruiyu.ni@intel.com>
> Cc: Laszlo Ersek <lersek@redhat.com>
> Cc: Jeff Fan <vanjeff_919@hotmail.com>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Eric Dong <eric.dong@intel.com>
> ---
>  UefiCpuPkg/Library/MpInitLib/MpLib.c | 21 +++++++++++++--------
>  1 file changed, 13 insertions(+), 8 deletions(-)
> 
> diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c b/UefiCpuPkg/Library/MpInitLib/MpLib.c
> index 48f930b..18060fd 100644
> --- a/UefiCpuPkg/Library/MpInitLib/MpLib.c
> +++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c
> @@ -936,15 +936,20 @@ WakeUpAP (
>      }
>      if (CpuMpData->InitFlag == ApInitConfig) {
>        //
> -      // Wait for one potential AP waken up in one specified period
> +      // Here support two methods to collect AP count through adjust
> +      // PcdCpuApInitTimeOutInMicroSeconds values.
>        //
> -      if (CpuMpData->CpuCount == 0) {
> -        TimedWaitForApFinish (
> -          CpuMpData,
> -          PcdGet32 (PcdCpuMaxLogicalProcessorNumber) - 1,
> -          PcdGet32 (PcdCpuApInitTimeOutInMicroSeconds)
> -          );
> -      }
> +      // one way is set a value to just let the first AP to start the
> +      // initialization, then through the later while loop to wait all Aps
> +      // finsh the initialization.
> +      // The other way is set a value to let all APs finished the initialzation.
> +      // In this case, the later while loop is useless.
> +      //
> +      TimedWaitForApFinish (
> +        CpuMpData,
> +        PcdGet32 (PcdCpuMaxLogicalProcessorNumber) - 1,
> +        PcdGet32 (PcdCpuApInitTimeOutInMicroSeconds)
> +        );
>  
>        while (CpuMpData->MpCpuExchangeInfo->NumApsExecuting != 0) {
>          CpuPause();
> 



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Patch] UefiCpuPkg/MpInitLib: Keep compatible with former solution.
  2017-10-26  8:25 ` Laszlo Ersek
@ 2017-10-27  1:38   ` Dong, Eric
  0 siblings, 0 replies; 4+ messages in thread
From: Dong, Eric @ 2017-10-27  1:38 UTC (permalink / raw)
  To: Laszlo Ersek, edk2-devel@lists.01.org; +Cc: Ni, Ruiyu

Laszlo,

Update both and pushed the change at 86121874.

Thanks,
Eric

> -----Original Message-----
> From: edk2-devel [mailto:edk2-devel-bounces@lists.01.org] On Behalf Of
> Laszlo Ersek
> Sent: Thursday, October 26, 2017 4:26 PM
> To: Dong, Eric <eric.dong@intel.com>; edk2-devel@lists.01.org
> Cc: Ni, Ruiyu <ruiyu.ni@intel.com>
> Subject: Re: [edk2] [Patch] UefiCpuPkg/MpInitLib: Keep compatible with
> former solution.
> 
> On 10/26/17 07:59, Eric Dong wrote:
> > For some special platforms (such as Ovmf), it is possible that, some
> > APs start up *and finish* before the remaining APs not start up *at
> > all*. In this case, the enhance
> 
> (1) I think the word "not" should be removed from the above line, so that we
> get: "some APs start up *and finish* before the remaining APs [] start up *at
> all*".
> 
> (2) For the subject line: can we add "AP counting" or "AP collection"
> somehow? For example:
> 
> UefiCpuPkg/MpInitLib: Keep compatible with former AP counting solution.
> 
> 
> I don't insist, but I think these changes would improve the commit message.
> They can be implemented before pushing. Either way,
> 
> Reviewed-by: Laszlo Ersek <lersek@redhat.com>
> 
> Thank you for the quick update, Eric and Jeff!
> Laszlo
> 
> > solution by changes 0594ec41 not works as expected.
> >
> > This change remove check CpuMpData->CpuCount logic to let old solution
> > still workable if platform owner still set a long time for
> > PcdCpuApInitTimeOutInMicroSeconds. It's platform owner's response to
> > decide which solution to use.
> >
> > Cc: Ruiyu Ni <ruiyu.ni@intel.com>
> > Cc: Laszlo Ersek <lersek@redhat.com>
> > Cc: Jeff Fan <vanjeff_919@hotmail.com>
> > Contributed-under: TianoCore Contribution Agreement 1.1
> > Signed-off-by: Eric Dong <eric.dong@intel.com>
> > ---
> >  UefiCpuPkg/Library/MpInitLib/MpLib.c | 21 +++++++++++++--------
> >  1 file changed, 13 insertions(+), 8 deletions(-)
> >
> > diff --git a/UefiCpuPkg/Library/MpInitLib/MpLib.c
> > b/UefiCpuPkg/Library/MpInitLib/MpLib.c
> > index 48f930b..18060fd 100644
> > --- a/UefiCpuPkg/Library/MpInitLib/MpLib.c
> > +++ b/UefiCpuPkg/Library/MpInitLib/MpLib.c
> > @@ -936,15 +936,20 @@ WakeUpAP (
> >      }
> >      if (CpuMpData->InitFlag == ApInitConfig) {
> >        //
> > -      // Wait for one potential AP waken up in one specified period
> > +      // Here support two methods to collect AP count through adjust
> > +      // PcdCpuApInitTimeOutInMicroSeconds values.
> >        //
> > -      if (CpuMpData->CpuCount == 0) {
> > -        TimedWaitForApFinish (
> > -          CpuMpData,
> > -          PcdGet32 (PcdCpuMaxLogicalProcessorNumber) - 1,
> > -          PcdGet32 (PcdCpuApInitTimeOutInMicroSeconds)
> > -          );
> > -      }
> > +      // one way is set a value to just let the first AP to start the
> > +      // initialization, then through the later while loop to wait all Aps
> > +      // finsh the initialization.
> > +      // The other way is set a value to let all APs finished the initialzation.
> > +      // In this case, the later while loop is useless.
> > +      //
> > +      TimedWaitForApFinish (
> > +        CpuMpData,
> > +        PcdGet32 (PcdCpuMaxLogicalProcessorNumber) - 1,
> > +        PcdGet32 (PcdCpuApInitTimeOutInMicroSeconds)
> > +        );
> >
> >        while (CpuMpData->MpCpuExchangeInfo->NumApsExecuting != 0) {
> >          CpuPause();
> >
> 
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-10-27  1:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-26  5:59 [Patch] UefiCpuPkg/MpInitLib: Keep compatible with former solution Eric Dong
2017-10-26  8:25 ` Laszlo Ersek
2017-10-27  1:38   ` Dong, Eric
  -- strict thread matches above, loose matches on Subject: below --
2017-10-26  7:17 Fan Jeff

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox