Opened 9 years ago

Closed 9 years ago

#641 closed defect (fixed)

RaspberryPi support broken by mainline,2297 (integration of CHT support)

Reported by: Jakub Jermář Owned by: Jiri Svoboda
Priority: major Milestone: 0.7.0
Component: helenos/kernel/arm32 Version: mainline
Keywords: RaspberryPi Cc:
Blocker for: Depends on:
See also:

Description

Since mainline,2297, HelenOS/rpi default build hangs during boot after it prints:

HelenOS bootloader, release 0.6.0 (Elastic Horse), revision 2297M (jakub@jermar.eu-20141222174740-758y1cdski7bmuio)
Built on 2015-10-07 13:00:17 for arm32
Copyright (c) 2001-2014 HelenOS project
Boot data: 0x00010000 -> 0x0040bdc9

Memory statistics
 0x00015000|0x00015000: bootstrap stack
 0x00010000|0x00010000: bootstrap page table
 0x0001571c|0x0001571c: boot info structure
 0x80a08000|0x00a08000: kernel entry point
 0x00015c24|0x00015c24: kernel image (572424/171099 bytes)
 0x0003f87f|0x0003f87f: ns image (233308/98817 bytes)
 0x00057a80|0x00057a80: loader image (231634/98534 bytes)
 0x0006fb66|0x0006fb66: init image (233740/99197 bytes)
 0x00087ee3|0x00087ee3: locsrv image (240728/102522 bytes)
 0x000a0f5d|0x000a0f5d: rd image (231103/98008 bytes)
 0x000b8e35|0x000b8e35: vfs image (247569/106157 bytes)
 0x000d2ce2|0x000d2ce2: logger image (237323/100653 bytes)
 0x000eb60f|0x000eb60f: fat image (315195/136993 bytes)
 0x0010cd30|0x0010cd30: initrd image (8657920/3141785 bytes)

Inflating components ... initrd fat logger vfs rd locsrv init loader ns kernel .
Booting the kernel...
SPARTAN kernel, release 0.6.0 (Elastic Horse), revision 2297M (jakub@jermar.eu-20141222174740-758y1cdski7bmuio)
Built on 2015-10-07 13:00:17 for arm32
Copyright (c) 2001-2014 HelenOS project
Detected 1 CPU(s), 196576 KiB free memory
Program loader at 0xf0080000

Change History (3)

comment:1 by Jakub Jermář, 9 years ago

The problem is in rcu_after_thread_ran() when it calls local_atomic_exchange():

        size_t nesting_cnt = local_atomic_exchange(&THE->rcu_nesting, 0);

I suspect the LDREX/STREX/CMP/BNE sequence just loops infinitely for some reason:

80a39754:       e59f320c        ldr     r3, [pc, #524]  ; 80a39968 <rcu_after_thread_ran+0x238>
80a39758:       e00d3003        and     r3, sp, r3
80a3975c:       e3a02000        mov     r2, #0
80a39760:       e2833004        add     r3, r3, #4
80a39764:       e1934f9f        ldrex   r4, [r3]
80a39768:       e1831f92        strex   r1, r2, [r3]
80a3976c:       e3510000        cmp     r1, #0
80a39770:       1afffffb        bne     80a39764 <rcu_after_thread_ran+0x34>

comment:2 by Jakub Jermář, 9 years ago

Seems like when pages are marked shareable, the STREX instruction in the above sequence always fails. I kind of verified this by printing out the result in a loop of 20 iterations. I haven't managed to figure out why though. The shareable bit seems to be set only on ARMv6 and only as a workaround for some other trouble (see next). When pages are not marked shareable, the D$ has some valid contents which makes the kernel crash early on. Invalidating the entire D$ prior to enabling it fixes the problem (did not verify if it also fixes the problem when pages are marked as shareable).

comment:3 by Jakub Jermář, 9 years ago

Resolution: fixed
Status: newclosed

Fix merged in mainline,2399.

Note: See TracTickets for help on using tickets.