From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id 9A2EE81F50 for ; Mon, 27 Feb 2017 08:07:18 -0800 (PST) Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 37CEF4E4E6; Mon, 27 Feb 2017 16:07:19 +0000 (UTC) Received: from lacos-laptop-7.usersys.redhat.com (ovpn-116-99.phx2.redhat.com [10.3.116.99]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id v1RG7H4R018130; Mon, 27 Feb 2017 11:07:18 -0500 To: Ard Biesheuvel , edk2-devel@ml01.01.org References: <1488208162-26709-1-git-send-email-ard.biesheuvel@linaro.org> From: Laszlo Ersek Message-ID: <9d4ada83-4141-75e8-a2d3-6e7879f0bb7c@redhat.com> Date: Mon, 27 Feb 2017 17:07:16 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.1 MIME-Version: 1.0 In-Reply-To: <1488208162-26709-1-git-send-email-ard.biesheuvel@linaro.org> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.27 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Mon, 27 Feb 2017 16:07:19 +0000 (UTC) Subject: Re: [PATCH v2] 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: Mon, 27 Feb 2017 16:07:18 -0000 Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit On 02/27/17 16:09, Ard Biesheuvel wrote: > 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 mapping 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 number between 90 and 1020, depending on whether > contiguous hints are honoured by the hardware. > > So let's remove PcdPerformanceLibraryPropertyMask until we find a reason > why we need it. > > (*) 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 > --- > v2: remove PCD altogether rather than explicitly set it to its default > value of 0 > > ArmVirtPkg/ArmVirt.dsc.inc | 1 - > 1 file changed, 1 deletion(-) > > diff --git a/ArmVirtPkg/ArmVirt.dsc.inc b/ArmVirtPkg/ArmVirt.dsc.inc > index 8e3d298723f1..cc09d38910a2 100644 > --- a/ArmVirtPkg/ArmVirt.dsc.inc > +++ b/ArmVirtPkg/ArmVirt.dsc.inc > @@ -295,7 +295,6 @@ [PcdsFixedAtBuild.common] > gEfiMdePkgTokenSpaceGuid.PcdMaximumLinkedListLength|1000000 > gEfiMdePkgTokenSpaceGuid.PcdSpinLockTimeout|10000000 > gEfiMdePkgTokenSpaceGuid.PcdDebugClearMemoryValue|0xAF > - gEfiMdePkgTokenSpaceGuid.PcdPerformanceLibraryPropertyMask|1 > gEfiMdePkgTokenSpaceGuid.PcdPostCodePropertyMask|0 > gEfiMdePkgTokenSpaceGuid.PcdUefiLibMaxPrintBufferSize|320 > > Reviewed-by: Laszlo Ersek