Troubles with ethr_dw_atomic_cmpxchg implementation on intel Atom?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Troubles with ethr_dw_atomic_cmpxchg implementation on intel Atom?

Filip Andres
Hello,
I have found out that on intel Atom processors the erlang:processes() crashes the VM.
To me it seems like a glitch in the implementation of ethr_dw_atomic_cmpxchg on platforms lacking native support for double word compare-and-exchange (although I cannot claim I really understand all of erl_threads.h and atomic.h).

GDB stacktrace:
(gdb) bt
#0  0x56798d70 in ethr_dw_atomic_cmpxchg () at ../include/internal/i386/atomic.h:177
#1  0x566103ce in ethr_dw_atomic_cmpxchg_nob (xchg=0xf4e0609c, new=0xf4e060a4, var=0x568688f0 <erts_proc+48>)
    at beam/erl_threads.h:1456
#2  erts_atomic64_inc_read_nob (var=0x568688f0 <erts_proc+48>) at beam/erl_threads.h:1646
#3  step_interval_nob (icp=0x568688f0 <erts_proc+48>) at beam/utils.c:4954
#4  erts_smp_step_interval_nob (icp=icp@entry=0x568688f0 <erts_proc+48>) at beam/utils.c:5004
#5  0x5671572b in ptab_list_bif_engine (c_p=c_p@entry=0xf6dc0218, res_accp=res_accp@entry=0xf4e06178, 
    mbp=mbp@entry=0xf1f80a88) at beam/erl_ptab.c:927
#6  0x56716a5d in erts_ptab_list (c_p=c_p@entry=0xf6dc0218, ptab=0x568688c0 <erts_proc>) at beam/erl_ptab.c:766
#7  0x5661be76 in processes_0 (A__p=0xf6dc0218, BIF__ARGS=0xf7483100) at beam/bif.c:3841
#8  0x5659978b in process_main () at beam/beam_emu.c:3690
#9  0x56638784 in sched_thread_func (vesdp=0xf6087dc0) at beam/erl_process.c:8021
#10 0x567a19cc in thr_wrapper (vtwd=0xffffd1b4) at pthread/ethread.c:114
#11 0xf7f164be in start_thread (arg=0xf4e06b40) at pthread_create.c:333
#12 0xf7e2a3fe in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:114
Some more information in: https://bugzilla.redhat.com/show_bug.cgi?id=1221824

_______________________________________________
erlang-bugs mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-bugs
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Troubles with ethr_dw_atomic_cmpxchg implementation on intel Atom?

Mikael Pettersson-5
Filip Andres writes:
 > Hello,
 > I have found out that on intel Atom processors the erlang:processes()
 > crashes the VM.
 > To me it seems like a glitch in the implementation of
 > ethr_dw_atomic_cmpxchg on platforms lacking native support for double word
 > compare-and-exchange (although I cannot claim I really understand all of
 > erl_threads.h and atomic.h).
 >
 > GDB stacktrace:
 >
 > (gdb) bt
 > #0  0x56798d70 in ethr_dw_atomic_cmpxchg () at
 > ../include/internal/i386/atomic.h:177
 > #1  0x566103ce in ethr_dw_atomic_cmpxchg_nob (xchg=0xf4e0609c,
 > new=0xf4e060a4, var=0x568688f0 <erts_proc+48>)
 >     at beam/erl_threads.h:1456
 > #2  erts_atomic64_inc_read_nob (var=0x568688f0 <erts_proc+48>) at
 > beam/erl_threads.h:1646
 > #3  step_interval_nob (icp=0x568688f0 <erts_proc+48>) at beam/utils.c:4954
 > #4  erts_smp_step_interval_nob (icp=icp@entry=0x568688f0
 > <erts_proc+48>) at beam/utils.c:5004
 > #5  0x5671572b in ptab_list_bif_engine (c_p=c_p@entry=0xf6dc0218,
 > res_accp=res_accp@entry=0xf4e06178,
 >     mbp=mbp@entry=0xf1f80a88) at beam/erl_ptab.c:927
 > #6  0x56716a5d in erts_ptab_list (c_p=c_p@entry=0xf6dc0218,
 > ptab=0x568688c0 <erts_proc>) at beam/erl_ptab.c:766
 > #7  0x5661be76 in processes_0 (A__p=0xf6dc0218, BIF__ARGS=0xf7483100)
 > at beam/bif.c:3841
 > #8  0x5659978b in process_main () at beam/beam_emu.c:3690
 > #9  0x56638784 in sched_thread_func (vesdp=0xf6087dc0) at
 > beam/erl_process.c:8021
 > #10 0x567a19cc in thr_wrapper (vtwd=0xffffd1b4) at pthread/ethread.c:114
 > #11 0xf7f164be in start_thread (arg=0xf4e06b40) at pthread_create.c:333
 > #12 0xf7e2a3fe in clone () at ../sysdeps/unix/sysv/linux/i386/clone.S:114
 >
 > Some more information in:
 > https://bugzilla.redhat.com/show_bug.cgi?id=1221824

I'm unable to reproduce this issue with Fedora 22 running on a Core-i7 CPU.
I forced a 32-bit build with "setarch i386", and in that I further forced
"-mtune=atom" into CFLAGS when building otp_src_18.2.1.tar.gz.  The build
succeeded and "erlang:processes()." didn't SEGV.

Can you please add the following information:
- all options passed to ./configure
- what does "gcc -v" say in your build environment?
- cat /proc/cpuinfo
- in your GDB session, please do "info regs" and disassemble the function
  which faulted
- do the binaries fault everywhere or only on those Atom processors?
- does the build use libatomic_ops? if so, can you try without that
_______________________________________________
erlang-bugs mailing list
[hidden email]
http://erlang.org/mailman/listinfo/erlang-bugs
Loading...