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

List:       linux-arm-kernel
Subject:    ARM1136JF-S:Is it a bug for ret_slow_syscall and ret_fast_syscall?
From:       CoryXie () pek ! destiny ! com ! cn
Date:       2007-05-30 13:05:14
Message-ID: OF5141B014.3907AD0C-ON482572EB.0044C6C9-482572EB.0047E081 () destiny ! com ! cn
[Download RAW message or body]

This is a multipart message in MIME format.
[Attachment #2 (text/plain)]

Hi list,

   I post this question mostly to continue the topic: "Unhandled fault" 
for ARM1136 system at boot time!
which seems out of focus for the kernel experts.You can find that topic 
at:

http://thread.gmane.org/gmane.linux.ports.arm.kernel/32056/focus=32057

In that topic,I found my port of linux to an ARM1136JF-S system will 
encounter data abort when it reaches
ret_slow_syscall and ret_fast_syscall,when it executes the "movs pc, lr" 
instruction.As below:

[
...
CPU: Testing write buffer coherency: ok
Unhandled fault: external abort on linefetch (0x806) at 0x00000000
Internal error: : 806 [#1]
Modules linked in:
CPU: 0
PC is at kernel_thread_helper+0x0/0xc
LR is at kernel_thread_helper+0x0/0xc
pc : [<c0022a38>]    lr : [<c0022a38>]    Not tainted
...
]

This crash beat me for some days,and finally I found this can be fixed by 
not clearing the A bit of the 
SPSR/CPSR,which is added new to ARMv6 as I know(please teach me if I am 
wrong).The fix for me is as below:

[added in ptrace.h:
#define PSR_A_BIT       0x00000100
#define PSR_E_BIT       0x00000200
]

[
ret_fast_syscall:
        disable_irq                             @ disable interrupts
        ldr     r1, [tsk, #TI_FLAGS]
        tst     r1, #_TIF_WORK_MASK
        bne     fast_work_pending

        /* perform architecture specific actions before user return */
        arch_ret_to_user r1, lr

        @ fast_restore_user_regs
        ldr     r1, [sp, #S_OFF + S_PSR]        @ get calling cpsr
        ldr     lr, [sp, #S_OFF + S_PC]!        @ get pc
#ifdef CONFIG_ARCH_ZR4230
        orr     r1, r1, #PSR_A_BIT      @keep the A bit set to fix data 
abort bug
#endif
        msr     spsr_cxsf, r1                   @ save in spsr_svc
        ldmdb   sp, {r1 - lr}^                  @ get calling r1 - lr
        mov     r0, r0
        add     sp, sp, #S_FRAME_SIZE - S_PC
        movs    pc, lr                          @ return & move spsr_svc 
into cpsr

]

[
ret_slow_syscall:
        disable_irq                             @ disable interrupts
        ldr     r1, [tsk, #TI_FLAGS]
        tst     r1, #_TIF_WORK_MASK
        bne     work_pending
no_work_pending:
        /* perform architecture specific actions before user return */
        arch_ret_to_user r1, lr

        @ slow_restore_user_regs
        ldr     r1, [sp, #S_PSR]                @ get calling cpsr
        ldr     lr, [sp, #S_PC]!                @ get pc
#ifdef CONFIG_ARCH_ZR4230
        orr     r1, r1, #PSR_A_BIT      @keep the A bit set to fix data 
abort bug
#endif
        msr     spsr_cxsf, r1                   @ save in spsr_svc
        ldmdb   sp, {r0 - lr}^                  @ get calling r1 - lr
        mov     r0, r0
        add     sp, sp, #S_FRAME_SIZE - S_PC
        movs    pc, lr                          @ return & move spsr_svc 
into cpsr
]

However,I noted that there are many others running OK with the orignal 
kernel for ARM1136JF-S
systems,eg,the OMAP2430.I doubt if this is a general problem for all 
ARM1136JF-S or just for 
my SoC.

Anyway,I post my modifcations to the list in order for someone will give 
this a deep look.
Also,I know my modification is not at the right place.The best place for 
this should be in :

pid_t kernel_thread(int (*fn)(void *), void *arg, unsigned long flags)

and the interrupt handling code.

Below is the output for my board.The console is working for some time,and 
after some "ls" it hangs.I gusess
there is some problems with my console driver.But if someone has 
encountered this kind of console hang up,
pleae teach me how to fix it.

Regards,

Cory
 
============================================================================================================================
 Uncompressing 
Linux............................................................................ 
done, booting the kernel.
Linux version 2.6.21.1 (root@localhost.localdomain) (gcc version 4.2.0 
20070413 (prerelease) (CodeSourcery Sourcery G++ Lite 2007q1-10)) #71 
PREEMPT Wed May 30 19:26:01 CST 2007
CPU: ARMv6-compatible processor [4107b364] revision 4 (ARMv6TEJ), 
cr=00c5207b
Machine: ZR4230 ZOLO Board
Ignoring unrecognised tag 0x00000000
Memory policy: ECC disabled, Data cache buffered
CPU0: D VIPT write-back cache
CPU0: I cache: 16384 bytes, associativity 4, 32 byte lines, 128 sets
CPU0: D cache: 16384 bytes, associativity 4, 32 byte lines, 128 sets
Built 1 zonelists.  Total pages: 32512
Kernel command line: mem=128M console=ttyS0,57600n8 root=/dev/ram0 
initrd=0x800000 init=/linuxrc
IRQ: Found ICU at 0xf0180000 with 94 interrupts
PID hash table entries: 512 (order: 9, 2048 bytes)
Kernel Timer Init
Console: colour dummy device 80x30
Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
Memory: 128MB = 128MB total
Memory: 125824KB available (2152K code, 196K data, 96K init)
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
NET: Registered protocol family 16
SCSI subsystem initialized
NET: Registered protocol family 2
IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
TCP established hash table entries: 4096 (order: 3, 32768 bytes)
TCP bind hash table entries: 4096 (order: 2, 16384 bytes)
TCP: Hash tables configured (established 4096 bind 4096)
TCP reno registered
checking if image is initramfs...it isn't (no cpio magic); looks like an 
initrd
Freeing initrd memory: 1511K
NetWinder Floating Point Emulator V0.97 (double precision)
io scheduler noop registered
io scheduler anticipatory registered
io scheduler deadline registered
io scheduler cfq registered (default)
zr4230-uart.0: ttyS0 at MMIO 0xf0380010 (irq = 17) is a UART
RAMDISK driver initialized: 16 RAM disks of 8192K size 1024 blocksize
loop: loaded (max 8 devices)
Linux video capture interface: v2.00
i2c /dev entries driver
TCP cubic registered
NET: Registered protocol family 1
NET: Registered protocol family 17
RAMDISK: Compressed image found at block 0
VFS: Mounted root (ext2 filesystem).
Freeing init memory: 96K
root:~> ### Application running ...

root:~> ls
bin      etc      home linuxrc 
 sbin     usr
dev      ftp      lib proc 
tmp      var
root:~> ls
bin      etc      home linuxrc 
 sbin     usr
dev      ftp      lib proc 
tmp      var
root:~> ls
bin      etc      home linuxrc 
 sbin     usr
dev      
=================My console hangs 
here!!====================================================



-------------------------------------------------------------------
List admin: http://lists.arm.linux.org.uk/mailman/listinfo/linux-arm-kernel
FAQ:        http://www.arm.linux.org.uk/mailinglists/faq.php
Etiquette:  http://www.arm.linux.org.uk/mailinglists/etiquette.php

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

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