On Fri, Feb 12, 2016 at 5:43 AM, Philippe Gerum <r...@xenomai.org> wrote:

> On 02/11/2016 01:57 PM, Charles Kiorpes wrote:
> >
> > I attempted to run several tests:  'task-1', 'event-1', and 'mutex-1'.
> > Each of these hung indefinitely.  A gdb trace indicated that they were
> > hanging on __libc_do_syscall() within __pthread_cond_wait() within
> > threadobj_cond_wait().
> >
> > I have attached the full backtrace from mutex-1 as mutex-1_bt.txt
> >
>
> Ok, if the test suite does not pass, something is badly wrong, so we
> should investigate that hang issue before anything else.
>
> The backtrace reveals that copperplate cannot handshake with a newly
> spawned task, this is the purpose of the wait_on_barrier() call over the
> context of rt_task_start(). That barrier should be signaled by a call to
> threadobj_notify_entry() from the internal trampoline code of the
> emerging thread (task_entry() in alchemy/task.c).
>
> - maybe task_prologue_2() (alchemy/task.c) which is called earlier hangs
> indefinitely, and therefore prevents threadobj_notify_entry() from running?
>
> - maybe the new thread does not even start for some reason, are we sure
> task_entry() is reached (e.g. do we hit a breakpoint there?)
>
> Could you inspect the current thread list under gdb when the program hangs?
>
> Also, I would recommend to enable full debugging for now
> (--enable-debug=full) to get accurate line information, assuming the
> issue should still show up with a non-optimized code. Hopefully.
>
> --
> Philippe.
>

I ran the task-1 test under gdb with this Xenomai configuration:
--with-core=mercury \
--enable-debug=full \
--enable-registry \
--enable-smp \
--enable-pshared \
--enable-condvar-workaround

It appears that the new thread is being launched, and getting stuck in
threadobj_wait_start() within task_prologue_2(), as you indicated might be
the case.
I have attached the thread list and a full backtrace for each thread (in
separate files by thread id).

As per your other message, my kernel configs all include CONFIG_FUTEX.

I have tried glibc 2.19 and 2.21, as well as RT patched and vanilla kernels.

Interestingly, when I removed --enable-pshared from my configuration, the
task-1 test passed.

- Charles
-------------- next part --------------
(gdb) thread 1
[Switching to thread 1 (Thread 0xb6ff0000 (LWP 14056))]
#0  __libc_do_syscall () at ../sysdeps/unix/sysv/linux/arm/libc-do-syscall.S:46
46      in ../sysdeps/unix/sysv/linux/arm/libc-do-syscall.S
(gdb) bt full
#0  __libc_do_syscall () at ../sysdeps/unix/sysv/linux/arm/libc-do-syscall.S:46
No locals.
#1  0xb6f5f6f2 in __pthread_cond_wait (cond=0xb6caa194, mutex=0xb6caa09c) at 
pthread_cond_wait.c:177
        _a2tmp = 11
        _a2 = 11
        _nametmp = 240
        _a3tmp = 3
        _a3 = 3
        _a1 = -1228234344
        _v1tmp = -1228234596
        _a4tmp = 0
        _a1tmp = -1228234344
        _a4 = 0
        _v1 = -1228234596
        _name = 240
        __ret = <optimized out>
        futex_val = 3
        buffer = {__routine = 0xb6f5f3e1 <__condvar_cleanup>, __arg = 
0xbefffa00, __canceltype = -1225039472, __prev = 0x0}
        cbuffer = {oldtype = 1, cond = 0xb6caa194, mutex = 0xb6caa09c, bc_seq = 
0}
        err = <optimized out>
        pshared = <optimized out>
        pi_flag = 1
        val = <optimized out>
        seq = <optimized out>
#2  0xb6f9cd9a in threadobj_cond_wait (cond=0xb6caa194, lock=0xb6caa09c) at 
../../../xenomai-3/lib/copperplate/threadobj.c:959
        ret = -1228234604
