From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=66.187.233.73; helo=mx1.redhat.com; envelope-from=lersek@redhat.com; receiver=edk2-devel@lists.01.org Received: from mx1.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) (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 579E3211299BA for ; Wed, 12 Sep 2018 03:04:31 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 90D70402333A; Wed, 12 Sep 2018 10:04:30 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-120-31.rdu2.redhat.com [10.10.120.31]) by smtp.corp.redhat.com (Postfix) with ESMTP id 922F1202706C; Wed, 12 Sep 2018 10:04:29 +0000 (UTC) To: "Wang, Jian J" , "edk2-devel@lists.01.org" Cc: "Zeng, Star" , "You, Benjamin" , "Dong, Eric" References: <20180910032225.10044-1-jian.j.wang@intel.com> From: Laszlo Ersek Message-ID: <3cceb1cd-31d1-5d92-ca64-3e001549294f@redhat.com> Date: Wed, 12 Sep 2018 12:04:28 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Wed, 12 Sep 2018 10:04:30 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.6]); Wed, 12 Sep 2018 10:04:30 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'lersek@redhat.com' RCPT:'' Subject: Re: [PATCH] UefiCpuPkg/PiSmmCpuDxeSmm: add message for S3 config error X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 12 Sep 2018 10:04:31 -0000 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit On 09/12/18 02:49, Wang, Jian J wrote: > Laszlo, > > Thanks for the comments. > > > (1) Agree. It’ll be updated in v2. > > (2) DEBUG_ERROR level won’t print word “ERROR” on console. I think an “ERROR” > > word in log should get the attention more easily. > > (3) How about log both of them? GUID value may be more friendly to log parser but > a GUID name is more friendly to person. > > (4) Good idea. I’ll add it in v2. Those work for me as well. Thanks Laszlo > From: Laszlo Ersek [mailto:lersek@redhat.com] > Sent: Tuesday, September 11, 2018 10:01 PM > To: Wang, Jian J ; edk2-devel@lists.01.org > Cc: Zeng, Star ; You, Benjamin ; Dong, Eric > Subject: Re: [PATCH] UefiCpuPkg/PiSmmCpuDxeSmm: add message for S3 config error > > On 09/10/18 05:22, Jian J Wang wrote: >> BZ#: https://bugzilla.tianocore.org/show_bug.cgi?id=1165 >> >> HOB gEfiAcpiVariableGuid is a must have data for S3 resume if >> PcdAcpiS3Enable is set to TRUE. Current code in CpuS3.c doesn't >> embody this strong binding between them. An error message and >> ASSERT is added by this patch to warn platform developer about >> it. >> >> Cc: Star Zeng > >> Cc: Benjamin You > >> Cc: Eric Dong > >> Cc: Laszlo Ersek > >> Contributed-under: TianoCore Contribution Agreement 1.1 >> Signed-off-by: Jian J Wang > >> --- >> UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c | 3 +++ >> 1 file changed, 3 insertions(+) >> >> diff --git a/UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c b/UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c >> index abd8a5a07b..f371667c44 100644 >> --- a/UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c >> +++ b/UefiCpuPkg/PiSmmCpuDxeSmm/CpuS3.c >> @@ -744,6 +744,9 @@ InitSmmS3ResumeState ( >> if (sizeof (UINTN) == sizeof (UINT32)) { >> SmmS3ResumeState->Signature = SMM_S3_RESUME_SMM_32; >> } >> + } else { >> + DEBUG ((DEBUG_ERROR, "ERROR: HOB(gEfiAcpiVariableGuid) needed by S3 resume doesn't exist!\n")); >> + ASSERT (FALSE); >> } >> >> // >> > > I have some superficial comments for this patch. > > (1) in case the "if" has an "else" branch, I think it's better style to > use "==" in the condition than "!=". To me, > > if (GuidHob != NULL) { > // > // do a bunch of stuff > // > } else { > // > // error > // > } > > is more difficult to read than: > > if (GuidHob == NULL) { > // > // error > // > } else { > // > // do a bunch of stuff > // > } > > in particular if the "bunch of stuff" includes nested "if" statements. > > > (2) I think the error message could be improved. I'd suggest removing > the word "ERROR", since DEBUG_ERROR already sets the error level / mask. > > (3) Furthermore, I suggest not logging the name "gEfiAcpiVariableGuid" > textually, as a string -- in edk2 we generally log GUIDs by value, and > log parsers / translators usually look for GUID values. Thus I suggest > using %g with &gEfiAcpiVariableGuid. > > (4) Please consider logging the module name and/or the function name > too, with "%a", and gEfiCallerBaseName and/or __FUNCTION__. > "gEfiCallerBaseName" is usually only helpful with libraries (because > they can be linked into multiple drivers), but __FUNCTION__ is more > frequently helpful. > > Thanks > Laszlo >