From patchwork Tue Mar 7 14:04:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 13163645 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 46A69C678D4 for ; Tue, 7 Mar 2023 14:16:35 +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:References:In-Reply-To: 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: List-Owner; bh=hBIKbtlWSHF++7R4O6D1qB40En8/qHuEwAbk+mBP00M=; b=JLKgLHHIUsqBFs aVbfzV6Xa5oe/fpSRbbw6jY7VsmHdGWJ6R3FiUhpQ28THDNWlvfBhwVpSous9tAGmd33hH1Xe6Edg 09XJEUnG0S6ZGNEdTqdl4+uqxe8ivmTT3XIh2dk2XT0Z3qUWuoTl1qRiXV3GvEFph2HU6okGasasT Keg4qTfz/odp5AwFOIhGaxM/3+O1c87dgBMgfSWKQ3Dolh44855SObU8w83lxUyMlWUNaBfhDXTDD xUYcUg65mC0cxWqAJPJJ4kn5B9gKN59AgMo+0QaGnl6zPMCaMSQlD5UvgIUAg/Jn4GO8o6I3HTYFw 1YPm3uGVpalfUrpDU9fw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pZY68-000heP-KK; Tue, 07 Mar 2023 14:15:25 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pZXxv-000drx-Oh for linux-arm-kernel@lists.infradead.org; Tue, 07 Mar 2023 14:06:57 +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 dfw.source.kernel.org (Postfix) with ESMTPS id 55D966145E; Tue, 7 Mar 2023 14:06:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 300F9C433A1; Tue, 7 Mar 2023 14:06:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1678198015; bh=DPMsp/QC9zVXvP3OPcvpzDcOxYcfkqxfml7V5i/ONDM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ugCg8BhB2NxQRFOpkGV3d/8rLVwopqUuCo0pAIsvasbJWio4WyKQ4muCtnCI2cAes r6vaMX85+sulFrsENmqvthSjf4MvtbenBosS6ncM9VhhE2/qo1T6DDQzGo3nscEz7O xGr33xhaQcKfn1suSW1007w0xDIb5Kz/ImB/rvoRqjXiS/Z+7toIrFTN3l/FOR1kzc 6wMNiCAVQkc+M2Jp3vWOQW1RmcnLKsoM8pgOK61lTTFU0azTdlZkMfv1F4xDciJtl6 d/UREpoF/8yToWEbxHPO4TlPF88y+OaH4WBceFB58Bjjynl6EtdL/v+JTlnkr316RQ CrSALKjQ01qnA== From: Ard Biesheuvel To: linux-kernel@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org, Ard Biesheuvel , Catalin Marinas , Will Deacon , Marc Zyngier , Mark Rutland , Ryan Roberts , Anshuman Khandual , Kees Cook Subject: [PATCH v3 07/60] arm64: ptdump: Discover start of vmemmap region at runtime Date: Tue, 7 Mar 2023 15:04:29 +0100 Message-Id: <20230307140522.2311461-8-ardb@kernel.org> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230307140522.2311461-1-ardb@kernel.org> References: <20230307140522.2311461-1-ardb@kernel.org> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1232; i=ardb@kernel.org; h=from:subject; bh=DPMsp/QC9zVXvP3OPcvpzDcOxYcfkqxfml7V5i/ONDM=; b=owGbwMvMwCFmkMcZplerG8N4Wi2JIYXdhefVN36elVZhTm+/XHq73zDLPZh7jnbAdXPthqkfH nY8t9nYUcrCIMbBICumyCIw+++7nacnStU6z5KFmcPKBDKEgYtTACbyTZWRYQs/e/OZQwk6/YxT lj6SyM4IWuTvHnPp8J4w3WOVv9eL2jEy3P9S21mxsO7GocuN0reW3VnT2HIlUEAvJu1P/oHLmde eMgIA 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-20230307_060655_907802_5F04168F X-CRM114-Status: GOOD ( 14.72 ) 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 We will soon reclaim the part of the vmemmap region that covers VA space that is not addressable by the hardware. To avoid confusion, ensure that the 'vmemmap start' marker points at the start of the region that is actually being used for the struct page array, rather than the start of the region we set aside for it at build time. Signed-off-by: Ard Biesheuvel --- arch/arm64/mm/ptdump.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/arm64/mm/ptdump.c b/arch/arm64/mm/ptdump.c index 910b35f02280cbdb..8f37d6d8b5216473 100644 --- a/arch/arm64/mm/ptdump.c +++ b/arch/arm64/mm/ptdump.c @@ -37,6 +37,7 @@ enum address_markers_idx { MODULES_END_NR, VMALLOC_START_NR, VMALLOC_END_NR, + VMEMMAP_START_NR, }; static struct addr_marker address_markers[] = { @@ -386,6 +387,10 @@ static int __init ptdump_init(void) #endif address_markers[VMALLOC_END_NR].start_address = VMALLOC_END; ptdump_initialize(); + if (vabits_actual < VA_BITS) { + address_markers[VMEMMAP_START_NR].start_address = + (unsigned long)virt_to_page(_PAGE_OFFSET(vabits_actual)); + } ptdump_debugfs_register(&kernel_ptdump_info, "kernel_page_tables"); return 0; }