linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Christophe Leroy <christophe.leroy@csgroup.eu>
To: Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Paul Mackerras <paulus@samba.org>,
	Michael Ellerman <mpe@ellerman.id.au>
Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org
Subject: [PATCH v3 10/45] powerpc/ptdump: Display size of BATs
Date: Mon, 11 May 2020 11:25:36 +0000 (UTC)	[thread overview]
Message-ID: <4fc349f2cfe5910965e4ef198c6d4e5106455069.1589196133.git.christophe.leroy@csgroup.eu> (raw)
In-Reply-To: <cover.1589196133.git.christophe.leroy@csgroup.eu>

Display the size of areas mapped with BATs.

For that, the size display for pages is refactorised.

Signed-off-by: Christophe Leroy <christophe.leroy@csgroup.eu>
---
v2: Add missing include of linux/seq_file.h (Thanks to kbuild test robot)
---
 arch/powerpc/mm/ptdump/bats.c   |  4 ++++
 arch/powerpc/mm/ptdump/ptdump.c | 23 ++++++++++++++---------
 arch/powerpc/mm/ptdump/ptdump.h |  3 +++
 3 files changed, 21 insertions(+), 9 deletions(-)

diff --git a/arch/powerpc/mm/ptdump/bats.c b/arch/powerpc/mm/ptdump/bats.c
index d3a5d6b318d1..d6c660f63d71 100644
--- a/arch/powerpc/mm/ptdump/bats.c
+++ b/arch/powerpc/mm/ptdump/bats.c
@@ -10,6 +10,8 @@
 #include <asm/pgtable.h>
 #include <asm/cpu_has_feature.h>
 
