Received: by 2002:ac0:98c7:0:0:0:0:0 with SMTP id g7-v6csp1752687imd; Sun, 4 Nov 2018 08:45:18 -0800 (PST) X-Google-Smtp-Source: AJdET5doj3LzCeRbJNaBZAA1F9rKw6HFi9CF8sB/S5gAlLC42DKGDR5E63TQwds4MkQ5QINT5I54 X-Received: by 2002:a62:93d5:: with SMTP id r82-v6mr15788497pfk.55.1541349918897; Sun, 04 Nov 2018 08:45:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541349918; cv=none; d=google.com; s=arc-20160816; b=ZalrlbC/TAQS/1b/gEwU2hFKmNNf60vGS7lwSf2oMTQ4n5S0vSPLlhgigNFY5s7OPk NqkX4MV7p93Igoc66UtgpEcgl6auGxSP6nOyO8Nk80Vd2ImU5N2yE+/kOe2acTHwflgz RVRXsyVU4Cqw2QwOVlLsKYyq7mLrxCSkFQ4n9UtC+5g6OhDUPsFzhcrqBY0Qe6jHDDTO hh5mksRyfJi59LRKhHyhZlh9fNbwjwwC0Cwx97DvwlzzV4zek0CfwLyOz1Vgxo1A8ux+ ggsdij7P7gyTEufzjOEsbi5Gai54azHM+wWKozYI0ZFnA0fojIMoZPjs8HdneMiNmjIC 9ZAg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=4eU/jPByrGpWtSGODTIK9KK4OAjbRTj8kC1i+dyclqw=; b=gZA/VTz0wO1rzU000xY9L41ORR8c5RH5WS9Ve4a1iVGtMrVl8KKqojeQEuyvPC1jjc IINZ+BOwuW3Vlzx6bKczZLSvmJ7UHp1S64X7RCftU4ds0mBfP4pZYGOo+WIijuD486r8 VGhQVUaStUbP4f2zDdwjGN/p60070BoAVG4+X1tAif3rKymNyX0Ooto5wvOAsmfz1R6J rhaUZ54srLYMTCtypo8RVJiLvaHUfm+ffKeeHPUMNJN+D8DQnXRkW9bxL5RCLhX993Ij aU1/fpYG8YtVYgS1hA/zl3HIqZJzaEx7kLRFXPznCOiUF5SVxuLgREPEltYX5SFlGMU+ MY5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=n2iklZpU; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c22-v6si41626248pgb.472.2018.11.04.08.45.03; Sun, 04 Nov 2018 08:45:18 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=n2iklZpU; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731213AbeKDXIj (ORCPT + 99 others); Sun, 4 Nov 2018 18:08:39 -0500 Received: from mail.kernel.org ([198.145.29.99]:47502 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731131AbeKDXIi (ORCPT ); Sun, 4 Nov 2018 18:08:38 -0500 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A184D20862; Sun, 4 Nov 2018 13:53:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1541339614; bh=s0LTwRFPFgBQvWBtl/RCYQO+tfX5PoSzy6Mt1v2LUM4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=n2iklZpUhuM21iSV/g1EdDkWTlRihl4NhoLhUSGZ7PckQdvUUr5Dnih7XUmlmXZLP mx8iFTepZ3L7k3QiHL3uw4Ir3N/0Mn2hlkrMXiBNG/8bZ4IUGy41Ab2N4ZBF0+zszn Am1cWyFQAi62rgfuG7QtWyzA5gBbT/rQkgtDDl0c= From: Sasha Levin To: stable@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Michael Ellerman , Sasha Levin Subject: [PATCH AUTOSEL 4.14 07/30] powerpc/mm: Fix page table dump to work on Radix Date: Sun, 4 Nov 2018 08:53:02 -0500 Message-Id: <20181104135325.88524-7-sashal@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181104135325.88524-1-sashal@kernel.org> References: <20181104135325.88524-1-sashal@kernel.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Michael Ellerman [ Upstream commit 0d923962ab69c27cca664a2d535e90ef655110ca ] When we're running on Book3S with the Radix MMU enabled the page table dump currently prints the wrong addresses because it uses the wrong start address. Fix it to use PAGE_OFFSET rather than KERN_VIRT_START. Signed-off-by: Michael Ellerman Signed-off-by: Sasha Levin --- arch/powerpc/mm/dump_linuxpagetables.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/arch/powerpc/mm/dump_linuxpagetables.c b/arch/powerpc/mm/dump_linuxpagetables.c index c9282d27b203..31c1c61afaa4 100644 --- a/arch/powerpc/mm/dump_linuxpagetables.c +++ b/arch/powerpc/mm/dump_linuxpagetables.c @@ -422,12 +422,13 @@ static void walk_pagetables(struct pg_state *st) unsigned int i; unsigned long addr; + addr = st->start_address; + /* * Traverse the linux pagetable structure and dump pages that are in * the hash pagetable. */ - for (i = 0; i < PTRS_PER_PGD; i++, pgd++) { - addr = KERN_VIRT_START + i * PGDIR_SIZE; + for (i = 0; i < PTRS_PER_PGD; i++, pgd++, addr += PGDIR_SIZE) { if (!pgd_none(*pgd) && !pgd_huge(*pgd)) /* pgd exists */ walk_pud(st, pgd, addr); @@ -476,9 +477,14 @@ static int ptdump_show(struct seq_file *m, void *v) { struct pg_state st = { .seq = m, - .start_address = KERN_VIRT_START, .marker = address_markers, }; + + if (radix_enabled()) + st.start_address = PAGE_OFFSET; + else + st.start_address = KERN_VIRT_START; + /* Traverse kernel page tables */ walk_pagetables(&st); note_page(&st, 0, 0, 0); -- 2.17.1