#3  0xb6f9d348 in wait_on_barrier (thobj=0xb6caa094, mask=16) at 
../../../xenomai-3/lib/copperplate/threadobj.c:1210
        __cancel_buf = {__cancel_jmp_buf = {{__cancel_jmp_buf = {-1446288694, 
-1580381599, -1090520024, 0, 0, -1090520496, 0, 0, -1224740864, 
                0 <repeats 17 times>, 2, 0, 5, 0, 1, -1224758200, -1659757782, 
-1224874387, 0, -1224738124, -1224757760, -1090520312, -1224757760, 0, -1, 
                -1224796312, -1225176080, -1224794112, -1225021852, 
-1224802304, -1224801088, 1, 0, -1224859353, -1224796312, 1, 5, 0, 0, 1, 
-1225039472, 
                0, -1090520024, 0, -1090520232, -1090520024, 0, 0}, 
__mask_was_saved = 0}}, __pad = {0xbefffc28, 0x0, 0x0, 0xb6ca496c}}
        __cancel_routine = 0xb6f5e225 <__GI___pthread_mutex_unlock>
        __cancel_arg = 0xb6caa09c
        __not_first_call = 0
        oldstate = 0
        status = 73
#4  0xb6f9d3fa in threadobj_start (thobj=0xb6caa094) at 
../../../xenomai-3/lib/copperplate/threadobj.c:1247
        current = 0xb6ca496c
        ret = 0
        oldstate = 1
#5  0xb6fc2cc8 in rt_task_start (task=0x20ed0 <t_main>, entry=0x10985 
<main_task>, arg=0xdeadbeef) at ../../../xenomai-3/lib/alchemy/task.c:634
        tcb = 0xb6ca9f6c
        svc = {cancel_type = -559038737}
        ret = 67973
#6  0x00010a62 in main (argc=1, argv=0x21538) at task-1.c:26
        ret = 0

-------------- next part --------------
(gdb) thread 2
[Switching to thread 2 (Thread 0xb6ca1460 (LWP 14063))]
#0  0xb6f61cbe in read () at ../sysdeps/unix/syscall-template.S:81
81      ../sysdeps/unix/syscall-template.S: No such file or directory.
(gdb) bt full
#0  0xb6f61cbe in read () at ../sysdeps/unix/syscall-template.S:81
No locals.
#1  0xb6f1936e in ?? () from /lib/arm-linux-gnueabihf/libfuse.so.2
No symbol table info available.
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
(gdb) 

-------------- next part --------------
(gdb) thread 3
[Switching to thread 3 (Thread 0xb6c6f460 (LWP 14065))]
#0  __libc_do_syscall () at ../sysdeps/unix/sysv/linux/arm/libc-do-syscall.S:46
46      ../sysdeps/unix/sysv/linux/arm/libc-do-syscall.S: No such file or 
directory.
(gdb) bt full
#0  __libc_do_syscall () at ../sysdeps/unix/sysv/linux/arm/libc-do-syscall.S:46
No locals.
#1  0xb6f5f6f2 in __pthread_cond_wait (cond=0xb6caa194, mutex=0xb6caa09c) at 
pthread_cond_wait.c:177
        _a2tmp = 11
        _a2 = 11
        _nametmp = 240
        _a3tmp = 1
        _a3 = 1
        _a1 = -1228234344
        _v1tmp = -1228234596
        _a4tmp = 0
        _a1tmp = -1228234344
        _a4 = 0
        _v1 = -1228234596
        _name = 240
        __ret = <optimized out>
        futex_val = 1
        buffer = {__routine = 0xb6f5f3e1 <__condvar_cleanup>, __arg = 
0xb6c6ec18, __canceltype = -1225039472, __prev = 0x0}
        cbuffer = {oldtype = 1, cond = 0xb6caa194, mutex = 0xb6caa09c, bc_seq = 
0}
        err = <optimized out>
        pshared = <optimized out>
        pi_flag = 1
        val = <optimized out>
        seq = <optimized out>
#2  0xb6f9cd9a in threadobj_cond_wait (cond=0xb6caa194, lock=0xb6caa09c) at 
../../../xenomai-3/lib/copperplate/threadobj.c:959
        ret = -1228234596
