public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] UefiCpuPkg PiSmmCpuDxeSmm: Only DumpCpuContext in error case
@ 2017-12-07  1:49 Star Zeng
  2017-12-07  3:01 ` Dong, Eric
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Star Zeng @ 2017-12-07  1:49 UTC (permalink / raw)
  To: edk2-devel; +Cc: Star Zeng, Jiewen Yao, Eric Dong, Laszlo Ersek, Ruiyu Ni

Only DumpCpuContext in error case, otherwise there will be too many
debug messages from DumpCpuContext() when SmmProfile feature is enabled
by setting PcdCpuSmmProfileEnable to TRUE. Those debug messages are not
needed for SmmProfile feature as it will record those information to
buffer for further dump.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <star.zeng@intel.com>
---
 UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/PageTbl.c | 6 ++++--
 UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c  | 6 ++++--
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/PageTbl.c b/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/PageTbl.c
index 0396f2daaaed..6e1ffe7c6287 100644
--- a/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/PageTbl.c
+++ b/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/PageTbl.c
@@ -134,12 +134,12 @@ SmiPFHandler (
   }
 
   //
-  // If a page fault occurs in SMM range
+  // If a page fault occurs in non-SMRAM range.
   //
   if ((PFAddress < mCpuHotPlugData.SmrrBase) ||
       (PFAddress >= mCpuHotPlugData.SmrrBase + mCpuHotPlugData.SmrrSize)) {
-    DumpCpuContext (InterruptType, SystemContext);
     if ((SystemContext.SystemContextIa32->ExceptionData & IA32_PF_EC_ID) != 0) {
+      DumpCpuContext (InterruptType, SystemContext);
       DEBUG ((DEBUG_ERROR, "Code executed on IP(0x%x) out of SMM range after SMM is locked!\n", PFAddress));
       DEBUG_CODE (
         DumpModuleInfoByIp (*(UINTN *)(UINTN)SystemContext.SystemContextIa32->Esp);
@@ -147,6 +147,7 @@ SmiPFHandler (
       CpuDeadLoop ();
     }
     if (IsSmmCommBufferForbiddenAddress (PFAddress)) {
+      DumpCpuContext (InterruptType, SystemContext);
       DEBUG ((DEBUG_ERROR, "Access SMM communication forbidden address (0x%x)!\n", PFAddress));
       DEBUG_CODE (
         DumpModuleInfoByIp ((UINTN)SystemContext.SystemContextIa32->Eip);
@@ -160,6 +161,7 @@ SmiPFHandler (
   //
   if ((PcdGet8 (PcdNullPointerDetectionPropertyMask) & BIT1) != 0 &&
       (PFAddress < EFI_PAGE_SIZE)) {
+    DumpCpuContext (InterruptType, SystemContext);
     DEBUG ((DEBUG_ERROR, "!!! NULL pointer access !!!\n"));
     DEBUG_CODE (
       DumpModuleInfoByIp ((UINTN)SystemContext.SystemContextIa32->Eip);
diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c b/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c
index 79a26d7ec6a3..6478c6c3e355 100644
--- a/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c
+++ b/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c
@@ -851,12 +851,12 @@ SmiPFHandler (
   }
 
   //
-  // If a page fault occurs in SMM range
+  // If a page fault occurs in non-SMRAM range.
   //
   if ((PFAddress < mCpuHotPlugData.SmrrBase) ||
       (PFAddress >= mCpuHotPlugData.SmrrBase + mCpuHotPlugData.SmrrSize)) {
-    DumpCpuContext (InterruptType, SystemContext);
     if ((SystemContext.SystemContextX64->ExceptionData & IA32_PF_EC_ID) != 0) {
+      DumpCpuContext (InterruptType, SystemContext);
       DEBUG ((DEBUG_ERROR, "Code executed on IP(0x%lx) out of SMM range after SMM is locked!\n", PFAddress));
       DEBUG_CODE (
         DumpModuleInfoByIp (*(UINTN *)(UINTN)SystemContext.SystemContextX64->Rsp);
@@ -864,6 +864,7 @@ SmiPFHandler (
       CpuDeadLoop ();
     }
     if (IsSmmCommBufferForbiddenAddress (PFAddress)) {
+      DumpCpuContext (InterruptType, SystemContext);
       DEBUG ((DEBUG_ERROR, "Access SMM communication forbidden address (0x%lx)!\n", PFAddress));
       DEBUG_CODE (
         DumpModuleInfoByIp ((UINTN)SystemContext.SystemContextX64->Rip);
@@ -877,6 +878,7 @@ SmiPFHandler (
   //
   if ((PcdGet8 (PcdNullPointerDetectionPropertyMask) & BIT1) != 0 &&
       (PFAddress < EFI_PAGE_SIZE)) {
+    DumpCpuContext (InterruptType, SystemContext);
     DEBUG ((DEBUG_ERROR, "!!! NULL pointer access !!!\n"));
     DEBUG_CODE (
       DumpModuleInfoByIp ((UINTN)SystemContext.SystemContextX64->Rip);
-- 
2.7.0.windows.1



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

* Re: [PATCH] UefiCpuPkg PiSmmCpuDxeSmm: Only DumpCpuContext in error case
  2017-12-07  1:49 [PATCH] UefiCpuPkg PiSmmCpuDxeSmm: Only DumpCpuContext in error case Star Zeng
@ 2017-12-07  3:01 ` Dong, Eric
  2017-12-07  3:03 ` Yao, Jiewen
  2017-12-07 11:12 ` Laszlo Ersek
  2 siblings, 0 replies; 5+ messages in thread
