]> git.proxmox.com Git - mirror_edk2.git/commitdiff
ArmVirtPkg: disable list length checks in NOOPT and DEBUG builds
authorLaszlo Ersek <lersek@redhat.com>
Wed, 13 Jan 2021 08:54:53 +0000 (09:54 +0100)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Tue, 19 Jan 2021 18:23:28 +0000 (18:23 +0000)
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.

(See some example OVMF numbers in the previous patch.)

Checking list lengths against an arbitrary maximum -- default value, and
current ArmVirtPkg setting: 1,000,000 -- seems useless even in NOOPT and
DEBUG builds, while the cost is significant; so set the PCD to 0.

Cc: Ard Biesheuvel <ard.biesheuvel@arm.com>
Cc: Julien Grall <julien@xen.org>
Cc: Leif Lindholm <leif@nuviainc.com>
Cc: Philippe Mathieu-Daudé <philmd@redhat.com>
Cc: Sami Mujawar <sami.mujawar@arm.com>
Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3152
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
Acked-by: Ard Biesheuvel <ard.biesheuvel@arm.com>
Message-Id: <20210113085453.10168-11-lersek@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>
ArmVirtPkg/ArmVirt.dsc.inc

index 9ec92930472df052036dd637da3a37db80de82ae..d9abadbe708c28ae6fbc8fbdd53761df233f182f 100644 (file)
 [PcdsFixedAtBuild.common]\r
   gEfiMdePkgTokenSpaceGuid.PcdMaximumUnicodeStringLength|1000000\r
   gEfiMdePkgTokenSpaceGuid.PcdMaximumAsciiStringLength|1000000\r
-  gEfiMdePkgTokenSpaceGuid.PcdMaximumLinkedListLength|1000000\r
+  gEfiMdePkgTokenSpaceGuid.PcdMaximumLinkedListLength|0\r
   gEfiMdePkgTokenSpaceGuid.PcdSpinLockTimeout|10000000\r
   gEfiMdePkgTokenSpaceGuid.PcdUefiLibMaxPrintBufferSize|320\r
 \r