#3  0xb6f9d348 in wait_on_barrier (thobj=0xb6caa094, mask=5) at 
../../../xenomai-3/lib/copperplate/threadobj.c:1210
        __cancel_buf = {__cancel_jmp_buf = {{__cancel_jmp_buf = {-1577945870, 
-1580381599, -1228476860, -1090520124, 0, -1228477336, -1228476512, 
                -1224802304, 0, -1228474732, 0 <repeats 16 times>, 1, 
-1224758200, -1228477152, -1228477004, 0, -1228477120, -1224757760, 
-1228477168, 
                -1224757760, -1224738124, -1, 0, -1225177696, -1224794112, 1, 
-1224794112, 0, 0, 0, 0, -1224793672, -1228477112, -1224793672, 0, -1, 0, 
                -1225027584, 119632, -1225021852, 0, -1228234596, -1090520124, 
0, -1228477040, -1228476512, -1224802304, 0, -1225404053}, 
              __mask_was_saved = 0}}, __pad = {0xb6c6ee80, 0x0, 0x0, 
0xb6c6ed90}}
        __cancel_routine = 0xb6f5e225 <__GI___pthread_mutex_unlock>
        __cancel_arg = 0xb6caa09c
        __not_first_call = 0
        oldstate = 0
        status = 8
#4  0xb6f9d45e in threadobj_wait_start () at 
../../../xenomai-3/lib/copperplate/threadobj.c:1276
        current = 0xb6caa094
        status = -1228234900
#5  0xb6fc2728 in task_prologue_2 (tcb=0xb6ca9f6c) at 
../../../xenomai-3/lib/alchemy/task.c:211
        ret = 0
#6  0xb6fc276e in task_entry (arg=0xb6ca9f6c) at 
../../../xenomai-3/lib/alchemy/task.c:227
        __ret = -1228476896
        tcb = 0xb6ca9f6c
        svc = {cancel_type = 1}
        ret = -1228475296
        __FUNCTION__ = "task_entry"
#7  0xb6f9a288 in thread_trampoline (arg=0xbefffb94) at 
../../../xenomai-3/lib/copperplate/internal.c:251
        cta = 0xbefffb94
        _cta = {stacksize = 0, detachstate = 1, policy = 1, param_ex = 
{__sched_priority = 99, sched_u = {rr = {__sched_rr_quantum = {tv_sec = 
-1225255424, 
                  tv_nsec = 0}}}}, prologue = 0xb6fc26d1 <task_prologue_1>, run 
= 0xb6fc275d <task_entry>, arg = 0xb6ca9f6c, __reserved = {status = -38, 
            warm = {__size = 
"\001\000\000\000\000\000\000\000\060m\376\266\001\000\000", __align = 1}, 
released = 0x10cac}}
        released = {__size = '\000' <repeats 15 times>, __align = 0}
        ret = 0
        __FUNCTION__ = "thread_trampoline"
#8  0xb6f5b424 in start_thread (arg=0x0) at pthread_create.c:335
        pd = 0x0
        unwind_buf = {cancel_jmp_buf = {{jmp_buf = {-1577945366, -1581175653, 
-1228475296, -1090520280, 0, -1228476816, -1228476512, -1224802304, 0, 
                -1228474732, 0 <repeats 54 times>}, mask_was_saved = 0}}, priv 
= {pad = {0x0, 0x0, 0x0, 0x0}, data = {prev = 0x0, cleanup = 0x0, 
              canceltype = 0}}}
        not_first_call = <optimized out>
        pagesize_m1 = <optimized out>
        sp = <optimized out>
        freesize = <optimized out>
        __PRETTY_FUNCTION__ = "start_thread"
#9  0xb6eb243c in ?? () at ../sysdeps/unix/sysv/linux/arm/clone.S:89 from 
/lib/arm-linux-gnueabihf/libc.so.6
No locals.
Backtrace stopped: previous frame identical to this frame (corrupt stack?)

-------------- next part --------------
(gdb) info threads
  Id   Target Id         Frame 
  3    Thread 0xb6c6f460 (LWP 14065) "main_task" __libc_do_syscall () at 
../sysdeps/unix/sysv/linux/arm/libc-do-syscall.S:46
  2    Thread 0xb6ca1460 (LWP 14063) "task-1" 0xb6f61cbe in read () at 
../sysdeps/unix/syscall-template.S:81
* 1    Thread 0xb6ff0000 (LWP 14056) "task-1" __libc_do_syscall () at 
../sysdeps/unix/sysv/linux/arm/libc-do-syscall.S:46
_______________________________________________
Xenomai mailing list
Xenomai@xenomai.org
http://xenomai.org/mailman/listinfo/xenomai

Reply via email to