All of lore.kernel.org
 help / color / mirror / Atom feed
From: Steve Capper <steve.capper@linaro.org>
To: Russell King - ARM Linux <linux@arm.linux.org.uk>
Cc: linux-arm-kernel@lists.infradead.org, linux-arch@vger.kernel.org
Subject: Re: ARM: add support to dump the kernel page tables
Date: Thu, 24 Oct 2013 17:25:43 +0100	[thread overview]
Message-ID: <20131024162542.GA32124@linaro.org> (raw)
In-Reply-To: <20131024154956.GN16735@n2100.arm.linux.org.uk>

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

WARNING: multiple messages have this Message-ID (diff)
From: steve.capper@linaro.org (Steve Capper)
To: linux-arm-kernel@lists.infradead.org
Subject: ARM: add support to dump the kernel page tables
Date: Thu, 24 Oct 2013 17:25:43 +0100	[thread overview]
Message-ID: <20131024162542.GA32124@linaro.org> (raw)
In-Reply-To: <20131024154956.GN16735@n2100.arm.linux.org.uk>

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

  reply	other threads:[~2013-10-24 16:25 UTC|newest]

Thread overview: 21+ 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  7:16 ` Russell King - ARM Linux
2013-10-24 10:51 ` Steve Capper
2013-10-24 10:51   ` Steve Capper
2013-10-24 12:23   ` Russell King - ARM Linux
2013-10-24 12:23     ` Russell King - ARM Linux
2013-10-24 12:55     ` Steve Capper
2013-10-24 12:55       ` Steve Capper
2013-10-24 15:49       ` Russell King - ARM Linux
2013-10-24 15:49         ` Russell King - ARM Linux
2013-10-24 15:49         ` Russell King - ARM Linux
2013-10-24 16:25         ` Steve Capper [this message]
2013-10-24 16:25           ` Steve Capper
2013-10-24 21:31           ` Russell King - ARM Linux
2013-10-24 21:31             ` Russell King - ARM Linux
2013-10-31 17:28 ` Laura Abbott
2013-10-31 17:28   ` Laura Abbott
2013-10-31 17:40   ` Russell King - ARM Linux
2013-10-31 17:40     ` Russell King - ARM Linux
2013-11-26 13:50 ` Uwe Kleine-König
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=20131024162542.GA32124@linaro.org \
    --to=steve.capper@linaro.org \
    --cc=linux-arch@vger.kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux@arm.linux.org.uk \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.