+#include "ptdump.h"
+
 static char *pp_601(int k, int pp)
 {
 	if (pp == 0)
@@ -42,6 +44,7 @@ static void bat_show_601(struct seq_file *m, int idx, u32 lower, u32 upper)
 #else
 	seq_printf(m, "0x%08x ", pbn);
 #endif
+	pt_dump_size(m, size);
 
 	seq_printf(m, "Kernel %s User %s", pp_601(k & 2, pp), pp_601(k & 1, pp));
 
@@ -88,6 +91,7 @@ static void bat_show_603(struct seq_file *m, int idx, u32 lower, u32 upper, bool
 #else
 	seq_printf(m, "0x%08x ", brpn);
 #endif
+	pt_dump_size(m, size);
 
 	if (k == 1)
 		seq_puts(m, "User ");
diff --git a/arch/powerpc/mm/ptdump/ptdump.c b/arch/powerpc/mm/ptdump/ptdump.c
index d92bb8ea229c..1f97668853e3 100644
--- a/arch/powerpc/mm/ptdump/ptdump.c
+++ b/arch/powerpc/mm/ptdump/ptdump.c
@@ -112,6 +112,19 @@ static struct addr_marker address_markers[] = {
 		seq_putc(m, c);		\
 })
 
+void pt_dump_size(struct seq_file *m, unsigned long size)
+{
+	static const char units[] = "KMGTPE";
+	const char *unit = units;
+
+	/* Work out what appropriate unit to use */
+	while (!(size & 1023) && unit[1]) {
+		size >>= 10;
+		unit++;
+	}
+	pt_dump_seq_printf(m, "%9lu%c ", size, *unit);
+}
+
 static void dump_flag_info(struct pg_state *st, const struct flag_info
 		*flag, u64 pte, int num)
 {
@@ -146,8 +159,6 @@ static void dump_flag_info(struct pg_state *st, const struct flag_info
 
 static void dump_addr(struct pg_state *st, unsigned long addr)
 {
-	static const char units[] = "KMGTPE";
-	const char *unit = units;
 	unsigned long delta;
 
 #ifdef CONFIG_PPC64
@@ -164,13 +175,7 @@ static void dump_addr(struct pg_state *st, unsigned long addr)
 		pt_dump_seq_printf(st->seq, " " REG " ", st->start_pa);
 		delta = (addr - st->start_address) >> 10;
 	}
-	/* Work out what appropriate unit to use */
-	while (!(delta & 1023) && unit[1]) {
-		delta >>= 10;
-		unit++;
-	}
-	pt_dump_seq_printf(st->seq, "%9lu%c", delta, *unit);
-
+	pt_dump_size(st->seq, delta);
 }
 
 static void note_prot_wx(struct pg_state *st, unsigned long addr)
diff --git a/arch/powerpc/mm/ptdump/ptdump.h b/arch/powerpc/mm/ptdump/ptdump.h
index 5d513636de73..154efae96ae0 100644
--- a/arch/powerpc/mm/ptdump/ptdump.h
+++ b/arch/powerpc/mm/ptdump/ptdump.h
@@ -1,5 +1,6 @@
 /* SPDX-License-Identifier: GPL-2.0 */
 #include <linux/types.h>
+#include <linux/seq_file.h>
 
 struct flag_info {
 	u64		mask;
@@ -17,3 +18,5 @@ struct pgtable_level {
 };
 
 extern struct pgtable_level pg_level[5];
+
+void pt_dump_size(struct seq_file *m, unsigned long delta);
-- 
2.25.0


  parent reply	other threads:[~2020-05-11 11:45 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-11 11:25 [PATCH v3 00/45] Use hugepages to map kernel mem on 8xx Christophe Leroy
2020-05-11 11:25 ` [PATCH v3 01/45] powerpc/kasan: Fix error detection on memory allocation Christophe Leroy
2020-05-11 11:25 ` [PATCH v3 02/45] powerpc/kasan: Fix issues by lowering KASAN_SHADOW_END Christophe Leroy
2020-05-11 11:25 ` [PATCH v3 03/45] powerpc/kasan: Fix shadow pages allocation failure Christophe Leroy
2020-05-11 11:25 ` [PATCH v3 04/45] powerpc/kasan: Remove unnecessary page table locking Christophe Leroy
2020-05-11 11:25 ` [PATCH v3 05/45] powerpc/kasan: Refactor update of early shadow mappings Christophe Leroy
2020-05-11 11:25 ` [PATCH v3 06/45] powerpc/kasan: Declare kasan_init_region() weak Christophe Leroy
2020-05-11 11:25 ` [PATCH v3 07/45] powerpc/ptdump: Limit size of flags text to 1/2 chars on PPC32 Christophe Leroy
2020-05-11 11:25 ` [PATCH v3 08/45] powerpc/ptdump: Reorder flags Christophe Leroy
2020-05-11 11:25 ` [PATCH v3 09/45] powerpc/ptdump: Add _PAGE_COHERENT flag Christophe Leroy
2020-05-11 11:25 ` Christophe Leroy [this message]
2020-05-11 11:25 ` [PATCH v3 11/45] powerpc/ptdump: Standardise display of BAT flags Christophe Leroy
2020-05-11 11:25 ` [PATCH v3 12/45] powerpc/ptdump: Properly handle non standard page size Christophe Leroy
2020-05-11 11:25 ` [PATCH v3 13/45] powerpc/ptdump: Handle hugepd at PGD level Christophe Leroy
2020-05-11 11:25 ` [PATCH v3 14/45] powerpc/32s: Don't warn when mapping RO data ROX Christophe Leroy
2020-05-11 11:25 ` [PATCH v3 15/45] powerpc/mm: Allocate static page tables for fixmap Christophe Leroy
2020-05-11 11:25 ` [PATCH v3 16/45] powerpc/mm: Fix conditions to perform MMU specific management by blocks on PPC32 Christophe Leroy
2020-05-11 11:25 ` [PATCH v3 17/45] powerpc/mm: PTE_ATOMIC_UPDATES is only for 40x Christophe Leroy
2020-05-11 11:25 ` [PATCH v3 18/45] powerpc/mm: Refactor pte_update() on nohash/32 Christophe Leroy
2020-05-11 11:25 ` [PATCH v3 19/45] powerpc/mm: Refactor pte_update() on book3s/32 Christophe Leroy
2020-05-11 11:25 ` [PATCH v3 20/45] powerpc/mm: Standardise __ptep_test_and_clear_young() params between PPC32 and PPC64 Christophe Leroy
2020-05-11 11:25 ` [PATCH v3 21/45] powerpc/mm: Standardise pte_update() prototype " Christophe Leroy
2020-05-11 11:25 ` [PATCH v3 22/45] powerpc/mm: Create a dedicated pte_update() for 8xx Christophe Leroy
2020-05-11 11:25 ` [PATCH v3 23/45] powerpc/mm: Reduce hugepd size for 8M hugepages on 8xx Christophe Leroy
2020-05-11 11:25 ` [PATCH v3 24/45] powerpc/8xx: Drop CONFIG_8xx_COPYBACK option Christophe Leroy
2020-05-11 11:25 ` [PATCH v3 25/45] powerpc/8xx: Prepare handlers for _PAGE_HUGE for 512k pages Christophe Leroy
2020-05-11 11:25 ` [PATCH v3 26/45] powerpc/8xx: Manage 512k huge pages as standard pages Christophe Leroy
2020-05-11 11:25 ` [PATCH v3 27/45] powerpc/8xx: Only 8M pages are hugepte pages now Christophe Leroy
2020-05-11 11:25 ` [PATCH v3 28/45] powerpc/8xx: MM_SLICE is not needed anymore Christophe Leroy
2020-05-11 11:25 ` [PATCH v3 29/45] powerpc/8xx: Move PPC_PIN_TLB options into 8xx Kconfig Christophe Leroy
2020-05-11 11:25 ` [PATCH v3 30/45] powerpc/8xx: Add function to set pinned TLBs Christophe Leroy
2020-05-11 11:25 ` [PATCH v3 31/45] powerpc/8xx: Don't set IMMR map anymore at boot Christophe Leroy
2020-05-11 11:25 ` [PATCH v3 32/45] powerpc/8xx: Always pin TLBs at startup Christophe Leroy
2020-05-11 11:25 ` [PATCH v3 33/45] powerpc/8xx: Drop special handling of Linear and IMMR mappings in I/D TLB handlers Christophe Leroy
2020-05-11 11:26 ` [PATCH v3 34/45] powerpc/8xx: Remove now unused TLB miss functions Christophe Leroy
2020-05-11 11:26 ` [PATCH v3 35/45] powerpc/8xx: Move DTLB perf handling closer Christophe Leroy
2020-05-11 11:26 ` [PATCH v3 36/45] powerpc/mm: Don't be too strict with _etext alignment on PPC32 Christophe Leroy
2020-05-11 11:26 ` [PATCH v3 37/45] powerpc/8xx: Refactor kernel address boundary comparison Christophe Leroy
2020-05-11 11:26 ` [PATCH v3 38/45] powerpc/8xx: Add a function to early map kernel via huge pages Christophe Leroy
2020-05-11 11:26 ` [PATCH v3 39/45] powerpc/8xx: Map IMMR with a huge page Christophe Leroy
2020-05-11 11:26 ` [PATCH v3 40/45] powerpc/8xx: Map linear memory with huge pages Christophe Leroy
2020-05-11 11:26 ` [PATCH v3 41/45] powerpc/8xx: Allow STRICT_KERNEL_RwX with pinned TLB Christophe Leroy
2020-05-11 11:26 ` [PATCH v3 42/45] powerpc/8xx: Allow large TLBs with DEBUG_PAGEALLOC Christophe Leroy
2020-05-11 11:26 ` [PATCH v3 43/45] powerpc/8xx: Implement dedicated kasan_init_region() Christophe Leroy
2020-05-11 11:26 ` [PATCH v3 44/45] powerpc/32s: Allow mapping with BATs with DEBUG_PAGEALLOC Christophe Leroy
2020-05-11 11:26 ` [PATCH v3 45/45] powerpc/32s: Implement dedicated kasan_init_region() Christophe Leroy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4fc349f2cfe5910965e4ef198c6d4e5106455069.1589196133.git.christophe.leroy@csgroup.eu \
    --to=christophe.leroy@csgroup.eu \
    --cc=benh@kernel.crashing.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mpe@ellerman.id.au \
    --cc=paulus@samba.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).