2004-03-16 01:42:35

by NeilBrown

[permalink] [raw]
Subject: Re: 2.6.4-mm1 - 4g patch breaks when X86_4G not selected

On Monday March 15, [email protected] wrote:
>
> * Neil Brown <[email protected]> wrote:
>
> > And it turns out it was spot on. Applying 4g-2.6.0-test2-mm2-A5.patch
> > (on top of preceding -mm1 patches) causes my server not to boot.
>
> hm. Since your .config boots on akpm's box, this is some BIOS dependency
> creating an early-boot problem i fear. Debugging such bugs is hard. One
> way would be via the PC speaker:
>
> movb $0x3,%al; outb %al,$0x61
>
> this will cause a continuous beep on a typical PC - it works in 16-bit
> code too, doesnt have any memory-model assumptions, etc.
>
> the first place to put this would be startup_32 - do we get to this
> point at all? (check CONFIG_4G first, to make sure the beep triggers.)
> If it beeps, then move it down until you find the place that crashes.
>
> Ingo

Thanks for the pointer. I now have something useful to report.

start_kernel calls setup_arch
which calls paging_init
which calls pagetable_init
which calls setup_identity_mappings
which calls page_address

If I put
asm("push %eax; movb $0x3,%al; outb %al,$0x61; popl %eax\n");
before the call to page_address, and
asm("push %eax; movb $0x0,%al; outb %al,$0x61; popl %eax\n");
afterwards, then I get a tone after boot, suggesting that page_address
isn't returning.

I'm guessing that the problem is:

page_address calls
spin_lock_irqsave(&pas->lock, flags);

but the spinlock isn't initialised by page_address_init
until much later in start_kernel.

NeilBrown


2004-03-16 04:52:19

by Andrew Morton

[permalink] [raw]
Subject: Re: 2.6.4-mm1 - 4g patch breaks when X86_4G not selected

Neil Brown <[email protected]> wrote:
>
> Thanks for the pointer. I now have something useful to report.
>
> start_kernel calls setup_arch
> which calls paging_init
> which calls pagetable_init
> which calls setup_identity_mappings
> which calls page_address
>
> If I put
> asm("push %eax; movb $0x3,%al; outb %al,$0x61; popl %eax\n");
> before the call to page_address, and
> asm("push %eax; movb $0x0,%al; outb %al,$0x61; popl %eax\n");
> afterwards, then I get a tone after boot, suggesting that page_address
> isn't returning.
>
> I'm guessing that the problem is:
>
> page_address calls
> spin_lock_irqsave(&pas->lock, flags);
>
> but the spinlock isn't initialised by page_address_init
> until much later in start_kernel.

That is useful, thanks. Sorry about the hassle.

Calling page_address_init() earlier isn't the fix though - pmd pages aren't
in highmem so we should never have got that far. Looks like the pgd or the
pmd page contains garbage. Did you try it without CONFIG_DEBUG_SLAB?

Nick was seeing slab 0x6b patterns on the NUMAQ, inside the pmd, so there's
some consistency there. We do have one early setup fix from Manfred, but
it's unlikely to cure this.

I'll have a play with your .config, see if I can reproduce it. If not I'll
squeeze off -mm3 and would ask you to retest on that if poss.

2004-03-16 08:30:12

by Ingo Molnar

[permalink] [raw]
Subject: Re: 2.6.4-mm1 - 4g patch breaks when X86_4G not selected


another thing: the bzImage is pretty large (1.7MB) - maybe 4G just
pushes the size of the kernel past some size limit. Same for SLAB_DEBUG.

Ingo

2004-03-16 08:33:03

by Ingo Molnar

[permalink] [raw]
Subject: Re: 2.6.4-mm1 - 4g patch breaks when X86_4G not selected


* Andrew Morton <[email protected]> wrote:

> I'll have a play with your .config, see if I can reproduce it. If not
> I'll squeeze off -mm3 and would ask you to retest on that if poss.

i tried Neil's bzImage and it hung on a stock PC too.

Ingo

2004-03-16 08:01:45

by Andrew Morton

[permalink] [raw]
Subject: Re: 2.6.4-mm1 - 4g patch breaks when X86_4G not selected

Ingo Molnar <[email protected]> wrote:
>
>
> * Andrew Morton <[email protected]> wrote:
>
> > I'll have a play with your .config, see if I can reproduce it. If not
> > I'll squeeze off -mm3 and would ask you to retest on that if poss.
>
> i tried Neil's bzImage and it hung on a stock PC too.

