[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux-arm-kernel
Subject:    Re: ARM925T problems...
From:       Matthias Welwarsky <mwelwarsky () web ! de>
Date:       2002-12-10 14:48:59
[Download RAW message or body]

George,

On Friday 06 December 2002 08:43, Matthias Welwarsky wrote:
> On Thursday 05 December 2002 20:19, George G. Davis wrote:
> > Matthias Welwarsky wrote:
> > > Any comments?
> >
> > On the TLB invalidate change, I defer to Russel's wisdom. : )
>
> and he was correct, of course ;) Maybe you should check, too. The
> cpu_arm925_tlb_invalidate_range() seems to have a subtle bug. I have pulled
> in the version from proc-arm926.S, that one works better, though I have to
> make a few tests to be really sure.

After another quick glance at the patch I think i found the bug in your 
version of the tlb_invalidate_range() function:

ENTRY(cpu_arm925_tlb_invalidate_range)
       mov     r3, #0
       mcr     p15, 0, r3, c7, c10, 4          @ drain WB

       mov     r3, #PAGESIZE
       sub     r3, r3, #1
       bic     r0, r0, r3
       bic     r1, r1, r3

1:     mcr     p15, 0, r0, c8, c6, 1           @ invalidate D TLB entry
       mcr     p15, 0, r0, c8, c5, 1           @ invalidate I TLB entry
       add     r0, r0, #PAGESIZE
       cmp     r0, r1
       blt     1b
       mov     pc, lr

The culprit is most likely the "blt 1b". This is for signed operands, while 
the range boundaries must be treated as unsigned values. Imagine what happens 
e.g. for "cpu_arm925_tlb_invalidate_range(0x00000000, 0xc0000000)" (happens 
on every execution of a new process):

r1 is 0xc0000000, MSB is set so it's treated as a negative value.

In the first iteration of the loop, "cmp r0, r1" compares "PAGESIZE" to a 
negative value and the loop exits without having properly cleared the TLB 
range.

Fix is simply using "blo" instead of "blt" :-)

regards,
	matthias


-------------------------------------------------------------------
Subscription options: http://lists.arm.linux.org.uk/mailman/listinfo/linux-arm-kernel
FAQ/Etiquette:       http://www.arm.linux.org.uk/armlinux/mailinglists.php

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic