[edk2-devel] [PATCH v2 09/10] OvmfPkg: disable list length checks in NOOPT and DEBUG builds
Philippe Mathieu-Daudé
philmd at redhat.com
Fri Jan 15 09:30:50 UTC 2021
On 1/13/21 9:54 AM, Laszlo Ersek wrote:
> In NOOPT and DEBUG builds, if "PcdMaximumLinkedListLength" is nonzero,
> then several LIST_ENTRY *node* APIs in BaseLib compare the *full* list
> length against the PCD.
>
> This turns the time complexity of node-level APIs from constant to linear,
> and that of full-list manipulations from linear to quadratic.
>
> As an example, consider the EFI_SHELL_FILE_INFO list, which is a data
> structure that's widely used in the UEFI shell. I randomly extracted 5000
> files from "/usr/include" on my laptop, spanning 1095 subdirectories out
> of 1538, and then ran "DIR -R" in the UEFI shell on this tree. These are
> the wall-clock times:
>
> PcdMaximumLinkedListLength PcdMaximumLinkedListLength
> =1,000,000 =0
> -------------------------- ---------------------------
> FAT 4 min 31 s 18 s
> virtio-fs 5 min 13 s 1 min 33 s
>
> Checking list lengths against an arbitrary maximum (default: 1,000,000)
> seems useless even in NOOPT and DEBUG builds, while the cost is
> significant; so set the PCD to 0.
>
> Cc: Anthony Perard <anthony.perard at citrix.com>
> Cc: Ard Biesheuvel <ard.biesheuvel at arm.com>
> Cc: Jordan Justen <jordan.l.justen at intel.com>
> Cc: Julien Grall <julien at xen.org>
> Cc: Leif Lindholm <leif at nuviainc.com>
> Cc: Peter Grehan <grehan at freebsd.org>
> Cc: Philippe Mathieu-Daudé <philmd at redhat.com>
> Cc: Rebecca Cran <rebecca at bsdio.com>
> Cc: Sami Mujawar <sami.mujawar at arm.com>
> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3152
> Signed-off-by: Laszlo Ersek <lersek at redhat.com>
> Acked-by: Ard Biesheuvel <ard.biesheuvel at arm.com>
> ---
>
> Notes:
> v2:
> - no changes
> - pick up Ard's A-b
>
> OvmfPkg/AmdSev/AmdSevX64.dsc | 1 +
> OvmfPkg/Bhyve/BhyveX64.dsc | 1 +
> OvmfPkg/OvmfPkgIa32.dsc | 1 +
> OvmfPkg/OvmfPkgIa32X64.dsc | 1 +
> OvmfPkg/OvmfPkgX64.dsc | 1 +
> OvmfPkg/OvmfXen.dsc | 1 +
> 6 files changed, 6 insertions(+)
Reviewed-by: Philippe Mathieu-Daude <philmd at redhat.com>
-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#70417): https://edk2.groups.io/g/devel/message/70417
Mute This Topic: https://groups.io/mt/79646589/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-
More information about the edk2-devel-archive
mailing list