Skip to content

Commit

Permalink
powerpc/mm: Fix page table dump to work on Radix
Browse files Browse the repository at this point in the history
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 <mpe@ellerman.id.au>
  • Loading branch information
Michael Ellerman committed Oct 20, 2018
1 parent afb6d06 commit 0d92396
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions arch/powerpc/mm/dump_linuxpagetables.c
Original file line number Diff line number Diff line change
Expand Up @@ -267,12 +267,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);
Expand Down Expand Up @@ -321,9 +322,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);
Expand Down

0 comments on commit 0d92396

Please sign in to comment.