From patchwork Tue Nov 22 16:56:18 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 13052572 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id DB064C4332F for ; Tue, 22 Nov 2022 16:57:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=tXFmObI2t4Wa0WNI6faNrqrtVqs7GPX2HZWL5+ppkWA=; b=pnwsqBS9pwkI0j nObinzFvjUP1UO2JuTJcNqvraIgVOCwUtLYRP8E1584TzWFTnMMjCORuLb+qDIi29XbclEdWNN/zh cbQhjaK08L8rtBWBhT1qGxlIL9YnRRiy+BJC2GjhHOFzFQszmAv9oEY5ngLnZOpaKPqgPBAzF4xEY F6nfJMT0w5rDj6lnRCtsSqHKetfkg92fXHNOShsQD20ysnmHIYrqyHvhOu6uQJ9luRmeEeeVTF5ve KTB0BqIePGiajePeEw252mhZkN+j8qrQ4A6p++IrVquUPGwgxMHdBu04YLDnsn2Kz87A1KSFvWiem wsBt6LZhmQ4hiWRLKi0A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oxWZT-00Aso5-Kv; Tue, 22 Nov 2022 16:56:31 +0000 Received: from ams.source.kernel.org ([145.40.68.75]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oxWZQ-00Asmu-HK for linux-arm-kernel@lists.infradead.org; Tue, 22 Nov 2022 16:56:29 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 1EE37B81CBB; Tue, 22 Nov 2022 16:56:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C1091C433C1; Tue, 22 Nov 2022 16:56:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1669136184; bh=+JCX1yOKiIRjZ6QCWZy3dH5CuneozU+UFClbetgxGaY=; h=From:To:Cc:Subject:Date:From; b=bCmB0DSD891rjvQexGrlmW1UGl+RPoSprEM+QxgUf4X2n0vJAK2FbPdv2CfTHG3F3 DX6iB5f3IwFzxkZIUGRBlq3knYmbezixsjXMelzvt2S2xyY9Dp3RRc/wLBjN93UJkQ 4CzuPUvFaGRJHT/wcvOfLMcJafB6VPENaMYkGF572GdetQ8XVAp+UntsZvcF8ngC/p L3Su4a9r5dXNvgaJPiQaaJtEz2Azm6FGoDtYCajSnMEYMAgq3ebiCBwK6OaeIDpXuH x44ghp9u8DnQ5AXUsuv/WBZE10qLbt+PD4lj2TzFlu1vwhEf/VcB6Q/CuLmc7VdTtC 1UL29xm6x9o9A== From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org Cc: will@kernel.org, catalin.marinas@arm.com, Ard Biesheuvel Subject: [PATCH] arm64: mm: Align PGDs to at least 64 bytes Date: Tue, 22 Nov 2022 17:56:18 +0100 Message-Id: <20221122165618.2453224-1-ardb@kernel.org> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1427; i=ardb@kernel.org; h=from:subject; bh=+JCX1yOKiIRjZ6QCWZy3dH5CuneozU+UFClbetgxGaY=; b=owEB7QES/pANAwAKAcNPIjmS2Y8kAcsmYgBjfP8xJA6CQc8DBGGyBvvRk1e6632oC2mplJUMc9Ci qLsulZaJAbMEAAEKAB0WIQT72WJ8QGnJQhU3VynDTyI5ktmPJAUCY3z/MQAKCRDDTyI5ktmPJK5uDA CXEwv1/r6NzRvkxbuhvjXYlx3gxYPmzdJxSSurSBOViHhoHL7iFjQXQYZQ7qPT188g2q7YUWbNaXz6 AOGvVdtWWgLNHPCDCu/QY6OwH+DSYajegiknR8oyb4cZlRewWqkOvhGMDn+J08IWtn3lnuahEpZK34 D4wti3ilURcoikBqj1tZZLJb9YSDShyDsnm4PzLRQ+1SjTG0DF8pyrlvw5nl3y+5sFEOgDKTYvh4TR EGGEr9rOZ0EBsk2s9Nn17H2gpQU8CwB5H8xe9dyGrm2h5sV+3oAa5010x30Kh/1vSZcjbWw3QdYga4 kxEm5tNlRq048IDJphVtjXfUdLpapPGkxtdJW3M+RI+L/7K8CBpjW83y+77lYstORNpkvHgPISmLvg CFresmQfZRxn35gKUkPerkdm+kC+xKp4HxQ6f5MSx2NifsfdsvlX+iGZAUHeupGUsvm4saNS23GI+X R+tsmcMuyViF2IFQqPG1VObYDVV/KPDGp4wGO+f7MXYZY= X-Developer-Key: i=ardb@kernel.org; a=openpgp; fpr=F43D03328115A198C90016883D200E9CA6329909 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221122_085628_761614_F815C5FC X-CRM114-Status: GOOD ( 13.05 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org My copy of the ARM ARM (DDI 0487G.a) no longer describes the 64 byte minimum alignment of root page tables as being conditional on whether 52-bit physical addressing is supported and enabled, even though I seem to remember that this was the case formerly (and our code suggests the same). So align pgd_t[] allocations to 64 bytes. Note that this only affects 16k/4 levels configurations, which are unlikely to be in wide use. Signed-off-by: Ard Biesheuvel Acked-by: Catalin Marinas --- arch/arm64/mm/pgd.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/arch/arm64/mm/pgd.c b/arch/arm64/mm/pgd.c index 4a64089e5771c1e2..8f01a75c35caaa9a 100644 --- a/arch/arm64/mm/pgd.c +++ b/arch/arm64/mm/pgd.c @@ -40,17 +40,10 @@ void __init pgtable_cache_init(void) if (PGD_SIZE == PAGE_SIZE) return; -#ifdef CONFIG_ARM64_PA_BITS_52 /* - * With 52-bit physical addresses, the architecture requires the - * top-level table to be aligned to at least 64 bytes. + * Naturally aligned pgds required by the architecture, with a minimum + * alignment of 64 bytes. */ - BUILD_BUG_ON(PGD_SIZE < 64); -#endif - - /* - * Naturally aligned pgds required by the architecture. - */ - pgd_cache = kmem_cache_create("pgd_cache", PGD_SIZE, PGD_SIZE, + pgd_cache = kmem_cache_create("pgd_cache", PGD_SIZE, max(PGD_SIZE, 64), SLAB_PANIC, NULL); }