From patchwork Thu May 10 16:23:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Capper X-Patchwork-Id: 10392089 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 85AEF6028E for ; Thu, 10 May 2018 16:30:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7668A28BDB for ; Thu, 10 May 2018 16:30:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7517828C30; Thu, 10 May 2018 16:30:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id E0CA728C26 for ; Thu, 10 May 2018 16:30:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=4DySkXjL/MmEmE7b2zozuZVSjQayfCoHoWEXTuwpdCE=; b=T1cToawl1BbDWwKrzKTZXamg5A oPld0dqL1wAUZ31dHa2TUxLPujfZsGwQj+x32buoFr51KHOCj2ZpRWntKcw3jaZ0kAiSfZVeUjB7t MaCewL1Mwnq32JKhwW+6Jb6VtGwog5C8CXJADC7I/8sRFG8b6LdGSqO0pAc0EzUat81o0cnD5KpDD fTzJVm9m8xUPhCGjB2jGVofBQzVVmKzZnhn4rhX4WuSQhGqdSXHL1O4+vNmArMWlcUa2cglUpknq1 NjV4cPJJ2DvrwtPd6evF4dL93bY+MQDPwuRsc6gy8p0d/eRz9/TIpNNqcrY6M+6vBBS61hmb5jXkB 7VJ1j1SA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fGoSj-0008QA-6x; Thu, 10 May 2018 16:30:37 +0000 Received: from foss.arm.com ([217.140.101.70]) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fGoMh-00036l-LV for linux-arm-kernel@lists.infradead.org; Thu, 10 May 2018 16:24:28 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 90AF91684; Thu, 10 May 2018 09:24:10 -0700 (PDT) Received: from capper-debian.arm.com (unknown [10.37.12.1]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 888EA3F73E; Thu, 10 May 2018 09:24:09 -0700 (PDT) From: Steve Capper To: linux-arm-kernel@lists.infradead.org, catalin.marinas@arm.com Subject: [PATCH v3 5/8] arm64: dump: Make kernel page table dumper dynamic again Date: Thu, 10 May 2018 17:23:44 +0100 Message-Id: <20180510162347.3858-6-steve.capper@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180510162347.3858-1-steve.capper@arm.com> References: <20180510162347.3858-1-steve.capper@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180510_092423_825980_E93F70A0 X-CRM114-Status: GOOD ( 14.07 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Steve Capper , ard.biesheuvel@linaro.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP The kernel page table dumper assumes that the placement of VA regions is constant and determined at compile time. As we are about to introduce variable VA logic, we need to be able to determine certain regions at boot time. This patch adds logic to the kernel page table dumper s.t. these regions can be computed at boot time. Signed-off-by: Steve Capper --- arch/arm64/mm/dump.c | 58 ++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 47 insertions(+), 11 deletions(-) diff --git a/arch/arm64/mm/dump.c b/arch/arm64/mm/dump.c index 76e8857b2baf..c1030b3ca3c7 100644 --- a/arch/arm64/mm/dump.c +++ b/arch/arm64/mm/dump.c @@ -29,23 +29,45 @@ #include #include -static const struct addr_marker address_markers[] = { - { PAGE_OFFSET, "Linear Mapping start" }, - { VA_START, "Linear Mapping end" }, + +enum address_markers_idx { + PAGE_OFFSET_NR = 0, + VA_START_NR, +#ifdef CONFIG_KASAN + KASAN_START_NR, + KASAN_END_NR, +#endif + MODULES_START_NR, + MODULES_END_NR, + VMALLOC_START_NR, + VMALLOC_END_NR, + FIXADDR_START_NR, + FIXADDR_END_NR, + PCI_START_NR, + PCI_END_NR, +#ifdef CONFIG_SPARSEMEM_VMEMMAP + VMEMMAP_START_NR, +#endif + END_NR +}; + +static struct addr_marker address_markers[] = { + { 0 /* PAGE_OFFSET */, "Linear Mapping start" }, + { 0 /* VA_START */, "Linear Mapping end" }, #ifdef CONFIG_KASAN - { KASAN_SHADOW_START, "Kasan shadow start" }, + { 0 /* KASAN_SHADOW_START */, "Kasan shadow start" }, { KASAN_SHADOW_END, "Kasan shadow end" }, #endif { MODULES_VADDR, "Modules start" }, { MODULES_END, "Modules end" }, { VMALLOC_START, "vmalloc() Area" }, - { VMALLOC_END, "vmalloc() End" }, - { FIXADDR_START, "Fixmap start" }, - { FIXADDR_TOP, "Fixmap end" }, - { PCI_IO_START, "PCI I/O start" }, - { PCI_IO_END, "PCI I/O end" }, + { 0 /* VMALLOC_END */, "vmalloc() End" }, + { 0 /* FIXADDR_START */, "Fixmap start" }, + { 0 /* FIXADDR_TOP */, "Fixmap end" }, + { 0 /* PCI_IO_START */, "PCI I/O start" }, + { 0 /* PCI_IO_END */, "PCI I/O end" }, #ifdef CONFIG_SPARSEMEM_VMEMMAP - { VMEMMAP_START, "vmemmap" }, + { 0 /* VMEMMAP_START */, "vmemmap" }, #endif { -1, NULL }, }; @@ -381,7 +403,6 @@ static void ptdump_initialize(void) static struct ptdump_info kernel_ptdump_info = { .mm = &init_mm, .markers = address_markers, - .base_addr = PAGE_OFFSET, }; void ptdump_check_wx(void) @@ -407,6 +428,21 @@ void ptdump_check_wx(void) static int ptdump_init(void) { ptdump_initialize(); + kernel_ptdump_info.base_addr = PAGE_OFFSET; + address_markers[PAGE_OFFSET_NR].start_address = PAGE_OFFSET; + address_markers[VA_START_NR].start_address = VA_START; +#ifdef CONFIG_KASAN + address_markers[KASAN_START_NR].start_address = KASAN_SHADOW_START; +#endif + address_markers[VMALLOC_END_NR].start_address = VMALLOC_END; + address_markers[FIXADDR_START_NR].start_address = FIXADDR_START; + address_markers[FIXADDR_END_NR].start_address = FIXADDR_TOP; + address_markers[PCI_START_NR].start_address = PCI_IO_START; + address_markers[PCI_END_NR].start_address = PCI_IO_END; +#ifdef CONFIG_SPARSEMEM_VMEMMAP + address_markers[VMEMMAP_START_NR].start_address = VMEMMAP_START; +#endif + return ptdump_debugfs_register(&kernel_ptdump_info, "kernel_page_tables"); }