ARM: add support to dump the kernel page tables

Steve Capper steve.capper at linaro.org
Thu Oct 24 12:25:43 EDT 2013


On Thu, Oct 24, 2013 at 04:49:56PM +0100, Russell King - ARM Linux wrote:
> On Thu, Oct 24, 2013 at 01:55:31PM +0100, Steve Capper wrote:
> > On Thu, Oct 24, 2013 at 01:23:06PM +0100, Russell King - ARM Linux wrote:
> > > 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?
> > > 
> > 
> > Apologies I was a little vague. I don't think there are any PROT_NONE
> > protected kernel huge pages, I am worried that pmd_huge may be used by
> > other code (and then run into problems with PROT_NONE).
> 
[I erroneously referred to pmd_huge here, I meant pmd_large sorry].

> Well, the obvious question is: why would you want pmd_large() to return
> false if there is a section entry in place?

Hi,
for LPAE:
I want pmd_large to return true for all non-zero pmds that have bit #1
clear.
 
Clearing bit #0 of a pmd produces a faulting entry, and this is how
PROT_NONE protection is enforced by huge pages.

pmd_sect will return false for non-zero pmds that have both bit #0 and
bit #1 clear, thus will return false for some huge pages.

Cheers,
-- 
Steve



More information about the linux-arm-kernel mailing list