From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=209.132.183.28; helo=mx1.redhat.com; envelope-from=lersek@redhat.com; receiver=edk2-devel@lists.01.org Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (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 46DE921B02836 for ; Thu, 7 Dec 2017 03:08:29 -0800 (PST) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id F3371356CF; Thu, 7 Dec 2017 11:13:01 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-120-204.rdu2.redhat.com [10.10.120.204]) by smtp.corp.redhat.com (Postfix) with ESMTP id 8F829183A2; Thu, 7 Dec 2017 11:13:00 +0000 (UTC) To: Star Zeng , edk2-devel@lists.01.org Cc: Jiewen Yao , Eric Dong , Ruiyu Ni References: <1512611363-14196-1-git-send-email-star.zeng@intel.com> From: Laszlo Ersek Message-ID: <0849d664-f963-01e9-8f61-eac7786525e2@redhat.com> Date: Thu, 7 Dec 2017 12:12:59 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.5.0 MIME-Version: 1.0 In-Reply-To: <1512611363-14196-1-git-send-email-star.zeng@intel.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Thu, 07 Dec 2017 11:13:02 +0000 (UTC) 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 11:08:29 -0000 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit 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 > 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(-) > > 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 Thanks! Laszlo