AW: [erlang-questions] Serious problems with some operations on the ARM platfor.

Decker, Nils n.decker@REDACTED
Fri Jan 21 11:03:28 CET 2011


Hello,

I had the same problem two weeks ago when cross compiling erlang to an embedded arm system.
The toolchain by the vendor uses an old compiler too:
  gcc-Version 3.4.3 (MontaVista 3.4.3-25.0.30.0501131 2005-07-23)

The bug caused almost all snmp queries to use 100% cpu with a totally unresponsive emulator. Keypresses in the erlang shell took minutes!

Using gdb on the emulator i found that the compiler did something funny with erst/emulator/big.c:I_lshift. The shift left branch was taken even when y < 0. This turned a shift right on a bignum to a shift left.
This lead to a small loop shifting bytes from a bignum into an infinite loop that built ever growing bignums. (snmp_pdus:eint/2)

The workaround for me was a simple
  CFLAGS=-O1
in my  erl-xcomp-xscale_be-linux.conf.

One thing i found, is that a single process can completely block a (non-smp) emulator by building large bignums.
  loop(N)  ->
    _ = N div 3, % some work needed on my desktop but not needed on arm.
    loop(N bsl 8).

The reason is, that one bignum operation consumes just one reduction by the scheduler, but the work done is depends on the size of the bignum. Maybe the size (in bytes) of the bignum should be used for the number reductions consumed by bignum operations?

Nils



> -----Ursprüngliche Nachricht-----
> Von: erlang-questions@REDACTED 
> [mailto:erlang-questions@REDACTED] Im Auftrag von Igor Karymov
> Gesendet: Donnerstag, 20. Januar 2011 17:01
> An: erlang-questions@REDACTED
> Betreff: [erlang-questions] Serious problems with some 
> operations on the ARM platfor.
> 
> On the last version of erlang (tested on r13b04 and r14a) I 
> observ next behavior:
> 
> (nmg@REDACTED)2> A =
> (nmg@REDACTED)3> B = A bsr 8.
> (nmg@REDACTED)4> C = A bsl 8.
> (nmg@REDACTED)5> A > B.
> true
> (nmg@REDACTED)6> C == B.
> true
> 
> On older versions (r12b05)  all are right.
> 
> Compiler:
> $ arm-softfloat-linux-gnu-gcc --version
> arm-softfloat-linux-gnu-gcc (GCC) 3.4.5
> 
> Linux:
> Linux some 2.6.22.19-4.03.0-c300evm #123 Tue Sep 21 10:00:16 
> NOVST 2010 armv6l unknown
> 
> Processor:
> CPU: ARMv6-compatible processor [4117b361] revision 1 (ARMv6TEJ)
> 

Nils Decker
Software-Ingenieur
Projektierung

Studio Hamburg Media Consult International (MCI) GmbH
Jenfelder Allee 80 | Haus R 2. OG / Raum 257
22039 Hamburg
Telefon: +49 (40) 6688-3437

n.decker@REDACTED
www.mci-systems.de
www.mci-products.de
www.mci-werkstaetten.de
www.mci-shop.de

.................................................................................

Geschäftsführung:
Ralf Schimmel (Vorsitzender)
Maximilian Below

Prokuristen:
Jörn Denneborg
Kerstin Göing
Jörg Pankow

Amtsgericht Hamburg:
HRB 70454


Bitte denken Sie an die Umwelt, bevor Sie diese E-Mail drucken.


More information about the erlang-questions mailing list