From 6e5586863148773c15399ead249711143a74d2d0 Mon Sep 17 00:00:00 2001 From: Laszlo Ersek Date: Wed, 13 Jan 2021 09:54:53 +0100 Subject: [PATCH] ArmVirtPkg: disable list length checks in NOOPT and DEBUG builds MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 Cc: Julien Grall Cc: Leif Lindholm Cc: Philippe Mathieu-Daudé Cc: Sami Mujawar Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3152 Signed-off-by: Laszlo Ersek Acked-by: Ard Biesheuvel Message-Id: <20210113085453.10168-11-lersek@redhat.com> Reviewed-by: Philippe Mathieu-Daudé --- ArmVirtPkg/ArmVirt.dsc.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ArmVirtPkg/ArmVirt.dsc.inc b/ArmVirtPkg/ArmVirt.dsc.inc index 9ec9293047..d9abadbe70 100644 --- a/ArmVirtPkg/ArmVirt.dsc.inc +++ b/ArmVirtPkg/ArmVirt.dsc.inc @@ -290,7 +290,7 @@ [PcdsFixedAtBuild.common] gEfiMdePkgTokenSpaceGuid.PcdMaximumUnicodeStringLength|1000000 gEfiMdePkgTokenSpaceGuid.PcdMaximumAsciiStringLength|1000000 - gEfiMdePkgTokenSpaceGuid.PcdMaximumLinkedListLength|1000000 + gEfiMdePkgTokenSpaceGuid.PcdMaximumLinkedListLength|0 gEfiMdePkgTokenSpaceGuid.PcdSpinLockTimeout|10000000 gEfiMdePkgTokenSpaceGuid.PcdUefiLibMaxPrintBufferSize|320 -- 2.39.2