[Ukfreebsd] ARM SMP lock/atomic implementations

Jon Schneider jon at axismilton.ltd.uk
Mon Nov 4 13:40:36 GMT 2019


I know some of you work on ARM kernel innards and really know your stuff 
so would like to ask about a problem we're still looking into. I'm being 
just a big vague on purpose.

It's about another kind of UNIX family kernel distributed under a more 
religious infectuous license. A product's ARMv7 core appears to hit a 
brick wall after a period of hours to weeks depending on its usage. But 
doesn't when run with the nosmp kernel parameter. There are no panic or 
or kernel messages or anything interesting from memory tests whatsoever 
which is why I say brick wall.

Attaching a JTAG debuggerer shows a stack leading to a spinlock in the 
kernel's scheduler interrupting some normal looking stuff. The normal 
looking stuff varies. Detaching this strangely returns the unit to 
working and could be that the debug block doesn't restore state 
properly. The spinlock implementation is

x:     ldrex   %0, [%3]
        add     %1, %0, %4
        strex   %2, %1, [%3]
        teq     %2, #0
        bne     x

which seems to be a pretty standard for these things even in FreeBSD.

Some earlier but not current sources have an #ifndef 
_vendor_errata_for_earlier_core wrapped WFE("ne") after the teq. I 
believe this relates to idling on acquisition failure but is suspicious.

My question is have you ever encountered problems with and vendor's 
ldrex/strex implementation ?

I have no doubt if the core were closer to its StrongARM roots it would 
work properly.

Jon


More information about the Ukfreebsd mailing list