From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=134.134.136.20; helo=mga02.intel.com; envelope-from=eric.dong@intel.com; receiver=edk2-devel@lists.01.org Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 3ADAF2218E923 for ; Wed, 6 Dec 2017 18:56:45 -0800 (PST) Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Dec 2017 19:01:17 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.45,370,1508828400"; d="scan'208";a="740467" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by orsmga008.jf.intel.com with ESMTP; 06 Dec 2017 19:01:17 -0800 Received: from fmsmsx151.amr.corp.intel.com (10.18.125.4) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 6 Dec 2017 19:01:17 -0800 Received: from shsmsx151.ccr.corp.intel.com (10.239.6.50) by FMSMSX151.amr.corp.intel.com (10.18.125.4) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 6 Dec 2017 19:01:17 -0800 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.175]) by SHSMSX151.ccr.corp.intel.com ([169.254.3.218]) with mapi id 14.03.0319.002; Thu, 7 Dec 2017 11:01:15 +0800 From: "Dong, Eric" To: "Zeng, Star" , "edk2-devel@lists.01.org" CC: "Yao, Jiewen" , Laszlo Ersek , "Ni, Ruiyu" Thread-Topic: [PATCH] UefiCpuPkg PiSmmCpuDxeSmm: Only DumpCpuContext in error case Thread-Index: AQHTbv2j76dppOgrJEePyGfz82Sir6M3MTlw Date: Thu, 7 Dec 2017 03:01:14 +0000 Message-ID: References: <1512611363-14196-1-git-send-email-star.zeng@intel.com> In-Reply-To: <1512611363-14196-1-git-send-email-star.zeng@intel.com> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH] UefiCpuPkg PiSmmCpuDxeSmm: Only DumpCpuContext in error case X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Dec 2017 02:56:45 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Reviewed-by: Eric Dong -----Original Message----- From: Zeng, Star=20 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 ca= se Only DumpCpuContext in error case, otherwise there will be too many debug m= essages from DumpCpuContext() when SmmProfile feature is enabled by setting= PcdCpuSmmProfileEnable to TRUE. Those debug messages are not needed for Sm= mProfile feature as it will record those information to buffer for further = dump. Cc: Jiewen Yao Cc: Eric Dong Cc: Laszlo Ersek Cc: Ruiyu Ni Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Star Zeng --- UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/PageTbl.c | 6 ++++-- UefiCpuPkg/PiSmmCpuDx= eSmm/X64/PageTbl.c | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/PageTbl.c b/UefiCpuPkg/PiSmmCpu= DxeSmm/Ia32/PageTbl.c index 0396f2daaaed..6e1ffe7c6287 100644 --- a/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/PageTbl.c +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/Ia32/PageTbl.c @@ -134,12 +134,12 @@ SmiPFHandler ( } =20 // - // If a page fault occurs in SMM range + // If a page fault occurs in non-SMRAM range. // if ((PFAddress < mCpuHotPlugData.SmrrBase) || (PFAddress >=3D mCpuHotPlugData.SmrrBase + mCpuHotPlugData.SmrrSize)= ) { - DumpCpuContext (InterruptType, SystemContext); if ((SystemContext.SystemContextIa32->ExceptionData & IA32_PF_EC_ID) != =3D 0) { + DumpCpuContext (InterruptType, SystemContext); DEBUG ((DEBUG_ERROR, "Code executed on IP(0x%x) out of SMM range aft= er SMM is locked!\n", PFAddress)); DEBUG_CODE ( DumpModuleInfoByIp (*(UINTN *)(UINTN)SystemContext.SystemContextIa= 32->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) !=3D 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/PiSmmCpuD= xeSmm/X64/PageTbl.c index 79a26d7ec6a3..6478c6c3e355 100644 --- a/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/X64/PageTbl.c @@ -851,12 +851,12 @@ SmiPFHandler ( } =20 // - // If a page fault occurs in SMM range + // If a page fault occurs in non-SMRAM range. // if ((PFAddress < mCpuHotPlugData.SmrrBase) || (PFAddress >=3D mCpuHotPlugData.SmrrBase + mCpuHotPlugData.SmrrSize)= ) { - DumpCpuContext (InterruptType, SystemContext); if ((SystemContext.SystemContextX64->ExceptionData & IA32_PF_EC_ID) != =3D 0) { + DumpCpuContext (InterruptType, SystemContext); DEBUG ((DEBUG_ERROR, "Code executed on IP(0x%lx) out of SMM range af= ter SMM is locked!\n", PFAddress)); DEBUG_CODE ( DumpModuleInfoByIp (*(UINTN *)(UINTN)SystemContext.SystemContextX6= 4->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) !=3D 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