Me too, with CONFIG_DEBUG_PAGEALLOC. We had a fatal bug around that.

However it seems that Neil's machine is dying with CONFIG_DEBUG_SLAB=y,
CONFIG_DEBUG_PAGEALLOC=n, for which we have no explanation. It seems that
we're getting use-after-free errors against the pgd's.

Maybe it was the early-x86-cpu-detection.patch bug biting in two places -
let me brew rc1-mm1 and we'll see.

2004-04-04 09:07:24

by Zwane Mwaikambo

[permalink] [raw]
Subject: [PATCH][2.6-mm] setup_identity_mappings depends on zone init.

On Mon, 15 Mar 2004, Andrew Morton wrote:

> Calling page_address_init() earlier isn't the fix though - pmd pages aren't
> in highmem so we should never have got that far. Looks like the pgd or the
> pmd page contains garbage. Did you try it without CONFIG_DEBUG_SLAB?
>
> Nick was seeing slab 0x6b patterns on the NUMAQ, inside the pmd, so there's
> some consistency there. We do have one early setup fix from Manfred, but
> it's unlikely to cure this.
>
> I'll have a play with your .config, see if I can reproduce it. If not I'll
> squeeze off -mm3 and would ask you to retest on that if poss.

I spent a bit of time on this today, and the problem appears to be that we haven't
done mem_map or zone initialisation, so mem_map[pfn]->flags is also wrong
(e.g. PG_highmem tests). This is still triple faulting on 2.6.5-rc3-mm4 on my
boxes. CONFIG_HIGHMEM and any setup without 4MB pages should do it. The
following patch got an approving nod from Bill.

Index: linux-2.6.5-rc3-mm4/arch/i386/mm/init.c
===================================================================
RCS file: /home/cvsroot/linux-2.6.5-rc3-mm4/arch/i386/mm/init.c,v
retrieving revision 1.1.1.1
diff -u -p -B -r1.1.1.1 init.c
--- linux-2.6.5-rc3-mm4/arch/i386/mm/init.c 2 Apr 2004 03:55:20 -0000 1.1.1.1
+++ linux-2.6.5-rc3-mm4/arch/i386/mm/init.c 4 Apr 2004 09:04:48 -0000
@@ -206,7 +206,7 @@ void setup_identity_mappings(pgd_t *pgd_
if (!pmd_present(*pmd))
pte_base = (pte_t *) alloc_bootmem_low_pages(PAGE_SIZE);
else
- pte_base = (pte_t *) page_address(pmd_page(*pmd));
+ pte_base = (pte_t *) pmd_page_kernel(*pmd);
pte = pte_base;
for (k = 0; k < PTRS_PER_PTE; pte++, k++) {
vaddr = i*PGDIR_SIZE + j*PMD_SIZE + k*PAGE_SIZE;

2004-04-04 09:28:07

by William Lee Irwin III

[permalink] [raw]
Subject: Re: [PATCH][2.6-mm] setup_identity_mappings depends on zone init.

On Mon, 15 Mar 2004, Andrew Morton wrote:
>> Calling page_address_init() earlier isn't the fix though - pmd pages aren't
>> in highmem so we should never have got that far. Looks like the pgd or the
>> pmd page contains garbage. Did you try it without CONFIG_DEBUG_SLAB?
>> Nick was seeing slab 0x6b patterns on the NUMAQ, inside the pmd, so there's
>> some consistency there. We do have one early setup fix from Manfred, but
>> it's unlikely to cure this.
>> I'll have a play with your .config, see if I can reproduce it. If not I'll
>> squeeze off -mm3 and would ask you to retest on that if poss.

On Sun, Apr 04, 2004 at 05:07:36AM -0400, Zwane Mwaikambo wrote:
> I spent a bit of time on this today, and the problem appears to be
> that we haven't done mem_map or zone initialisation, so
> mem_map[pfn]->flags is also wrong (e.g. PG_highmem tests). This is
> still triple faulting on 2.6.5-rc3-mm4 on my boxes. CONFIG_HIGHMEM
> and any setup without 4MB pages should do it. The following patch got
> an approving nod from Bill.

A nicer fix, though with potentially too high a "cleanup factor", would
be a pte_bootmem_alloc_map() or some such equivalent of pte_alloc_map().


-- wli