public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Kinney, Michael D" <michael.d.kinney@intel.com>
To: Ard Biesheuvel <ard.biesheuvel@linaro.org>,
	"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>,
	"Kinney, Michael D" <michael.d.kinney@intel.com>
Cc: Laszlo Ersek <lersek@redhat.com>,
	Leif Lindholm <leif.lindholm@linaro.org>,
	"Gao, Liming" <liming.gao@intel.com>,
	"Zeng, Star" <star.zeng@intel.com>,
	"Dong, Eric" <eric.dong@intel.com>,
	"Bi, Dandan" <dandan.bi@intel.com>
Subject: Re: [PATCH v2 0/5] Abstract allocation of PEI accessible memory
Date: Thu, 24 May 2018 16:57:07 +0000	[thread overview]
Message-ID: <E92EE9817A31E24EB0585FDF735412F5B8A388B1@ORSMSX113.amr.corp.intel.com> (raw)
In-Reply-To: <20180524090945.10289-1-ard.biesheuvel@linaro.org>

Ard,

Thanks for the update.  This looks really close.

One comment is on the use of #ifdef MDE_CPU_X64
in a C file.

In general, the #ifdef for a specific type of CPU
should be limited to .h files and we should split
out CPU specific sources into their own source
files and use the INF file [Sources.<arch>] to
list the CPU specific source files.

Only other minor comment is that the summary still
mentions adding the new API to the UefiLib.

Mike


> -----Original Message-----
> From: Ard Biesheuvel [mailto:ard.biesheuvel@linaro.org]
> Sent: Thursday, May 24, 2018 2:10 AM
> To: edk2-devel@lists.01.org
> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org>; Laszlo
> Ersek <lersek@redhat.com>; Leif Lindholm
> <leif.lindholm@linaro.org>; Kinney, Michael D
> <michael.d.kinney@intel.com>; Gao, Liming
> <liming.gao@intel.com>; Zeng, Star
> <star.zeng@intel.com>; Dong, Eric <eric.dong@intel.com>;
> Bi, Dandan <dandan.bi@intel.com>
> Subject: [PATCH v2 0/5] Abstract allocation of PEI
> accessible memory
> 
> At the moment, FirmwarePerformanceTableDataDxe or
> DxeCorePerformanceLib
> are unusable on systems such as AMD Seattle, because
> they unconditionally
> attempt to allocate memory below 4 GB, and ASSERT() if
> this fails. On AMD
> Seattle, no 32-bit addressable DRAM exists, and so the
> driver will always
> assert, and crash a running DEBUG build.
> 
> The reason for this is that some platforms (i.e., X64
> builds consisting of
> a 32-bit PEI stage and 64-bit remaining stages) require
> these allocations
> to be below 4 GB, and for some reason, open coding this
> practice throughout
> the code without regard for other architectures has been
> regarded as an
> acceptable approach.
> 
> Instead, I would like to propose the approach
> implemented in this series:
> - create an abstracted EfiAllocatePeiAccessiblePages()
> routine in UefiLib
>   that simply allocates pages from any region on all
> architectures except
>   X64, and allocate below 4 GB for X64
> - update the various call sites with calls to this new
> function.
> 
> The above is implemented in patches #3 - #6. Patches #1
> and #2 are fixes
> for issues that I observed in ArmVirtPkg and OvmfPkg
> while working on
> these patches.
> 
> Code can be found here:
> https://github.com/ardbiesheuvel/edk2/tree/allocate-pei-
> v2
> 
> Changes since v1:
> - add Laszlo's ack to #1 - #2
> - move EfiAllocatePeiPages() to DxeServicesLib and drop
> Efi prefix
> - update implementation to take EfiFreeMemoryTop into
> account when built
>   for X64
> 
> Cc: Laszlo Ersek <lersek@redhat.com>
> Cc: Leif Lindholm <leif.lindholm@linaro.org>
> Cc: Michael D Kinney <michael.d.kinney@intel.com>
> Cc: Liming Gao <liming.gao@intel.com>
> Cc: Star Zeng <star.zeng@intel.com>
> Cc: Eric Dong <eric.dong@intel.com>
> Cc: Dandan Bi <dandan.bi@intel.com>
> 
> Ard Biesheuvel (5):
>   OvmfPkg/PlatformBootManagerLib: add missing report
> status code call
>   ArmVirtPkg/PlatformBootManagerLib: add missing report
> status code call
>   MdePkg/DxeServicesLib: introduce
> AllocatePeiAccessiblePages routine
>   MdeModulePkg/DxeCorePerformanceLib: use
> AllocatePeiAccessiblePages
>   MdeModulePkg/FirmwarePerformanceDataTableDxe: use
>     AllocatePeiAccessiblePages
> 
>  .../PlatformBootManagerLib.inf                |  1 +
>  .../PlatformBootManagerLib/QemuKernel.c       |  4 ++
>  .../DxeCorePerformanceLib.c                   | 45 ++--
> -----------
>  .../FirmwarePerformanceDxe.c                  | 51 +++-
> -------------
>  .../FirmwarePerformanceDxe.inf                |  1 +
>  MdePkg/Include/Library/DxeServicesLib.h       | 23
> +++++++-
>  .../Library/DxeServicesLib/DxeServicesLib.c   | 55
> +++++++++++++++++++
>  .../Library/DxeServicesLib/DxeServicesLib.inf |  3 +
>  .../PlatformBootManagerLib.inf                |  1 +
>  .../PlatformBootManagerLib/QemuKernel.c       |  4 ++
>  10 files changed, 104 insertions(+), 84 deletions(-)
> 
> --
> 2.17.0



      parent reply	other threads:[~2018-05-24 16:57 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-24  9:09 [PATCH v2 0/5] Abstract allocation of PEI accessible memory Ard Biesheuvel
2018-05-24  9:09 ` [PATCH v2 1/5] OvmfPkg/PlatformBootManagerLib: add missing report status code call Ard Biesheuvel
2018-05-24  9:09 ` [PATCH v2 2/5] ArmVirtPkg/PlatformBootManagerLib: " Ard Biesheuvel
2018-05-24  9:09 ` [PATCH v2 3/5] MdePkg/DxeServicesLib: introduce AllocatePeiAccessiblePages routine Ard Biesheuvel
2018-05-24 12:36   ` Laszlo Ersek
2018-05-24  9:09 ` [PATCH v2 4/5] MdeModulePkg/DxeCorePerformanceLib: use AllocatePeiAccessiblePages Ard Biesheuvel
2018-05-24 12:49   ` Laszlo Ersek
2018-05-24 12:54     ` Ard Biesheuvel
2018-05-24 13:09       ` Laszlo Ersek
2018-05-25  2:00       ` Bi, Dandan
2018-05-25  2:44         ` Zeng, Star
2018-05-25  3:07           ` Bi, Dandan
2018-05-24  9:09 ` [PATCH v2 5/5] MdeModulePkg/FirmwarePerformanceDataTableDxe: " Ard Biesheuvel
2018-05-24 12:53   ` Laszlo Ersek
2018-05-24 16:57 ` Kinney, Michael D [this message]

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=E92EE9817A31E24EB0585FDF735412F5B8A388B1@ORSMSX113.amr.corp.intel.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