From: Dong, Eric @ 2017-12-07  3:01 UTC (permalink / raw)
  To: Zeng, Star, edk2-devel@lists.01.org; +Cc: Yao, Jiewen, Laszlo Ersek, Ni, Ruiyu

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

-----Original Message-----
From: Zeng, Star 
Sent: Thursday, December 7, 2017 9:49 AM
To: edk2-devel@lists.01.org
Cc: Zeng, Star; Yao, Jiewen; Dong, Eric; Laszlo Ersek; Ni, Ruiyu
Subject: [PATCH] UefiCpuPkg PiSmmCpuDxeSmm: Only DumpCpuContext in error case

Only DumpCpuContext in error case, otherwise there will be too many debug messages from DumpCpuContext() when SmmProfile feature is enabled by setting PcdCpuSmmProfileEnable to TRUE. Those debug messages are not needed for SmmProfile feature as it will record those information to buffer for further dump.

Cc: Jiewen Yao <jiewen.yao@intel.com>
Cc: Eric Dong <eric.dong@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>
Cc: Ruiyu Ni <ruiyu.ni@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Star Zeng <star.zeng@intel.com>
---
 UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/PageTbl.c | 6 ++++--  UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c  | 6 ++++--
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/PageTbl.c b/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/PageTbl.c
index 0396f2daaaed..6e1ffe7c6287 100644
--- a/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/PageTbl.c
+++ b/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/PageTbl.c
@@ -134,12 +134,12 @@ SmiPFHandler (
   }
 
   //
