From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-x22f.google.com (mail-wr0-x22f.google.com [IPv6:2a00:1450:400c:c0c::22f]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 0B8EB8217E for ; Fri, 24 Feb 2017 10:17:04 -0800 (PST) Received: by mail-wr0-x22f.google.com with SMTP id 89so18243200wrr.3 for ; Fri, 24 Feb 2017 10:17:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=FKUIWs/alMKaVaqxqlSENbHDGdTw5DbcCBGEB1+kfWE=; b=Ywvkssuo0gaQ9K5r2bBVAVZcnUpd8Lw+CmCJ++WW+MlEUuHT/pj/AXZrMmN9n2q31W w/M3q8HZw1VPOey//DyYlkN3xa+LmDXWmdXvJjXTpRprCF7kMnYDTiKGrs4Cdhhn8E1d JQUP3PPvAnFEuKBheWpxLbCukQzw85st0TV10= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=FKUIWs/alMKaVaqxqlSENbHDGdTw5DbcCBGEB1+kfWE=; b=hhRZxSIoohEcEWtY+Bdw9AY5E6HOdk3/NrEz4t13Zs2P/IH7IGGBMQF1+SfJouCOaL kgrQxMobn6f3/BsLdg+bFKk2lKBqrBnfUfE//+k+KrLPEBDxt8sVRqEYRKz0Fwk6x/pS 892LsMvHzZvQkdB1lYpQaoGlW/BdhtYXWfPINbzHDU9Gra9OFwa4cEF+lACOPbPqalJk UcVvJ2vz2dyAiccrQpCIhf1peR90KwwxdpArh2U5RLmVGUPraPiU/FpIwa33y4AAJTQO Niqr+d3fqeMNiQMtAcGLf1KBQ+Quq/hZH2lYx3ZMZ/PyLSPLVafiALBBnwP0ojXJHzTB 1GJA== X-Gm-Message-State: AMke39l3h0U3Tt8f569YLmTj7OOw6oZluCE2JL1gXe3syRSu0SSKEfuw6FXdoloNIxiY+6+5 X-Received: by 10.223.143.14 with SMTP id p14mr2259582wrb.120.1487960222661; Fri, 24 Feb 2017 10:17:02 -0800 (PST) Received: from localhost.localdomain ([105.149.201.216]) by smtp.gmail.com with ESMTPSA id z134sm3239660wmc.20.2017.02.24.10.17.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 24 Feb 2017 10:17:02 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org, lersek@redhat.com, leif.lindholm@linaro.org Cc: Ard Biesheuvel Date: Fri, 24 Feb 2017 18:16:55 +0000 Message-Id: <1487960215-14052-1-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.7.4 Subject: [PATCH] ArmVirtPkg: clear PcdPerformanceLibraryPropertyMask PCD X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 24 Feb 2017 18:17:04 -0000 The only observeable effect of having PcdPerformanceLibraryPropertyMask set to 1 is that a EfiReservedMemory region of 4 pages is allocated right below the 4 GB mark. This region is out of bounds for the OS, which means it is not even allowed to map it, to avoid speculative loads from it. On Linux, this may prevent the kernel from using a 1 GB block mappings for this region, and instead it has to carve up the block as follows: 0xffffffff80000000-0xffffffffbe000000 992M PMD CON BLK 0xffffffffbe000000-0xffffffffbfe00000 30M PMD BLK 0xffffffffbfe00000-0xffffffffbfff0000 1984K PTE CON 0xffffffffbfff0000-0xffffffffbfffc000 48K PTE where it would otherwise use a single 1 GB mapping (*), i.e., 0xffffffff80000000-0xffffffffc0000000 1G PGD To clarify, the latter is a single 8 byte entry in the top level page table, whereas in the former case, we have two additional levels of paging, requiring two extra 4 KB pages (on a 4 KB pagesize kernel). The real cost, however, is the TLB footprint, which goes up from a single entry to a value between 90 and 1020, depending on whether contiguous hints are honoured by the hardware. So let's set PcdPerformanceLibraryPropertyMask to zero until we find a reason why we shouldn't. (*) provided that no other allocations were deliberately located right below the 4 GB mark, and that we are running with more than 3 GB of memory, in which case most allocations will be over 4 GB, given EDK2's default top-down allocation policy. Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Ard Biesheuvel --- 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 61d4a6642eb7..ca0a4d31a03d 100644 --- a/ArmVirtPkg/ArmVirt.dsc.inc +++ b/ArmVirtPkg/ArmVirt.dsc.inc @@ -295,7 +295,7 @@ [PcdsFixedAtBuild.common] gEfiMdePkgTokenSpaceGuid.PcdMaximumLinkedListLength|1000000 gEfiMdePkgTokenSpaceGuid.PcdSpinLockTimeout|10000000 gEfiMdePkgTokenSpaceGuid.PcdDebugClearMemoryValue|0xAF - gEfiMdePkgTokenSpaceGuid.PcdPerformanceLibraryPropertyMask|1 + gEfiMdePkgTokenSpaceGuid.PcdPerformanceLibraryPropertyMask|0 gEfiMdePkgTokenSpaceGuid.PcdPostCodePropertyMask|0 gEfiMdePkgTokenSpaceGuid.PcdUefiLibMaxPrintBufferSize|320 -- 2.7.4