public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH v1] UefiCpuPkg/PiSmmCpuDxeSmm: Fix S3 failure in SmmRestoreCpu
@ 2023-03-13  7:03 Wu, Jiaxin
  2023-03-13  8:44 ` Ni, Ray
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Wu, Jiaxin @ 2023-03-13  7:03 UTC (permalink / raw)
  To: devel; +Cc: Eric Dong, Ray Ni, Zeng Star, Laszlo Ersek, Gerd Hoffmann

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4368

This issue is caused by the commit:
ec07fd0e35d90dbcc36be300a9ceeac29c5de2ad

GetFirstGuidHob() should not be used after exit boot service.

Cc: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Zeng Star <star.zeng@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com>
---
 UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c | 14 +-------------
 1 file changed, 1 insertion(+), 13 deletions(-)

diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c b/UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c
index d408b3f9f7..240eee6a7d 100644
--- a/UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c
+++ b/UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c
@@ -821,23 +821,11 @@ SmmRestoreCpu (
     // First time microcode load and restore MTRRs
     //
     InitializeCpuBeforeRebase ();
   }
 
-  //
-  // Make sure the gSmmBaseHobGuid existence status is the same between normal and S3 boot.
-  //
-  ASSERT (mSmmRelocated == (BOOLEAN)(GetFirstGuidHob (&gSmmBaseHobGuid) != NULL));
-  if (mSmmRelocated != (BOOLEAN)(GetFirstGuidHob (&gSmmBaseHobGuid) != NULL)) {
-    DEBUG ((
-      DEBUG_ERROR,
-      "gSmmBaseHobGuid %a produced in normal boot but %a in S3 boot!",
-      mSmmRelocated ? "is" : "is not",
-      mSmmRelocated ? "is not" : "is"
-      ));
-    CpuDeadLoop ();
-  }
+  DEBUG ((DEBUG_INFO, "SmmRestoreCpu: mSmmRelocated is %d\n", mSmmRelocated));
 
   //
   // Check whether Smm Relocation is done or not.
   // If not, will do the SmmBases Relocation here!!!
   //
-- 
2.16.2.windows.1


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

* Re: [PATCH v1] UefiCpuPkg/PiSmmCpuDxeSmm: Fix S3 failure in SmmRestoreCpu
  2023-03-13  7:03 [PATCH v1] UefiCpuPkg/PiSmmCpuDxeSmm: Fix S3 failure in SmmRestoreCpu Wu, Jiaxin
@ 2023-03-13  8:44 ` Ni, Ray
  2023-03-13  8:50 ` Gerd Hoffmann
  2023-03-13  8:56 ` Zeng, Star
  2 siblings, 0 replies; 4+ messages in thread
From: Ni, Ray @ 2023-03-13  8:44 UTC (permalink / raw)
  To: Wu, Jiaxin, devel@edk2.groups.io
  Cc: Dong, Eric, Zeng, Star, Laszlo Ersek, Gerd Hoffmann

Jiaxin,
Thanks for fixing the bug.

Reviewed-by: Ray Ni <ray.ni@intel.com> 

> -----Original Message-----
> From: Wu, Jiaxin <jiaxin.wu@intel.com>
> Sent: Monday, March 13, 2023 3:04 PM
> To: devel@edk2.groups.io
> Cc: Dong, Eric <eric.dong@intel.com>; Ni, Ray <ray.ni@intel.com>; Zeng, Star
> <star.zeng@intel.com>; Laszlo Ersek <lersek@redhat.com>; Gerd Hoffmann
> <kraxel@redhat.com>
> Subject: [PATCH v1] UefiCpuPkg/PiSmmCpuDxeSmm: Fix S3 failure in
> SmmRestoreCpu
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4368
> 
> This issue is caused by the commit:
> ec07fd0e35d90dbcc36be300a9ceeac29c5de2ad
> 
> GetFirstGuidHob() should not be used after exit boot service.
> 
> Cc: Eric Dong <eric.dong@intel.com>
> Cc: Ray Ni <ray.ni@intel.com>
> Cc: Zeng Star <star.zeng@intel.com>
> Cc: Laszlo Ersek <lersek@redhat.com>
> Cc: Gerd Hoffmann <kraxel@redhat.com>
> Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com>
> ---
>  UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c | 14 +-------------
>  1 file changed, 1 insertion(+), 13 deletions(-)
> 
> diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c
> b/UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c
> index d408b3f9f7..240eee6a7d 100644
> --- a/UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c
> +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c
> @@ -821,23 +821,11 @@ SmmRestoreCpu (
>      // First time microcode load and restore MTRRs
>      //
>      InitializeCpuBeforeRebase ();
>    }
> 
> -  //
> -  // Make sure the gSmmBaseHobGuid existence status is the same
> between normal and S3 boot.
> -  //
> -  ASSERT (mSmmRelocated == (BOOLEAN)(GetFirstGuidHob
> (&gSmmBaseHobGuid) != NULL));
> -  if (mSmmRelocated != (BOOLEAN)(GetFirstGuidHob
> (&gSmmBaseHobGuid) != NULL)) {
> -    DEBUG ((
> -      DEBUG_ERROR,
> -      "gSmmBaseHobGuid %a produced in normal boot but %a in S3 boot!",
> -      mSmmRelocated ? "is" : "is not",
> -      mSmmRelocated ? "is not" : "is"
> -      ));
> -    CpuDeadLoop ();
> -  }
> +  DEBUG ((DEBUG_INFO, "SmmRestoreCpu: mSmmRelocated is %d\n",
> mSmmRelocated));
> 
>    //
>    // Check whether Smm Relocation is done or not.
>    // If not, will do the SmmBases Relocation here!!!
>    //
> --
> 2.16.2.windows.1


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

