public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Laszlo Ersek <lersek@redhat.com>
To: "Wang, Jian J" <jian.j.wang@intel.com>,
	"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Cc: "Ni, Ruiyu" <ruiyu.ni@intel.com>, "Dong, Eric" <eric.dong@intel.com>
Subject: Re: [PATCH v2 3/4] UefiCpuPkg/CpuDxe: implement non-stop mode for uefi
Date: Wed, 22 Aug 2018 09:45:09 +0200	[thread overview]
Message-ID: <6622884d-8e5f-b1ab-2abf-34de7cda200c@redhat.com> (raw)
In-Reply-To: <D827630B58408649ACB04F44C510003624E26A3B@SHSMSX103.ccr.corp.intel.com>

On 08/22/18 09:13, Wang, Jian J wrote:
> Hi Laszlo,
> 
> Regards,
> Jian
> 
> From: Laszlo Ersek [mailto:lersek@redhat.com]
> Sent: Tuesday, August 21, 2018 10:59 PM
> To: Wang, Jian J <jian.j.wang@intel.com>; edk2-devel@lists.01.org
> Cc: Ni, Ruiyu <ruiyu.ni@intel.com>; Dong, Eric <eric.dong@intel.com>
> Subject: Re: [edk2] [PATCH v2 3/4] UefiCpuPkg/CpuDxe: implement non-stop mode for uefi

>> +/**
>> +  Find and display image base address and return image base and its entry point.
>> +
>> +  @param CurrentIp      Current instruction pointer.
>> +
>> +**/
>> +STATIC
>> +VOID
>> +DumpModuleImageInfo (
>> +  IN  UINTN              CurrentIp
>> +  )
>> +{
>> +  EFI_STATUS                           Status;
>> +  UINTN                                Pe32Data;
>> +  VOID                                 *PdbPointer;
>> +  VOID                                 *EntryPoint;
>> +
>> +  Pe32Data = PeCoffSearchImageBase (CurrentIp);
>> +  if (Pe32Data == 0) {
>> +    InternalPrintMessage ("!!!! Can't find image information. !!!!\n");
>> +  } else {
>> +    //
>> +    // Find Image Base entry point
>> +    //
>> +    Status = PeCoffLoaderGetEntryPoint ((VOID *) Pe32Data, &EntryPoint);
>> +    if (EFI_ERROR (Status)) {
>> +      EntryPoint = NULL;
>> +    }
>> +    InternalPrintMessage ("!!!! Find image based on IP(0x%x) ", CurrentIp);
>> +    PdbPointer = PeCoffLoaderGetPdbPointer ((VOID *) Pe32Data);
>> +    if (PdbPointer != NULL) {
>> +      InternalPrintMessage ("%a", PdbPointer);
>> +    } else {
>> +      InternalPrintMessage ("(No PDB) " );
>> +    }
>> +    InternalPrintMessage (
>> +      " (ImageBase=%016lp, EntryPoint=%016p) !!!!\n",
>> +      (VOID *) Pe32Data,
>> +      EntryPoint
>> +      );
>> +  }
>> +}
> 
> (4) Why is this function copied here? From a quick check, it looks
> identical to DumpModuleImageInfo() in
> "UefiCpuPkg/Library/CpuExceptionHandlerLib/CpuExceptionCommon.c".
> 
> And, DumpModuleImageInfo() is an extern function in
> "UefiCpuPkg/Library/CpuExceptionHandlerLib/CpuExceptionCommon.h", and we
> are (likely) already linking against that library instance. As a result
> we'll have the same function twice in CpuDxe, once as STATIC, and
> another time as extern.
> 
> If this is a useful utility function, then it should be elevated to a
> public library API, and used from there. (I don't know where to add it,
> I just find this code duplication regrettable.)
> 
> [Jian] I reviewed the whole working model again. I think we don’t need to dump
> the image information here, because, if there’s an issue detected, the developers
> will disable the non-stop mode anyway in order to find the root cause. Then the
> image information can be dumped (normal mode). So we can just dump cpu
> information to tell the user that there’s an exception here. And dumping cpu
> information is already a public interface so we don’t need to duplicate any code
> here.

Oh cool. If we can eliminate the function altogether, that's best.

Thanks!
Laszlo


  reply	other threads:[~2018-08-22  7:45 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-21  3:05 [PATCH v2 0/4] Support non-stop mode in heap guard and null detection Jian J Wang
2018-08-21  3:05 ` [PATCH v2 1/4] MdeModulePkg/MdeModulePkg.dec: add new settings for PCDs Jian J Wang
2018-08-21  3:05 ` [PATCH v2 2/4] UefiCpuPkg/CpuExceptionHandlerLib: Setup single step in #PF handler Jian J Wang
2018-08-21 14:39   ` Laszlo Ersek
2018-08-28  1:14   ` Dong, Eric
2018-08-28  3:24     ` Wang, Jian J
2018-08-21  3:05 ` [PATCH v2 3/4] UefiCpuPkg/CpuDxe: implement non-stop mode for uefi Jian J Wang
2018-08-21 14:58   ` Laszlo Ersek
2018-08-22  7:13     ` Wang, Jian J
2018-08-22  7:45       ` Laszlo Ersek [this message]
2018-08-21  3:05 ` [PATCH v2 4/4] UefiCpuPkg/PiSmmCpuDxeSmm: implement non-stop mode for SMM Jian J Wang
2018-08-21 15:44   ` Laszlo Ersek
2018-08-22  7:16     ` Wang, Jian J
2018-08-21 14:28 ` [PATCH v2 0/4] Support non-stop mode in heap guard and null detection Laszlo Ersek
2018-08-22  6:59   ` Wang, Jian J

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6622884d-8e5f-b1ab-2abf-34de7cda200c@redhat.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox