From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.120; helo=mga04.intel.com; envelope-from=jiewen.yao@intel.com; receiver=edk2-devel@lists.01.org Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) (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 AA9502218E938 for ; Wed, 6 Dec 2017 18:58:44 -0800 (PST) Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Dec 2017 19:03:17 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.45,370,1508828400"; d="scan'208";a="13817258" Received: from fmsmsx104.amr.corp.intel.com ([10.18.124.202]) by orsmga001.jf.intel.com with ESMTP; 06 Dec 2017 19:03:16 -0800 Received: from FMSMSX110.amr.corp.intel.com (10.18.116.10) by fmsmsx104.amr.corp.intel.com (10.18.124.202) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 6 Dec 2017 19:03:16 -0800 Received: from shsmsx152.ccr.corp.intel.com (10.239.6.52) by fmsmsx110.amr.corp.intel.com (10.18.116.10) with Microsoft SMTP Server (TLS) id 14.3.319.2; Wed, 6 Dec 2017 19:03:14 -0800 Received: from shsmsx102.ccr.corp.intel.com ([169.254.2.175]) by SHSMSX152.ccr.corp.intel.com ([169.254.6.93]) with mapi id 14.03.0319.002; Thu, 7 Dec 2017 11:03:12 +0800 From: "Yao, Jiewen" To: "Zeng, Star" , "edk2-devel@lists.01.org" CC: "Dong, Eric" , Laszlo Ersek , "Ni, Ruiyu" Thread-Topic: [PATCH] UefiCpuPkg PiSmmCpuDxeSmm: Only DumpCpuContext in error case Thread-Index: AQHTbv2j9j2WXNc2dE6XQmljVlUEPKM3MYMw Date: Thu, 7 Dec 2017 03:03:12 +0000 Message-ID: <74D8A39837DF1E4DA445A8C0B3885C503AA3C7C2@shsmsx102.ccr.corp.intel.com> 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: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiOWY1ZWE1NWMtN2FjOS00YzEzLTk2NDItYjVjMDI1ODkwMzFkIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX0lDIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjIuNS4xOCIsIlRydXN0ZWRMYWJlbEhhc2giOiJoS1F3dENCS05MRkN1cEV3Y0dQSDRIK1JyeWtwQnRKcWdoUGZiUmJaak9ENGZBSFVUOElaKzVhdlwvb2M0ZFZpaSJ9 x-ctpclassification: CTP_IC dlp-product: dlpe-windows dlp-version: 11.0.0.116 dlp-reaction: no-action 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:58:44 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable 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 ; Yao, Jiewen ; > Dong, Eric ; Laszlo Ersek ; Ni, R= uiyu > > Subject: [PATCH] UefiCpuPkg PiSmmCpuDxeSmm: Only DumpCpuContext in > error case >=20 > 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. >=20 > 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/PiSmmCpuDxeSmm/X64/PageTbl.c | 6 ++++-- > 2 files changed, 8 insertions(+), 4 deletions(-) >=20 > 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 ( > } >=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 > 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) !=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/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 ( > } >=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 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) !=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