[edk2-devel] [PATCH v2 10/10] MdePkg: use CpuPause() in CpuDeadLoop()

Ankur Arora posted 10 patches 3 years, 10 months ago
There is a newer version of this series
[edk2-devel] [PATCH v2 10/10] MdePkg: use CpuPause() in CpuDeadLoop()
Posted by Ankur Arora 3 years, 10 months ago
Use CpuPause() to allow the CPU to go into a lower power state
state while we spin wait.

Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Zhiguang Liu <zhiguang.liu@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Igor Mammedov <imammedo@redhat.com>
Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Cc: Aaron Young <aaron.young@oracle.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3132
Signed-off-by: Ankur Arora <ankur.a.arora@oracle.com>
---
 MdePkg/Library/BaseLib/CpuDeadLoop.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/MdePkg/Library/BaseLib/CpuDeadLoop.c b/MdePkg/Library/BaseLib/CpuDeadLoop.c
index 9e110cacbc96..e76312de7b4e 100644
--- a/MdePkg/Library/BaseLib/CpuDeadLoop.c
+++ b/MdePkg/Library/BaseLib/CpuDeadLoop.c
@@ -28,5 +28,6 @@ CpuDeadLoop (
 {
   volatile UINTN  Index;
 
-  for (Index = 0; Index == 0;);
+  for (Index = 0; Index == 0;)
+  	CpuPause();
 }
-- 
2.9.3



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#69980): https://edk2.groups.io/g/devel/message/69980
Mute This Topic: https://groups.io/mt/79507581/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-


Re: [edk2-devel] [PATCH v2 10/10] MdePkg: use CpuPause() in CpuDeadLoop()
Posted by Michael D Kinney 3 years, 10 months ago
Looks like a good improvement.  One minor comment is that the loop 
should have {} to follow coding style:

  for (Index = 0; Index == 0;) {
    CpuPause();
  }

With that change:

Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>

Mike

> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Ankur Arora
> Sent: Thursday, January 7, 2021 11:55 AM
> To: devel@edk2.groups.io
> Cc: lersek@redhat.com; imammedo@redhat.com; boris.ostrovsky@oracle.com; Ankur Arora <ankur.a.arora@oracle.com>; Kinney,
> Michael D <michael.d.kinney@intel.com>; Liming Gao <gaoliming@byosoft.com.cn>; Liu, Zhiguang <zhiguang.liu@intel.com>;
> Aaron Young <aaron.young@oracle.com>
> Subject: [edk2-devel] [PATCH v2 10/10] MdePkg: use CpuPause() in CpuDeadLoop()
> 
> Use CpuPause() to allow the CPU to go into a lower power state
> state while we spin wait.
> 
> Cc: Michael D Kinney <michael.d.kinney@intel.com>
> Cc: Liming Gao <gaoliming@byosoft.com.cn>
> Cc: Zhiguang Liu <zhiguang.liu@intel.com>
> Cc: Laszlo Ersek <lersek@redhat.com>
> Cc: Igor Mammedov <imammedo@redhat.com>
> Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
> Cc: Aaron Young <aaron.young@oracle.com>
> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3132
> Signed-off-by: Ankur Arora <ankur.a.arora@oracle.com>
> ---
>  MdePkg/Library/BaseLib/CpuDeadLoop.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/MdePkg/Library/BaseLib/CpuDeadLoop.c b/MdePkg/Library/BaseLib/CpuDeadLoop.c
> index 9e110cacbc96..e76312de7b4e 100644
> --- a/MdePkg/Library/BaseLib/CpuDeadLoop.c
> +++ b/MdePkg/Library/BaseLib/CpuDeadLoop.c
> @@ -28,5 +28,6 @@ CpuDeadLoop (
>  {
> 
>    volatile UINTN  Index;
> 
> 
> 
> -  for (Index = 0; Index == 0;);
> 
> +  for (Index = 0; Index == 0;)
> 
> +  	CpuPause();> 
>  }
> 
> --
> 2.9.3
> 
> 
> 
> -=-=-=-=-=-=
> Groups.io Links: You receive all messages sent to this group.
> View/Reply Online (#69980): https://edk2.groups.io/g/devel/message/69980
> Mute This Topic: https://groups.io/mt/79507581/1643496
> Group Owner: devel+owner@edk2.groups.io
> Unsubscribe: https://edk2.groups.io/g/devel/unsub [michael.d.kinney@intel.com]
> -=-=-=-=-=-=
> 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#69990): https://edk2.groups.io/g/devel/message/69990
Mute This Topic: https://groups.io/mt/79507581/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-


Re: [edk2-devel] [PATCH v2 10/10] MdePkg: use CpuPause() in CpuDeadLoop()
Posted by Ankur Arora 3 years, 10 months ago
On 2021-01-07 2:30 p.m., Kinney, Michael D wrote:
> Looks like a good improvement.  One minor comment is that the loop
> should have {} to follow coding style:
> 
>    for (Index = 0; Index == 0;) {
>      CpuPause();
>    }
> 
> With that change:
> 
> Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>

Thanks. Will fix up the coding style and resend with the rest of the series.

Ankur

> 
> Mike
> 
>> -----Original Message-----
>> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Ankur Arora
>> Sent: Thursday, January 7, 2021 11:55 AM
>> To: devel@edk2.groups.io
>> Cc: lersek@redhat.com; imammedo@redhat.com; boris.ostrovsky@oracle.com; Ankur Arora <ankur.a.arora@oracle.com>; Kinney,
>> Michael D <michael.d.kinney@intel.com>; Liming Gao <gaoliming@byosoft.com.cn>; Liu, Zhiguang <zhiguang.liu@intel.com>;
>> Aaron Young <aaron.young@oracle.com>
>> Subject: [edk2-devel] [PATCH v2 10/10] MdePkg: use CpuPause() in CpuDeadLoop()
>>
>> Use CpuPause() to allow the CPU to go into a lower power state
>> state while we spin wait.
>>
>> Cc: Michael D Kinney <michael.d.kinney@intel.com>
>> Cc: Liming Gao <gaoliming@byosoft.com.cn>
>> Cc: Zhiguang Liu <zhiguang.liu@intel.com>
>> Cc: Laszlo Ersek <lersek@redhat.com>
>> Cc: Igor Mammedov <imammedo@redhat.com>
>> Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
>> Cc: Aaron Young <aaron.young@oracle.com>
>> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3132
>> Signed-off-by: Ankur Arora <ankur.a.arora@oracle.com>
>> ---
>>   MdePkg/Library/BaseLib/CpuDeadLoop.c | 3 ++-
>>   1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/MdePkg/Library/BaseLib/CpuDeadLoop.c b/MdePkg/Library/BaseLib/CpuDeadLoop.c
>> index 9e110cacbc96..e76312de7b4e 100644
>> --- a/MdePkg/Library/BaseLib/CpuDeadLoop.c
>> +++ b/MdePkg/Library/BaseLib/CpuDeadLoop.c
>> @@ -28,5 +28,6 @@ CpuDeadLoop (
>>   {
>>
>>     volatile UINTN  Index;
>>
>>
>>
>> -  for (Index = 0; Index == 0;);
>>
>> +  for (Index = 0; Index == 0;)
>>
>> +  	CpuPause();>
>>   }
>>
>> --
>> 2.9.3
>>
>>
>>
>> -=-=-=-=-=-=
>> Groups.io Links: You receive all messages sent to this group.
>> View/Reply Online (#69980): https://edk2.groups.io/g/devel/message/69980
>> Mute This Topic: https://groups.io/mt/79507581/1643496
>> Group Owner: devel+owner@edk2.groups.io
>> Unsubscribe: https://edk2.groups.io/g/devel/unsub [michael.d.kinney@intel.com]
>> -=-=-=-=-=-=
>>
> 


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#69993): https://edk2.groups.io/g/devel/message/69993
Mute This Topic: https://groups.io/mt/79507581/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-