public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Laszlo Ersek <lersek@redhat.com>
To: "Ni, Ray" <ray.ni@Intel.com>,
	"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Cc: "Wu, Hao A" <hao.a.wu@intel.com>,
	"Bi, Dandan" <dandan.bi@intel.com>,
	"Zeng, Star" <star.zeng@intel.com>
Subject: Re: [PATCH v3 1/5] MdeModulePkg/UefiBootManagerLib: fix LoadImage/StartImage status code rep.
Date: Mon, 25 Feb 2019 11:54:35 +0100	[thread overview]
Message-ID: <b168323f-dac8-bd51-ea18-264f506a1ba6@redhat.com> (raw)
In-Reply-To: <0a59efb2-45cb-51b4-60d6-9cf3a125c9cb@Intel.com>

On 02/25/19 09:27, Ni, Ray wrote:
> On 2/23/2019 1:16 AM, Laszlo Ersek wrote:
>> Yes, I was fully aware of that.
>>
>> However:
>>
>> The issue is that, in the BmReportLoadFailure() function, we do some
>> work*before*  we call REPORT_STATUS_CODE_EX(). We have an ASSERT(), a
>> ZeroMem(), and a field assignment.
>>
>> If status code reporting is disabled for EFI_ERROR_CODE in the platform,
>> then said work will be wasted. We can optimize this by checking for
>> ReportErrorCodeEnabled() up-front, because we know for sure that later
>> on we will report the status code with EFI_ERROR_CODE type.
>>
>> In other words, this approach is similar to DEBUG_CODE(). In some cases,
>> logging a piece of information with DEBUG() takes non-trivial
>> computation. And it would be a waste, for example in RELEASE builds, to
>> perform the computation, and then throw away only the result (the log
>> message). Therefore the DEBUG_CODE macro is used, and the whole work is
>> eliminated in RELEASE builds.
>>
>> The idea is the same here. If the compiler can statically deduce that
>> ReportErrorCodeEnabled() will always return FALSE -- for example because
>> the ReportStatusCodeLib instance in question looks at
>> "PcdReportStatusCodePropertyMask", and the PCD is Fixed-at-Build, and
>> the corresponding bit is clear --, then the compiler can eliminate the
>> entire BmReportLoadFailure() function. This is good for both flash usage
>> and for performance.
>>
>> I'm fine either way, but first, please confirm again that you really
>> want me to remove the ReportErrorCodeEnabled() check, before pushing.
>>
>> Thanks!
>> Laszlo
> 
> Thanks for the explanation. I am fine with both.
> Reviewed-by: Ray Ni <ray.ni@intel.com>
> 

Thank you, Ray. I opted for pushing v3 as-is.

Laszlo


  reply	other threads:[~2019-02-25 10:54 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-21 10:41 [PATCH v3 0/5] MdeModulePkg, OvmfPkg, ArmVirtPkg: more visible boot progress reporting Laszlo Ersek
2019-02-21 10:41 ` [PATCH v3 1/5] MdeModulePkg/UefiBootManagerLib: fix LoadImage/StartImage status code rep Laszlo Ersek
2019-02-22  1:05   ` Bi, Dandan
2019-02-22  9:02     ` Laszlo Ersek
2019-02-22 11:50   ` Ni, Ray
2019-02-22 17:16     ` Laszlo Ersek
2019-02-25  8:27       ` Ni, Ray
2019-02-25 10:54         ` Laszlo Ersek [this message]
2019-02-21 10:41 ` [PATCH v3 2/5] OvmfPkg: add library to track boot option loading/starting on the console Laszlo Ersek
2019-02-21 10:41 ` [PATCH v3 3/5] OvmfPkg/PlatformBootManagerLib: display boot option loading/starting Laszlo Ersek
2019-02-21 10:41 ` [PATCH v3 4/5] ArmVirtPkg/ArmVirtQemu*: enable minimal Status Code Routing in DXE Laszlo Ersek
2019-02-21 10:41 ` [PATCH v3 5/5] ArmVirtPkg/PlatformBootManagerLib: display boot option loading/starting Laszlo Ersek
2019-02-25 10:55 ` [PATCH v3 0/5] MdeModulePkg, OvmfPkg, ArmVirtPkg: more visible boot progress reporting Laszlo Ersek

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=b168323f-dac8-bd51-ea18-264f506a1ba6@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