From patchwork Tue Jan 23 14:53:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ard Biesheuvel X-Patchwork-Id: 13527536 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 89217C47258 for ; Tue, 23 Jan 2024 14:55:20 +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:Cc:To:From:Subject:Message-ID: References:Mime-Version:In-Reply-To:Date:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=3BQrT5O1I9IlkjXbUrGR7NcWKmiqripMfyHhdoGumVk=; b=GkkXRk5e2WxnibXpCHr3DfMWG+ grdHy/Kg23v3xJIM5OOeryTfFyUmAT13VXz0uo3Q00Mm0vw4vZAxpgEwCLm5BnjTyqzDRaCz7+kFp rYb6G8Co+cVezKtP61T/JpVSQdR+EQ9Ccv15cL5NOfRIugEHi7Ro/cOlg5q49pm10FwF6LXlaxmA2 FwUxmh7h0Xr236S9zQ2KYbuA2Km16wzqTz7vQh1isXyoX6bVVhASn78fYr2kXpuWpuDfrs1VHn1Tp iTABR2b3iJ2u/07sbaUthv5ut5QFhLnTSVJKE4BXHBTF1XqiE2zAfsQEOYHWoPfbCjEWVUEClMap4 U04Fguqw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1rSIAr-00Gtjy-2O; Tue, 23 Jan 2024 14:54:49 +0000 Received: from mail-yw1-x1149.google.com ([2607:f8b0:4864:20::1149]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1rSIAa-00GtcI-0S for linux-arm-kernel@lists.infradead.org; Tue, 23 Jan 2024 14:54:33 +0000 Received: by mail-yw1-x1149.google.com with SMTP id 00721157ae682-5ff908a0247so48500497b3.2 for ; Tue, 23 Jan 2024 06:54:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1706021671; x=1706626471; darn=lists.infradead.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=YqZpebP/619MZl4FrpiPrqRKlomSscik+QpqTvG+E/0=; b=TjBfEGYIDACo4700Q2oGalXiV0MIchsOHERR2MvviYOqeRses0pWbqM0M65QP+Huhm RNjXoXbzf+1MCvgU9MLEOpxWGI2jEnFLtyoDHY2xjqyYgBrjlsgZnii3cefNnX6flR7+ DMVAdOP5ZA/3G3+oSnvWr9OC6q8Wb1AUCEKtSPiyZ67opEsefhR86lY2C5gSz9rnIoVw ZoE6W55GsDrzOL9ITc2IrvYCtQC0xict1aNz7hrJtAmS8cS5L8n7ba6oUJWISnoH02GL rud9b88NaGQl19ibbzY3HcjBJma2lAcV/pAY9KmoyQqvqP+x6NDLdPAXVL9BswZDh0b+ D1dg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706021671; x=1706626471; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=YqZpebP/619MZl4FrpiPrqRKlomSscik+QpqTvG+E/0=; b=K6afgKS/tcT8qb8G3v7OIPyOEEV5mK95SHMWfdwcrDvW/QQNZiAVqW1JSUowyrjaCV ecsWYy1XziLFAMROKT2Ud8aVYOoC88spRF9b5vm1X+goX6miGpFoAoF9vSjpv4ycVH76 XKQUJRZlSRdvsATjHfM5TkxQj8JAVN1HwXH5PAQphx2jCobpgh5h1jqAoBjNh3oKXrLe zQStGB27f9KgQRWVgZ/22jGaB4q9jZW5YpyaFF5AXbcP1tWV2xgxaH6ljIC66MiQygie ldWLRNEIajoF6QJNOthl7JltmwsgUgNyeZmWHW9SvzJMjJX2/ZJCnB06s1e0i7lU1B6/ pWjQ== X-Gm-Message-State: AOJu0YwPh37Yx/ijKZCcv6jt1vcYw5rW5oWYj+CqtcXJaMLKerzhMTiN +rF/yktWaL9ln8FEcQfqE660lupI2yWJ8TRDXpH7zegJv2BVqluEyYDF/87chNJO1jREgGu6sHd bpNaCSgcM4Oss22QJ8LKqAOpDME9P/LCpVMXQ3AYnMmvJyJbdylv17qx7zbph2pYSw9McMMRglM m3v1cliUHxqdb2w452+p4MSxSfab9zwAhL3f33HPLA X-Google-Smtp-Source: AGHT+IGZ7LHsAR1y9kL/k7v453+mxgypoThLExj21IPccAxuGuflr8aAOfNVo/wUhdYtMOiipGovAijW X-Received: from palermo.c.googlers.com ([fda3:e722:ac3:cc00:28:9cb1:c0a8:118a]) (user=ardb job=sendgmr) by 2002:a25:d08f:0:b0:dc2:25fd:eff1 with SMTP id h137-20020a25d08f000000b00dc225fdeff1mr318865ybg.4.1706021670456; Tue, 23 Jan 2024 06:54:30 -0800 (PST) Date: Tue, 23 Jan 2024 15:53:03 +0100 In-Reply-To: <20240123145258.1462979-52-ardb+git@google.com> Mime-Version: 1.0 References: <20240123145258.1462979-52-ardb+git@google.com> X-Developer-Key: i=ardb@kernel.org; a=openpgp; fpr=F43D03328115A198C90016883D200E9CA6329909 X-Developer-Signature: v=1; a=openpgp-sha256; l=1413; i=ardb@kernel.org; h=from:subject; bh=hVe/Y/PUF55gLJVsLW/mBqvWk0Rwo/FbI6Wtlis7ICs=; b=owGbwMvMwCFmkMcZplerG8N4Wi2JIXX9pfPdQYou37Xv/fk3i9tn4qV1zdma9//nsW9XjfV6v HJTn5BhRykLgxgHg6yYIovA7L/vdp6eKFXrPEsWZg4rE8gQBi5OAZjIrreMDJO8F67sfMLf3cbf ciZgQd+FW+1Pez9LrX5WqZ4jU+sbwsbwh1/zWWNH24TigAWvD31JXFAVbJyuyBt7XqtT/xOv1lx PJgA= X-Mailer: git-send-email 2.43.0.429.g432eaa2c6b-goog Message-ID: <20240123145258.1462979-56-ardb+git@google.com> Subject: [PATCH v7 04/50] arm64: ptdump: Discover start of vmemmap region at runtime From: Ard Biesheuvel To: linux-arm-kernel@lists.infradead.org Cc: Ard Biesheuvel , Catalin Marinas , Will Deacon , Marc Zyngier , Mark Rutland , Ryan Roberts , Anshuman Khandual , Kees Cook X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240123_065432_176658_75A73310 X-CRM114-Status: GOOD ( 14.14 ) 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 From: Ard Biesheuvel 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. Acked-by: Mark Rutland Signed-off-by: Ard Biesheuvel --- arch/arm64/mm/ptdump.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/arm64/mm/ptdump.c b/arch/arm64/mm/ptdump.c index 66ccb8d6997e..5f0849528ccf 100644 --- a/arch/arm64/mm/ptdump.c +++ b/arch/arm64/mm/ptdump.c @@ -346,6 +346,8 @@ void ptdump_check_wx(void) static int __init ptdump_init(void) { + u64 page_offset = _PAGE_OFFSET(vabits_actual); + u64 vmemmap_start = (u64)virt_to_page((void *)page_offset); struct addr_marker m[] = { { PAGE_OFFSET, "Linear Mapping start" }, { PAGE_END, "Linear Mapping end" }, @@ -357,7 +359,7 @@ static int __init ptdump_init(void) { MODULES_END, "Modules end" }, { VMALLOC_START, "vmalloc() area" }, { VMALLOC_END, "vmalloc() end" }, - { VMEMMAP_START, "vmemmap start" }, + { vmemmap_start, "vmemmap start" }, { VMEMMAP_END, "vmemmap end" }, { PCI_IO_START, "PCI I/O start" }, { PCI_IO_END, "PCI I/O end" },