public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] UefiCpuPkg/PiSmmCpu: Fix GCC7/GCC8 build failure
@ 2019-07-11  1:16 Ni, Ray
  2019-07-11  2:09 ` Dong, Eric
  2019-07-11 10:02 ` Laszlo Ersek
  0 siblings, 2 replies; 4+ messages in thread
From: Ni, Ray @ 2019-07-11  1:16 UTC (permalink / raw)
  To: devel; +Cc: Michael D Kinney, Eric Dong, Laszlo Ersek

Signed-off-by: Ray Ni <ray.ni@intel.com>
Cc: Michael D Kinney <michael.d.kinney@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
---
 UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c b/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c
index c31160735a..a3b62f7787 100644
--- a/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c
+++ b/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c
@@ -571,7 +571,7 @@ ReclaimPages (
   //
   // First, find the leaf entry has the smallest access record value
   //
-  for (Pml5Index = 0; Pml5Index < Enable5LevelPaging ? (EFI_PAGE_SIZE / sizeof (*Pml4)) : 1; Pml5Index++) {
+  for (Pml5Index = 0; Pml5Index < (Enable5LevelPaging ? (EFI_PAGE_SIZE / sizeof (*Pml4)) : 1); Pml5Index++) {
     if ((Pml5[Pml5Index] & IA32_PG_P) == 0 || (Pml5[Pml5Index] & IA32_PG_PMNT) != 0) {
       //
       // If the PML5 entry is not present or is masked, skip it
-- 
2.21.0.windows.1


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

* Re: [PATCH] UefiCpuPkg/PiSmmCpu: Fix GCC7/GCC8 build failure
  2019-07-11  1:16 [PATCH] UefiCpuPkg/PiSmmCpu: Fix GCC7/GCC8 build failure Ni, Ray
@ 2019-07-11  2:09 ` Dong, Eric
  2019-07-11 10:02 ` Laszlo Ersek
  1 sibling, 0 replies; 4+ messages in thread
From: Dong, Eric @ 2019-07-11  2:09 UTC (permalink / raw)
  To: Ni, Ray, devel@edk2.groups.io; +Cc: Kinney, Michael D, Laszlo Ersek

Reviewed-by: Eric Dong <eric.dong@intel.com>

> -----Original Message-----
> From: Ni, Ray
> Sent: Thursday, July 11, 2019 9:17 AM
> To: devel@edk2.groups.io
> Cc: Kinney, Michael D <michael.d.kinney@intel.com>; Dong, Eric
> <eric.dong@intel.com>; Laszlo Ersek <lersek@redhat.com>
> Subject: [PATCH] UefiCpuPkg/PiSmmCpu: Fix GCC7/GCC8 build failure
> 
> Signed-off-by: Ray Ni <ray.ni@intel.com>
> Cc: Michael D Kinney <michael.d.kinney@intel.com>
> Cc: Eric Dong <eric.dong@intel.com>
> Cc: Laszlo Ersek <lersek@redhat.com>
> ---
>  UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c
> b/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c
> index c31160735a..a3b62f7787 100644
> --- a/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c
> +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c
> @@ -571,7 +571,7 @@ ReclaimPages (
>    //
>    // First, find the leaf entry has the smallest access record value
>    //
> -  for (Pml5Index = 0; Pml5Index < Enable5LevelPaging ? (EFI_PAGE_SIZE /
> sizeof (*Pml4)) : 1; Pml5Index++) {
> +  for (Pml5Index = 0; Pml5Index < (Enable5LevelPaging ? (EFI_PAGE_SIZE /
> sizeof (*Pml4)) : 1); Pml5Index++) {
>      if ((Pml5[Pml5Index] & IA32_PG_P) == 0 || (Pml5[Pml5Index] &
> IA32_PG_PMNT) != 0) {
>        //
>        // If the PML5 entry is not present or is masked, skip it
> --
> 2.21.0.windows.1


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

* Re: [PATCH] UefiCpuPkg/PiSmmCpu: Fix GCC7/GCC8 build failure
  2019-07-11  1:16 [PATCH] UefiCpuPkg/PiSmmCpu: Fix GCC7/GCC8 build failure Ni, Ray
  2019-07-11  2:09 ` Dong, Eric
@ 2019-07-11 10:02 ` Laszlo Ersek
  2019-07-11 12:14   ` Laszlo Ersek
  1 sibling, 1 reply; 4+ messages in thread
From: Laszlo Ersek @ 2019-07-11 10:02 UTC (permalink / raw)
  To: Ray Ni, devel; +Cc: Michael D Kinney, Eric Dong

Hello Ray,

On 07/11/19 03:16, Ray Ni wrote:
> Signed-off-by: Ray Ni <ray.ni@intel.com>
> Cc: Michael D Kinney <michael.d.kinney@intel.com>
> Cc: Eric Dong <eric.dong@intel.com>
> Cc: Laszlo Ersek <lersek@redhat.com>
> ---
>  UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c b/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c
> index c31160735a..a3b62f7787 100644
> --- a/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c
> +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c
> @@ -571,7 +571,7 @@ ReclaimPages (
>    //
>    // First, find the leaf entry has the smallest access record value
>    //
> -  for (Pml5Index = 0; Pml5Index < Enable5LevelPaging ? (EFI_PAGE_SIZE / sizeof (*Pml4)) : 1; Pml5Index++) {
> +  for (Pml5Index = 0; Pml5Index < (Enable5LevelPaging ? (EFI_PAGE_SIZE / sizeof (*Pml4)) : 1); Pml5Index++) {
>      if ((Pml5[Pml5Index] & IA32_PG_P) == 0 || (Pml5[Pml5Index] & IA32_PG_PMNT) != 0) {
>        //
>        // If the PML5 entry is not present or is masked, skip it
> 

This is not a GCC7/GCC8 build failure, but a genuine bug in the code
that GCC7/GCC8 helpfully reported.

The conditional operator ?: has weaker precedence than the relational
operator <, and so the patch incurs a behavioral change -- thus, it is a
bugfix.

If we were only adding the parentheses to reinforce the operator
bingings that are already in place, i.e., preserving the behavior,
*then* we could call this a "build failure".


(1) Please update the subject accordingly, for example:

UefiCpuPkg/PiSmmCpuDxeSmm: ReclaimPages: fix incorrect operator binding

(71 characters)


(2) I'd suggest also adding, to the commit message body:

Fixes: 7365eb2c8cf1d7112330d09918c0c67e8d0b827a

With those:

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

Thanks
Laszlo

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

* Re: [PATCH] UefiCpuPkg/PiSmmCpu: Fix GCC7/GCC8 build failure
  2019-07-11 10:02 ` Laszlo Ersek
@ 2019-07-11 12:14   ` Laszlo Ersek
  0 siblings, 0 replies; 4+ messages in thread
From: Laszlo Ersek @ 2019-07-11 12:14 UTC (permalink / raw)
  To: Ray Ni, devel; +Cc: Michael D Kinney, Eric Dong

On 07/11/19 12:02, Laszlo Ersek wrote:
> Hello Ray,
> 
> On 07/11/19 03:16, Ray Ni wrote:
>> Signed-off-by: Ray Ni <ray.ni@intel.com>
>> Cc: Michael D Kinney <michael.d.kinney@intel.com>
>> Cc: Eric Dong <eric.dong@intel.com>
>> Cc: Laszlo Ersek <lersek@redhat.com>
>> ---
>>  UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c b/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c
>> index c31160735a..a3b62f7787 100644
>> --- a/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c
>> +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c
>> @@ -571,7 +571,7 @@ ReclaimPages (
>>    //
>>    // First, find the leaf entry has the smallest access record value
>>    //
>> -  for (Pml5Index = 0; Pml5Index < Enable5LevelPaging ? (EFI_PAGE_SIZE / sizeof (*Pml4)) : 1; Pml5Index++) {
>> +  for (Pml5Index = 0; Pml5Index < (Enable5LevelPaging ? (EFI_PAGE_SIZE / sizeof (*Pml4)) : 1); Pml5Index++) {
>>      if ((Pml5[Pml5Index] & IA32_PG_P) == 0 || (Pml5[Pml5Index] & IA32_PG_PMNT) != 0) {
>>        //
>>        // If the PML5 entry is not present or is masked, skip it
>>
> 
> This is not a GCC7/GCC8 build failure, but a genuine bug in the code
> that GCC7/GCC8 helpfully reported.
> 
> The conditional operator ?: has weaker precedence than the relational
> operator <, and so the patch incurs a behavioral change -- thus, it is a
> bugfix.
> 
> If we were only adding the parentheses to reinforce the operator
> bingings that are already in place, i.e., preserving the behavior,
> *then* we could call this a "build failure".
> 
> 
> (1) Please update the subject accordingly, for example:
> 
> UefiCpuPkg/PiSmmCpuDxeSmm: ReclaimPages: fix incorrect operator binding
> 
> (71 characters)
> 
> 
> (2) I'd suggest also adding, to the commit message body:
> 
> Fixes: 7365eb2c8cf1d7112330d09918c0c67e8d0b827a
> 
> With those:
> 
> Reviewed-by: Laszlo Ersek <lersek@redhat.com>

IMPORTANT: please do not push this patch before you revert and reapply
7365eb2c8cf1; otherwise we'll get into a huge mess. Please see here:

https://edk2.groups.io/g/devel/message/43599

(Namely, if you apply this patch on top of 7365eb2c8cf1, then you won't
be able to revert 7365eb2c8cf1, which is a pre-requisite for reverting
7c5010c7f88b.)

Thanks
Laszlo

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

end of thread, other threads:[~2019-07-11 12:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-07-11  1:16 [PATCH] UefiCpuPkg/PiSmmCpu: Fix GCC7/GCC8 build failure Ni, Ray
2019-07-11  2:09 ` Dong, Eric
2019-07-11 10:02 ` Laszlo Ersek
2019-07-11 12:14   ` Laszlo Ersek

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