* Re: [PATCH v1] UefiCpuPkg/PiSmmCpuDxeSmm: Fix S3 failure in SmmRestoreCpu
  2023-03-13  7:03 [PATCH v1] UefiCpuPkg/PiSmmCpuDxeSmm: Fix S3 failure in SmmRestoreCpu Wu, Jiaxin
  2023-03-13  8:44 ` Ni, Ray
@ 2023-03-13  8:50 ` Gerd Hoffmann
  2023-03-13  8:56 ` Zeng, Star
  2 siblings, 0 replies; 4+ messages in thread
From: Gerd Hoffmann @ 2023-03-13  8:50 UTC (permalink / raw)
  To: Jiaxin Wu; +Cc: devel, Eric Dong, Ray Ni, Zeng Star, Laszlo Ersek

  Hi,

> -  //
> -  // Make sure the gSmmBaseHobGuid existence status is the same between normal and S3 boot.
> -  //
> -  ASSERT (mSmmRelocated == (BOOLEAN)(GetFirstGuidHob (&gSmmBaseHobGuid) != NULL));
> -  if (mSmmRelocated != (BOOLEAN)(GetFirstGuidHob (&gSmmBaseHobGuid) != NULL)) {
> -    DEBUG ((
> -      DEBUG_ERROR,
> -      "gSmmBaseHobGuid %a produced in normal boot but %a in S3 boot!",
> -      mSmmRelocated ? "is" : "is not",
> -      mSmmRelocated ? "is not" : "is"
> -      ));
> -    CpuDeadLoop ();
> -  }
> +  DEBUG ((DEBUG_INFO, "SmmRestoreCpu: mSmmRelocated is %d\n", mSmmRelocated));

Reviewed-by: Gerd Hoffmann <kraxel@redhat.com>
Tested-by: Gerd Hoffmann <kraxel@redhat.com>

thanks & take care,
  Gerd


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

* Re: [PATCH v1] UefiCpuPkg/PiSmmCpuDxeSmm: Fix S3 failure in SmmRestoreCpu
  2023-03-13  7:03 [PATCH v1] UefiCpuPkg/PiSmmCpuDxeSmm: Fix S3 failure in SmmRestoreCpu Wu, Jiaxin
  2023-03-13  8:44 ` Ni, Ray
  2023-03-13  8:50 ` Gerd Hoffmann
@ 2023-03-13  8:56 ` Zeng, Star
  2 siblings, 0 replies; 4+ messages in thread
From: Zeng, Star @ 2023-03-13  8:56 UTC (permalink / raw)
  To: Wu, Jiaxin, devel@edk2.groups.io
  Cc: Dong, Eric, Ni, Ray, Laszlo Ersek, Gerd Hoffmann, Zeng, Star

Reviewed-by: Star Zeng <star.zeng@intel.com>

-----Original Message-----
From: Wu, Jiaxin <jiaxin.wu@intel.com> 
Sent: Monday, March 13, 2023 3:04 PM
To: devel@edk2.groups.io
Cc: Dong, Eric <eric.dong@intel.com>; Ni, Ray <ray.ni@intel.com>; Zeng, Star <star.zeng@intel.com>; Laszlo Ersek <lersek@redhat.com>; Gerd Hoffmann <kraxel@redhat.com>
Subject: [PATCH v1] UefiCpuPkg/PiSmmCpuDxeSmm: Fix S3 failure in SmmRestoreCpu

REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4368

This issue is caused by the commit:
ec07fd0e35d90dbcc36be300a9ceeac29c5de2ad

GetFirstGuidHob() should not be used after exit boot service.

Cc: Eric Dong <eric.dong@intel.com>
Cc: Ray Ni <ray.ni@intel.com>
Cc: Zeng Star <star.zeng@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Signed-off-by: Jiaxin Wu <jiaxin.wu@intel.com>
---
 UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c | 14 +-------------
 1 file changed, 1 insertion(+), 13 deletions(-)

diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c b/UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c
index d408b3f9f7..240eee6a7d 100644
--- a/UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c
+++ b/UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c
@@ -821,23 +821,11 @@ SmmRestoreCpu (
     // First time microcode load and restore MTRRs
     //
     InitializeCpuBeforeRebase ();
   }
 
-  //
-  // Make sure the gSmmBaseHobGuid existence status is the same between normal and S3 boot.
-  //
-  ASSERT (mSmmRelocated == (BOOLEAN)(GetFirstGuidHob (&gSmmBaseHobGuid) != NULL));
-  if (mSmmRelocated != (BOOLEAN)(GetFirstGuidHob (&gSmmBaseHobGuid) != NULL)) {
-    DEBUG ((
-      DEBUG_ERROR,
-      "gSmmBaseHobGuid %a produced in normal boot but %a in S3 boot!",
-      mSmmRelocated ? "is" : "is not",
-      mSmmRelocated ? "is not" : "is"
-      ));
-    CpuDeadLoop ();
-  }
+  DEBUG ((DEBUG_INFO, "SmmRestoreCpu: mSmmRelocated is %d\n", mSmmRelocated));
 
   //
   // Check whether Smm Relocation is done or not.
   // If not, will do the SmmBases Relocation here!!!
   //
-- 
2.16.2.windows.1


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

end of thread, other threads:[~2023-03-13  8:56 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-13  7:03 [PATCH v1] UefiCpuPkg/PiSmmCpuDxeSmm: Fix S3 failure in SmmRestoreCpu Wu, Jiaxin
2023-03-13  8:44 ` Ni, Ray
2023-03-13  8:50 ` Gerd Hoffmann
2023-03-13  8:56 ` Zeng, Star

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