-  // If a page fault occurs in SMM range
+  // If a page fault occurs in non-SMRAM range.
   //
   if ((PFAddress < mCpuHotPlugData.SmrrBase) ||
       (PFAddress >= mCpuHotPlugData.SmrrBase + mCpuHotPlugData.SmrrSize)) {
-    DumpCpuContext (InterruptType, SystemContext);
     if ((SystemContext.SystemContextIa32->ExceptionData & IA32_PF_EC_ID) != 0) {
+      DumpCpuContext (InterruptType, SystemContext);
       DEBUG ((DEBUG_ERROR, "Code executed on IP(0x%x) out of SMM range after SMM is locked!\n", PFAddress));
       DEBUG_CODE (
         DumpModuleInfoByIp (*(UINTN *)(UINTN)SystemContext.SystemContextIa32->Esp);
@@ -147,6 +147,7 @@ SmiPFHandler (
       CpuDeadLoop ();
     }
     if (IsSmmCommBufferForbiddenAddress (PFAddress)) {
+      DumpCpuContext (InterruptType, SystemContext);
       DEBUG ((DEBUG_ERROR, "Access SMM communication forbidden address (0x%x)!\n", PFAddress));
       DEBUG_CODE (
         DumpModuleInfoByIp ((UINTN)SystemContext.SystemContextIa32->Eip);
@@ -160,6 +161,7 @@ SmiPFHandler (
   //
   if ((PcdGet8 (PcdNullPointerDetectionPropertyMask) & BIT1) != 0 &&
       (PFAddress < EFI_PAGE_SIZE)) {
+    DumpCpuContext (InterruptType, SystemContext);
     DEBUG ((DEBUG_ERROR, "!!! NULL pointer access !!!\n"));
     DEBUG_CODE (
       DumpModuleInfoByIp ((UINTN)SystemContext.SystemContextIa32->Eip);
diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c b/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c
index 79a26d7ec6a3..6478c6c3e355 100644
--- a/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c
+++ b/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c
@@ -851,12 +851,12 @@ SmiPFHandler (
   }
 
   //
-  // If a page fault occurs in SMM range
+  // If a page fault occurs in non-SMRAM range.
   //
   if ((PFAddress < mCpuHotPlugData.SmrrBase) ||
       (PFAddress >= mCpuHotPlugData.SmrrBase + mCpuHotPlugData.SmrrSize)) {
-    DumpCpuContext (InterruptType, SystemContext);
     if ((SystemContext.SystemContextX64->ExceptionData & IA32_PF_EC_ID) != 0) {
+      DumpCpuContext (InterruptType, SystemContext);
       DEBUG ((DEBUG_ERROR, "Code executed on IP(0x%lx) out of SMM range after SMM is locked!\n", PFAddress));
       DEBUG_CODE (
         DumpModuleInfoByIp (*(UINTN *)(UINTN)SystemContext.SystemContextX64->Rsp);
@@ -864,6 +864,7 @@ SmiPFHandler (
       CpuDeadLoop ();
     }
     if (IsSmmCommBufferForbiddenAddress (PFAddress)) {
+      DumpCpuContext (InterruptType, SystemContext);
       DEBUG ((DEBUG_ERROR, "Access SMM communication forbidden address (0x%lx)!\n", PFAddress));
       DEBUG_CODE (
         DumpModuleInfoByIp ((UINTN)SystemContext.SystemContextX64->Rip);
@@ -877,6 +878,7 @@ SmiPFHandler (
   //
   if ((PcdGet8 (PcdNullPointerDetectionPropertyMask) & BIT1) != 0 &&
       (PFAddress < EFI_PAGE_SIZE)) {
+    DumpCpuContext (InterruptType, SystemContext);
     DEBUG ((DEBUG_ERROR, "!!! NULL pointer access !!!\n"));
     DEBUG_CODE (
       DumpModuleInfoByIp ((UINTN)SystemContext.SystemContextX64->Rip);
--
2.7.0.windows.1



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

* Re: [PATCH] UefiCpuPkg PiSmmCpuDxeSmm: Only DumpCpuContext in error case
  2017-12-07  1:49 [PATCH] UefiCpuPkg PiSmmCpuDxeSmm: Only DumpCpuContext in error case Star Zeng
  2017-12-07  3:01 ` Dong, Eric
@ 2017-12-07  3:03 ` Yao, Jiewen
  2017-12-07  3:03   ` Zeng, Star
  2017-12-07 11:12 ` Laszlo Ersek
  2 siblings, 1 reply; 5+ messages in thread
From: Yao, Jiewen @ 2017-12-07  3:03 UTC (permalink / raw)
  To: Zeng, Star, edk2-devel@lists.01.org; +Cc: Dong, Eric, Laszlo Ersek, Ni, Ruiyu

Good enhancement.
Reviewed-by: Jiewen.yao@intel.com

BTW: I think we should also ASSERT(FALSE) if StaticPage and Smmprofile are both TRUE....


> -----Original Message-----
> From: Zeng, Star
> Sent: Thursday, December 7, 2017 9:49 AM
> To: edk2-devel@lists.01.org
> Cc: Zeng, Star <star.zeng@intel.com>; Yao, Jiewen <jiewen.yao@intel.com>;
> Dong, Eric <eric.dong@intel.com>; Laszlo Ersek <lersek@redhat.com>; Ni, Ruiyu
> <ruiyu.ni@intel.com>
> Subject: [PATCH] UefiCpuPkg PiSmmCpuDxeSmm: Only DumpCpuContext in
> error case
> 
> Only DumpCpuContext in error case, otherwise there will be too many
> debug messages from DumpCpuContext() when SmmProfile feature is enabled
> by setting PcdCpuSmmProfileEnable to TRUE. Those debug messages are not
> needed for SmmProfile feature as it will record those information to
> buffer for further dump.
> 
> Cc: Jiewen Yao <jiewen.yao@intel.com>
> Cc: Eric Dong <eric.dong@intel.com>
> Cc: Laszlo Ersek <lersek@redhat.com>
> Cc: Ruiyu Ni <ruiyu.ni@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Star Zeng <star.zeng@intel.com>
> ---
>  UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/PageTbl.c | 6 ++++--
>  UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c  | 6 ++++--
>  2 files changed, 8 insertions(+), 4 deletions(-)
> 
> diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/PageTbl.c
> b/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/PageTbl.c
> index 0396f2daaaed..6e1ffe7c6287 100644
> --- a/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/PageTbl.c
> +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/PageTbl.c
> @@ -134,12 +134,12 @@ SmiPFHandler (
>    }
> 
>    //
> -  // If a page fault occurs in SMM range
> +  // If a page fault occurs in non-SMRAM range.
>    //
>    if ((PFAddress < mCpuHotPlugData.SmrrBase) ||
>        (PFAddress >= mCpuHotPlugData.SmrrBase +
> mCpuHotPlugData.SmrrSize)) {
> -    DumpCpuContext (InterruptType, SystemContext);
>      if ((SystemContext.SystemContextIa32->ExceptionData &
> IA32_PF_EC_ID) != 0) {
> +      DumpCpuContext (InterruptType, SystemContext);
>        DEBUG ((DEBUG_ERROR, "Code executed on IP(0x%x) out of SMM range
> after SMM is locked!\n", PFAddress));
>        DEBUG_CODE (
>          DumpModuleInfoByIp (*(UINTN
> *)(UINTN)SystemContext.SystemContextIa32->Esp);
> @@ -147,6 +147,7 @@ SmiPFHandler (
>        CpuDeadLoop ();
>      }
>      if (IsSmmCommBufferForbiddenAddress (PFAddress)) {
> +      DumpCpuContext (InterruptType, SystemContext);
>        DEBUG ((DEBUG_ERROR, "Access SMM communication forbidden
> address (0x%x)!\n", PFAddress));
>        DEBUG_CODE (
>          DumpModuleInfoByIp
> ((UINTN)SystemContext.SystemContextIa32->Eip);
> @@ -160,6 +161,7 @@ SmiPFHandler (
>    //
>    if ((PcdGet8 (PcdNullPointerDetectionPropertyMask) & BIT1) != 0 &&
>        (PFAddress < EFI_PAGE_SIZE)) {
> +    DumpCpuContext (InterruptType, SystemContext);
>      DEBUG ((DEBUG_ERROR, "!!! NULL pointer access !!!\n"));
>      DEBUG_CODE (
>        DumpModuleInfoByIp
> ((UINTN)SystemContext.SystemContextIa32->Eip);
> diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c
> b/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c
> index 79a26d7ec6a3..6478c6c3e355 100644
> --- a/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c
> +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c
> @@ -851,12 +851,12 @@ SmiPFHandler (
>    }
> 
>    //
> -  // If a page fault occurs in SMM range
> +  // If a page fault occurs in non-SMRAM range.
>    //
>    if ((PFAddress < mCpuHotPlugData.SmrrBase) ||
>        (PFAddress >= mCpuHotPlugData.SmrrBase +
> mCpuHotPlugData.SmrrSize)) {
> -    DumpCpuContext (InterruptType, SystemContext);
>      if ((SystemContext.SystemContextX64->ExceptionData &
> IA32_PF_EC_ID) != 0) {
> +      DumpCpuContext (InterruptType, SystemContext);
>        DEBUG ((DEBUG_ERROR, "Code executed on IP(0x%lx) out of SMM
> range after SMM is locked!\n", PFAddress));
>        DEBUG_CODE (
>          DumpModuleInfoByIp (*(UINTN
> *)(UINTN)SystemContext.SystemContextX64->Rsp);
> @@ -864,6 +864,7 @@ SmiPFHandler (
>        CpuDeadLoop ();
>      }
>      if (IsSmmCommBufferForbiddenAddress (PFAddress)) {
> +      DumpCpuContext (InterruptType, SystemContext);
>        DEBUG ((DEBUG_ERROR, "Access SMM communication forbidden
> address (0x%lx)!\n", PFAddress));
>        DEBUG_CODE (
>          DumpModuleInfoByIp
> ((UINTN)SystemContext.SystemContextX64->Rip);
> @@ -877,6 +878,7 @@ SmiPFHandler (
>    //
>    if ((PcdGet8 (PcdNullPointerDetectionPropertyMask) & BIT1) != 0 &&
>        (PFAddress < EFI_PAGE_SIZE)) {
> +    DumpCpuContext (InterruptType, SystemContext);
>      DEBUG ((DEBUG_ERROR, "!!! NULL pointer access !!!\n"));
>      DEBUG_CODE (
>        DumpModuleInfoByIp
> ((UINTN)SystemContext.SystemContextX64->Rip);
> --
> 2.7.0.windows.1



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

* Re: [PATCH] UefiCpuPkg PiSmmCpuDxeSmm: Only DumpCpuContext in error case
  2017-12-07  3:03 ` Yao, Jiewen
@ 2017-12-07  3:03   ` Zeng, Star
  0 siblings, 0 replies; 5+ messages in thread
From: Zeng, Star @ 2017-12-07  3:03 UTC (permalink / raw)
  To: Yao, Jiewen, edk2-devel@lists.01.org
  Cc: Dong, Eric, Laszlo Ersek, Ni, Ruiyu, Zeng, Star

That will be in another patch. :)

Thanks,
Star
-----Original Message-----
From: Yao, Jiewen 
Sent: Thursday, December 7, 2017 11:03 AM
To: Zeng, Star <star.zeng@intel.com>; edk2-devel@lists.01.org
Cc: Dong, Eric <eric.dong@intel.com>; Laszlo Ersek <lersek@redhat.com>; Ni, Ruiyu <ruiyu.ni@intel.com>
Subject: RE: [PATCH] UefiCpuPkg PiSmmCpuDxeSmm: Only DumpCpuContext in error case

Good enhancement.
Reviewed-by: Jiewen.yao@intel.com

BTW: I think we should also ASSERT(FALSE) if StaticPage and Smmprofile are both TRUE....


> -----Original Message-----
> From: Zeng, Star
> Sent: Thursday, December 7, 2017 9:49 AM
> To: edk2-devel@lists.01.org
> Cc: Zeng, Star <star.zeng@intel.com>; Yao, Jiewen 
> <jiewen.yao@intel.com>; Dong, Eric <eric.dong@intel.com>; Laszlo Ersek 
> <lersek@redhat.com>; Ni, Ruiyu <ruiyu.ni@intel.com>
> Subject: [PATCH] UefiCpuPkg PiSmmCpuDxeSmm: Only DumpCpuContext in 
> error case
> 
> Only DumpCpuContext in error case, otherwise there will be too many 
> debug messages from DumpCpuContext() when SmmProfile feature is 
> enabled by setting PcdCpuSmmProfileEnable to TRUE. Those debug 
> messages are not needed for SmmProfile feature as it will record those 
> information to buffer for further dump.
> 
> Cc: Jiewen Yao <jiewen.yao@intel.com>
> Cc: Eric Dong <eric.dong@intel.com>
> Cc: Laszlo Ersek <lersek@redhat.com>
> Cc: Ruiyu Ni <ruiyu.ni@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Star Zeng <star.zeng@intel.com>
> ---
>  UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/PageTbl.c | 6 ++++--  
> UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c  | 6 ++++--
>  2 files changed, 8 insertions(+), 4 deletions(-)
> 
> diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/PageTbl.c
> b/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/PageTbl.c
> index 0396f2daaaed..6e1ffe7c6287 100644
> --- a/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/PageTbl.c
> +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/PageTbl.c
> @@ -134,12 +134,12 @@ SmiPFHandler (
>    }
> 
>    //
> -  // If a page fault occurs in SMM range
> +  // If a page fault occurs in non-SMRAM range.
>    //
>    if ((PFAddress < mCpuHotPlugData.SmrrBase) ||
>        (PFAddress >= mCpuHotPlugData.SmrrBase +
> mCpuHotPlugData.SmrrSize)) {
> -    DumpCpuContext (InterruptType, SystemContext);
>      if ((SystemContext.SystemContextIa32->ExceptionData &
> IA32_PF_EC_ID) != 0) {
> +      DumpCpuContext (InterruptType, SystemContext);
>        DEBUG ((DEBUG_ERROR, "Code executed on IP(0x%x) out of SMM 
> range after SMM is locked!\n", PFAddress));
>        DEBUG_CODE (
>          DumpModuleInfoByIp (*(UINTN
> *)(UINTN)SystemContext.SystemContextIa32->Esp);
> @@ -147,6 +147,7 @@ SmiPFHandler (
>        CpuDeadLoop ();
>      }
>      if (IsSmmCommBufferForbiddenAddress (PFAddress)) {
> +      DumpCpuContext (InterruptType, SystemContext);
>        DEBUG ((DEBUG_ERROR, "Access SMM communication forbidden 
> address (0x%x)!\n", PFAddress));
>        DEBUG_CODE (
>          DumpModuleInfoByIp
> ((UINTN)SystemContext.SystemContextIa32->Eip);
> @@ -160,6 +161,7 @@ SmiPFHandler (
>    //
>    if ((PcdGet8 (PcdNullPointerDetectionPropertyMask) & BIT1) != 0 &&
>        (PFAddress < EFI_PAGE_SIZE)) {
> +    DumpCpuContext (InterruptType, SystemContext);
>      DEBUG ((DEBUG_ERROR, "!!! NULL pointer access !!!\n"));
>      DEBUG_CODE (
>        DumpModuleInfoByIp
> ((UINTN)SystemContext.SystemContextIa32->Eip);
> diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c
> b/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c
> index 79a26d7ec6a3..6478c6c3e355 100644
> --- a/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c
> +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c
> @@ -851,12 +851,12 @@ SmiPFHandler (
>    }
> 
>    //
> -  // If a page fault occurs in SMM range
> +  // If a page fault occurs in non-SMRAM range.
>    //
>    if ((PFAddress < mCpuHotPlugData.SmrrBase) ||
>        (PFAddress >= mCpuHotPlugData.SmrrBase +
> mCpuHotPlugData.SmrrSize)) {
> -    DumpCpuContext (InterruptType, SystemContext);
>      if ((SystemContext.SystemContextX64->ExceptionData &
> IA32_PF_EC_ID) != 0) {
> +      DumpCpuContext (InterruptType, SystemContext);
>        DEBUG ((DEBUG_ERROR, "Code executed on IP(0x%lx) out of SMM 
> range after SMM is locked!\n", PFAddress));
>        DEBUG_CODE (
>          DumpModuleInfoByIp (*(UINTN
> *)(UINTN)SystemContext.SystemContextX64->Rsp);
> @@ -864,6 +864,7 @@ SmiPFHandler (
>        CpuDeadLoop ();
>      }
>      if (IsSmmCommBufferForbiddenAddress (PFAddress)) {
> +      DumpCpuContext (InterruptType, SystemContext);
>        DEBUG ((DEBUG_ERROR, "Access SMM communication forbidden 
> address (0x%lx)!\n", PFAddress));
>        DEBUG_CODE (
>          DumpModuleInfoByIp
> ((UINTN)SystemContext.SystemContextX64->Rip);
> @@ -877,6 +878,7 @@ SmiPFHandler (
>    //
>    if ((PcdGet8 (PcdNullPointerDetectionPropertyMask) & BIT1) != 0 &&
>        (PFAddress < EFI_PAGE_SIZE)) {
> +    DumpCpuContext (InterruptType, SystemContext);
>      DEBUG ((DEBUG_ERROR, "!!! NULL pointer access !!!\n"));
>      DEBUG_CODE (
>        DumpModuleInfoByIp
> ((UINTN)SystemContext.SystemContextX64->Rip);
> --
> 2.7.0.windows.1



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

* Re: [PATCH] UefiCpuPkg PiSmmCpuDxeSmm: Only DumpCpuContext in error case
  2017-12-07  1:49 [PATCH] UefiCpuPkg PiSmmCpuDxeSmm: Only DumpCpuContext in error case Star Zeng
  2017-12-07  3:01 ` Dong, Eric
  2017-12-07  3:03 ` Yao, Jiewen
@ 2017-12-07 11:12 ` Laszlo Ersek
  2 siblings, 0 replies; 5+ messages in thread
From: Laszlo Ersek @ 2017-12-07 11:12 UTC (permalink / raw)
  To: Star Zeng, edk2-devel; +Cc: Jiewen Yao, Eric Dong, Ruiyu Ni

On 12/07/17 02:49, Star Zeng wrote:
> Only DumpCpuContext in error case, otherwise there will be too many
> debug messages from DumpCpuContext() when SmmProfile feature is enabled
> by setting PcdCpuSmmProfileEnable to TRUE. Those debug messages are not
> needed for SmmProfile feature as it will record those information to
> buffer for further dump.
> 
> Cc: Jiewen Yao <jiewen.yao@intel.com>
> Cc: Eric Dong <eric.dong@intel.com>
> Cc: Laszlo Ersek <lersek@redhat.com>
> Cc: Ruiyu Ni <ruiyu.ni@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Star Zeng <star.zeng@intel.com>
> ---
>  UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/PageTbl.c | 6 ++++--
>  UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c  | 6 ++++--
>  2 files changed, 8 insertions(+), 4 deletions(-)
> 
> diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/PageTbl.c b/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/PageTbl.c
> index 0396f2daaaed..6e1ffe7c6287 100644
> --- a/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/PageTbl.c
> +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/PageTbl.c
> @@ -134,12 +134,12 @@ SmiPFHandler (
>    }
>  
>    //
> -  // If a page fault occurs in SMM range
> +  // If a page fault occurs in non-SMRAM range.
>    //
>    if ((PFAddress < mCpuHotPlugData.SmrrBase) ||
>        (PFAddress >= mCpuHotPlugData.SmrrBase + mCpuHotPlugData.SmrrSize)) {
> -    DumpCpuContext (InterruptType, SystemContext);
>      if ((SystemContext.SystemContextIa32->ExceptionData & IA32_PF_EC_ID) != 0) {
> +      DumpCpuContext (InterruptType, SystemContext);
>        DEBUG ((DEBUG_ERROR, "Code executed on IP(0x%x) out of SMM range after SMM is locked!\n", PFAddress));
>        DEBUG_CODE (
>          DumpModuleInfoByIp (*(UINTN *)(UINTN)SystemContext.SystemContextIa32->Esp);
> @@ -147,6 +147,7 @@ SmiPFHandler (
>        CpuDeadLoop ();
>      }
>      if (IsSmmCommBufferForbiddenAddress (PFAddress)) {
> +      DumpCpuContext (InterruptType, SystemContext);
>        DEBUG ((DEBUG_ERROR, "Access SMM communication forbidden address (0x%x)!\n", PFAddress));
>        DEBUG_CODE (
>          DumpModuleInfoByIp ((UINTN)SystemContext.SystemContextIa32->Eip);
> @@ -160,6 +161,7 @@ SmiPFHandler (
>    //
>    if ((PcdGet8 (PcdNullPointerDetectionPropertyMask) & BIT1) != 0 &&
>        (PFAddress < EFI_PAGE_SIZE)) {
> +    DumpCpuContext (InterruptType, SystemContext);
>      DEBUG ((DEBUG_ERROR, "!!! NULL pointer access !!!\n"));
>      DEBUG_CODE (
>        DumpModuleInfoByIp ((UINTN)SystemContext.SystemContextIa32->Eip);
> diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c b/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c
> index 79a26d7ec6a3..6478c6c3e355 100644
> --- a/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c
> +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c
> @@ -851,12 +851,12 @@ SmiPFHandler (
>    }
>  
>    //
> -  // If a page fault occurs in SMM range
> +  // If a page fault occurs in non-SMRAM range.
>    //
>    if ((PFAddress < mCpuHotPlugData.SmrrBase) ||
>        (PFAddress >= mCpuHotPlugData.SmrrBase + mCpuHotPlugData.SmrrSize)) {
> -    DumpCpuContext (InterruptType, SystemContext);
>      if ((SystemContext.SystemContextX64->ExceptionData & IA32_PF_EC_ID) != 0) {
> +      DumpCpuContext (InterruptType, SystemContext);
>        DEBUG ((DEBUG_ERROR, "Code executed on IP(0x%lx) out of SMM range after SMM is locked!\n", PFAddress));
>        DEBUG_CODE (
>          DumpModuleInfoByIp (*(UINTN *)(UINTN)SystemContext.SystemContextX64->Rsp);
> @@ -864,6 +864,7 @@ SmiPFHandler (
>        CpuDeadLoop ();
>      }
>      if (IsSmmCommBufferForbiddenAddress (PFAddress)) {
> +      DumpCpuContext (InterruptType, SystemContext);
>        DEBUG ((DEBUG_ERROR, "Access SMM communication forbidden address (0x%lx)!\n", PFAddress));
>        DEBUG_CODE (
>          DumpModuleInfoByIp ((UINTN)SystemContext.SystemContextX64->Rip);
> @@ -877,6 +878,7 @@ SmiPFHandler (
>    //
>    if ((PcdGet8 (PcdNullPointerDetectionPropertyMask) & BIT1) != 0 &&
>        (PFAddress < EFI_PAGE_SIZE)) {
> +    DumpCpuContext (InterruptType, SystemContext);
>      DEBUG ((DEBUG_ERROR, "!!! NULL pointer access !!!\n"));
>      DEBUG_CODE (
>        DumpModuleInfoByIp ((UINTN)SystemContext.SystemContextX64->Rip);
> 

Looks reasonable to me.

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

Thanks!
Laszlo


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

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

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-07  1:49 [PATCH] UefiCpuPkg PiSmmCpuDxeSmm: Only DumpCpuContext in error case Star Zeng
2017-12-07  3:01 ` Dong, Eric
2017-12-07  3:03 ` Yao, Jiewen
2017-12-07  3:03   ` Zeng, Star
2017-12-07 11:12 ` Laszlo Ersek

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