public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* pgd_none_or_clear_bad strangeness?
@ 2007-10-02 22:20 Matt Mackall
  2007-10-03 11:25 ` Nick Piggin
  0 siblings, 1 reply; 4+ messages in thread
From: Matt Mackall @ 2007-10-02 22:20 UTC (permalink / raw)
  To: Nick Piggin, Hugh Dickins; +Cc: linux-kernel

In lib/pagewalk.c, I've been using the various forms of
{pgd,pud,pmd}_none_or_clear_bad while walking page tables as that
seemed the canonical way to do things. Lately (eg with -rc7-mm1),
these have been triggering messages like "bad pgd 0x01e3" and causing
nasty double faults. It appears this is actually triggered at the pmd
level (mm/memory.c:116), though it appears to produce the wrong
message.

Has something changed here? I'm pretty sure this used to work! Is this
not a kosher thing to do? Does it make any sense I'd repeatedly run
into a bad pmd in the middle of bash's page table right after boot?
The simple _none variant seems to work, but I worry that it's papering
over a real problem.

-- 
Mathematics is the supreme nostalgia of our time.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: pgd_none_or_clear_bad strangeness?
  2007-10-02 22:20 pgd_none_or_clear_bad strangeness? Matt Mackall
@ 2007-10-03 11:25 ` Nick Piggin
  2007-10-03 18:18   ` Hugh Dickins
  0 siblings, 1 reply; 4+ messages in thread
From: Nick Piggin @ 2007-10-03 11:25 UTC (permalink / raw)
  To: Matt Mackall; +Cc: Hugh Dickins, linux-kernel

On Tue, Oct 02, 2007 at 05:20:03PM -0500, Matt Mackall wrote:
> In lib/pagewalk.c, I've been using the various forms of
> {pgd,pud,pmd}_none_or_clear_bad while walking page tables as that
> seemed the canonical way to do things. Lately (eg with -rc7-mm1),
> these have been triggering messages like "bad pgd 0x01e3" and causing
> nasty double faults. It appears this is actually triggered at the pmd
> level (mm/memory.c:116), though it appears to produce the wrong
> message.
> 
> Has something changed here? I'm pretty sure this used to work! Is this
> not a kosher thing to do? Does it make any sense I'd repeatedly run
> into a bad pmd in the middle of bash's page table right after boot?
> The simple _none variant seems to work, but I worry that it's papering
> over a real problem.

No, I think that should be the right thing to do for userspace pages.
You're not walking into a hugetlb area or a kernel mapping are you?
(the bad pgd: line could be important... 0x01e3 would be a linear kernel
mapping I think?).


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: pgd_none_or_clear_bad strangeness?
  2007-10-03 11:25 ` Nick Piggin
@ 2007-10-03 18:18   ` Hugh Dickins
  2007-10-03 21:31     ` Matt Mackall
  0 siblings, 1 reply; 4+ messages in thread
From: Hugh Dickins @ 2007-10-03 18:18 UTC (permalink / raw)
  To: Matt Mackall; +Cc: Nick Piggin, linux-kernel

On Wed, 3 Oct 2007, Nick Piggin wrote:
> On Tue, Oct 02, 2007 at 05:20:03PM -0500, Matt Mackall wrote:
> > In lib/pagewalk.c, I've been using the various forms of
> > {pgd,pud,pmd}_none_or_clear_bad while walking page tables as that
> > seemed the canonical way to do things. Lately (eg with -rc7-mm1),
> > these have been triggering messages like "bad pgd 0x01e3" and causing
> > nasty double faults. It appears this is actually triggered at the pmd
> > level (mm/memory.c:116), though it appears to produce the wrong
> > message.

I guess the "wrong message" is an artifact of pud/pmd folding;
but I get too confused by the different levels myself to want to
think more about it - I'll just assume it's "right" somehow ;)

> > 
> > Has something changed here? I'm pretty sure this used to work! Is this

I don't know of anything changing here, sorry.

> > not a kosher thing to do? Does it make any sense I'd repeatedly run
> > into a bad pmd in the middle of bash's page table right after boot?
> > The simple _none variant seems to work, but I worry that it's papering
> > over a real problem.
> 
> No, I think that should be the right thing to do for userspace pages.
> You're not walking into a hugetlb area or a kernel mapping are you?
> (the bad pgd: line could be important... 0x01e3 would be a linear kernel
> mapping I think?).

I should have spent more time reading Nick's reply and less time trying
to work it out for myself!  Yes, that's the conclusion I came to, for
some reason you're now going beyond the user vmas and walking into the
linear kernel mapping, which has _PAGE_GLOBAL and _PAGE_PSE bits set.

Hugh

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: pgd_none_or_clear_bad strangeness?
  2007-10-03 18:18   ` Hugh Dickins
@ 2007-10-03 21:31     ` Matt Mackall
  0 siblings, 0 replies; 4+ messages in thread
From: Matt Mackall @ 2007-10-03 21:31 UTC (permalink / raw)
  To: Hugh Dickins; +Cc: Nick Piggin, linux-kernel

On Wed, Oct 03, 2007 at 07:18:23PM +0100, Hugh Dickins wrote:
> On Wed, 3 Oct 2007, Nick Piggin wrote:
> > On Tue, Oct 02, 2007 at 05:20:03PM -0500, Matt Mackall wrote:
> > > In lib/pagewalk.c, I've been using the various forms of
> > > {pgd,pud,pmd}_none_or_clear_bad while walking page tables as that
> > > seemed the canonical way to do things. Lately (eg with -rc7-mm1),
> > > these have been triggering messages like "bad pgd 0x01e3" and causing
> > > nasty double faults. It appears this is actually triggered at the pmd
> > > level (mm/memory.c:116), though it appears to produce the wrong
> > > message.
> 
> I guess the "wrong message" is an artifact of pud/pmd folding;
> but I get too confused by the different levels myself to want to
> think more about it - I'll just assume it's "right" somehow ;)
> 
> > > 
> > > Has something changed here? I'm pretty sure this used to work! Is this
> 
> I don't know of anything changing here, sorry.
> 
> > > not a kosher thing to do? Does it make any sense I'd repeatedly run
> > > into a bad pmd in the middle of bash's page table right after boot?
> > > The simple _none variant seems to work, but I worry that it's papering
> > > over a real problem.
> > 
> > No, I think that should be the right thing to do for userspace pages.
> > You're not walking into a hugetlb area or a kernel mapping are you?
> > (the bad pgd: line could be important... 0x01e3 would be a linear kernel
> > mapping I think?).
> 
> I should have spent more time reading Nick's reply and less time trying
> to work it out for myself!  Yes, that's the conclusion I came to, for
> some reason you're now going beyond the user vmas and walking into the
> linear kernel mapping, which has _PAGE_GLOBAL and _PAGE_PSE bits set.

Indeed, that's precisely what's happening. I'm walking one page past
the end of userspace. 

And the reason is I changed my walker from using for loops to do/while
loops at Nick's insistance, so start==end no longer gets noticed
immediately. This also explains why the bug doesn't manifest in
lguest: no PSE mappings.

Thanks, guys!

-- 
Mathematics is the supreme nostalgia of our time.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2007-10-03 21:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-10-02 22:20 pgd_none_or_clear_bad strangeness? Matt Mackall
2007-10-03 11:25 ` Nick Piggin
2007-10-03 18:18   ` Hugh Dickins
2007-10-03 21:31     ` Matt Mackall

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox