From: linux@arm.linux.org.uk (Russell King - ARM Linux)
To: linux-arm-kernel@lists.infradead.org
Subject: ARM: add support to dump the kernel page tables
Date: Thu, 24 Oct 2013 13:23:06 +0100 [thread overview]
Message-ID: <20131024122306.GK16735@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <20131024105143.GA24288@linaro.org>
On Thu, Oct 24, 2013 at 11:51:44AM +0100, Steve Capper wrote:
> Hi Russell,
> I've given this a quick go on an Arndale with LPAE, and have a few
> suggestions below.
Thanks.
> > diff --git a/arch/arm/include/asm/pgtable-3level.h b/arch/arm/include/asm/pgtable-3level.h
> > index 5689c18..d7682cd 100644
> > --- a/arch/arm/include/asm/pgtable-3level.h
> > +++ b/arch/arm/include/asm/pgtable-3level.h
> > @@ -140,6 +140,7 @@
> > PMD_TYPE_TABLE)
> > #define pmd_sect(pmd) ((pmd_val(pmd) & PMD_TYPE_MASK) == \
> > PMD_TYPE_SECT)
> > +#define pmd_large(pmd) pmd_sect(pmd)
>
> Could we please instead do something like:
> #define pmd_large(pmd) (pmd_val(pmd) && !(pmd_val(pmd) & PMD_TABLE_BIT))
>
> This matches the logic used in the huge pages patches (it picks up the
> PROT_NONE case) that would be missed above.
Is this used in the generic parts of the kernel? Can you please point
out where?
> The logic here needs adjusting for LPAE. Without LPAE,
> USER_PGTABLES_CEILING is equal to zero and i at 0.
>
> With LPAE enabled, USER_PGTABLES_CEILING / PGDIR_SIZE == 2 for me, but
> pgd refers to the first pgd (not the third). Thus we walk the pgds we
> don't want to walk and get empty output.
>
> The following worked for me:
> static void walk_pgd(struct seq_file *m)
> {
> pgd_t *pgd = swapper_pg_dir;
> struct pg_state st;
> unsigned long addr;
> unsigned i, pgdoff = USER_PGTABLES_CEILING / PGDIR_SIZE;
>
> memset(&st, 0, sizeof(st));
> st.seq = m;
> st.marker = address_markers;
>
> pgd += pgdoff;
>
> for (i = pgdoff; i < PTRS_PER_PGD; i++, pgd++) {
> addr = i * PGDIR_SIZE;
> if (!pgd_none(*pgd)) {
> walk_pud(&st, pgd, addr);
> } else {
> note_page(&st, addr, 1, pgd_val(*pgd));
> }
> }
>
> note_page(&st, 0, 0, 0);
> }
>
> But pgdoff is a terrible variable name :-).
Nevertheless, I've taken that change. :) Just tested on non-LPAE and it
still works, thanks.
next prev parent reply other threads:[~2013-10-24 12:23 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-24 7:16 ARM: add support to dump the kernel page tables Russell King - ARM Linux
2013-10-24 10:51 ` Steve Capper
2013-10-24 12:23 ` Russell King - ARM Linux [this message]
2013-10-24 12:55 ` Steve Capper
2013-10-24 15:49 ` Russell King - ARM Linux
2013-10-24 16:25 ` Steve Capper
2013-10-24 21:31 ` Russell King - ARM Linux
2013-10-31 17:28 ` Laura Abbott
2013-10-31 17:40 ` Russell King - ARM Linux
2013-11-26 13:50 ` Uwe Kleine-König
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=20131024122306.GK16735@n2100.arm.linux.org.uk \
--to=linux@arm.linux.org.uk \
--cc=linux-arm-kernel@lists.infradead.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).