From patchwork Mon Oct 14 10:58:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryan Roberts X-Patchwork-Id: 13834717 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2E93AD1A43B for ; Mon, 14 Oct 2024 11:02:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id AB27F6B00E0; Mon, 14 Oct 2024 07:01:59 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A3A456B00E2; Mon, 14 Oct 2024 07:01:59 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 88E456B00E3; Mon, 14 Oct 2024 07:01:59 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id 6A4006B00E0 for ; Mon, 14 Oct 2024 07:01:59 -0400 (EDT) Received: from smtpin26.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 9169280D96 for ; Mon, 14 Oct 2024 11:01:52 +0000 (UTC) X-FDA: 82671917748.26.03F7C58 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by imf01.hostedemail.com (Postfix) with ESMTP id 12D364001B for ; Mon, 14 Oct 2024 11:01:51 +0000 (UTC) Authentication-Results: imf01.hostedemail.com; dkim=none; spf=pass (imf01.hostedemail.com: domain of ryan.roberts@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=ryan.roberts@arm.com; dmarc=pass (policy=none) header.from=arm.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1728903671; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=97p+R0dspaRUKJqMA/Y3wP7vnE/E8FcpBV0RwE1dMZY=; b=7J5Bt4T8LII6d4nO6FLOvCKFSwHcm4cd/c29lBq7jNTmltHkdFK+T26j+28A+ACDs3OgfX wYFSnMWCrjEr6zdiTljZ0+6ajuRR6oVcWKWg0Na/QqQ9rQRuEMJjLD4+Q3RXWjSGiSYVwt /lr5op+e04XONj+1qTF+Ebyvkm3fAV4= ARC-Authentication-Results: i=1; imf01.hostedemail.com; dkim=none; spf=pass (imf01.hostedemail.com: domain of ryan.roberts@arm.com designates 217.140.110.172 as permitted sender) smtp.mailfrom=ryan.roberts@arm.com; dmarc=pass (policy=none) header.from=arm.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1728903671; a=rsa-sha256; cv=none; b=M42SW2xQQHuAVsJFqE6xCmO+taRk/dTa9nrtZnxS78s36FlFTkYO/Vf6yS8pCA5AZWix6Q 4thio+lG3k6olDhnrekJe3gPbyWVc5bZ/C75gfFIKuAcp5/TvUFzrPSQrEu/TV43iaTrCK k6l8G/fqS1ceDMJpUjI/A9+bxg7xFfA= Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 4FFED19F0; Mon, 14 Oct 2024 04:02:26 -0700 (PDT) Received: from e125769.cambridge.arm.com (e125769.cambridge.arm.com [10.1.196.27]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 512493F51B; Mon, 14 Oct 2024 04:01:54 -0700 (PDT) From: Ryan Roberts To: Andrew Morton , Anshuman Khandual , Ard Biesheuvel , Catalin Marinas , David Hildenbrand , Greg Marsden , Ivan Ivanov , Kalesh Singh , Marc Zyngier , Mark Rutland , Matthias Brugger , Miroslav Benes , Will Deacon Cc: Ryan Roberts , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: [RFC PATCH v1 49/57] arm64: Convert BUILD_BUG_ON to VM_BUG_ON Date: Mon, 14 Oct 2024 11:58:56 +0100 Message-ID: <20241014105912.3207374-49-ryan.roberts@arm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241014105912.3207374-1-ryan.roberts@arm.com> References: <20241014105514.3206191-1-ryan.roberts@arm.com> <20241014105912.3207374-1-ryan.roberts@arm.com> MIME-Version: 1.0 X-Rspam-User: X-Stat-Signature: 67cfct18wbdofytk7kxshbytk4dhq7iq X-Rspamd-Queue-Id: 12D364001B X-Rspamd-Server: rspam11 X-HE-Tag: 1728903711-262718 X-HE-Meta: U2FsdGVkX19fVbl1RtZtvaZ7+7pMbI6w1CMrfdvf/kqtXZBZWgAUUxJA10iVmlF9/zuxTC3FIRP7PUdDqtyt8J7a1A2zAt6R/fmfy2RntHmp896u6nnZN3iPC81JTTLoqWScXkJrmGenZwjxqr2wOaPzAqcXWeWsjac3UZjmoG+PulfWzVkD25Ao1ozjZn7lFNhtW9A2fhOLi7tuPi3H1I1Ubhg9IkEHmQ9JaygMfGCqWs76yuMw7O4DRsEIWyBn/PupxsSdrgmvdvaBRwBMMnj1zw/h2JPL+vLTai1xBrx1jHf5Nx8xgVKpSBvkpl1l1Cpj0YDHzwPG38lWjaRw/7uUUhcDFPLhQj51G7PaoPsmPsgzdjf74XE+I5QpE01st09HJGXe3h3khYmjLz24M5+VeRWbIEQkqbPMK9mZPpaVcDXR5TFVVV/yBeN13dAIPLcps9ouzFEb+TmDihhbfrFuMLzyrM4CnbVs9FAiQzbsQhtOO6icepiy3SzLJiTjtJ1LLRV4tsr3OZ/+R3sn4/mwZsdO0NgZToLGDQg23rAyatzRIVVE70zyoCqxEEKoMzr6CQrQLD4FU/JuaClnLmsBLLyXpPuqnmiMCT8j/Htp0UpholJdQy0lYpbcXtdYN5R0lYSDOt98hPsfY90o0/gH6sxVSZGFIWPWzk0070ihY1lRym65I4z+PGTCRKmODCSq2ouLxOAuULhlYBVL8j7IwcTlVZcJOSj/pi1gBByBik7ZzJGkrgfaR8hrSa6dGJaWrLbUrONYqV7MHJTxtQvlWpNWRkhi+VmsTd1huLwe3cnZxUQ2dHg8K8qZCF9a8E/CCtBjiUPi4Rn9kFEpXQ1zCkZ0rg9LRm17pldgm6vuO9cFz0K15bzfnozw6BbYfOXbFDhHSUV1t5wdqrwzqKYh7AGXgD4UiqIaaZSptAUwWyAmjeuWzcI01x/F+7WeCOebgKVat2aIlzVK4Fe v64awk07 v/SVo6F412/sWSconcVUrgWqO9wKe1VgyX5LGOsJ/r0n6N5hCJX4zgEw5hMDnli/P0tlfeakUGM3yKXufrIfZYu3J3UPaGi8dwvsaZxDsg9bUVLXaXNnY1ugObvzX0xRVgeiUi/DnsS82fbic3vEJ+1spP90RcwlfakQduTwDr0h/ts6oN+WITFdJw0Zy/k0o+TJkcGNRwAIM741FP811OWT3aycHpAsKrhud X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: There are some build bug checks that will no longer compile for boot-time page size because the values they are testing are no longer compile-time constants. Resolve these by converting them to VM_BUG_ON, which will perform a runtime check. Signed-off-by: Ryan Roberts --- ***NOTE*** Any confused maintainers may want to read the cover note here for context: https://lore.kernel.org/all/20241014105514.3206191-1-ryan.roberts@arm.com/ arch/arm64/mm/init.c | 6 +++--- arch/arm64/mm/mmu.c | 4 ++-- arch/arm64/mm/pgd.c | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/arch/arm64/mm/init.c b/arch/arm64/mm/init.c index 42eb246949072..4d24034418b39 100644 --- a/arch/arm64/mm/init.c +++ b/arch/arm64/mm/init.c @@ -388,15 +388,15 @@ void __init mem_init(void) * detected at build time already. */ #ifdef CONFIG_COMPAT - BUILD_BUG_ON(TASK_SIZE_32 > DEFAULT_MAP_WINDOW_64); + VM_BUG_ON(TASK_SIZE_32 > DEFAULT_MAP_WINDOW_64); #endif /* * Selected page table levels should match when derived from * scratch using the virtual address range and page size. */ - BUILD_BUG_ON(ARM64_HW_PGTABLE_LEVELS(CONFIG_ARM64_VA_BITS) != - CONFIG_PGTABLE_LEVELS); + VM_BUG_ON(ARM64_HW_PGTABLE_LEVELS(CONFIG_ARM64_VA_BITS) != + CONFIG_PGTABLE_LEVELS); if (PAGE_SIZE >= 16384 && get_num_physpages() <= 128) { extern int sysctl_overcommit_memory; diff --git a/arch/arm64/mm/mmu.c b/arch/arm64/mm/mmu.c index b4cd3b6a73c22..ad7fd3fda705a 100644 --- a/arch/arm64/mm/mmu.c +++ b/arch/arm64/mm/mmu.c @@ -639,8 +639,8 @@ static void __init map_mem(pgd_t *pgdp) * entire reduced VA space is covered by a single pgd_t which will have * been populated without the PXNTable attribute by the time we get here.) */ - BUILD_BUG_ON(pgd_index(direct_map_end - 1) == pgd_index(direct_map_end) && - pgd_index(_PAGE_OFFSET(VA_BITS_MIN)) != PTRS_PER_PGD - 1); + VM_BUG_ON(pgd_index(direct_map_end - 1) == pgd_index(direct_map_end) && + pgd_index(_PAGE_OFFSET(VA_BITS_MIN)) != PTRS_PER_PGD - 1); early_kfence_pool = arm64_kfence_alloc_pool(); diff --git a/arch/arm64/mm/pgd.c b/arch/arm64/mm/pgd.c index 0c501cabc2384..4b106510358b1 100644 --- a/arch/arm64/mm/pgd.c +++ b/arch/arm64/mm/pgd.c @@ -56,7 +56,7 @@ void __init pgtable_cache_init(void) * With 52-bit physical addresses, the architecture requires the * top-level table to be aligned to at least 64 bytes. */ - BUILD_BUG_ON(PGD_SIZE < 64); + VM_BUG_ON(PGD_SIZE < 64); #endif /*