From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-x22e.google.com (mail-wm0-x22e.google.com [IPv6:2a00:1450:400c:c09::22e]) (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 616E581C73 for ; Mon, 27 Feb 2017 07:09:31 -0800 (PST) Received: by mail-wm0-x22e.google.com with SMTP id v186so63599534wmd.0 for ; Mon, 27 Feb 2017 07:09:31 -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=L8PSRrQSBg6QWolm2E+gXR0Gm2KpTfbvxBGAdw86hoc=; b=GbrbCWOPmkyWTMaXMpwYXQ4KJNNAwFgRei9bZg9HY+v6EU6CkrwVskIrGACjOgx2zS YPj6rslloWcUNsySv/pBq17xv0+AdXkDuJncU82OBdzAHDo/hDHigwa9Q5KTm4fOWqzz lB8UhhoF4oiYIjJNslWLAg2Ox+D7oB5MWsaOk= 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=L8PSRrQSBg6QWolm2E+gXR0Gm2KpTfbvxBGAdw86hoc=; b=hsvL8nd+hsRhmSF5Xe6TIgy2q55S3DFcsDGze0hGkFG2Caom056GSjV8dqyc38PNm7 kc+lls7Ul5kPl4Lp6Mxabeb4SymQiOuL1U6pc9KL0Ond3ta/rWt45mfLNOhCy0174ETj j9Jr11CLLU6DbPa+d+a2HF8XP93bGGqU7PBXXboQTiJeVrAK6ElUZQRzAkYUICiWrz7l w+ikI3YRZqi4pwbaxt1qC+LFytCYVSEQ0e4KY9+KzlAq/9QDSxVl/wIMP1x2RwUFPn37 p9XRjhRuyN7xU+HwvVzY5RZDgwsGob8PTo3RVhghAbrCg+Rgwc0uYsrjxU8Hm6ZlHPTt KpcQ== X-Gm-Message-State: AMke39neDZfcMMhizfnbUnCHVbhgWoajVHYgCiAMNtFNmHxpLkTLHa+lg6XsvO9Fga42eb+I X-Received: by 10.28.68.10 with SMTP id r10mr14564793wma.68.1488208169952; Mon, 27 Feb 2017 07:09:29 -0800 (PST) Received: from localhost.localdomain ([105.149.201.216]) by smtp.gmail.com with ESMTPSA id 99sm18500147wrm.18.2017.02.27.07.09.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 27 Feb 2017 07:09:29 -0800 (PST) From: Ard Biesheuvel To: edk2-devel@lists.01.org, lersek@redhat.com Cc: Ard Biesheuvel Date: Mon, 27 Feb 2017 15:09:22 +0000 Message-Id: <1488208162-26709-1-git-send-email-ard.biesheuvel@linaro.org> X-Mailer: git-send-email 2.7.4 Subject: [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 15:09:31 -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 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 -- 2.7.4