Process stuck in cobalt_monitor_enter
A message that is not in the archive (sent off-list or not yet received): [email protected]
Hi all,
I'm using Xenomai 3.2.3 on an Atom x84_64 with a 5.4.255 ipipe kernel.
The application I'm running (a complex application, with about 60-70 RT threads) has a simple loop in the main function, something like that:
while (stay_in) {
ret = rt_buffer_read(...); // with 50ms timeout
if(ret) do_something
}The main loop reads the buffer to receive some commands from outside, and when the application gets a SIGINT, the custom signal handler simply does "stay_in = false" breaking the main loop, and then the program closes. During normal running, I can see the timer associated to the rt_buffer_read() timeout get fired and reprogrammed, calling multiple times "cat /proc/xenomai/timer/coreclk" e.g.:
0 291/290 2ms970us - myapp
...
0 609/608 34ms860us - myapp
I also see the thread in "w" state (waiting for a resource with timeout) doing "cat cat /proc/xenomai/sched/threads":
0 16328 rt cobalt 50 21ms279us w myapp
Sometimes, in a non reproducible way (at least for the moment), when the process get the SIGINT it never exits, remaining in this status:
/proc/xenomai/sched/threads:
0 16328 rt cobalt 50 - W flxcore
The state becomed "W" (waiting for a resource without timeout) and in fact the remaining timeout is not present in the row, also in /proc/xenomai/timer/coreclk:
0 291609/291362 - - myapp
(BTW, seems that some timeouts got lost, because scheds are many that shots, and this happens also on other timers in coreclk)
This is the backtrace in gdb:
#0 0x00007f5b15bb05f7 in cobalt_monitor_enter () from /usr/lib/libcobalt.so.2
#1 0x00007f5b15bb0748 in cobalt_monitor_wait () from /usr/lib/libcobalt.so.2
#2 0x00007f5b15bd7497 in syncobj_wait_grant () from /usr/lib/libcopperplate.so.0
#3 0x00007f5b15bea691 in rt_buffer_read_timed () from /usr/lib/libalchemy.so.0
#4 0x000055d2d6e7e689 in rt_buffer_read (timeout=50000000, size=19216, ptr=0x55d2d6e82180 <Request>,
bf=0x55d2d6e82168 <Flxcore_ReqBuf>)
at /usr/include/xenomai/alchemy/buffer.h:129#5 main (argc=<optimized out>, argv=<optimized out>) at myapp.c:421
Do you have any hints about that?
Thanks in advance, best regards
Signature · 1 line
Mauro S.
Quoted 40 lines · Mauro S.
Hi all,
I'm using Xenomai 3.2.3 on an Atom
x84_64with a 5.4.255 ipipe kernel.The application I'm running (a complex application, with about 60-70 RT threads) has a simple loop in the main function, something like that:
while (
stay_in) {
ret = rt_buffer_read(...); // with 50ms timeout if(ret)do_something
}The main loop reads the buffer to receive some commands from outside, and when the application gets a SIGINT, the custom signal handler simply does "
stay_in= false" breaking the main loop, and then the program closes. During normal running, I can see the timer associated to thert_buffer_read()timeout get fired and reprogrammed, calling multiple times "cat/proc/xenomai/timer/coreclk" e.g.:0 291/290 2ms970us - myapp
...
0 609/608 34ms860us - myappI also see the thread in "w" state (waiting for a resource with timeout) doing "cat cat
/proc/xenomai/sched/threads":0 16328 rt cobalt 50 21ms279us w myapp
Sometimes, in a non reproducible way (at least for the moment), when the process get the SIGINT it never exits, remaining in this status:
/proc/xenomai/sched/threads:
0 16328 rt cobalt 50 - W flxcoreThe state becomed "W" (waiting for a resource without timeout) and in fact the remaining timeout is not present in the row, also in
/proc/xenomai/timer/coreclk:0 291609/291362 - - myapp
Quoted 7 lines
(BTW, seems that some timeouts got lost, because scheds are many that shots, and this happens also on other timers in coreclk)
This is the backtrace in gdb:
#0
0x00007f5b15bb05f7incobalt_monitor_enter() from/usr/lib/libcobalt.so.2
This relates to lib/cobalt/internal.c, cobalt_monitor_wait():
/*
* If we got interrupted while trying to re-enter the monitor,
* we need to redo. In the meantime, any pending linux signal
* has been processed.
*/
if (ret == -EINTR)
ret = cobalt_monitor_enter(mon);But the problem is that the lock (monitor) is no free. Someone else holds it, and your interrupted reader does not proceed.
If you dive into mon at this point via gdb, you may find the owner (according to libcobalt's view) when you resolve manually what get_monitor_state() does.
Jan
Quoted 15 lines
#1
0x00007f5b15bb0748incobalt_monitor_wait() from/usr/lib/libcobalt.so.2
#20x00007f5b15bd7497insyncobj_wait_grant() from/usr/lib/libcopperplate.so.0
#30x00007f5b15bea691inrt_buffer_read_timed() from/usr/lib/libalchemy.so.0
#40x000055d2d6e7e689inrt_buffer_read(timeout=50000000, size=19216, ptr=0x55d2d6e82180 <Request>,
bf=0x55d2d6e82168 <Flxcore_ReqBuf>)
at/usr/include/xenomai/alchemy/buffer.h:129
#5 main (argc=<optimized out>, argv=<optimized out>) at myapp.c:421Do you have any hints about that?
Thanks in advance, best regards
Signature · 2 lines
Siemens AG, Technology Linux Expert Center
Quoted 59 lines · Jan Kiszka
Quoted 40 lines · Mauro S.
Hi all,
I'm using Xenomai 3.2.3 on an Atom
x84_64with a 5.4.255 ipipe kernel.The application I'm running (a complex application, with about 60-70 RT threads) has a simple loop in the main function, something like that:
while (
stay_in) {
ret = rt_buffer_read(...); // with 50ms timeout if(ret)do_something
}The main loop reads the buffer to receive some commands from outside, and when the application gets a SIGINT, the custom signal handler simply does "
stay_in= false" breaking the main loop, and then the program closes. During normal running, I can see the timer associated to thert_buffer_read()timeout get fired and reprogrammed, calling multiple times "cat/proc/xenomai/timer/coreclk" e.g.:0 291/290 2ms970us - myapp
...
0 609/608 34ms860us - myappI also see the thread in "w" state (waiting for a resource with timeout) doing "cat cat
/proc/xenomai/sched/threads":0 16328 rt cobalt 50 21ms279us w myapp
Sometimes, in a non reproducible way (at least for the moment), when the process get the SIGINT it never exits, remaining in this status:
/proc/xenomai/sched/threads:
0 16328 rt cobalt 50 - W flxcoreThe state becomed "W" (waiting for a resource without timeout) and in fact the remaining timeout is not present in the row, also in
/proc/xenomai/timer/coreclk:0 291609/291362 - - myapp
Quoted 7 lines
(BTW, seems that some timeouts got lost, because scheds are many that shots, and this happens also on other timers in coreclk)
This is the backtrace in gdb:
#0
0x00007f5b15bb05f7incobalt_monitor_enter() from/usr/lib/libcobalt.so.2This relates to
lib/cobalt/internal.c,cobalt_monitor_wait():/* * If we got interrupted while trying to re-enter the monitor, * we need to redo. In the meantime, any pending linux signal * has been processed. */ if (ret == -EINTR) ret = cobalt_monitor_enter(mon);
Quoted 9 lines
But the problem is that the lock (monitor) is no free. Someone else holds it, and your interrupted reader does not proceed.
If you dive into mon at this point via gdb, you may find the owner (according to libcobalt's view) when you resolve manually what
get_monitor_state()does.Jan
Thank you Jan.
I rebuilt the Xenomai libraries with debugging symbols enabled. But when I try to print the mon variable, I get
(gdb) print mon
$1 = (cobalt_monitor_t *) 0x7f3cb524e62c
(gdb) print *mon
Cannot access memory at address 0x7f3cb524e62c
Seems that the memory address is not in the core dump, but I'm wondering why
TIA, regards
Quoted 16 lines
Quoted 15 lines
#1
0x00007f5b15bb0748incobalt_monitor_wait() from/usr/lib/libcobalt.so.2
#20x00007f5b15bd7497insyncobj_wait_grant() from/usr/lib/libcopperplate.so.0
#30x00007f5b15bea691inrt_buffer_read_timed() from/usr/lib/libalchemy.so.0
#40x000055d2d6e7e689inrt_buffer_read(timeout=50000000, size=19216, ptr=0x55d2d6e82180 <Request>,
bf=0x55d2d6e82168 <Flxcore_ReqBuf>)
at/usr/include/xenomai/alchemy/buffer.h:129
#5 main (argc=<optimized out>, argv=<optimized out>) at myapp.c:421Do you have any hints about that?
Thanks in advance, best regards
Signature · 1 line
Mauro S.
Quoted 76 lines · Mauro S.
Quoted 60 lines · Jan Kiszka
Quoted 41 lines · Mauro S.
Hi all,
I'm using Xenomai 3.2.3 on an Atom
x84_64with a 5.4.255 ipipe kernel.The application I'm running (a complex application, with about 60-70 RT threads) has a simple loop in the main function, something like that:
while (
stay_in) {
ret = rt_buffer_read(...); // with 50ms timeout if(ret)do_something
}The main loop reads the buffer to receive some commands from outside, and when the application gets a SIGINT, the custom signal handler simply does "
stay_in= false" breaking the main loop, and then the program closes.
During normal running, I can see the timer associated to thert_buffer_read()timeout get fired and reprogrammed, calling multiple times "cat/proc/xenomai/timer/coreclk" e.g.:0 291/290 2ms970us - myapp
...
0 609/608 34ms860us - myappI also see the thread in "w" state (waiting for a resource with timeout) doing "cat cat
/proc/xenomai/sched/threads":0 16328 rt cobalt 50 21ms279us w myapp
Sometimes, in a non reproducible way (at least for the moment), when the process get the SIGINT it never exits, remaining in this status:
/proc/xenomai/sched/threads:
0 16328 rt cobalt 50 - W flxcoreThe state becomed "W" (waiting for a resource without timeout) and in fact the remaining timeout is not present in the row, also in
/proc/xenomai/timer/coreclk:0 291609/291362 - - myapp
Quoted 7 lines
(BTW, seems that some timeouts got lost, because scheds are many that shots, and this happens also on other timers in coreclk)
This is the backtrace in gdb:
#0
0x00007f5b15bb05f7incobalt_monitor_enter() from/usr/lib/libcobalt.so.2This relates to
lib/cobalt/internal.c,cobalt_monitor_wait():/*
* If we got interrupted while trying to re-enter the monitor,
* we need to redo. In the meantime, any pending linux signal
* has been processed.
*/
if (ret ==-EINTR)
ret =cobalt_monitor_enter(mon);Quoted 9 lines
But the problem is that the lock (monitor) is no free. Someone else holds it, and your interrupted reader does not proceed.
If you dive into mon at this point via gdb, you may find the owner (according to libcobalt's view) when you resolve manually what
get_monitor_state()does.Jan
Thank you Jan.
I rebuilt the Xenomai libraries with debugging symbols enabled. But when I try to print the mon variable, I get
Quoted 7 lines
(gdb) print mon
$1 = (cobalt_monitor_t*)0x7f3cb524e62c
(gdb) print *mon
Cannot access memory at address0x7f3cb524e62cSeems that the memory address is not in the core dump, but I'm wondering why
Did you create a core dump or tried to attach live the hung process? Maybe the former was incomplete - for whatever reason.
Jan
Signature · 2 lines
Siemens AG, Technology Linux Expert Center
Il giorno mar 21 nov 2023 alle ore 01:06 Jan Kiszka <[email protected]> ha scritto:
Quoted 83 lines · Mauro S.
Quoted 81 lines · Jan Kiszka
Quoted 60 lines · Mauro S.
Quoted 41 lines
Hi all,
I'm using Xenomai 3.2.3 on an Atom
x84_64with a 5.4.255 ipipe kernel.The application I'm running (a complex application, with about 60-70 RT threads) has a simple loop in the main function, something like that:
while (stay_in) { ret = rt_buffer_read(...); // with 50ms timeout if(ret) do_something }The main loop reads the buffer to receive some commands from outside, and when the application gets a SIGINT, the custom signal handler simply does "
stay_in= false" breaking the main loop, and then the program closes.
During normal running, I can see the timer associated to thert_buffer_read()timeout get fired and reprogrammed, calling multiple times "cat/proc/xenomai/timer/coreclk" e.g.:0 291/290 2ms970us - myapp
...
0 609/608 34ms860us - myappI also see the thread in "w" state (waiting for a resource with timeout) doing "cat cat
/proc/xenomai/sched/threads":0 16328 rt cobalt 50 21ms279us w myapp
Sometimes, in a non reproducible way (at least for the moment), when the process get the SIGINT it never exits, remaining in this status:
/proc/xenomai/sched/threads:
0 16328 rt cobalt 50 - W flxcoreThe state becomed "W" (waiting for a resource without timeout) and in fact the remaining timeout is not present in the row, also in
/proc/xenomai/timer/coreclk:0 291609/291362 - - myapp
Quoted 7 lines
(BTW, seems that some timeouts got lost, because scheds are many that shots, and this happens also on other timers in coreclk)
This is the backtrace in gdb:
#0
0x00007f5b15bb05f7incobalt_monitor_enter() from/usr/lib/libcobalt.so.2This relates to
lib/cobalt/internal.c,cobalt_monitor_wait():/* * If we got interrupted while trying to re-enter the monitor, * we need to redo. In the meantime, any pending linux signal * has been processed. */ if (ret == -EINTR) ret = cobalt_monitor_enter(mon);Quoted 9 lines
But the problem is that the lock (monitor) is no free. Someone else holds it, and your interrupted reader does not proceed.
If you dive into mon at this point via gdb, you may find the owner (according to libcobalt's view) when you resolve manually what
get_monitor_state()does.Jan
Thank you Jan.
I rebuilt the Xenomai libraries with debugging symbols enabled. But when I try to print the mon variable, I get
(gdb) print mon
$1 = (cobalt_monitor_t*)0x7f3cb524e62c
(gdb) print *mon
Cannot access memory at address0x7f3cb524e62c
Quoted 7 lines
Quoted 2 lines
Seems that the memory address is not in the core dump, but I'm wondering why
Did you create a core dump or tried to attach live the hung process? Maybe the former was incomplete - for whatever reason.
Jan
Sorry for the delay, but every time I modify something I need to wait for the issue to arise.
I'm working on core dumps. The previous core was incomplete, as you said. I needed to set the coredump_filter kernel cmdline argument to 0x7f to have the complete coredump.
Now, I can see also the values into the Xenomai lib memory space:
(gdb) print *mon
$8 = {state_offset = 1047984, flags = 1, handle = 44} (gdb) print *(struct cobalt_monitor_state *)(cobalt_umm_shared + mon->state_offset)
$9 = {owner = {v = -2147483638}, flags = 0}
(gdb) print cobalt_current
$10 = 10
Could you please tell me how I can figure out who my owner is starting from these values?
I tried to find the owner ID with "thread apply all -q print cobalt_current", but nobody has that owner value.
Thanks in advance, regards
Signature · 1 line
Mauro
Quoted 100 lines · Mauro Salvini
Il giorno mar 21 nov 2023 alle ore 01:06 Jan Kiszka <[email protected]> ha scritto:
Quoted 83 lines · Mauro S.
Quoted 81 lines · Jan Kiszka
Quoted 60 lines · Mauro S.
Quoted 41 lines
Hi all,
I'm using Xenomai 3.2.3 on an Atom
x84_64with a 5.4.255 ipipe kernel.The application I'm running (a complex application, with about 60-70 RT threads) has a simple loop in the main function, something like that:
while (stay_in) { ret = rt_buffer_read(...); // with 50ms timeout if(ret) do_something }The main loop reads the buffer to receive some commands from outside, and when the application gets a SIGINT, the custom signal handler simply does "
stay_in= false" breaking the main loop, and then the program closes.
During normal running, I can see the timer associated to thert_buffer_read()timeout get fired and reprogrammed, calling multiple times "cat/proc/xenomai/timer/coreclk" e.g.:0 291/290 2ms970us - myapp
...
0 609/608 34ms860us - myappI also see the thread in "w" state (waiting for a resource with timeout) doing "cat cat
/proc/xenomai/sched/threads":0 16328 rt cobalt 50 21ms279us w myapp
Sometimes, in a non reproducible way (at least for the moment), when the process get the SIGINT it never exits, remaining in this status:
/proc/xenomai/sched/threads:
0 16328 rt cobalt 50 - W flxcoreThe state becomed "W" (waiting for a resource without timeout) and in fact the remaining timeout is not present in the row, also in
/proc/xenomai/timer/coreclk:0 291609/291362 - - myapp
Quoted 7 lines
(BTW, seems that some timeouts got lost, because scheds are many that shots, and this happens also on other timers in coreclk)
This is the backtrace in gdb:
#0
0x00007f5b15bb05f7incobalt_monitor_enter() from/usr/lib/libcobalt.so.2This relates to
lib/cobalt/internal.c,cobalt_monitor_wait():/* * If we got interrupted while trying to re-enter the monitor, * we need to redo. In the meantime, any pending linux signal * has been processed. */ if (ret == -EINTR) ret = cobalt_monitor_enter(mon);Quoted 9 lines
But the problem is that the lock (monitor) is no free. Someone else holds it, and your interrupted reader does not proceed.
If you dive into mon at this point via gdb, you may find the owner (according to libcobalt's view) when you resolve manually what
get_monitor_state()does.Jan
Thank you Jan.
I rebuilt the Xenomai libraries with debugging symbols enabled. But when I try to print the mon variable, I get
(gdb) print mon
$1 = (cobalt_monitor_t*)0x7f3cb524e62c
(gdb) print *mon
Cannot access memory at address0x7f3cb524e62cQuoted 7 lines
Quoted 2 lines
Seems that the memory address is not in the core dump, but I'm wondering why
Did you create a core dump or tried to attach live the hung process? Maybe the former was incomplete - for whatever reason.
Jan
Sorry for the delay, but every time I modify something I need to wait for the issue to arise.
I'm working on core dumps. The previous core was incomplete, as you said. I needed to set the
coredump_filterkernel cmdline argument to0x7fto have the complete coredump.
Quoted 7 lines
Now, I can see also the values into the Xenomai lib memory space:
(gdb) print *mon
$8 = {state_offset= 1047984, flags = 1, handle = 44} (gdb) print *(structcobalt_monitor_state*)(cobalt_umm_shared +mon->state_offset)
$9 = {owner = {v = -2147483638}, flags = 0}
This is 0x8000000a, XNSYNCH_FLCLAIM | 10 (see also xnhandle_get_id), thus 10 is the owner. Unintended recursion?
Jan
Quoted 10 lines
(gdb) print
cobalt_current
$10 = 10Could you please tell me how I can figure out who my owner is starting from these values?
I tried to find the owner ID with "thread apply all -q printcobalt_current", but nobody has that owner value.Thanks in advance, regards
Signature · 2 lines
Siemens AG, Technology Linux Expert Center
Il giorno mar 28 nov 2023 alle ore 00:15 Jan Kiszka <[email protected]> ha scritto:
Quoted 110 lines · Mauro Salvini
Quoted 100 lines
Il giorno mar 21 nov 2023 alle ore 01:06 Jan Kiszka <[email protected]> ha scritto:
Quoted 83 lines · Mauro S.
Quoted 81 lines · Jan Kiszka
Quoted 60 lines · Mauro S.
Quoted 41 lines
Hi all,
I'm using Xenomai 3.2.3 on an Atom
x84_64with a 5.4.255 ipipe kernel.The application I'm running (a complex application, with about 60-70 RT threads) has a simple loop in the main function, something like that:
while (stay_in) { ret = rt_buffer_read(...); // with 50ms timeout if(ret) do_something }The main loop reads the buffer to receive some commands from outside, and when the application gets a SIGINT, the custom signal handler simply does "
stay_in= false" breaking the main loop, and then the program closes.
During normal running, I can see the timer associated to thert_buffer_read()timeout get fired and reprogrammed, calling multiple times "cat/proc/xenomai/timer/coreclk" e.g.:0 291/290 2ms970us - myapp
...
0 609/608 34ms860us - myappI also see the thread in "w" state (waiting for a resource with timeout) doing "cat cat
/proc/xenomai/sched/threads":0 16328 rt cobalt 50 21ms279us w myapp
Sometimes, in a non reproducible way (at least for the moment), when the process get the SIGINT it never exits, remaining in this status:
/proc/xenomai/sched/threads:
0 16328 rt cobalt 50 - W flxcoreThe state becomed "W" (waiting for a resource without timeout) and in fact the remaining timeout is not present in the row, also in
/proc/xenomai/timer/coreclk:0 291609/291362 - - myapp
Quoted 7 lines
(BTW, seems that some timeouts got lost, because scheds are many that shots, and this happens also on other timers in coreclk)
This is the backtrace in gdb:
#0
0x00007f5b15bb05f7incobalt_monitor_enter() from/usr/lib/libcobalt.so.2This relates to
lib/cobalt/internal.c,cobalt_monitor_wait():/* * If we got interrupted while trying to re-enter the monitor, * we need to redo. In the meantime, any pending linux signal * has been processed. */ if (ret == -EINTR) ret = cobalt_monitor_enter(mon);Quoted 9 lines
But the problem is that the lock (monitor) is no free. Someone else holds it, and your interrupted reader does not proceed.
If you dive into mon at this point via gdb, you may find the owner (according to libcobalt's view) when you resolve manually what
get_monitor_state()does.Jan
Thank you Jan.
I rebuilt the Xenomai libraries with debugging symbols enabled. But when I try to print the mon variable, I get
(gdb) print mon
$1 = (cobalt_monitor_t*)0x7f3cb524e62c
(gdb) print *mon
Cannot access memory at address0x7f3cb524e62cQuoted 7 lines
Quoted 2 lines
Seems that the memory address is not in the core dump, but I'm wondering why
Did you create a core dump or tried to attach live the hung process? Maybe the former was incomplete - for whatever reason.
Jan
Sorry for the delay, but every time I modify something I need to wait for the issue to arise.
I'm working on core dumps. The previous core was incomplete, as you said. I needed to set the
coredump_filterkernel cmdline argument to0x7fto have the complete coredump.Quoted 7 lines
Now, I can see also the values into the Xenomai lib memory space:
(gdb) print *mon
$8 = {state_offset= 1047984, flags = 1, handle = 44} (gdb) print *(structcobalt_monitor_state*)(cobalt_umm_shared +mon->state_offset)
$9 = {owner = {v = -2147483638}, flags = 0}
Quoted 4 lines
This is
0x8000000a,XNSYNCH_FLCLAIM| 10 (see alsoxnhandle_get_id), thus 10 is the owner. Unintended recursion?Jan
Oh, yes, my bad: I have seen the xnhandle_get_id, but not considered that atomic_t is treated as a 2-complement number.
Then, the owner is the caller ID. I'm wondering how it could be a
recursion: the main thread is a simple while(..) rt_buffer_read(..); I will investigate a bit more on it.
Thanks.
Signature · 1 line
Mauro
Il giorno mar 28 nov 2023 alle ore 09:39 Mauro Salvini <[email protected]> ha scritto:
Quoted 118 lines
Il giorno mar 28 nov 2023 alle ore 00:15 Jan Kiszka <[email protected]> ha scritto:
Quoted 110 lines · Mauro Salvini
Quoted 100 lines
Il giorno mar 21 nov 2023 alle ore 01:06 Jan Kiszka <[email protected]> ha scritto:
Quoted 83 lines · Mauro S.
Quoted 81 lines · Jan Kiszka
Quoted 60 lines · Mauro S.
Quoted 41 lines
Hi all,
I'm using Xenomai 3.2.3 on an Atom
x84_64with a 5.4.255 ipipe kernel.The application I'm running (a complex application, with about 60-70 RT threads) has a simple loop in the main function, something like that:
while (stay_in) { ret = rt_buffer_read(...); // with 50ms timeout if(ret) do_something }The main loop reads the buffer to receive some commands from outside, and when the application gets a SIGINT, the custom signal handler simply does "
stay_in= false" breaking the main loop, and then the program closes.
During normal running, I can see the timer associated to thert_buffer_read()timeout get fired and reprogrammed, calling multiple times "cat/proc/xenomai/timer/coreclk" e.g.:0 291/290 2ms970us - myapp
...
0 609/608 34ms860us - myappI also see the thread in "w" state (waiting for a resource with timeout) doing "cat cat
/proc/xenomai/sched/threads":0 16328 rt cobalt 50 21ms279us w myapp
Sometimes, in a non reproducible way (at least for the moment), when the process get the SIGINT it never exits, remaining in this status:
/proc/xenomai/sched/threads:
0 16328 rt cobalt 50 - W flxcoreThe state becomed "W" (waiting for a resource without timeout) and in fact the remaining timeout is not present in the row, also in
/proc/xenomai/timer/coreclk:0 291609/291362 - - myapp
Quoted 7 lines
(BTW, seems that some timeouts got lost, because scheds are many that shots, and this happens also on other timers in coreclk)
This is the backtrace in gdb:
#0
0x00007f5b15bb05f7incobalt_monitor_enter() from/usr/lib/libcobalt.so.2This relates to
lib/cobalt/internal.c,cobalt_monitor_wait():/* * If we got interrupted while trying to re-enter the monitor, * we need to redo. In the meantime, any pending linux signal * has been processed. */ if (ret == -EINTR) ret = cobalt_monitor_enter(mon);Quoted 9 lines
But the problem is that the lock (monitor) is no free. Someone else holds it, and your interrupted reader does not proceed.
If you dive into mon at this point via gdb, you may find the owner (according to libcobalt's view) when you resolve manually what
get_monitor_state()does.Jan
Thank you Jan.
I rebuilt the Xenomai libraries with debugging symbols enabled. But when I try to print the mon variable, I get
(gdb) print mon
$1 = (cobalt_monitor_t*)0x7f3cb524e62c
(gdb) print *mon
Cannot access memory at address0x7f3cb524e62cQuoted 7 lines
Quoted 2 lines
Seems that the memory address is not in the core dump, but I'm wondering why
Did you create a core dump or tried to attach live the hung process? Maybe the former was incomplete - for whatever reason.
Jan
Sorry for the delay, but every time I modify something I need to wait for the issue to arise.
I'm working on core dumps. The previous core was incomplete, as you said. I needed to set the
coredump_filterkernel cmdline argument to0x7fto have the complete coredump.Quoted 7 lines
Now, I can see also the values into the Xenomai lib memory space:
(gdb) print *mon
$8 = {state_offset= 1047984, flags = 1, handle = 44} (gdb) print *(structcobalt_monitor_state*)(cobalt_umm_shared +mon->state_offset)
$9 = {owner = {v = -2147483638}, flags = 0}Quoted 4 lines
This is
0x8000000a,XNSYNCH_FLCLAIM| 10 (see alsoxnhandle_get_id), thus 10 is the owner. Unintended recursion?Jan
Quoted 7 lines
Oh, yes, my bad: I have seen the
xnhandle_get_id, but not considered thatatomic_tis treated as a 2-complement number.
Then, the owner is the caller ID. I'm wondering how it could be a
recursion: the main thread is a simple while(..)rt_buffer_read(..); I will investigate a bit more on it.Thanks.
Maybe I found something: in the backtrace of every core (cores are generated with SIGABRT) the first two frames are referring both to cobalt_monitor_enter(): frame #0 is at the source line where the program is stuck (syscall), frame #1 is at the cobalt_monitor_enter() function declaration source line:
Program terminated with signal SIGABRT, Aborted.
#0 cobalt_monitor_enter (mon=0x7f0d7583862c)
at ../../../../../../../../../linux+xeno-src/xenomai-3.2-new/lib/cobalt/internal.c:218
[Current thread is 1 (Thread 0x7f0d7628c400 (LWP 2751))]
#0 cobalt_monitor_enter (mon=0x7f0d7583862c)
at ../../../../../../../../../linux+xeno-src/xenomai-3.2-new/lib/cobalt/internal.c:218
#1 cobalt_monitor_enter (mon=0x7f0d7583862c)
at ../../../../../../../../../linux+xeno-src/xenomai-3.2-new/lib/cobalt/internal.c:186
#2 0x00007f0d76612748 in cobalt_monitor_wait
(mon=mon@entry=0x7f0d7583862c, event=event@entry=0,
ts=ts@entry=0x7ffe7d7380f0)
at ../../../../../../../../../linux+xeno-src/xenomai-3.2-new/lib/cobalt/internal.c:276
#3 0x00007f0d76639497 in monitor_wait_grant (current=0x7f0d75842bc8,
timeout=0x7ffe7d7380f0, sobj=0x7f0d758385f0)
at ../../../../../../../../../linux+xeno-src/xenomai-3.2-new/lib/copperplate/syncobj.c:553
#4 syncobj_wait_grant (sobj=sobj@entry=0x7f0d758385f0,
timeout=timeout@entry=0x7ffe7d7380f0, syns=syns@entry=0x7ffe7d738074)
at ../../../../../../../../../linux+xeno-src/xenomai-3.2-new/lib/copperplate/syncobj.c:553
#5 0x00007f0d7664c691 in rt_buffer_read_timed (bf=<optimized out>,
ptr=<optimized out>, size=<optimized out>,
abs_timeout=0x7ffe7d7380f0) at
../../../../../../../../../linux+xeno-src/xenomai-3.2-new/lib/alchemy/buffer.c:555
#6 0x000055b104840601 in rt_buffer_read (timeout=50000000,
size=19216, ptr=0x55b104844180 <Request>,
bf=0x55b104844168 <ReqBuf>)
at /opt/sdk/3.1.22-2.0/sysroots/corei7-64-poky-linux/usr/include/xenomai/alchemy/buffer.h:129#7 main (argc=<optimized out>, argv=<optimized out>) at main.c:410
Could that be a clue?
TIA
Signature · 1 line
Mauro
Quoted 160 lines · Mauro Salvini
Il giorno mar 28 nov 2023 alle ore 09:39 Mauro Salvini <[email protected]> ha scritto:
Quoted 118 lines
Il giorno mar 28 nov 2023 alle ore 00:15 Jan Kiszka <[email protected]> ha scritto:
Quoted 110 lines · Mauro Salvini
Quoted 100 lines
Il giorno mar 21 nov 2023 alle ore 01:06 Jan Kiszka <[email protected]> ha scritto:
Quoted 83 lines · Mauro S.
Quoted 81 lines · Jan Kiszka
Quoted 60 lines · Mauro S.
Quoted 41 lines
Hi all,
I'm using Xenomai 3.2.3 on an Atom
x84_64with a 5.4.255 ipipe kernel.The application I'm running (a complex application, with about 60-70 RT threads) has a simple loop in the main function, something like that:
while (stay_in) { ret = rt_buffer_read(...); // with 50ms timeout if(ret) do_something }The main loop reads the buffer to receive some commands from outside, and when the application gets a SIGINT, the custom signal handler simply does "
stay_in= false" breaking the main loop, and then the program closes.
During normal running, I can see the timer associated to thert_buffer_read()timeout get fired and reprogrammed, calling multiple times "cat/proc/xenomai/timer/coreclk" e.g.:0 291/290 2ms970us - myapp
...
0 609/608 34ms860us - myappI also see the thread in "w" state (waiting for a resource with timeout) doing "cat cat
/proc/xenomai/sched/threads":0 16328 rt cobalt 50 21ms279us w myapp
Sometimes, in a non reproducible way (at least for the moment), when the process get the SIGINT it never exits, remaining in this status:
/proc/xenomai/sched/threads:
0 16328 rt cobalt 50 - W flxcoreThe state becomed "W" (waiting for a resource without timeout) and in fact the remaining timeout is not present in the row, also in
/proc/xenomai/timer/coreclk:0 291609/291362 - - myapp
Quoted 7 lines
(BTW, seems that some timeouts got lost, because scheds are many that shots, and this happens also on other timers in coreclk)
This is the backtrace in gdb:
#0
0x00007f5b15bb05f7incobalt_monitor_enter() from/usr/lib/libcobalt.so.2This relates to
lib/cobalt/internal.c,cobalt_monitor_wait():/* * If we got interrupted while trying to re-enter the monitor, * we need to redo. In the meantime, any pending linux signal * has been processed. */ if (ret == -EINTR) ret = cobalt_monitor_enter(mon);Quoted 9 lines
But the problem is that the lock (monitor) is no free. Someone else holds it, and your interrupted reader does not proceed.
If you dive into mon at this point via gdb, you may find the owner (according to libcobalt's view) when you resolve manually what
get_monitor_state()does.Jan
Thank you Jan.
I rebuilt the Xenomai libraries with debugging symbols enabled. But when I try to print the mon variable, I get
(gdb) print mon
$1 = (cobalt_monitor_t*)0x7f3cb524e62c
(gdb) print *mon
Cannot access memory at address0x7f3cb524e62cQuoted 7 lines
Quoted 2 lines
Seems that the memory address is not in the core dump, but I'm wondering why
Did you create a core dump or tried to attach live the hung process? Maybe the former was incomplete - for whatever reason.
Jan
Sorry for the delay, but every time I modify something I need to wait for the issue to arise.
I'm working on core dumps. The previous core was incomplete, as you said. I needed to set the
coredump_filterkernel cmdline argument to0x7fto have the complete coredump.Quoted 7 lines
Now, I can see also the values into the Xenomai lib memory space:
(gdb) print *mon
$8 = {state_offset= 1047984, flags = 1, handle = 44} (gdb) print *(structcobalt_monitor_state*)(cobalt_umm_shared +mon->state_offset)
$9 = {owner = {v = -2147483638}, flags = 0}Quoted 4 lines
This is
0x8000000a,XNSYNCH_FLCLAIM| 10 (see alsoxnhandle_get_id), thus 10 is the owner. Unintended recursion?Jan
Quoted 7 lines
Oh, yes, my bad: I have seen the
xnhandle_get_id, but not considered thatatomic_tis treated as a 2-complement number.
Then, the owner is the caller ID. I'm wondering how it could be a
recursion: the main thread is a simple while(..)rt_buffer_read(..); I will investigate a bit more on it.Thanks.
Maybe I found something: in the backtrace of every core (cores are generated with SIGABRT) the first two frames are referring both to
cobalt_monitor_enter(): frame #0 is at the source line where the program is stuck (syscall), frame #1 is at thecobalt_monitor_enter()function declaration source line:Program terminated with signal SIGABRT, Aborted.
#0cobalt_monitor_enter(mon=0x7f0d7583862c)at ../../../../../../../../../linux+xeno-src/xenomai-3.2-new/lib/cobalt/internal.c:218 [Current thread is 1 (Thread 0x7f0d7628c400 (LWP 2751))] #0 cobalt_monitor_enter (mon=0x7f0d7583862c) at ../../../../../../../../../linux+xeno-src/xenomai-3.2-new/lib/cobalt/internal.c:218 #1 cobalt_monitor_enter (mon=0x7f0d7583862c) at ../../../../../../../../../linux+xeno-src/xenomai-3.2-new/lib/cobalt/internal.c:186 #2 0x00007f0d76612748 in cobalt_monitor_wait (mon=mon@entry=0x7f0d7583862c, event=event@entry=0, ts=ts@entry=0x7ffe7d7380f0) at ../../../../../../../../../linux+xeno-src/xenomai-3.2-new/lib/cobalt/internal.c:276 #3 0x00007f0d76639497 in monitor_wait_grant (current=0x7f0d75842bc8, timeout=0x7ffe7d7380f0, sobj=0x7f0d758385f0) at ../../../../../../../../../linux+xeno-src/xenomai-3.2-new/lib/copperplate/syncobj.c:553 #4 syncobj_wait_grant (sobj=sobj@entry=0x7f0d758385f0, timeout=timeout@entry=0x7ffe7d7380f0, syns=syns@entry=0x7ffe7d738074) at ../../../../../../../../../linux+xeno-src/xenomai-3.2-new/lib/copperplate/syncobj.c:553 #5 0x00007f0d7664c691 in rt_buffer_read_timed (bf=<optimized out>, ptr=<optimized out>, size=<optimized out>, abs_timeout=0x7ffe7d7380f0) at ../../../../../../../../../linux+xeno-src/xenomai-3.2-new/lib/alchemy/buffer.c:555 #6 0x000055b104840601 in rt_buffer_read (timeout=50000000, size=19216, ptr=0x55b104844180 <Request>, bf=0x55b104844168 <ReqBuf>) at /opt/sdk/3.1.22-2.0/sysroots/corei7-64-poky-linux/usr/include/xenomai/alchemy/buffer.h:129
Quoted 3 lines
#7 main (argc=<optimized out>, argv=<optimized out>) at main.c:410
Could that be a clue?
That alone does not tell a story. We know now that - at least according to the monitor data structure - thread with ID 10 is holding the lock. If the very same thread is trying to re-aquire it, this will cause a deadlock. And if that is true, we need to find out, how that could have happened. I have no idea about that so far.
Would you be able to factor out a simpler, sharable reproduction case?
It also looks like as if the reader is receiving some signal while blocking. Is that expected based on your workload? It may destroy timing constraints, even without the deadlock.
Jan
Signature · 2 lines
Siemens AG, Technology Linux Expert Center
Quoted 171 lines · Jan Kiszka
Quoted 160 lines · Mauro Salvini
Il giorno mar 28 nov 2023 alle ore 09:39 Mauro Salvini <[email protected]> ha scritto:
Quoted 118 lines
Il giorno mar 28 nov 2023 alle ore 00:15 Jan Kiszka <[email protected]> ha scritto:
Quoted 110 lines · Mauro Salvini
Quoted 100 lines
Il giorno mar 21 nov 2023 alle ore 01:06 Jan Kiszka <[email protected]> ha scritto:
Quoted 83 lines · Mauro S.
Quoted 81 lines · Jan Kiszka
Quoted 60 lines · Mauro S.
Quoted 41 lines
Hi all,
I'm using Xenomai 3.2.3 on an Atom
x84_64with a 5.4.255 ipipe kernel.The application I'm running (a complex application, with about 60-70 RT threads) has a simple loop in the main function, something like that:
while (stay_in) { ret = rt_buffer_read(...); // with 50ms timeout if(ret) do_something }The main loop reads the buffer to receive some commands from outside, and when the application gets a SIGINT, the custom signal handler simply does "
stay_in= false" breaking the main loop, and then the program closes.
During normal running, I can see the timer associated to thert_buffer_read()timeout get fired and reprogrammed, calling multiple times "cat/proc/xenomai/timer/coreclk" e.g.:0 291/290 2ms970us - myapp
...
0 609/608 34ms860us - myappI also see the thread in "w" state (waiting for a resource with timeout) doing "cat cat
/proc/xenomai/sched/threads":0 16328 rt cobalt 50 21ms279us w myapp
Sometimes, in a non reproducible way (at least for the moment), when the process get the SIGINT it never exits, remaining in this status:
/proc/xenomai/sched/threads:
0 16328 rt cobalt 50 - W flxcoreThe state becomed "W" (waiting for a resource without timeout) and in fact the remaining timeout is not present in the row, also in
/proc/xenomai/timer/coreclk:0 291609/291362 - - myapp
Quoted 7 lines
(BTW, seems that some timeouts got lost, because scheds are many that shots, and this happens also on other timers in coreclk)
This is the backtrace in gdb:
#0
0x00007f5b15bb05f7incobalt_monitor_enter() from/usr/lib/libcobalt.so.2This relates to
lib/cobalt/internal.c,cobalt_monitor_wait():/* * If we got interrupted while trying to re-enter the monitor, * we need to redo. In the meantime, any pending linux signal * has been processed. */ if (ret == -EINTR) ret = cobalt_monitor_enter(mon);Quoted 9 lines
But the problem is that the lock (monitor) is no free. Someone else holds it, and your interrupted reader does not proceed.
If you dive into mon at this point via gdb, you may find the owner (according to libcobalt's view) when you resolve manually what
get_monitor_state()does.Jan
Thank you Jan.
I rebuilt the Xenomai libraries with debugging symbols enabled. But when I try to print the mon variable, I get
(gdb) print mon
$1 = (cobalt_monitor_t*)0x7f3cb524e62c
(gdb) print *mon
Cannot access memory at address0x7f3cb524e62cQuoted 7 lines
Quoted 2 lines
Seems that the memory address is not in the core dump, but I'm wondering why
Did you create a core dump or tried to attach live the hung process? Maybe the former was incomplete - for whatever reason.
Jan
Sorry for the delay, but every time I modify something I need to wait for the issue to arise.
I'm working on core dumps. The previous core was incomplete, as you said. I needed to set the
coredump_filterkernel cmdline argument to0x7fto have the complete coredump.Quoted 7 lines
Now, I can see also the values into the Xenomai lib memory space:
(gdb) print *mon
$8 = {state_offset= 1047984, flags = 1, handle = 44} (gdb) print *(structcobalt_monitor_state*)(cobalt_umm_shared +mon->state_offset)
$9 = {owner = {v = -2147483638}, flags = 0}Quoted 4 lines
This is
0x8000000a,XNSYNCH_FLCLAIM| 10 (see alsoxnhandle_get_id), thus 10 is the owner. Unintended recursion?Jan
Quoted 7 lines
Oh, yes, my bad: I have seen the
xnhandle_get_id, but not considered thatatomic_tis treated as a 2-complement number.
Then, the owner is the caller ID. I'm wondering how it could be a
recursion: the main thread is a simple while(..)rt_buffer_read(..); I will investigate a bit more on it.Thanks.
Maybe I found something: in the backtrace of every core (cores are generated with SIGABRT) the first two frames are referring both to
cobalt_monitor_enter(): frame #0 is at the source line where the program is stuck (syscall), frame #1 is at thecobalt_monitor_enter()function declaration source line:Program terminated with signal SIGABRT, Aborted.
#0cobalt_monitor_enter(mon=0x7f0d7583862c)at ../../../../../../../../../linux+xeno-src/xenomai-3.2-new/lib/cobalt/internal.c:218 [Current thread is 1 (Thread 0x7f0d7628c400 (LWP 2751))] #0 cobalt_monitor_enter (mon=0x7f0d7583862c) at ../../../../../../../../../linux+xeno-src/xenomai-3.2-new/lib/cobalt/internal.c:218 #1 cobalt_monitor_enter (mon=0x7f0d7583862c) at ../../../../../../../../../linux+xeno-src/xenomai-3.2-new/lib/cobalt/internal.c:186 #2 0x00007f0d76612748 in cobalt_monitor_wait (mon=mon@entry=0x7f0d7583862c, event=event@entry=0, ts=ts@entry=0x7ffe7d7380f0) at ../../../../../../../../../linux+xeno-src/xenomai-3.2-new/lib/cobalt/internal.c:276 #3 0x00007f0d76639497 in monitor_wait_grant (current=0x7f0d75842bc8, timeout=0x7ffe7d7380f0, sobj=0x7f0d758385f0) at ../../../../../../../../../linux+xeno-src/xenomai-3.2-new/lib/copperplate/syncobj.c:553 #4 syncobj_wait_grant (sobj=sobj@entry=0x7f0d758385f0, timeout=timeout@entry=0x7ffe7d7380f0, syns=syns@entry=0x7ffe7d738074) at ../../../../../../../../../linux+xeno-src/xenomai-3.2-new/lib/copperplate/syncobj.c:553 #5 0x00007f0d7664c691 in rt_buffer_read_timed (bf=<optimized out>, ptr=<optimized out>, size=<optimized out>, abs_timeout=0x7ffe7d7380f0) at ../../../../../../../../../linux+xeno-src/xenomai-3.2-new/lib/alchemy/buffer.c:555 #6 0x000055b104840601 in rt_buffer_read (timeout=50000000, size=19216, ptr=0x55b104844180 <Request>, bf=0x55b104844168 <ReqBuf>) at /opt/sdk/3.1.22-2.0/sysroots/corei7-64-poky-linux/usr/include/xenomai/alchemy/buffer.h:129Quoted 3 lines
#7 main (argc=<optimized out>, argv=<optimized out>) at main.c:410
Could that be a clue?
That alone does not tell a story. We know now that - at least according to the monitor data structure - thread with ID 10 is holding the lock. If the very same thread is trying to re-aquire it, this will cause a deadlock. And if that is true, we need to find out, how that could have happened. I have no idea about that so far.
Quoted 4 lines
Would you be able to factor out a simpler, sharable reproduction case? > It also looks like as if the reader is receiving some signal while blocking. Is that expected based on your workload? It may destroy timing constraints, even without the deadlock.
Yes, I think it is expected, the workflow is the following:
- a daemon starts the program
- upon an external request, the daemon terminates the program sending to it a SIGTERM. I think this is the signal received while blocking
- when the SIGTERM is received (a sighandler is installed by the main thread), the main loop (where the rt_buffer_read() is) breaks, and the program performs some cleanups and then exits
- in 95% cases, the program terminates well. In the remaining 5% cases the program hangs on rt_buffer_read()
- if the daemon detects that the program is not terminated after 30 seconds from the SIGTERM sending, the daemon send a SIGABRT to generate the core we are analyzing
I'm trying to reproduce the issue with simpler programs, but without success for the moment.
I will update you (hope with better news).
Thanks
Signature · 1 line
Mauro S.
Quoted 205 lines · Mauro S.
Quoted 197 lines · Jan Kiszka
Quoted 188 lines · Mauro Salvini
Il giorno mar 28 nov 2023 alle ore 09:39 Mauro Salvini <[email protected]> ha scritto:
Quoted 137 lines
Il giorno mar 28 nov 2023 alle ore 00:15 Jan Kiszka <[email protected]> ha scritto:
Quoted 129 lines · Mauro Salvini
Quoted 119 lines
Il giorno mar 21 nov 2023 alle ore 01:06 Jan Kiszka <[email protected]> ha scritto:
Quoted 99 lines · Mauro S.
Quoted 97 lines · Jan Kiszka
Quoted 79 lines · Mauro S.
Quoted 53 lines
Hi all,
I'm using Xenomai 3.2.3 on an Atom
x84_64with a 5.4.255 ipipe kernel.The application I'm running (a complex application, with about 60-70 RT
threads) has a simple loop in the main function, something like that:while (
stay_in) {
ret = rt_buffer_read(...); // with 50ms timeout if(ret)do_something
}The main loop reads the buffer to receive some commands from outside,
and when the application gets a SIGINT, the custom signal handler simply
does "stay_in= false" breaking the main loop, and then the program
closes.
During normal running, I can see the timer associated to thert_buffer_read()timeout get fired and reprogrammed, calling multiple
times "cat/proc/xenomai/timer/coreclk" e.g.:0 291/290 2ms970us - myapp
...
0 609/608 34ms860us - myappI also see the thread in "w" state (waiting for a resource with timeout)
doing "cat cat/proc/xenomai/sched/threads":0 16328 rt cobalt 50 21ms279us
w myappSometimes, in a non reproducible way (at least for the moment), when the
process get the SIGINT it never exits, remaining in this status:
/proc/xenomai/sched/threads:
0 16328 rt cobalt 50 - W flxcoreThe state becomed "W" (waiting for a resource without timeout) and in
fact the remaining timeout is not present in the row, also in/proc/xenomai/timer/coreclk:0 291609/291362 - - myapp
Quoted 8 lines
(BTW, seems that some timeouts got lost, because scheds are many that
shots, and this happens also on other timers in coreclk)This is the backtrace in gdb:
#0
0x00007f5b15bb05f7incobalt_monitor_enter() from/usr/lib/libcobalt.so.2This relates to
lib/cobalt/internal.c,cobalt_monitor_wait():/*
* If we got interrupted while trying to re-enter the monitor,
* we need to redo. In the meantime, any pending linux signal
* has been processed.
*/
if (ret ==-EINTR)
ret =cobalt_monitor_enter(mon);But the problem is that the lock (monitor) is no free. Someone else
holds it, and your interrupted reader does not proceed.Quoted 6 lines
If you dive into mon at this point via gdb, you may find the owner (according to libcobalt's view) when you resolve manually what
get_monitor_state()does.Jan
Thank you Jan.
I rebuilt the Xenomai libraries with debugging symbols enabled. But when I try to print the mon variable, I get
(gdb) print mon
$1 = (cobalt_monitor_t*)0x7f3cb524e62c
(gdb) print *mon
Cannot access memory at address0x7f3cb524e62cQuoted 8 lines
Quoted 3 lines
Seems that the memory address is not in the core dump, but I'm wondering
whyDid you create a core dump or tried to attach live the hung process? Maybe the former was incomplete - for whatever reason.
Jan
Sorry for the delay, but every time I modify something I need to wait for the issue to arise.
I'm working on core dumps. The previous core was incomplete, as you said.
I needed to set thecoredump_filterkernel cmdline argument to0x7fto
have the complete coredump.Quoted 7 lines
Now, I can see also the values into the Xenomai lib memory space:
(gdb) print *mon
$8 = {state_offset= 1047984, flags = 1, handle = 44} (gdb) print *(structcobalt_monitor_state*)(cobalt_umm_shared +mon->state_offset)
$9 = {owner = {v = -2147483638}, flags = 0}Quoted 4 lines
This is
0x8000000a,XNSYNCH_FLCLAIM| 10 (see alsoxnhandle_get_id), thus 10 is the owner. Unintended recursion?Jan
Quoted 7 lines
Oh, yes, my bad: I have seen the
xnhandle_get_id, but not considered thatatomic_tis treated as a 2-complement number.
Then, the owner is the caller ID. I'm wondering how it could be a
recursion: the main thread is a simple while(..)rt_buffer_read(..); I will investigate a bit more on it.Thanks.
Maybe I found something: in the backtrace of every core (cores are generated with SIGABRT) the first two frames are referring both to
cobalt_monitor_enter(): frame #0 is at the source line where the program is stuck (syscall), frame #1 is at thecobalt_monitor_enter()function declaration source line:Program terminated with signal SIGABRT, Aborted.
#0cobalt_monitor_enter(mon=0x7f0d7583862c)
at../../../../../../../../../linux+xeno-src/xenomai-3.2-new/lib/cobalt/internal.c:218[Current thread is 1 (Thread0x7f0d7628c400(LWP 2751))]
#0cobalt_monitor_enter(mon=0x7f0d7583862c)
at../../../../../../../../../linux+xeno-src/xenomai-3.2-new/lib/cobalt/internal.c:218#1cobalt_monitor_enter(mon=0x7f0d7583862c)
at../../../../../../../../../linux+xeno-src/xenomai-3.2-new/lib/cobalt/internal.c:186#20x00007f0d76612748incobalt_monitor_wait(mon=mon@entry=0x7f0d7583862c, event=event@entry=0, ts=ts@entry=0x7ffe7d7380f0)
at../../../../../../../../../linux+xeno-src/xenomai-3.2-new/lib/cobalt/internal.c:276#30x00007f0d76639497inmonitor_wait_grant(current=0x7f0d75842bc8, timeout=0x7ffe7d7380f0, sobj=0x7f0d758385f0)
at../../../../../../../../../linux+xeno-src/xenomai-3.2-new/lib/copperplate/syncobj.c:553#4syncobj_wait_grant(sobj=sobj@entry=0x7f0d758385f0, timeout=timeout@entry=0x7ffe7d7380f0, syns=syns@entry=0x7ffe7d738074)
at../../../../../../../../../linux+xeno-src/xenomai-3.2-new/lib/copperplate/syncobj.c:553#50x00007f0d7664c691inrt_buffer_read_timed(bf=<optimized out>, ptr=<optimized out>, size=<optimized out>,
abs_timeout=0x7ffe7d7380f0) at../../../../../../../../../linux+xeno-src/xenomai-3.2-new/lib/alchemy/buffer.c:555#60x000055b104840601inrt_buffer_read(timeout=50000000,
size=19216, ptr=0x55b104844180 <Request>,
bf=0x55b104844168 <ReqBuf>)
at/opt/sdk/3.1.22-2.0/sysroots/corei7-64-poky-linux/usr/include/xenomai/alchemy/buffer.h:129#7 main (argc=<optimized out>, argv=<optimized out>) at main.c:410Quoted 1 line
Could that be a clue?
That alone does not tell a story. We know now that - at least according to the monitor data structure - thread with ID 10 is holding the lock. If the very same thread is trying to re-aquire it, this will cause a deadlock. And if that is true, we need to find out, how that could have happened. I have no idea about that so far.
Quoted 4 lines
Would you be able to factor out a simpler, sharable reproduction case? > It also looks like as if the reader is receiving some signal while blocking. Is that expected based on your workload? It may destroy timing constraints, even without the deadlock.
Yes, I think it is expected, the workflow is the following:
Quoted 12 lines
- a daemon starts the program
- upon an external request, the daemon terminates the program sending to it a SIGTERM. I think this is the signal received while blocking
- when the SIGTERM is received (a sighandler is installed by the main thread), the main loop (where thert_buffer_read()is) breaks, and the program performs some cleanups and then exits
- in 95% cases, the program terminates well. In the remaining 5% cases the program hangs onrt_buffer_read()
- if the daemon detects that the program is not terminated after 30 seconds from the SIGTERM sending, the daemon send a SIGABRT to generate the core we are analyzing
OK, makes sense. Based on this description, we may indeed have an issue around Linux signal processing here. Now it's about making it reproducible.
Quoted 5 lines
I'm trying to reproduce the issue with simpler programs, but without success for the moment.
I will update you (hope with better news).
Thanks in advance!
Jan
Signature · 2 lines
Siemens AG, Technology Linux Expert Center
Quoted 222 lines · Jan Kiszka
Quoted 205 lines · Mauro S.
Quoted 197 lines · Jan Kiszka
Quoted 188 lines · Mauro Salvini
Il giorno mar 28 nov 2023 alle ore 09:39 Mauro Salvini <[email protected]> ha scritto:
Quoted 137 lines
Il giorno mar 28 nov 2023 alle ore 00:15 Jan Kiszka <[email protected]> ha scritto:
Quoted 129 lines · Mauro Salvini
Quoted 119 lines
Il giorno mar 21 nov 2023 alle ore 01:06 Jan Kiszka <[email protected]> ha scritto:
Quoted 99 lines · Mauro S.
Quoted 97 lines · Jan Kiszka
Quoted 79 lines · Mauro S.
Quoted 53 lines
Hi all,
I'm using Xenomai 3.2.3 on an Atom
x84_64with a 5.4.255 ipipe kernel.The application I'm running (a complex application, with about 60-70 RT
threads) has a simple loop in the main function, something like that:while (
stay_in) {
ret = rt_buffer_read(...); // with 50ms timeout if(ret)do_something
}The main loop reads the buffer to receive some commands from outside,
and when the application gets a SIGINT, the custom signal handler simply
does "stay_in= false" breaking the main loop, and then the program
closes.
During normal running, I can see the timer associated to thert_buffer_read()timeout get fired and reprogrammed, calling multiple
times "cat/proc/xenomai/timer/coreclk" e.g.:0 291/290 2ms970us - myapp
...
0 609/608 34ms860us - myappI also see the thread in "w" state (waiting for a resource with timeout)
doing "cat cat/proc/xenomai/sched/threads":0 16328 rt cobalt 50 21ms279us
w myappSometimes, in a non reproducible way (at least for the moment), when the
process get the SIGINT it never exits, remaining in this status:
/proc/xenomai/sched/threads:
0 16328 rt cobalt 50 - W
flxcoreThe state becomed "W" (waiting for a resource without timeout) and in
fact the remaining timeout is not present in the row, also in/proc/xenomai/timer/coreclk:0 291609/291362 - - myapp
Quoted 8 lines
(BTW, seems that some timeouts got lost, because scheds are many that
shots, and this happens also on other timers in coreclk)This is the backtrace in gdb:
#0
0x00007f5b15bb05f7incobalt_monitor_enter() from/usr/lib/libcobalt.so.2This relates to
lib/cobalt/internal.c,cobalt_monitor_wait():/*
* If we got interrupted while trying to re-enter the
monitor,
* we need to redo. In the meantime, any pending
linux signal
* has been processed.
*/
if (ret ==-EINTR)
ret =cobalt_monitor_enter(mon);But the problem is that the lock (monitor) is no free. Someone else
holds it, and your interrupted reader does not proceed.Quoted 6 lines
If you dive into mon at this point via gdb, you may find the owner (according to libcobalt's view) when you resolve manually what
get_monitor_state()does.Jan
Thank you Jan.
I rebuilt the Xenomai libraries with debugging symbols enabled. But when I try to print the mon variable, I get
(gdb) print mon
$1 = (cobalt_monitor_t*)0x7f3cb524e62c
(gdb) print *mon
Cannot access memory at address0x7f3cb524e62cQuoted 8 lines
Quoted 3 lines
Seems that the memory address is not in the core dump, but I'm wondering
whyDid you create a core dump or tried to attach live the hung process? Maybe the former was incomplete - for whatever reason.
Jan
Sorry for the delay, but every time I modify something I need to wait for the issue to arise.
I'm working on core dumps. The previous core was incomplete, as you said.
I needed to set thecoredump_filterkernel cmdline argument to0x7fto
have the complete coredump.Quoted 7 lines
Now, I can see also the values into the Xenomai lib memory space:
(gdb) print *mon
$8 = {state_offset= 1047984, flags = 1, handle = 44} (gdb) print *(structcobalt_monitor_state*)(cobalt_umm_shared +mon->state_offset)
$9 = {owner = {v = -2147483638}, flags = 0}Quoted 4 lines
This is
0x8000000a,XNSYNCH_FLCLAIM| 10 (see alsoxnhandle_get_id), thus 10 is the owner. Unintended recursion?Jan
Quoted 7 lines
Oh, yes, my bad: I have seen the
xnhandle_get_id, but not considered thatatomic_tis treated as a 2-complement number.
Then, the owner is the caller ID. I'm wondering how it could be a
recursion: the main thread is a simple while(..)rt_buffer_read(..); I will investigate a bit more on it.Thanks.
Maybe I found something: in the backtrace of every core (cores are generated with SIGABRT) the first two frames are referring both to
cobalt_monitor_enter(): frame #0 is at the source line where the program is stuck (syscall), frame #1 is at thecobalt_monitor_enter()function declaration source line:Program terminated with signal SIGABRT, Aborted.
#0cobalt_monitor_enter(mon=0x7f0d7583862c)
at../../../../../../../../../linux+xeno-src/xenomai-3.2-new/lib/cobalt/internal.c:218[Current thread is 1 (Thread0x7f0d7628c400(LWP 2751))]
#0cobalt_monitor_enter(mon=0x7f0d7583862c)
at../../../../../../../../../linux+xeno-src/xenomai-3.2-new/lib/cobalt/internal.c:218#1cobalt_monitor_enter(mon=0x7f0d7583862c)
at../../../../../../../../../linux+xeno-src/xenomai-3.2-new/lib/cobalt/internal.c:186#20x00007f0d76612748incobalt_monitor_wait(mon=mon@entry=0x7f0d7583862c, event=event@entry=0, ts=ts@entry=0x7ffe7d7380f0)
at../../../../../../../../../linux+xeno-src/xenomai-3.2-new/lib/cobalt/internal.c:276#30x00007f0d76639497inmonitor_wait_grant(current=0x7f0d75842bc8, timeout=0x7ffe7d7380f0, sobj=0x7f0d758385f0)
at../../../../../../../../../linux+xeno-src/xenomai-3.2-new/lib/copperplate/syncobj.c:553#4syncobj_wait_grant(sobj=sobj@entry=0x7f0d758385f0, timeout=timeout@entry=0x7ffe7d7380f0, syns=syns@entry=0x7ffe7d738074)
at../../../../../../../../../linux+xeno-src/xenomai-3.2-new/lib/copperplate/syncobj.c:553#50x00007f0d7664c691inrt_buffer_read_timed(bf=<optimized out>, ptr=<optimized out>, size=<optimized out>,
abs_timeout=0x7ffe7d7380f0) at../../../../../../../../../linux+xeno-src/xenomai-3.2-new/lib/alchemy/buffer.c:555#60x000055b104840601inrt_buffer_read(timeout=50000000,
size=19216, ptr=0x55b104844180 <Request>,
bf=0x55b104844168 <ReqBuf>)
at/opt/sdk/3.1.22-2.0/sysroots/corei7-64-poky-linux/usr/include/xenomai/alchemy/buffer.h:129#7 main (argc=<optimized out>, argv=<optimized out>) at main.c:410Quoted 1 line
Could that be a clue?
That alone does not tell a story. We know now that - at least according to the monitor data structure - thread with ID 10 is holding the lock. If the very same thread is trying to re-aquire it, this will cause a deadlock. And if that is true, we need to find out, how that could have happened. I have no idea about that so far.
Quoted 4 lines
Would you be able to factor out a simpler, sharable reproduction case? > It also looks like as if the reader is receiving some signal while blocking. Is that expected based on your workload? It may destroy timing constraints, even without the deadlock.
Yes, I think it is expected, the workflow is the following:
Quoted 12 lines
- a daemon starts the program
- upon an external request, the daemon terminates the program sending to it a SIGTERM. I think this is the signal received while blocking
- when the SIGTERM is received (a sighandler is installed by the main thread), the main loop (where thert_buffer_read()is) breaks, and the program performs some cleanups and then exits
- in 95% cases, the program terminates well. In the remaining 5% cases the program hangs onrt_buffer_read()
- if the daemon detects that the program is not terminated after 30 seconds from the SIGTERM sending, the daemon send a SIGABRT to generate the core we are analyzingOK, makes sense. Based on this description, we may indeed have an issue around Linux signal processing here. Now it's about making it reproducible.
Quoted 9 lines
Quoted 5 lines
I'm trying to reproduce the issue with simpler programs, but without success for the moment.
I will update you (hope with better news).
Thanks in advance!
Jan
Hi Jan,
finally I managed to have a piece of code that makes the issue reproducible. It's not exactly small, but not too big either. I hope that this makes the issue reproducible also on your test system.
The zip contains:
- a little main program (test.c)
- a little library (in mylib dir). Some pieces of code are never reached, but leaved to avoid potential compiler optimizations that could remove other relevant parts (maybe cycles?)
- a script (build.sh) to build the two components above
- a script to launch the test (start-test.sh)
- the configuration of the kernel in use
After building the program and the library with build.sh, you can copy on the target:
- the start-test.sh script
- the built program xeno-test-session-hang-on-exit
- the built library libmylib.so.2.0.0
and create the library link /usr/lib/libmylib.so.2
Start the test with "./start-test.sh &" and follow what happening with "tail -f log.txt": after a time that varies from a couple of minutes to 25-30 minutes, the log should stop on "~~~~~~ RECEIVED SIGINT ~~~~~~" line: the hang is happened.
A small recap:
Atom x5-E8000 CPU, Linux 5.4.255 with Ipipe 15, Xenomai 3.2.3. GCC compiler used: 9.5.0 from Yocto Dunfell 3.1.22
Some potential interesting things:
- seems that application arguments "--session" and "--cpu-affinity" matters
- seems that compilation flags matters
- seems that splitting the code in an application and a library matters
Thanks in advance, regards
Signature · 1 line
Mauro S.
Quoted 258 lines · Mauro S.
Quoted 222 lines · Jan Kiszka
Quoted 205 lines · Mauro S.
Quoted 197 lines · Jan Kiszka
Quoted 188 lines · Mauro Salvini
Il giorno mar 28 nov 2023 alle ore 09:39 Mauro Salvini <[email protected]> ha scritto:
Quoted 137 lines
Il giorno mar 28 nov 2023 alle ore 00:15 Jan Kiszka <[email protected]> ha scritto:
Quoted 129 lines · Mauro Salvini
Quoted 119 lines
Il giorno mar 21 nov 2023 alle ore 01:06 Jan Kiszka <[email protected]> ha scritto:
Quoted 99 lines · Mauro S.
Quoted 97 lines · Jan Kiszka
Quoted 79 lines · Mauro S.
Quoted 53 lines
Hi all,
I'm using Xenomai 3.2.3 on an Atom
x84_64with a 5.4.255 ipipe kernel.The application I'm running (a complex application, with about 60-70 RT
threads) has a simple loop in the main function, something like that:while (
stay_in) {
ret = rt_buffer_read(...); // with 50ms timeout if(ret)do_something
}The main loop reads the buffer to receive some commands from outside,
and when the application gets a SIGINT, the custom signal handler simply
does "stay_in= false" breaking the main loop, and then the program
closes.
During normal running, I can see the timer associated to thert_buffer_read()timeout get fired and reprogrammed, calling multiple
times "cat/proc/xenomai/timer/coreclk" e.g.:0 291/290 2ms970us - myapp
...
0 609/608 34ms860us - myappI also see the thread in "w" state (waiting for a resource with timeout)
doing "cat cat/proc/xenomai/sched/threads":0 16328 rt cobalt 50 21ms279us
w myappSometimes, in a non reproducible way (at least for the moment), when the
process get the SIGINT it never exits, remaining in this status:
/proc/xenomai/sched/threads:
0 16328 rt cobalt 50 - W flxcoreThe state becomed "W" (waiting for a resource without timeout) and in
fact the remaining timeout is not present in the row, also in/proc/xenomai/timer/coreclk:0 291609/291362 - - myapp
Quoted 8 lines
(BTW, seems that some timeouts got lost, because scheds are many that
shots, and this happens also on other timers in coreclk)This is the backtrace in gdb:
#0
0x00007f5b15bb05f7incobalt_monitor_enter() from/usr/lib/libcobalt.so.2This relates to
lib/cobalt/internal.c,cobalt_monitor_wait():/*
* If we got interrupted while trying to re-enter the monitor,
* we need to redo. In the meantime, any pending linux signal
* has been processed.
*/
if (ret ==-EINTR)
ret =cobalt_monitor_enter(mon);But the problem is that the lock (monitor) is no free. Someone else
holds it, and your interrupted reader does not proceed.Quoted 6 lines
If you dive into mon at this point via gdb, you may find the owner (according to libcobalt's view) when you resolve manually what
get_monitor_state()does.Jan
Thank you Jan.
I rebuilt the Xenomai libraries with debugging symbols enabled. But when I try to print the mon variable, I get
(gdb) print mon
$1 = (cobalt_monitor_t*)0x7f3cb524e62c
(gdb) print *mon
Cannot access memory at address0x7f3cb524e62cQuoted 8 lines
Quoted 3 lines
Seems that the memory address is not in the core dump, but I'm wondering
whyDid you create a core dump or tried to attach live the hung process? Maybe the former was incomplete - for whatever reason.
Jan
Sorry for the delay, but every time I modify something I need to wait for the issue to arise.
I'm working on core dumps. The previous core was incomplete, as you said.
I needed to set thecoredump_filterkernel cmdline argument to0x7fto
have the complete coredump.Quoted 7 lines
Now, I can see also the values into the Xenomai lib memory space:
(gdb) print *mon
$8 = {state_offset= 1047984, flags = 1, handle = 44} (gdb) print *(structcobalt_monitor_state*)(cobalt_umm_shared +mon->state_offset)
$9 = {owner = {v = -2147483638}, flags = 0}Quoted 4 lines
This is
0x8000000a,XNSYNCH_FLCLAIM| 10 (see alsoxnhandle_get_id), thus 10 is the owner. Unintended recursion?Jan
Quoted 7 lines
Oh, yes, my bad: I have seen the
xnhandle_get_id, but not considered thatatomic_tis treated as a 2-complement number.
Then, the owner is the caller ID. I'm wondering how it could be a
recursion: the main thread is a simple while(..)rt_buffer_read(..); I will investigate a bit more on it.Thanks.
Maybe I found something: in the backtrace of every core (cores are generated with SIGABRT) the first two frames are referring both to
cobalt_monitor_enter(): frame #0 is at the source line where the program is stuck (syscall), frame #1 is at thecobalt_monitor_enter()function declaration source line:Program terminated with signal SIGABRT, Aborted.
#0cobalt_monitor_enter(mon=0x7f0d7583862c)
at../../../../../../../../../linux+xeno-src/xenomai-3.2-new/lib/cobalt/internal.c:218[Current thread is 1 (Thread0x7f0d7628c400(LWP 2751))]
#0cobalt_monitor_enter(mon=0x7f0d7583862c)
at../../../../../../../../../linux+xeno-src/xenomai-3.2-new/lib/cobalt/internal.c:218#1cobalt_monitor_enter(mon=0x7f0d7583862c)
at../../../../../../../../../linux+xeno-src/xenomai-3.2-new/lib/cobalt/internal.c:186#20x00007f0d76612748incobalt_monitor_wait(mon=mon@entry=0x7f0d7583862c, event=event@entry=0, ts=ts@entry=0x7ffe7d7380f0)
at../../../../../../../../../linux+xeno-src/xenomai-3.2-new/lib/cobalt/internal.c:276#30x00007f0d76639497inmonitor_wait_grant(current=0x7f0d75842bc8, timeout=0x7ffe7d7380f0, sobj=0x7f0d758385f0)
at../../../../../../../../../linux+xeno-src/xenomai-3.2-new/lib/copperplate/syncobj.c:553#4syncobj_wait_grant(sobj=sobj@entry=0x7f0d758385f0, timeout=timeout@entry=0x7ffe7d7380f0, syns=syns@entry=0x7ffe7d738074)
at../../../../../../../../../linux+xeno-src/xenomai-3.2-new/lib/copperplate/syncobj.c:553#50x00007f0d7664c691inrt_buffer_read_timed(bf=<optimized out>, ptr=<optimized out>, size=<optimized out>,
abs_timeout=0x7ffe7d7380f0) at../../../../../../../../../linux+xeno-src/xenomai-3.2-new/lib/alchemy/buffer.c:555#60x000055b104840601inrt_buffer_read(timeout=50000000,
size=19216, ptr=0x55b104844180 <Request>,
bf=0x55b104844168 <ReqBuf>)
at/opt/sdk/3.1.22-2.0/sysroots/corei7-64-poky-linux/usr/include/xenomai/alchemy/buffer.h:129#7 main (argc=<optimized out>, argv=<optimized out>) at main.c:410Quoted 1 line
Could that be a clue?
That alone does not tell a story. We know now that - at least according to the monitor data structure - thread with ID 10 is holding the lock. If the very same thread is trying to re-aquire it, this will cause a deadlock. And if that is true, we need to find out, how that could have happened. I have no idea about that so far.
Quoted 4 lines
Would you be able to factor out a simpler, sharable reproduction case? > It also looks like as if the reader is receiving some signal while blocking. Is that expected based on your workload? It may destroy timing constraints, even without the deadlock.
Yes, I think it is expected, the workflow is the following:
Quoted 12 lines
- a daemon starts the program
- upon an external request, the daemon terminates the program sending to it a SIGTERM. I think this is the signal received while blocking
- when the SIGTERM is received (a sighandler is installed by the main thread), the main loop (where thert_buffer_read()is) breaks, and the program performs some cleanups and then exits
- in 95% cases, the program terminates well. In the remaining 5% cases the program hangs onrt_buffer_read()
- if the daemon detects that the program is not terminated after 30 seconds from the SIGTERM sending, the daemon send a SIGABRT to generate the core we are analyzingOK, makes sense. Based on this description, we may indeed have an issue around Linux signal processing here. Now it's about making it reproducible.
Quoted 9 lines
Quoted 5 lines
I'm trying to reproduce the issue with simpler programs, but without success for the moment.
I will update you (hope with better news).
Thanks in advance!
JanHi Jan,
finally I managed to have a piece of code that makes the issue reproducible. It's not exactly small, but not too big either. I hope that this makes the issue reproducible also on your test system.
The zip contains:
- a little main program (test.c)
- a little library (in mylib dir). Some pieces of code are never
reached, but leaved to avoid potential compiler optimizations that could remove other relevant parts (maybe cycles?)
- a script (build.sh) to build the two components above
- a script to launch the test (start-test.sh)
- the configuration of the kernel in useAfter building the program and the library with
build.sh, you can copy on the target:
- thestart-test.shscript
- the built program xeno-test-session-hang-on-exit
- the built library libmylib.so.2.0.0
and create the library link/usr/lib/libmylib.so.2Start the test with "./start-test.sh &" and follow what happening with "tail -f log.txt": after a time that varies from a couple of minutes to 25-30 minutes, the log should stop on "~~~~~~ RECEIVED SIGINT ~~~~~~" line: the hang is happened.
A small recap:
Atom x5-E8000 CPU, Linux 5.4.255 with Ipipe 15, Xenomai 3.2.3. GCC compiler used: 9.5.0 from Yocto Dunfell 3.1.22
Quoted 7 lines
Some potential interesting things:
- seems that application arguments "--session" and "--cpu-affinity" matters
- seems that compilation flags matters
- seems that splitting the code in an application and a library mattersThanks in advance, regards
Hi,
kind ping about that.
Not to put0 pressure on, just to know if the problem is worth considering and will be examined or if I have to make my workarounds definitive.
Thanks in advance, regards
Signature · 1 line
Mauro S.
Quoted 11 lines · Mauro S.
Hi,
kind ping about that.
Not to put0 pressure on, just to know if the problem is worth considering and will be examined or if I have to make my workarounds definitive.
Thanks in advance, regards
--
Mauro S.
Hi,
we had a short discussion about that issue in the last Xenomai community call and agreed that we have to dig deeper. If you got more information in the meantime, please let us know.
How does your workaround currently look like?
I think Jan will answer once he's back at work.
Best regards,
Florian
Quoted 13 lines · Florian Bezdeka
Quoted 11 lines · Mauro S.
Hi,
kind ping about that.
Not to put0 pressure on, just to know if the problem is worth considering and will be examined or if I have to make my workarounds definitive.
Thanks in advance, regards
--
Mauro S.
Quoted 6 lines
Hi,
we had a short discussion about that issue in the last Xenomai community call and agreed that we have to dig deeper. If you got more information in the meantime, please let us know.
Hi Florian,
thank you for the update, good to hear that.
Feel free to ask any additional information you may need in your analysis. Unfortunately I have no further information. If I will have, I will let you know.
Quoted 2 lines
How does your workaround currently look like?
Nothing useful, I suspect: simply the external process that kindly ask the main process to terminate with SIGTERM also monitors the main process exit duration: if the main process does not exit in some amount of time, the monitor process kills the main process with SIGKILL. The side effect is that I brutally interrupt some operations that, in a normal exit, would be finished in a clean way.
Quoted 5 lines
I think Jan will answer once he's back at work.
Best regards,
Florian
Thanks in advance, regards
Signature · 1 line
Mauro S.
Quoted 32 lines · Mauro S.
Quoted 13 lines · Florian Bezdeka
Quoted 11 lines · Mauro S.
Hi,
kind ping about that.
Not to put0 pressure on, just to know if the problem is worth considering and will be examined or if I have to make my workarounds definitive.
Thanks in advance, regards
Signature · 1 line
Mauro S.Quoted 6 lines
Hi,
we had a short discussion about that issue in the last Xenomai community call and agreed that we have to dig deeper. If you got more information in the meantime, please let us know.
Hi Florian,
thank you for the update, good to hear that.
Feel free to ask any additional information you may need in your analysis. Unfortunately I have no further information. If I will have, I will let you know.Quoted 2 lines
How does your workaround currently look like?
Nothing useful, I suspect: simply the external process that kindly ask the main process to terminate with SIGTERM also monitors the main process exit duration: if the main process does not exit in some amount of time, the monitor process kills the main process with SIGKILL. The side effect is that I brutally interrupt some operations that, in a normal exit, would be finished in a clean way.
Quoted 8 lines
Quoted 5 lines
I think Jan will answer once he's back at work.
Best regards,
FlorianThanks in advance, regards
Hi all,
I don't want to bother you, and I don't want to put pressure.
Just wondering if this issue would be analyzable/fixable, or not fixable at all, to decide whether or not to make the workarounds "official" in final code.
Thank you, regards
Signature · 1 line
Mauro S.
Quoted 49 lines · Mauro S.
Quoted 39 lines · Mauro S.
Quoted 13 lines · Florian Bezdeka
Quoted 11 lines · Mauro S.
Hi,
kind ping about that.
Not to put0 pressure on, just to know if the problem is worth considering and will be examined or if I have to make my workarounds definitive.
Thanks in advance, regards
--
Mauro S.Quoted 6 lines
Hi,
we had a short discussion about that issue in the last Xenomai community call and agreed that we have to dig deeper. If you got more information in the meantime, please let us know.
Hi Florian,
thank you for the update, good to hear that.
Feel free to ask any additional information you may need in your analysis.
Unfortunately I have no further information. If I will have, I will let you know.Quoted 2 lines
How does your workaround currently look like?
Nothing useful, I suspect: simply the external process that kindly ask the main process to terminate with SIGTERM also monitors the main process exit duration: if the main process does not exit in some amount of time, the monitor process kills the main process with SIGKILL. The side effect is that I brutally interrupt some operations that, in a normal exit, would be finished in a clean way.
Quoted 8 lines
Quoted 5 lines
I think Jan will answer once he's back at work.
Best regards,
FlorianThanks in advance, regards
Quoted 7 lines
Hi all,
I don't want to bother you, and I don't want to put pressure. Just wondering if this issue would be analyzable/fixable, or not fixable at all, to decide whether or not to make the workarounds "official" in final code.
Sorry, this fell through the cracks. We should look into this before the release, for sure. Scheduled for next week.
Jan
Signature · 2 lines
Siemens AG, Technology Linux Expert Center
Quoted 262 lines · Mauro S.
Quoted 229 lines · Jan Kiszka
Quoted 211 lines · Mauro S.
Quoted 201 lines · Jan Kiszka
Quoted 192 lines · Mauro Salvini
Il giorno mar 28 nov 2023 alle ore 09:39 Mauro Salvini <[email protected]> ha scritto:
Quoted 141 lines
Il giorno mar 28 nov 2023 alle ore 00:15 Jan Kiszka <[email protected]> ha scritto:
Quoted 133 lines · Mauro Salvini
Quoted 123 lines
Il giorno mar 21 nov 2023 alle ore 01:06 Jan Kiszka <[email protected]> ha scritto:
Quoted 105 lines · Mauro S.
Quoted 94 lines · Jan Kiszka
Quoted 80 lines · Mauro S.
Quoted 54 lines
Hi all,
I'm using Xenomai 3.2.3 on an Atom
x84_64with a 5.4.255 ipipe kernel.The application I'm running (a complex application, with about 60-70 RT
threads) has a simple loop in the main function, something like that:while (
stay_in) {
ret = rt_buffer_read(...); // with 50ms timeout if(ret)do_something
}The main loop reads the buffer to receive some commands from outside,
and when the application gets a SIGINT, the custom signal handler simply
does "stay_in= false" breaking the main loop, and then the program
closes.
During normal running, I can see the timer associated to thert_buffer_read()timeout get fired and reprogrammed, calling multiple
times "cat/proc/xenomai/timer/coreclk" e.g.:0 291/290 2ms970us - myapp
...
0 609/608 34ms860us - myappI also see the thread in "w" state (waiting for a resource with timeout)
doing "cat cat/proc/xenomai/sched/threads":0 16328 rt cobalt 50 21ms279us
w myappSometimes, in a non reproducible way (at least for the moment), when the
process get the SIGINT it never exits, remaining in this status:
/proc/xenomai/sched/threads:
0 16328 rt cobalt 50 - W flxcoreThe state becomed "W" (waiting for a resource without timeout) and in
fact the remaining timeout is not present in the row, also in/proc/xenomai/timer/coreclk:0 291609/291362 - - myapp
Quoted 8 lines
(BTW, seems that some timeouts got lost, because scheds are many that
shots, and this happens also on other timers in coreclk)This is the backtrace in gdb:
#0
0x00007f5b15bb05f7incobalt_monitor_enter() from/usr/lib/libcobalt.so.2This relates to
lib/cobalt/internal.c,cobalt_monitor_wait():/*
* If we got interrupted while trying to re-enter the monitor,
* we need to redo. In the meantime, any pending linux signal
* has been processed.
*/
if (ret ==-EINTR)
ret =cobalt_monitor_enter(mon);But the problem is that the lock (monitor) is no free. Someone else
holds it, and your interrupted reader does not proceed.Quoted 7 lines
If you dive into mon at this point via gdb, you may find the owner
(according to libcobalt's view) when you resolve manually whatget_monitor_state()does.Jan
Thank you Jan.
I rebuilt the Xenomai libraries with debugging symbols enabled. But when I try to print the mon variable, I get
Quoted 8 lines
(gdb) print mon
$1 = (cobalt_monitor_t*)0x7f3cb524e62c
(gdb) print *mon
Cannot access memory at address0x7f3cb524e62cSeems that the memory address is not in the core dump, but I'm wondering
whyQuoted 5 lines
Did you create a core dump or tried to attach live the hung process?
Maybe the former was incomplete - for whatever reason.Jan
Sorry for the delay, but every time I modify something I need to wait
for the issue to arise.I'm working on core dumps. The previous core was incomplete, as you said.
I needed to set thecoredump_filterkernel cmdline argument to0x7fto
have the complete coredump.Quoted 7 lines
Now, I can see also the values into the Xenomai lib memory space:
(gdb) print *mon
$8 = {state_offset= 1047984, flags = 1, handle = 44} (gdb) print *(structcobalt_monitor_state*)(cobalt_umm_shared +mon->state_offset)
$9 = {owner = {v = -2147483638}, flags = 0}Quoted 4 lines
This is
0x8000000a,XNSYNCH_FLCLAIM| 10 (see alsoxnhandle_get_id), thus 10 is the owner. Unintended recursion?Jan
Quoted 7 lines
Oh, yes, my bad: I have seen the
xnhandle_get_id, but not considered thatatomic_tis treated as a 2-complement number.
Then, the owner is the caller ID. I'm wondering how it could be a
recursion: the main thread is a simple while(..)rt_buffer_read(..); I will investigate a bit more on it.Thanks.
Maybe I found something: in the backtrace of every core (cores are generated with SIGABRT) the first two frames are referring both to
cobalt_monitor_enter(): frame #0 is at the source line where the program is stuck (syscall), frame #1 is at thecobalt_monitor_enter()function declaration source line:Program terminated with signal SIGABRT, Aborted.
#0cobalt_monitor_enter(mon=0x7f0d7583862c)
at../../../../../../../../../linux+xeno-src/xenomai-3.2-new/lib/cobalt/internal.c:218[Current thread is 1 (Thread0x7f0d7628c400(LWP 2751))]
#0cobalt_monitor_enter(mon=0x7f0d7583862c)
at../../../../../../../../../linux+xeno-src/xenomai-3.2-new/lib/cobalt/internal.c:218#1cobalt_monitor_enter(mon=0x7f0d7583862c)
at../../../../../../../../../linux+xeno-src/xenomai-3.2-new/lib/cobalt/internal.c:186#20x00007f0d76612748incobalt_monitor_wait(mon=mon@entry=0x7f0d7583862c, event=event@entry=0, ts=ts@entry=0x7ffe7d7380f0)
at../../../../../../../../../linux+xeno-src/xenomai-3.2-new/lib/cobalt/internal.c:276#30x00007f0d76639497inmonitor_wait_grant(current=0x7f0d75842bc8, timeout=0x7ffe7d7380f0, sobj=0x7f0d758385f0)
at../../../../../../../../../linux+xeno-src/xenomai-3.2-new/lib/copperplate/syncobj.c:553#4syncobj_wait_grant(sobj=sobj@entry=0x7f0d758385f0, timeout=timeout@entry=0x7ffe7d7380f0, syns=syns@entry=0x7ffe7d738074)
at../../../../../../../../../linux+xeno-src/xenomai-3.2-new/lib/copperplate/syncobj.c:553#50x00007f0d7664c691inrt_buffer_read_timed(bf=<optimized out>, ptr=<optimized out>, size=<optimized out>,
abs_timeout=0x7ffe7d7380f0) at../../../../../../../../../linux+xeno-src/xenomai-3.2-new/lib/alchemy/buffer.c:555#60x000055b104840601inrt_buffer_read(timeout=50000000,
size=19216, ptr=0x55b104844180 <Request>,
bf=0x55b104844168 <ReqBuf>)
at/opt/sdk/3.1.22-2.0/sysroots/corei7-64-poky-linux/usr/include/xenomai/alchemy/buffer.h:129#7 main (argc=<optimized out>, argv=<optimized out>) at main.c:410Quoted 1 line
Could that be a clue?
That alone does not tell a story. We know now that - at least according to the monitor data structure - thread with ID 10 is holding the lock. If the very same thread is trying to re-aquire it, this will cause a deadlock. And if that is true, we need to find out, how that could have happened. I have no idea about that so far.
Quoted 6 lines
Would you be able to factor out a simpler, sharable reproduction case? >
It also looks like as if the reader is receiving some signal while blocking. Is that expected based on your workload? It may destroy timing
constraints, even without the deadlock.Yes, I think it is expected, the workflow is the following:
Quoted 12 lines
- a daemon starts the program
- upon an external request, the daemon terminates the program sending to it a SIGTERM. I think this is the signal received while blocking
- when the SIGTERM is received (a sighandler is installed by the main thread), the main loop (where thert_buffer_read()is) breaks, and the program performs some cleanups and then exits
- in 95% cases, the program terminates well. In the remaining 5% cases the program hangs onrt_buffer_read()
- if the daemon detects that the program is not terminated after 30 seconds from the SIGTERM sending, the daemon send a SIGABRT to generate the core we are analyzingOK, makes sense. Based on this description, we may indeed have an issue around Linux signal processing here. Now it's about making it reproducible.
Quoted 9 lines
Quoted 5 lines
I'm trying to reproduce the issue with simpler programs, but without success for the moment.
I will update you (hope with better news).
Thanks in advance!
JanHi Jan,
finally I managed to have a piece of code that makes the issue reproducible. It's not exactly small, but not too big either. I hope that this makes the issue reproducible also on your test system.
The zip contains:
- a little main program (test.c)
- a little library (in mylib dir). Some pieces of code are never reached, but leaved to avoid potential compiler optimizations that could remove other relevant parts (maybe cycles?)
- a script (build.sh) to build the two components above
- a script to launch the test (start-test.sh)
- the configuration of the kernel in useAfter building the program and the library with
build.sh, you can copy on the target:
- thestart-test.shscript
- the built program xeno-test-session-hang-on-exit
- the built library libmylib.so.2.0.0
and create the library link/usr/lib/libmylib.so.2
Quoted 8 lines
Start the test with "./start-test.sh &" and follow what happening with "tail -f log.txt": after a time that varies from a couple of minutes to 25-30 minutes, the log should stop on "~~~~~~ RECEIVED SIGINT ~~~~~~"
line: the hang is happened.A small recap:
Atom x5-E8000 CPU, Linux 5.4.255 with Ipipe 15, Xenomai 3.2.3. GCC compiler used: 9.5.0 from Yocto Dunfell 3.1.22
Can you only reproduce with this setup, specifically with this compiler version and only on real hardware? If you rather use xenomai-images and qemu/kvm target but still the same kernel and xenomai version, the issue does not occur?
I'm trying in kvm right now, also with different compiler. Iit would be good to align / rule out variables if my first setup turns out to be unhelpful.
Quoted 4 lines
Some potential interesting things:
- seems that application arguments "--session" and "--cpu-affinity" matters
- seems that compilation flags matters
Which compilation flags are you referring to? I was using your Makefile now, will that give me the right flags?
Quoted 4 lines
- seems that splitting the code in an application and a library matters
Thanks in advance, regards
Jan
Signature · 2 lines
Siemens AG, Technology Linux Expert Center
Quoted 49 lines · Jan Kiszka
Quoted 22 lines · Mauro S.
Hi Jan,
finally I managed to have a piece of code that makes the issue reproducible. It's not exactly small, but not too big either. I hope that this makes the issue reproducible also on your test system.
The zip contains:
- a little main program (test.c)
- a little library (in mylib dir). Some pieces of code are never reached, but leaved to avoid potential compiler optimizations that could remove other relevant parts (maybe cycles?)
- a script (build.sh) to build the two components above
- a script to launch the test (start-test.sh)
- the configuration of the kernel in useAfter building the program and the library with
build.sh, you can copy on the target:
- thestart-test.shscript
- the built program xeno-test-session-hang-on-exit
- the built library libmylib.so.2.0.0
and create the library link/usr/lib/libmylib.so.2Quoted 8 lines
Start the test with "./start-test.sh &" and follow what happening with "tail -f log.txt": after a time that varies from a couple of minutes to 25-30 minutes, the log should stop on "~~~~~~ RECEIVED SIGINT ~~~~~~"
line: the hang is happened.A small recap:
Atom x5-E8000 CPU, Linux 5.4.255 with Ipipe 15, Xenomai 3.2.3. GCC compiler used: 9.5.0 from Yocto Dunfell 3.1.22Can you only reproduce with this setup, specifically with this compiler version and only on real hardware? If you rather use xenomai-images and qemu/kvm target but still the same kernel and xenomai version, the issue does not occur?
I'm trying in kvm right now, also with different compiler. Iit would be good to align / rule out variables if my first setup turns out to be unhelpful.
Quoted 4 lines
Some potential interesting things:
- seems that application arguments "--session" and "--cpu-affinity" matters
- seems that compilation flags mattersWhich compilation flags are you referring to? I was using your
Makefilenow, will that give me the right flags?
Quoted 7 lines
Quoted 4 lines
- seems that splitting the code in an application and a library matters
Thanks in advance, regards
Jan
So, my first tests do not expose the issue yet. I will need more details, I'm afraid.
Jan
Signature · 2 lines
Siemens AG, Technology Linux Expert Center
A message that is not in the archive (sent off-list or not yet received): CADBp9xn4OGi99e57phnv58NtCbxzO62bhrkJhSns-FUbbt4_pg@mail.gmail.com
Quoted 40 lines · Mauro Salvini
Il giorno lun 5 ago 2024 alle ore 14:10 Jan Kiszka <[email protected]> ha scritto:
Quoted 38 lines · Mauro S.
Quoted 22 lines
Hi Jan,
finally I managed to have a piece of code that makes the issue reproducible. It's not exactly small, but not too big either. I hope that this makes the issue reproducible also on your test system.
The zip contains:
- a little main program (test.c)
- a little library (in mylib dir). Some pieces of code are never reached, but leaved to avoid potential compiler optimizations that could remove other relevant parts (maybe cycles?)
- a script (build.sh) to build the two components above
- a script to launch the test (start-test.sh)
- the configuration of the kernel in useAfter building the program and the library with
build.sh, you can copy on the target:
- thestart-test.shscript
- the built program xeno-test-session-hang-on-exit
- the built library libmylib.so.2.0.0
and create the library link/usr/lib/libmylib.so.2Quoted 8 lines
Start the test with "./start-test.sh &" and follow what happening with "tail -f log.txt": after a time that varies from a couple of minutes to 25-30 minutes, the log should stop on "~~~~~~ RECEIVED SIGINT ~~~~~~"
line: the hang is happened.A small recap:
Atom x5-E8000 CPU, Linux 5.4.255 with Ipipe 15, Xenomai 3.2.3. GCC compiler used: 9.5.0 from Yocto Dunfell 3.1.22Can you only reproduce with this setup, specifically with this compiler version and only on real hardware? If you rather use xenomai-images and qemu/kvm target but still the same kernel and xenomai version, the issue does not occur?
Quoted 8 lines
Quoted 4 lines
I'm trying in kvm right now, also with different compiler. Iit would be good to align / rule out variables if my first setup turns out to be unhelpful.
Hi Jan,
Sorry, I never tried on an emulated system like qemu, I did the tests
qemu/kvm - that is CPU-wise not emulated, virtualized. It generally gives similar execution patterns as on real hardware.
Quoted 3 lines
only on real hardware (using different samples of the same hardware, just to exclude hardware problems).
I can do a test with Xenomai images on real hardware if it would be useful.
That would already be useful to rule out the toolchain as contributor, yes. When at it, testing in qemu-kvm would also be nice.
Quoted 15 lines
I used also GCC 9.3 (from Yocto Dunfell too), with same result. I can share the cross-compiler toolchains in case.
I saw the problem also using some different Xenomai and kernel versions, but always 5.4.x kernels from Xenomai repos and 3.2.x Xenomai versions.Quoted 8 lines
Quoted 5 lines
Some potential interesting things:
- seems that application arguments "--session" and "--cpu-affinity" matters
- seems that compilation flags mattersWhich compilation flags are you referring to? I was using your
Makefilenow, will that give me the right flags?
Quoted 8 lines
Sorry, I was not clear. Compilation flags that seem to have an impact (at least on the frequency with which the problem occurs) are the ones related to code optimization
(like -O3 and -g).
Compilation flags that are inMakefileI shipped are the "best" ones that I found, to get the problem appearing frequently and in a short
time: then yes, flags inMakefileare the right ones.
OK, perfect.
Jan
Signature · 2 lines
Siemens AG, Technology Linux Expert Center
Quoted 53 lines · Jan Kiszka
Quoted 40 lines · Mauro Salvini
Il giorno lun 5 ago 2024 alle ore 14:10 Jan Kiszka <[email protected]> ha scritto:
Quoted 38 lines · Mauro S.
Quoted 22 lines
Hi Jan,
finally I managed to have a piece of code that makes the issue reproducible. It's not exactly small, but not too big either. I hope that this makes the issue reproducible also on your test system.
The zip contains:
- a little main program (test.c)
- a little library (in mylib dir). Some pieces of code are never reached, but leaved to avoid potential compiler optimizations that could remove other relevant parts (maybe cycles?)
- a script (build.sh) to build the two components above
- a script to launch the test (start-test.sh)
- the configuration of the kernel in useAfter building the program and the library with
build.sh, you can copy on the target:
- thestart-test.shscript
- the built program xeno-test-session-hang-on-exit
- the built library libmylib.so.2.0.0
and create the library link/usr/lib/libmylib.so.2Quoted 8 lines
Start the test with "./start-test.sh &" and follow what happening with "tail -f log.txt": after a time that varies from a couple of minutes to 25-30 minutes, the log should stop on "~~~~~~ RECEIVED SIGINT ~~~~~~"
line: the hang is happened.A small recap:
Atom x5-E8000 CPU, Linux 5.4.255 with Ipipe 15, Xenomai 3.2.3. GCC compiler used: 9.5.0 from Yocto Dunfell 3.1.22Can you only reproduce with this setup, specifically with this compiler version and only on real hardware? If you rather use xenomai-images and qemu/kvm target but still the same kernel and xenomai version, the issue does not occur?
Quoted 8 lines
Quoted 4 lines
I'm trying in kvm right now, also with different compiler. Iit would be good to align / rule out variables if my first setup turns out to be unhelpful.
Hi Jan,
Sorry, I never tried on an emulated system like qemu, I did the tests
qemu/kvm - that is CPU-wise not emulated, virtualized. It generally gives similar execution patterns as on real hardware.
Quoted 7 lines
Quoted 3 lines
only on real hardware (using different samples of the same hardware, just to exclude hardware problems).
I can do a test with Xenomai images on real hardware if it would be useful.That would already be useful to rule out the toolchain as contributor, yes. When at it, testing in qemu-kvm would also be nice.
FWIW, I've pushed ipipe-core-5.4.281-x86-16. It's not that I expect positive impact on your issue, but you never know (until you understood the actual root cause).
Jan
Signature · 2 lines
Siemens AG, Technology Linux Expert Center
Quoted 62 lines · Jan Kiszka
Quoted 53 lines · Jan Kiszka
Quoted 40 lines · Mauro Salvini
Il giorno lun 5 ago 2024 alle ore 14:10 Jan Kiszka <[email protected]> ha scritto:
Quoted 38 lines · Mauro S.
Quoted 22 lines
Hi Jan,
finally I managed to have a piece of code that makes the issue reproducible. It's not exactly small, but not too big either. I hope that this makes the issue reproducible also on your test system.
The zip contains:
- a little main program (test.c)
- a little library (in mylib dir). Some pieces of code are never reached, but leaved to avoid potential compiler optimizations that could remove other relevant parts (maybe cycles?)
- a script (build.sh) to build the two components above
- a script to launch the test (start-test.sh)
- the configuration of the kernel in useAfter building the program and the library with
build.sh, you can copy on the target:
- thestart-test.shscript
- the built program xeno-test-session-hang-on-exit
- the built library libmylib.so.2.0.0
and create the library link/usr/lib/libmylib.so.2Quoted 8 lines
Start the test with "./start-test.sh &" and follow what happening with "tail -f log.txt": after a time that varies from a couple of minutes to 25-30 minutes, the log should stop on "~~~~~~ RECEIVED SIGINT ~~~~~~"
line: the hang is happened.A small recap:
Atom x5-E8000 CPU, Linux 5.4.255 with Ipipe 15, Xenomai 3.2.3. GCC compiler used: 9.5.0 from Yocto Dunfell 3.1.22Can you only reproduce with this setup, specifically with this compiler version and only on real hardware? If you rather use xenomai-images and qemu/kvm target but still the same kernel and xenomai version, the issue does not occur?
Quoted 8 lines
Quoted 4 lines
I'm trying in kvm right now, also with different compiler. Iit would be good to align / rule out variables if my first setup turns out to be unhelpful.
Hi Jan,
Sorry, I never tried on an emulated system like qemu, I did the tests
qemu/kvm - that is CPU-wise not emulated, virtualized. It generally gives similar execution patterns as on real hardware.
Quoted 7 lines
Quoted 3 lines
only on real hardware (using different samples of the same hardware, just to exclude hardware problems).
I can do a test with Xenomai images on real hardware if it would be useful.That would already be useful to rule out the toolchain as contributor, yes. When at it, testing in qemu-kvm would also be nice.
Quoted 5 lines
FWIW, I've pushed ipipe-core-5.4.281-x86-16. It's not that I expect positive impact on your issue, but you never know (until you understood the actual root cause).
Jan
Hi Jan,
I've seen, thank you.
I will try xenomai images on real hardware and I will back to you with results.
Thanks again, regards
Signature · 1 line
Mauro S.
Quoted 69 lines · Mauro S.
Quoted 62 lines · Jan Kiszka
Quoted 53 lines · Jan Kiszka
Quoted 40 lines · Mauro Salvini
Il giorno lun 5 ago 2024 alle ore 14:10 Jan Kiszka <[email protected]> ha scritto:
Quoted 38 lines · Mauro S.
Quoted 22 lines
Hi Jan,
finally I managed to have a piece of code that makes the issue reproducible. It's not exactly small, but not too big either. I hope that this makes the issue reproducible also on your test system.
The zip contains:
- a little main program (test.c)
- a little library (in mylib dir). Some pieces of code are never reached, but leaved to avoid potential compiler optimizations that could remove other relevant parts (maybe cycles?)
- a script (build.sh) to build the two components above
- a script to launch the test (start-test.sh)
- the configuration of the kernel in useAfter building the program and the library with
build.sh, you can copy on the target:
- thestart-test.shscript
- the built program xeno-test-session-hang-on-exit
- the built library libmylib.so.2.0.0
and create the library link/usr/lib/libmylib.so.2Quoted 8 lines
Start the test with "./start-test.sh &" and follow what happening with "tail -f log.txt": after a time that varies from a couple of minutes to 25-30 minutes, the log should stop on "~~~~~~ RECEIVED SIGINT ~~~~~~"
line: the hang is happened.A small recap:
Atom x5-E8000 CPU, Linux 5.4.255 with Ipipe 15, Xenomai 3.2.3. GCC compiler used: 9.5.0 from Yocto Dunfell 3.1.22Can you only reproduce with this setup, specifically with this compiler version and only on real hardware? If you rather use xenomai-images and qemu/kvm target but still the same kernel and xenomai version, the issue does not occur?
Quoted 8 lines
Quoted 4 lines
I'm trying in kvm right now, also with different compiler. Iit would be good to align / rule out variables if my first setup turns out to be unhelpful.
Hi Jan,
Sorry, I never tried on an emulated system like qemu, I did the tests
qemu/kvm - that is CPU-wise not emulated, virtualized. It generally gives similar execution patterns as on real hardware.
Quoted 7 lines
Quoted 3 lines
only on real hardware (using different samples of the same hardware, just to exclude hardware problems).
I can do a test with Xenomai images on real hardware if it would be useful.That would already be useful to rule out the toolchain as contributor, yes. When at it, testing in qemu-kvm would also be nice.
Quoted 5 lines
FWIW, I've pushed ipipe-core-5.4.281-x86-16. It's not that I expect positive impact on your issue, but you never know (until you understood the actual root cause).
Jan
Quoted 8 lines
Hi Jan,
I've seen, thank you.
I will try xenomai images on real hardware and I will back to you with results.
Thanks again, regards
Hi,
first results after some tests on real hardware:
- xenomai-image does not show the problem
- xenomai-image started with my custom kernel instead of the xenomai-image one does not show the problem
- I didn't manage to run the xenomai-image kernel with my rootfs yet (it does not start, but at the moment I have a headless system and I'm not able to debug it)
While waiting the verification with xenomai-image kernel with my rootfs, could we conclude that the problem lies in userspace then? Could be the Xenomai config flags? Or the compiler version? Do you have suggestions about other tests to run?
Note that the test binary is always the same in all scenarios, built with my toolchain (that is built by Yocto), and my rootfs and xenomai-image have both Xenomai v3.2.3.
Side note: xenomai-image still has 5.4.228 kernel, maybe you didn't push the upgrade patch to 5.4.281? Anyway, it seems that does not matter.
Thanks in advance, regards
Signature · 1 line
Mauro S.
Quoted 91 lines · Mauro S.
Quoted 80 lines · Mauro S.
Quoted 73 lines · Jan Kiszka
Quoted 63 lines · Jan Kiszka
Quoted 55 lines · Mauro Salvini
Il giorno lun 5 ago 2024 alle ore 14:10 Jan Kiszka <[email protected]> ha scritto:
Quoted 47 lines · Mauro S.
Quoted 33 lines
Hi Jan,
finally I managed to have a piece of code that makes the issue reproducible. It's not exactly small, but not too big either. I hope that this makes the issue reproducible also on your test system.
The zip contains:
- a little main program (test.c)
- a little library (in mylib dir). Some pieces of code are never reached, but leaved to avoid potential compiler optimizations that could
remove other relevant parts (maybe cycles?)
- a script (build.sh) to build the two components above
- a script to launch the test (start-test.sh)
- the configuration of the kernel in useAfter building the program and the library with
build.sh, you can copy
on the target:
- thestart-test.shscript
- the built program xeno-test-session-hang-on-exit
- the built library libmylib.so.2.0.0
and create the library link/usr/lib/libmylib.so.2Start the test with "./start-test.sh &" and follow what happening with
"tail -f log.txt": after a time that varies from a couple of minutes to
25-30 minutes, the log should stop on "~~~~~~ RECEIVED SIGINT ~~~~~~"
line: the hang is happened.Quoted 3 lines
A small recap:
Atom x5-E8000 CPU, Linux 5.4.255 with Ipipe 15, Xenomai 3.2.3. GCC compiler used: 9.5.0 from Yocto Dunfell 3.1.22Can you only reproduce with this setup, specifically with this compiler
version and only on real hardware? If you rather use xenomai-images and
qemu/kvm target but still the same kernel and xenomai version, the issue
does not occur?Quoted 5 lines
I'm trying in kvm right now, also with different compiler. Iit would be
good to align / rule out variables if my first setup turns out to be unhelpful.Quoted 3 lines
Hi Jan,
Sorry, I never tried on an emulated system like qemu, I did the tests
qemu/kvm - that is CPU-wise not emulated, virtualized. It generally gives similar execution patterns as on real hardware.
Quoted 8 lines
Quoted 4 lines
only on real hardware (using different samples of the same hardware, just to exclude hardware problems).
I can do a test with Xenomai images on real hardware if it would be useful.That would already be useful to rule out the toolchain as contributor, yes. When at it, testing in qemu-kvm would also be nice.
Quoted 5 lines
FWIW, I've pushed ipipe-core-5.4.281-x86-16. It's not that I expect positive impact on your issue, but you never know (until you understood the actual root cause).
Jan
Quoted 9 lines
Hi Jan,
I've seen, thank you.
I will try xenomai images on real hardware and I will back to you with results.
Thanks again, regards
Quoted 7 lines
Hi,
first results after some tests on real hardware:
- xenomai-image does not show the problem
- xenomai-image started with my custom kernel instead of the xenomai-image one does not show the problem
How did you build that custom kernel? Is it the same binary that failed before?
Quoted 3 lines
- I didn't manage to run the xenomai-image kernel with my rootfs yet (it does not start, but at the moment I have a headless system and I'm not able to debug it)
The kernel we build in xenomai-images may lack some config switches needed for you rootfs.
Quoted 5 lines
While waiting the verification with xenomai-image kernel with my rootfs, could we conclude that the problem lies in userspace then? Could be the Xenomai config flags? Or the compiler version? Do you have suggestions about other tests to run?
Until we understood the reason, we do not know where the problem lies. Your userspace may trigger something that the Debian image we build does not.
Quoted 7 lines
Note that the test binary is always the same in all scenarios, built with my toolchain (that is built by Yocto), and my rootfs and xenomai-image have both Xenomai v3.2.3.
Side note: xenomai-image still has 5.4.228 kernel, maybe you didn't push the upgrade patch to 5.4.281? Anyway, it seems that does not matter.
Only the next branch of xenomai-images contains the update of the released versions so far. But when you build "head of tree" kernel, you should also get that latest version.
Jan
Signature · 2 lines
Siemens AG, Technology Linux Expert Center
Quoted 94 lines · Jan Kiszka
Quoted 93 lines · Mauro S.
Quoted 80 lines · Mauro S.
Quoted 73 lines · Jan Kiszka
Quoted 63 lines · Jan Kiszka
Quoted 55 lines · Mauro Salvini
Il giorno lun 5 ago 2024 alle ore 14:10 Jan Kiszka <[email protected]> ha scritto:
Quoted 47 lines · Mauro S.
Quoted 33 lines
Hi Jan,
finally I managed to have a piece of code that makes the issue reproducible. It's not exactly small, but not too big either. I hope that this makes the issue reproducible also on your test system.
The zip contains:
- a little main program (test.c)
- a little library (in mylib dir). Some pieces of code are never reached, but leaved to avoid potential compiler optimizations that could
remove other relevant parts (maybe cycles?)
- a script (build.sh) to build the two components above
- a script to launch the test (start-test.sh)
- the configuration of the kernel in useAfter building the program and the library with
build.sh, you can copy
on the target:
- thestart-test.shscript
- the built program xeno-test-session-hang-on-exit
- the built library libmylib.so.2.0.0
and create the library link/usr/lib/libmylib.so.2Start the test with "./start-test.sh &" and follow what happening with
"tail -f log.txt": after a time that varies from a couple of minutes to
25-30 minutes, the log should stop on "~~~~~~ RECEIVED SIGINT ~~~~~~"
line: the hang is happened.Quoted 3 lines
A small recap:
Atom x5-E8000 CPU, Linux 5.4.255 with Ipipe 15, Xenomai 3.2.3. GCC compiler used: 9.5.0 from Yocto Dunfell 3.1.22Can you only reproduce with this setup, specifically with this compiler
version and only on real hardware? If you rather use xenomai-images and
qemu/kvm target but still the same kernel and xenomai version, the issue
does not occur?Quoted 5 lines
I'm trying in kvm right now, also with different compiler. Iit would be
good to align / rule out variables if my first setup turns out to be unhelpful.Quoted 3 lines
Hi Jan,
Sorry, I never tried on an emulated system like qemu, I did the tests
qemu/kvm - that is CPU-wise not emulated, virtualized. It generally gives similar execution patterns as on real hardware.
Quoted 8 lines
Quoted 4 lines
only on real hardware (using different samples of the same hardware, just to exclude hardware problems).
I can do a test with Xenomai images on real hardware if it would be useful.That would already be useful to rule out the toolchain as contributor, yes. When at it, testing in qemu-kvm would also be nice.
Quoted 5 lines
FWIW, I've pushed ipipe-core-5.4.281-x86-16. It's not that I expect positive impact on your issue, but you never know (until you understood the actual root cause).
Jan
Quoted 9 lines
Hi Jan,
I've seen, thank you.
I will try xenomai images on real hardware and I will back to you with results.
Thanks again, regards
Hi,
Quoted 9 lines
Quoted 5 lines
first results after some tests on real hardware:
- xenomai-image does not show the problem
- xenomai-image started with my custom kernel instead of the xenomai-image one does not show the problemHow did you build that custom kernel? Is it the same binary that failed before?
Yes, exactly the same: I took the binary from my image and copied into xenomai-image bootfs, changing the grub.cfg (because I use a bzImage instead of vmlinuz). On my custom image the problem shows up, on xenomai-image with my custom kernel no. My custom kernel is built by Yocto.
Quoted 6 lines
Quoted 3 lines
- I didn't manage to run the xenomai-image kernel with my rootfs yet (it does not start, but at the moment I have a headless system and I'm not able to debug it)
The kernel we build in xenomai-images may lack some config switches needed for you rootfs.
Yes, I have to discover which ones.
Quoted 11 lines
Quoted 6 lines
While waiting the verification with xenomai-image kernel with my rootfs, could we conclude that the problem lies in userspace then? Could be the Xenomai config flags? Or the compiler version? Do you have suggestions about other tests to run?
Until we understood the reason, we do not know where the problem lies. Your userspace may trigger something that the Debian image we build does not.
Ok, understood.
Quoted 5 lines
Quoted 5 lines
Note that the test binary is always the same in all scenarios, built with my toolchain (that is built by Yocto), and my rootfs and xenomai-image have both Xenomai v3.2.3.
Quoted 9 lines
Quoted 2 lines
Side note: xenomai-image still has 5.4.228 kernel, maybe you didn't push the upgrade patch to 5.4.281? Anyway, it seems that does not matter.
Only the next branch of xenomai-images contains the update of the released versions so far. But when you build "head of tree" kernel, you should also get that latest version.
Jan
Ok, I used the master branch to build the image.
I will keep on doing my tests, reporting further results.
Thanks
Signature · 1 line
Mauro S.
Quoted 143 lines · Mauro S.
Quoted 94 lines · Jan Kiszka
Quoted 93 lines · Mauro S.
Quoted 80 lines · Mauro S.
Quoted 73 lines · Jan Kiszka
Quoted 63 lines · Jan Kiszka
Quoted 55 lines · Mauro Salvini
Il giorno lun 5 ago 2024 alle ore 14:10 Jan Kiszka <[email protected]> ha scritto:
Quoted 47 lines · Mauro S.
Quoted 33 lines
Hi Jan,
finally I managed to have a piece of code that makes the issue reproducible. It's not exactly small, but not too big either. I hope that this makes the issue reproducible also on your test system.
The zip contains:
- a little main program (test.c)
- a little library (in mylib dir). Some pieces of code are never reached, but leaved to avoid potential compiler optimizations that could
remove other relevant parts (maybe cycles?)
- a script (build.sh) to build the two components above
- a script to launch the test (start-test.sh)
- the configuration of the kernel in useAfter building the program and the library with
build.sh, you can copy
on the target:
- thestart-test.shscript
- the built program xeno-test-session-hang-on-exit
- the built library libmylib.so.2.0.0
and create the library link/usr/lib/libmylib.so.2Start the test with "./start-test.sh &" and follow what happening with
"tail -f log.txt": after a time that varies from a couple of minutes to
25-30 minutes, the log should stop on "~~~~~~ RECEIVED SIGINT ~~~~~~"
line: the hang is happened.Quoted 3 lines
A small recap:
Atom x5-E8000 CPU, Linux 5.4.255 with Ipipe 15, Xenomai 3.2.3. GCC compiler used: 9.5.0 from Yocto Dunfell 3.1.22Can you only reproduce with this setup, specifically with this compiler
version and only on real hardware? If you rather use xenomai-images and
qemu/kvm target but still the same kernel and xenomai version, the issue
does not occur?Quoted 5 lines
I'm trying in kvm right now, also with different compiler. Iit would be
good to align / rule out variables if my first setup turns out to be unhelpful.Quoted 3 lines
Hi Jan,
Sorry, I never tried on an emulated system like qemu, I did the tests
qemu/kvm - that is CPU-wise not emulated, virtualized. It generally gives similar execution patterns as on real hardware.
Quoted 8 lines
Quoted 4 lines
only on real hardware (using different samples of the same hardware, just to exclude hardware problems).
I can do a test with Xenomai images on real hardware if it would be useful.That would already be useful to rule out the toolchain as contributor, yes. When at it, testing in qemu-kvm would also be nice.
Quoted 5 lines
FWIW, I've pushed ipipe-core-5.4.281-x86-16. It's not that I expect positive impact on your issue, but you never know (until you understood the actual root cause).
Jan
Quoted 9 lines
Hi Jan,
I've seen, thank you.
I will try xenomai images on real hardware and I will back to you with results.
Thanks again, regards
Hi,
Quoted 9 lines
Quoted 5 lines
first results after some tests on real hardware:
- xenomai-image does not show the problem
- xenomai-image started with my custom kernel instead of the xenomai-image one does not show the problemHow did you build that custom kernel? Is it the same binary that failed before?
Yes, exactly the same: I took the binary from my image and copied into xenomai-image bootfs, changing the grub.cfg (because I use a bzImage instead of vmlinuz). On my custom image the problem shows up, on xenomai-image with my custom kernel no. My custom kernel is built by Yocto.
Quoted 6 lines
Quoted 3 lines
- I didn't manage to run the xenomai-image kernel with my rootfs yet (it does not start, but at the moment I have a headless system and I'm not able to debug it)
The kernel we build in xenomai-images may lack some config switches needed for you rootfs.
Yes, I have to discover which ones.
Quoted 11 lines
Quoted 6 lines
While waiting the verification with xenomai-image kernel with my rootfs, could we conclude that the problem lies in userspace then? Could be the Xenomai config flags? Or the compiler version? Do you have suggestions about other tests to run?
Until we understood the reason, we do not know where the problem lies. Your userspace may trigger something that the Debian image we build does not.
Ok, understood.
Quoted 12 lines
Quoted 7 lines
Note that the test binary is always the same in all scenarios, built with my toolchain (that is built by Yocto), and my rootfs and xenomai-image have both Xenomai v3.2.3.
Side note: xenomai-image still has 5.4.228 kernel, maybe you didn't push the upgrade patch to 5.4.281? Anyway, it seems that does not matter.
Only the next branch of xenomai-images contains the update of the released versions so far. But when you build "head of tree" kernel, you should also get that latest version.
Quoted 9 lines
Quoted 2 lines
Jan
Ok, I used the master branch to build the image.
I will keep on doing my tests, reporting further results.
Thanks
Hi,
I played a bit with QEMU and my image vs. Xenomai image, here the results:
- xenomai-image does not show the problem, both with 5.4.228 and 5.4.281 kernel (as already seen on real hardware)
- xenomai-image started with my own kernel does not show the problem (as already seen on real hardware)
- my image started with xenomai image kernel and initrd does not show the problem, both with 5.4.228 and 5.4.281 kernel (on real hardware this kind of image does not boot, I'm waiting for a board that allows me to debug why)
- my image shows the problem: the only difference with real hardware is that sometimes it takes a bit more to show up (up to 1h instead of 30 minutes max). I also observed that having some load on the host PC seems to delay the problem.
I can share with you my rootfs and my kernel, and the QEMU startup args if it would help.
Thanks in advance, regards
Signature · 1 line
Mauro S.
Quoted 168 lines · Mauro S.
Quoted 144 lines · Mauro S.
Quoted 94 lines · Jan Kiszka
Quoted 93 lines · Mauro S.
Quoted 80 lines · Mauro S.
Quoted 73 lines · Jan Kiszka
Quoted 63 lines · Jan Kiszka
Quoted 55 lines · Mauro Salvini
Il giorno lun 5 ago 2024 alle ore 14:10 Jan Kiszka <[email protected]> ha scritto:
Quoted 47 lines · Mauro S.
Quoted 33 lines
Hi Jan,
finally I managed to have a piece of code that makes the issue reproducible. It's not exactly small, but not too big either. I hope that this makes the issue reproducible also on your test system.
The zip contains:
- a little main program (test.c)
- a little library (in mylib dir). Some pieces of code are never reached, but leaved to avoid potential compiler optimizations that could
remove other relevant parts (maybe cycles?)
- a script (build.sh) to build the two components above
- a script to launch the test (start-test.sh)
- the configuration of the kernel in useAfter building the program and the library with
build.sh, you can copy
on the target:
- thestart-test.shscript
- the built program xeno-test-session-hang-on-exit
- the built library libmylib.so.2.0.0
and create the library link/usr/lib/libmylib.so.2Start the test with "./start-test.sh &" and follow what happening with
"tail -f log.txt": after a time that varies from a couple of minutes to
25-30 minutes, the log should stop on "~~~~~~ RECEIVED SIGINT ~~~~~~"
line: the hang is happened.Quoted 3 lines
A small recap:
Atom x5-E8000 CPU, Linux 5.4.255 with Ipipe 15, Xenomai 3.2.3. GCC compiler used: 9.5.0 from Yocto Dunfell 3.1.22Can you only reproduce with this setup, specifically with this compiler
version and only on real hardware? If you rather use xenomai-images and
qemu/kvm target but still the same kernel and xenomai version, the issue
does not occur?Quoted 5 lines
I'm trying in kvm right now, also with different compiler. Iit would be
good to align / rule out variables if my first setup turns out to be unhelpful.Quoted 3 lines
Hi Jan,
Sorry, I never tried on an emulated system like qemu, I did the tests
qemu/kvm - that is CPU-wise not emulated, virtualized. It generally gives similar execution patterns as on real hardware.
Quoted 8 lines
Quoted 4 lines
only on real hardware (using different samples of the same hardware, just to exclude hardware problems).
I can do a test with Xenomai images on real hardware if it would be useful.That would already be useful to rule out the toolchain as contributor, yes. When at it, testing in qemu-kvm would also be nice.
Quoted 5 lines
FWIW, I've pushed ipipe-core-5.4.281-x86-16. It's not that I expect positive impact on your issue, but you never know (until you understood the actual root cause).
Jan
Quoted 9 lines
Hi Jan,
I've seen, thank you.
I will try xenomai images on real hardware and I will back to you with results.
Thanks again, regards
Hi,
Quoted 9 lines
Quoted 5 lines
first results after some tests on real hardware:
- xenomai-image does not show the problem
- xenomai-image started with my custom kernel instead of the xenomai-image one does not show the problemHow did you build that custom kernel? Is it the same binary that failed before?
Yes, exactly the same: I took the binary from my image and copied into xenomai-image bootfs, changing the grub.cfg (because I use a bzImage instead of vmlinuz). On my custom image the problem shows up, on xenomai-image with my custom kernel no. My custom kernel is built by Yocto.
Quoted 7 lines
Quoted 4 lines
- I didn't manage to run the xenomai-image kernel with my rootfs yet (it
does not start, but at the moment I have a headless system and I'm not able to debug it)The kernel we build in xenomai-images may lack some config switches needed for you rootfs.
Yes, I have to discover which ones.
Quoted 11 lines
Quoted 6 lines
While waiting the verification with xenomai-image kernel with my rootfs, could we conclude that the problem lies in userspace then? Could be the Xenomai config flags? Or the compiler version? Do you have suggestions about other tests to run?
Until we understood the reason, we do not know where the problem lies. Your userspace may trigger something that the Debian image we build does not.
Ok, understood.
Quoted 5 lines
Quoted 5 lines
Note that the test binary is always the same in all scenarios, built with my toolchain (that is built by Yocto), and my rootfs and xenomai-image have both Xenomai v3.2.3.
Quoted 7 lines
Quoted 2 lines
Side note: xenomai-image still has 5.4.228 kernel, maybe you didn't push the upgrade patch to 5.4.281? Anyway, it seems that does not matter.
Only the next branch of xenomai-images contains the update of the released versions so far. But when you build "head of tree" kernel, you should also get that latest version.
Quoted 9 lines
> Jan
>Ok, I used the master branch to build the image.
I will keep on doing my tests, reporting further results.
Thanks
Hi,
I played a bit with QEMU and my image vs. Xenomai image, here the results:
- xenomai-image does not show the problem, both with 5.4.228 and 5.4.281
kernel (as already seen on real hardware)
- xenomai-image started with my own kernel does not show the problem (as
already seen on real hardware)
- my image started with xenomai image kernel and initrd does not show
the problem, both with 5.4.228 and 5.4.281 kernel (on real hardware this kind of image does not boot, I'm waiting for a board that allows me to debug why)
- my image shows the problem: the only difference with real hardware is
that sometimes it takes a bit more to show up (up to 1h instead of 30 minutes max). I also observed that having some load on the host PC seems to delay the problem.
Quoted 4 lines
I can share with you my rootfs and my kernel, and the QEMU startup args if it would help.
Thanks in advance, regards
Hi,
I'm back after doing more tests also on real hardware.
Here is a summary:
- custom image: kernel 5.4.255 + xenomai 3.2.3, built by Yocto Dunfell (GCC 9.5.0)
- xenomai-image: kernel 5.4.228 (and its initrd.img) + xenomai 3.2.4, built by isar in xenomai image (GCC 12.2.0)
I confirm that the problem shows only with my own kernel + rootfs, both on QEMU and on real hardware. Other combinations:
- xenomai-image kernel (and its initrd.img) + xenomai-image rootfs
- xenomai-image kernel (and its initrd.img) + my rootfs
- my kernel + xenomai-image rootfs
don't show the problem, both on QEMU and on real hardware.
Furthermore, I compiled the xenomai-image kernel forcing the 5.4.255 version and using my defconfig: the kernel became identical to mine, then I expected to see the problem using this kernel with my rootfs. But -surprise- the problem does NOT show.
xenomai-image uses xenomai 3.2.4, but I don't see relevant changes between 3.2.4 and 3.2.3 (mine) in code linked into kernel sources. Then, could really the problem be triggered by the GCC compiler version used to build the kernel OR the rootfs?
Actually, my kernel with the xenomai-image rootfs does not show the problem, then seems that the problem shows only when using GCC 9.5.0 on both sides.
Or is it a dormant bug that some versions of GCC hide?
I can share with you my rootfs and my kernel and the QEMU startup args, or other things that could help you, and I'm open to suggestions about other tests to do.
Thanks in advance, regards
Signature · 1 line
Mauro S.
Quoted 31 lines · Mauro S.
Hi,
I'm back after doing more tests also on real hardware.
Here is a summary:
- custom image: kernel 5.4.255 + xenomai 3.2.3, built by Yocto Dunfell (GCC 9.5.0)
- xenomai-image: kernel 5.4.228 (and its initrd.img) + xenomai 3.2.4, built by isar in xenomai image (GCC 12.2.0)I confirm that the problem shows only with my own kernel + rootfs, both on QEMU and on real hardware.
Other combinations:
- xenomai-image kernel (and its initrd.img) + xenomai-image rootfs
- xenomai-image kernel (and its initrd.img) + my rootfs
- my kernel + xenomai-image rootfs
don't show the problem, both on QEMU and on real hardware.Furthermore, I compiled the xenomai-image kernel forcing the 5.4.255 version and using my defconfig: the kernel became identical to mine, then I expected to see the problem using this kernel with my rootfs. But -surprise- the problem does NOT show.
xenomai-image uses xenomai 3.2.4, but I don't see relevant changes between 3.2.4 and 3.2.3 (mine) in code linked into kernel sources. Then, could really the problem be triggered by the GCC compiler version used to build the kernel OR the rootfs?
Actually, my kernel with the xenomai-image rootfs does not show the problem, then seems that the problem shows only when using GCC 9.5.0 on both sides.
Quoted 2 lines
Or is it a dormant bug that some versions of GCC hide?
One option. Did you already try switching to a different, likely newer toolchain while keeping the rest?
But it could also be that the compiler brings in some noise to a rather narrow race window, widening it so that it becomes much more likely to be hit.
Quoted 3 lines
I can share with you my rootfs and my kernel and the QEMU startup args, or other things that could help you, and I'm open to suggestions about other tests to do.
Problem may be that we will have to be able to reproduce variations of both in order to try out instrumentations.
I'm also still puzzled that it takes both your self-built kernel and userland to trigger the issue. We only have similar but not identical code for both when it comes to xnsync_fast_*. Hmm, maybe it is worth to compare the disassembly of lib/cobalt/internal.o...
Jan
Signature · 2 lines
Siemens AG, Technology Linux Expert Center
Quoted 32 lines · Jan Kiszka
Quoted 31 lines · Mauro S.
Hi,
I'm back after doing more tests also on real hardware.
Here is a summary:
- custom image: kernel 5.4.255 + xenomai 3.2.3, built by Yocto Dunfell (GCC 9.5.0)
- xenomai-image: kernel 5.4.228 (and its initrd.img) + xenomai 3.2.4, built by isar in xenomai image (GCC 12.2.0)I confirm that the problem shows only with my own kernel + rootfs, both on QEMU and on real hardware.
Other combinations:
- xenomai-image kernel (and its initrd.img) + xenomai-image rootfs
- xenomai-image kernel (and its initrd.img) + my rootfs
- my kernel + xenomai-image rootfs
don't show the problem, both on QEMU and on real hardware.Furthermore, I compiled the xenomai-image kernel forcing the 5.4.255 version and using my defconfig: the kernel became identical to mine, then I expected to see the problem using this kernel with my rootfs. But -surprise- the problem does NOT show.
xenomai-image uses xenomai 3.2.4, but I don't see relevant changes between 3.2.4 and 3.2.3 (mine) in code linked into kernel sources. Then, could really the problem be triggered by the GCC compiler version used to build the kernel OR the rootfs?
Actually, my kernel with the xenomai-image rootfs does not show the problem, then seems that the problem shows only when using GCC 9.5.0 on both sides.
Quoted 6 lines
Quoted 2 lines
Or is it a dormant bug that some versions of GCC hide?
One option. Did you already try switching to a different, likely newer toolchain while keeping the rest?
No, for the moment: I should port the whole custom meta layer (that contains kernel and xenomai recipes) to a recent Yocto version. This means that also other userspace components will change: would that influence our testing?
Quoted 10 lines
But it could also be that the compiler brings in some noise to a rather narrow race window, widening it so that it becomes much more likely to be hit.
Quoted 3 lines
I can share with you my rootfs and my kernel and the QEMU startup args, or other things that could help you, and I'm open to suggestions about other tests to do.
Problem may be that we will have to be able to reproduce variations of both in order to try out instrumentations.
Right, I overlooked this aspect.
Quoted 5 lines
I'm also still puzzled that it takes both your self-built kernel and userland to trigger the issue. We only have similar but not identical code for both when it comes to xnsync_fast_*. Hmm, maybe it is worth to compare the disassembly of
lib/cobalt/internal.o...
Yes, this really puzzles me too.
Attached the disassembly (obtained with objdump -dSlf) of the two libcobalt.so.2.0.0, with the two libraries too.
Thank you
Signature · 1 line
Mauro S.
Quoted 59 lines · Mauro S.
Quoted 32 lines · Jan Kiszka
Quoted 31 lines · Mauro S.
Hi,
I'm back after doing more tests also on real hardware.
Here is a summary:
- custom image: kernel 5.4.255 + xenomai 3.2.3, built by Yocto Dunfell (GCC 9.5.0)
- xenomai-image: kernel 5.4.228 (and its initrd.img) + xenomai 3.2.4, built by isar in xenomai image (GCC 12.2.0)I confirm that the problem shows only with my own kernel + rootfs, both on QEMU and on real hardware.
Other combinations:
- xenomai-image kernel (and its initrd.img) + xenomai-image rootfs
- xenomai-image kernel (and its initrd.img) + my rootfs
- my kernel + xenomai-image rootfs
don't show the problem, both on QEMU and on real hardware.Furthermore, I compiled the xenomai-image kernel forcing the 5.4.255 version and using my defconfig: the kernel became identical to mine, then I expected to see the problem using this kernel with my rootfs. But -surprise- the problem does NOT show.
xenomai-image uses xenomai 3.2.4, but I don't see relevant changes between 3.2.4 and 3.2.3 (mine) in code linked into kernel sources. Then, could really the problem be triggered by the GCC compiler version used to build the kernel OR the rootfs?
Actually, my kernel with the xenomai-image rootfs does not show the problem, then seems that the problem shows only when using GCC 9.5.0 on both sides.Quoted 6 lines
Quoted 2 lines
Or is it a dormant bug that some versions of GCC hide?
One option. Did you already try switching to a different, likely newer toolchain while keeping the rest?
No, for the moment: I should port the whole custom meta layer (that contains kernel and xenomai recipes) to a recent Yocto version. This means that also other userspace components will change: would that influence our testing?
Quoted 10 lines
But it could also be that the compiler brings in some noise to a rather narrow race window, widening it so that it becomes much more likely to be hit.
Quoted 3 lines
I can share with you my rootfs and my kernel and the QEMU startup args, or other things that could help you, and I'm open to suggestions about other tests to do.
Problem may be that we will have to be able to reproduce variations of both in order to try out instrumentations.
Right, I overlooked this aspect.
Quoted 1 line
Quoted 9 lines
Quoted 4 lines
I'm also still puzzled that it takes both your self-built kernel and userland to trigger the issue. We only have similar but not identical code for both when it comes to xnsync_fast_*. Hmm, maybe it is worth to compare the disassembly of
lib/cobalt/internal.o...Yes, this really puzzles me too.
Attached the disassembly (obtained with objdump -dSlf) of the two libcobalt.so.2.0.0, with the two libraries too.
There seems to be a difference between the two toolchains in the selected TLS models. Could you check for both CONFIG_XENO_TLS_MODEL in include/xeno_config.h?
Jan
Signature · 2 lines
Siemens AG, Technology Linux Expert Center
Quoted 65 lines · Jan Kiszka
Quoted 64 lines · Mauro S.
Quoted 32 lines · Jan Kiszka
Quoted 31 lines · Mauro S.
Hi,
I'm back after doing more tests also on real hardware.
Here is a summary:
- custom image: kernel 5.4.255 + xenomai 3.2.3, built by Yocto Dunfell (GCC 9.5.0)
- xenomai-image: kernel 5.4.228 (and its initrd.img) + xenomai 3.2.4, built by isar in xenomai image (GCC 12.2.0)I confirm that the problem shows only with my own kernel + rootfs, both on QEMU and on real hardware.
Other combinations:
- xenomai-image kernel (and its initrd.img) + xenomai-image rootfs
- xenomai-image kernel (and its initrd.img) + my rootfs
- my kernel + xenomai-image rootfs
don't show the problem, both on QEMU and on real hardware.Furthermore, I compiled the xenomai-image kernel forcing the 5.4.255 version and using my defconfig: the kernel became identical to mine, then I expected to see the problem using this kernel with my rootfs. But -surprise- the problem does NOT show.
xenomai-image uses xenomai 3.2.4, but I don't see relevant changes between 3.2.4 and 3.2.3 (mine) in code linked into kernel sources. Then, could really the problem be triggered by the GCC compiler version used to build the kernel OR the rootfs?
Actually, my kernel with the xenomai-image rootfs does not show the problem, then seems that the problem shows only when using GCC 9.5.0 on both sides.Quoted 6 lines
Quoted 2 lines
Or is it a dormant bug that some versions of GCC hide?
One option. Did you already try switching to a different, likely newer toolchain while keeping the rest?
No, for the moment: I should port the whole custom meta layer (that contains kernel and xenomai recipes) to a recent Yocto version. This means that also other userspace components will change: would that influence our testing?
Quoted 10 lines
But it could also be that the compiler brings in some noise to a rather narrow race window, widening it so that it becomes much more likely to be hit.
Quoted 3 lines
I can share with you my rootfs and my kernel and the QEMU startup args, or other things that could help you, and I'm open to suggestions about other tests to do.
Problem may be that we will have to be able to reproduce variations of both in order to try out instrumentations.
Right, I overlooked this aspect.
Quoted 5 lines
I'm also still puzzled that it takes both your self-built kernel and userland to trigger the issue. We only have similar but not identical code for both when it comes to xnsync_fast_*. Hmm, maybe it is worth to compare the disassembly of
lib/cobalt/internal.o...
Quoted 9 lines
Quoted 4 lines
Yes, this really puzzles me too.
Attached the disassembly (obtained with objdump -dSlf) of the two libcobalt.so.2.0.0, with the two libraries too.There seems to be a difference between the two toolchains in the selected TLS models. Could you check for both
CONFIG_XENO_TLS_MODELininclude/xeno_config.h?
Yes sure.
GCC 9.5.0:
#define CONFIG_XENO_TLS_MODEL "initial-exec"
GCC 12.2.0:
#define CONFIG_XENO_TLS_MODEL "global-dynamic"
(I got this from build/tmp/schroot-overlay/isar-builder-.... in xenomai-images build)
For completeness of information, in my Xenomai recipe I have the following configuration flags
--with-core=cobalt --enable-smp --enable-pshared --enable-debug=symbols
Thanks, regards
Signature · 1 line
Mauro S.
Quoted 91 lines · Mauro S.
Quoted 70 lines · Jan Kiszka
Quoted 69 lines · Mauro S.
Quoted 36 lines · Jan Kiszka
Quoted 35 lines · Mauro S.
Hi,
I'm back after doing more tests also on real hardware.
Here is a summary:
- custom image: kernel 5.4.255 + xenomai 3.2.3, built by Yocto Dunfell (GCC 9.5.0)
- xenomai-image: kernel 5.4.228 (and its initrd.img) + xenomai 3.2.4, built by isar in xenomai image (GCC 12.2.0)I confirm that the problem shows only with my own kernel + rootfs, both
on QEMU and on real hardware.
Other combinations:
- xenomai-image kernel (and its initrd.img) + xenomai-image rootfs
- xenomai-image kernel (and its initrd.img) + my rootfs
- my kernel + xenomai-image rootfs
don't show the problem, both on QEMU and on real hardware.Furthermore, I compiled the xenomai-image kernel forcing the 5.4.255 version and using my defconfig: the kernel became identical to mine, then I expected to see the problem using this kernel with my rootfs. But
-surprise- the problem does NOT show.xenomai-image uses xenomai 3.2.4, but I don't see relevant changes between 3.2.4 and 3.2.3 (mine) in code linked into kernel sources. Then, could really the problem be triggered by the GCC compiler version
used to build the kernel OR the rootfs?
Actually, my kernel with the xenomai-image rootfs does not show the problem, then seems that the problem shows only when using GCC 9.5.0 on
both sides.Quoted 6 lines
Quoted 2 lines
Or is it a dormant bug that some versions of GCC hide?
One option. Did you already try switching to a different, likely newer toolchain while keeping the rest?
No, for the moment: I should port the whole custom meta layer (that contains kernel and xenomai recipes) to a recent Yocto version. This means that also other userspace components will change: would that influence our testing?
Quoted 11 lines
But it could also be that the compiler brings in some noise to a rather narrow race window, widening it so that it becomes much more likely to be hit.
Quoted 4 lines
I can share with you my rootfs and my kernel and the QEMU startup args,
or other things that could help you, and I'm open to suggestions about other tests to do.Problem may be that we will have to be able to reproduce variations of both in order to try out instrumentations.
Right, I overlooked this aspect.
Quoted 5 lines
I'm also still puzzled that it takes both your self-built kernel and userland to trigger the issue. We only have similar but not identical code for both when it comes to xnsync_fast_*. Hmm, maybe it is worth to compare the disassembly of
lib/cobalt/internal.o...Quoted 9 lines
Quoted 4 lines
Yes, this really puzzles me too.
Attached the disassembly (obtained with objdump -dSlf) of the two libcobalt.so.2.0.0, with the two libraries too.There seems to be a difference between the two toolchains in the selected TLS models. Could you check for both
CONFIG_XENO_TLS_MODELininclude/xeno_config.h?Yes sure.
GCC 9.5.0:
#defineCONFIG_XENO_TLS_MODEL"initial-exec"GCC 12.2.0:
#defineCONFIG_XENO_TLS_MODEL"global-dynamic"
(I got this from build/tmp/schroot-overlay/isar-builder-.... in xenomai-images build)
Quoted 5 lines
For completeness of information, in my Xenomai recipe I have the following configuration flags
--with-core=cobalt --enable-smp --enable-pshared --enable-debug=symbols
OK, and does the issue disappear with your setup when you add --enable-dlopen-libs?
But it still did no make it appear on my setup when I removed it. We might be unlucky that there are multiple parameters with the right value needed.
Jan
Signature · 2 lines
Siemens AG, Technology Linux Expert Center
Quoted 92 lines · Jan Kiszka
Quoted 91 lines · Mauro S.
Quoted 70 lines · Jan Kiszka
Quoted 69 lines · Mauro S.
Quoted 36 lines · Jan Kiszka
Quoted 35 lines · Mauro S.
Hi,
I'm back after doing more tests also on real hardware.
Here is a summary:
- custom image: kernel 5.4.255 + xenomai 3.2.3, built by Yocto Dunfell (GCC 9.5.0)
- xenomai-image: kernel 5.4.228 (and its initrd.img) + xenomai 3.2.4, built by isar in xenomai image (GCC 12.2.0)I confirm that the problem shows only with my own kernel + rootfs, both
on QEMU and on real hardware.
Other combinations:
- xenomai-image kernel (and its initrd.img) + xenomai-image rootfs
- xenomai-image kernel (and its initrd.img) + my rootfs
- my kernel + xenomai-image rootfs
don't show the problem, both on QEMU and on real hardware.Furthermore, I compiled the xenomai-image kernel forcing the 5.4.255 version and using my defconfig: the kernel became identical to mine, then I expected to see the problem using this kernel with my rootfs. But
-surprise- the problem does NOT show.xenomai-image uses xenomai 3.2.4, but I don't see relevant changes between 3.2.4 and 3.2.3 (mine) in code linked into kernel sources. Then, could really the problem be triggered by the GCC compiler version
used to build the kernel OR the rootfs?
Actually, my kernel with the xenomai-image rootfs does not show the problem, then seems that the problem shows only when using GCC 9.5.0 on
both sides.Quoted 6 lines
Quoted 2 lines
Or is it a dormant bug that some versions of GCC hide?
One option. Did you already try switching to a different, likely newer toolchain while keeping the rest?
No, for the moment: I should port the whole custom meta layer (that contains kernel and xenomai recipes) to a recent Yocto version. This means that also other userspace components will change: would that influence our testing?
Quoted 11 lines
But it could also be that the compiler brings in some noise to a rather narrow race window, widening it so that it becomes much more likely to be hit.
Quoted 4 lines
I can share with you my rootfs and my kernel and the QEMU startup args,
or other things that could help you, and I'm open to suggestions about other tests to do.Problem may be that we will have to be able to reproduce variations of both in order to try out instrumentations.
Right, I overlooked this aspect.
Quoted 5 lines
I'm also still puzzled that it takes both your self-built kernel and userland to trigger the issue. We only have similar but not identical code for both when it comes to xnsync_fast_*. Hmm, maybe it is worth to compare the disassembly of
lib/cobalt/internal.o...Quoted 9 lines
Quoted 4 lines
Yes, this really puzzles me too.
Attached the disassembly (obtained with objdump -dSlf) of the two libcobalt.so.2.0.0, with the two libraries too.There seems to be a difference between the two toolchains in the selected TLS models. Could you check for both
CONFIG_XENO_TLS_MODELininclude/xeno_config.h?Yes sure.
GCC 9.5.0:
#defineCONFIG_XENO_TLS_MODEL"initial-exec"GCC 12.2.0:
#defineCONFIG_XENO_TLS_MODEL"global-dynamic"
(I got this from build/tmp/schroot-overlay/isar-builder-.... in xenomai-images build)
Quoted 9 lines
Quoted 5 lines
For completeness of information, in my Xenomai recipe I have the following configuration flags
--with-core=cobalt --enable-smp --enable-pshared --enable-debug=symbols
OK, and does the issue disappear with your setup when you add --enable-dlopen-libs?
I added --enable-dlopen-libs to the recipe (rebuilding the rootfs and the toolcain and recompiling the test application with the new toolchain), but the problem still happen. Maybe it takes a bit more time (about 30 minutes) but it happens.
Quoted 4 lines
But it still did no make it appear on my setup when I removed it. We might be unlucky that there are multiple parameters with the right value needed.
Yes, probably we are unlucky.
Anyway, the whole config flags passed by Yocto to Xenomai lib's configure is:
--build=x86_64-linux --host=x86_64-smitec2-linux --target=x86_64-smitec2-linux --prefix=/usr --exec_prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --libexecdir=/usr/libexec --datadir=/usr/share --sysconfdir=/etc --sharedstatedir=/com --localstatedir=/var --libdir=/usr/lib --includedir=/usr/include/xenomai --oldincludedir=/usr/include --infodir=/usr/share/info --mandir=/usr/share/man --disable-silent-rules --with-libtool-sysroot=/opt/yocto/dunfell-x86_64/build-/tmp/work/corei7-64-poky-linux/xenomai/3.2.3-r1/recipe-sysroot --with-core=cobalt --enable-smp --enable-pshared --enable-debug=symbols --enable-dlopen-libs --disable-static
Thanks, regards
Signature · 1 line
Mauro S.
Quoted 126 lines · Mauro S.
Quoted 97 lines · Jan Kiszka
Quoted 96 lines · Mauro S.
Quoted 72 lines · Jan Kiszka
Quoted 71 lines · Mauro S.
Quoted 38 lines · Jan Kiszka
Quoted 37 lines · Mauro S.
Hi,
I'm back after doing more tests also on real hardware.
Here is a summary:
- custom image: kernel 5.4.255 + xenomai 3.2.3, built by Yocto Dunfell
(GCC 9.5.0)
- xenomai-image: kernel 5.4.228 (and its initrd.img) + xenomai 3.2.4,
built by isar in xenomai image (GCC 12.2.0)I confirm that the problem shows only with my own kernel + rootfs, both
on QEMU and on real hardware.
Other combinations:
- xenomai-image kernel (and its initrd.img) + xenomai-image rootfs
- xenomai-image kernel (and its initrd.img) + my rootfs
- my kernel + xenomai-image rootfs
don't show the problem, both on QEMU and on real hardware.Furthermore, I compiled the xenomai-image kernel forcing the 5.4.255 version and using my defconfig: the kernel became identical to mine, then I expected to see the problem using this kernel with my rootfs. But
-surprise- the problem does NOT show.xenomai-image uses xenomai 3.2.4, but I don't see relevant changes between 3.2.4 and 3.2.3 (mine) in code linked into kernel sources. Then, could really the problem be triggered by the GCC compiler version
used to build the kernel OR the rootfs?
Actually, my kernel with the xenomai-image rootfs does not show the problem, then seems that the problem shows only when using GCC 9.5.0 on
both sides.Quoted 6 lines
Quoted 2 lines
Or is it a dormant bug that some versions of GCC hide?
One option. Did you already try switching to a different, likely newer toolchain while keeping the rest?
No, for the moment: I should port the whole custom meta layer (that contains kernel and xenomai recipes) to a recent Yocto version. This means that also other userspace components will change: would that influence our testing?
Quoted 11 lines
But it could also be that the compiler brings in some noise to a rather narrow race window, widening it so that it becomes much more likely to be hit.
Quoted 4 lines
I can share with you my rootfs and my kernel and the QEMU startup args,
or other things that could help you, and I'm open to suggestions about other tests to do.Problem may be that we will have to be able to reproduce variations of both in order to try out instrumentations.
Right, I overlooked this aspect.
Quoted 5 lines
I'm also still puzzled that it takes both your self-built kernel and userland to trigger the issue. We only have similar but not identical code for both when it comes to xnsync_fast_*. Hmm, maybe it is worth to compare the disassembly of
lib/cobalt/internal.o...Quoted 9 lines
Quoted 4 lines
Yes, this really puzzles me too.
Attached the disassembly (obtained with objdump -dSlf) of the two libcobalt.so.2.0.0, with the two libraries too.There seems to be a difference between the two toolchains in the selected TLS models. Could you check for both
CONFIG_XENO_TLS_MODELininclude/xeno_config.h?Yes sure.
GCC 9.5.0:
#defineCONFIG_XENO_TLS_MODEL"initial-exec"GCC 12.2.0:
#defineCONFIG_XENO_TLS_MODEL"global-dynamic"
(I got this from build/tmp/schroot-overlay/isar-builder-.... in xenomai-images build)For completeness of information, in my Xenomai recipe I have the following configuration flags
Quoted 7 lines
Quoted 3 lines
--with-core=cobalt --enable-smp --enable-pshared --enable-debug=symbols
OK, and does the issue disappear with your setup when you add --enable-dlopen-libs?
I added --enable-dlopen-libs to the recipe (rebuilding the rootfs and the toolcain and recompiling the test application with the new toolchain), but the problem still happen. Maybe it takes a bit more time (about 30 minutes) but it happens.
Quoted 4 lines
But it still did no make it appear on my setup when I removed it. We might be unlucky that there are multiple parameters with the right value needed.
Yes, probably we are unlucky.
Anyway, the whole config flags passed by Yocto to Xenomai lib's configure is:
--build=x86_64-linux --host=x86_64-smitec2-linux
--target=x86_64-smitec2-linux --prefix=/usr --exec_prefix=/usr
--bindir=/usr/bin --sbindir=/usr/sbin --libexecdir=/usr/libexec
--datadir=/usr/share --sysconfdir=/etc --sharedstatedir=/com
--localstatedir=/var --libdir=/usr/lib --includedir=/usr/include/xenomai
--oldincludedir=/usr/include --infodir=/usr/share/info
--mandir=/usr/share/man --disable-silent-rules
--with-libtool-sysroot=/opt/yocto/dunfell-x86_64/build-/tmp/work/corei7-64-poky-linux/xenomai/3.2.3-r1/recipe-sysroot --with-core=cobalt --enable-smp --enable-pshared --enable-debug=symbols --enable-dlopen-libs --disable-static
Quoted 2 lines
Thanks, regards
Hi all,
I made a "minimal" Yocto setup that allows to build an image which in Qemu shows the problem.
Yocto image is built into a docker container, to allow the maximum reproducibility. Test application is compiled by the SDK generated from the same Yocto.
If it could be useful to reproduce on your side the problem, I can share the Yocto setup, and the Qemu start script to run the image.
Thanks in advance, regards
Signature · 1 line
Mauro S.
Quoted 149 lines · Mauro S.
Quoted 140 lines · Mauro S.
Quoted 106 lines · Jan Kiszka
Quoted 105 lines · Mauro S.
Quoted 81 lines · Jan Kiszka
Quoted 80 lines · Mauro S.
Quoted 40 lines · Jan Kiszka
Quoted 39 lines · Mauro S.
Hi,
I'm back after doing more tests also on real hardware.
Here is a summary:
- custom image: kernel 5.4.255 + xenomai 3.2.3, built by Yocto Dunfell
(GCC 9.5.0)
- xenomai-image: kernel 5.4.228 (and its initrd.img) + xenomai 3.2.4,
built by isar in xenomai image (GCC 12.2.0)I confirm that the problem shows only with my own kernel + rootfs, both
on QEMU and on real hardware.
Other combinations:
- xenomai-image kernel (and its initrd.img) + xenomai-image rootfs
- xenomai-image kernel (and its initrd.img) + my rootfs
- my kernel + xenomai-image rootfs
don't show the problem, both on QEMU and on real hardware.Furthermore, I compiled the xenomai-image kernel forcing the 5.4.255
version and using my defconfig: the kernel became identical to mine,
then I expected to see the problem using this kernel with my rootfs. But
-surprise- the problem does NOT show.xenomai-image uses xenomai 3.2.4, but I don't see relevant changes between 3.2.4 and 3.2.3 (mine) in code linked into kernel sources. Then, could really the problem be triggered by the GCC compiler version
used to build the kernel OR the rootfs?
Actually, my kernel with the xenomai-image rootfs does not show the problem, then seems that the problem shows only when using GCC 9.5.0 on
both sides.Quoted 7 lines
Quoted 2 lines
Or is it a dormant bug that some versions of GCC hide?
One option. Did you already try switching to a different, likely newer
toolchain while keeping the rest?No, for the moment: I should port the whole custom meta layer (that contains kernel and xenomai recipes) to a recent Yocto version. This means that also other userspace components will change: would that influence our testing?
Quoted 12 lines
But it could also be that the compiler brings in some noise to a rather
narrow race window, widening it so that it becomes much more likely to
be hit.Quoted 5 lines
I can share with you my rootfs and my kernel and the QEMU startup args,
or other things that could help you, and I'm open to suggestions about
other tests to do.Quoted 3 lines
Problem may be that we will have to be able to reproduce variations of
both in order to try out instrumentations.Right, I overlooked this aspect.
Quoted 7 lines
I'm also still puzzled that it takes both your self-built kernel and userland to trigger the issue. We only have similar but not identical
code for both when it comes to xnsync_fast_*. Hmm, maybe it is worth to
compare the disassembly oflib/cobalt/internal.o...Quoted 9 lines
Quoted 4 lines
Yes, this really puzzles me too.
Attached the disassembly (obtained with objdump -dSlf) of the two libcobalt.so.2.0.0, with the two libraries too.There seems to be a difference between the two toolchains in the selected TLS models. Could you check for both
CONFIG_XENO_TLS_MODELininclude/xeno_config.h?Yes sure.
GCC 9.5.0:
#defineCONFIG_XENO_TLS_MODEL"initial-exec"GCC 12.2.0:
#defineCONFIG_XENO_TLS_MODEL"global-dynamic"
(I got this from build/tmp/schroot-overlay/isar-builder-.... in xenomai-images build)For completeness of information, in my Xenomai recipe I have the following configuration flags
Quoted 7 lines
Quoted 3 lines
--with-core=cobalt --enable-smp --enable-pshared --enable-debug=symbols
OK, and does the issue disappear with your setup when you add --enable-dlopen-libs?
I added --enable-dlopen-libs to the recipe (rebuilding the rootfs and the toolcain and recompiling the test application with the new toolchain), but the problem still happen. Maybe it takes a bit more time (about 30 minutes) but it happens.
Quoted 4 lines
But it still did no make it appear on my setup when I removed it. We might be unlucky that there are multiple parameters with the right value needed.
Yes, probably we are unlucky.
Anyway, the whole config flags passed by Yocto to Xenomai lib's configure is:
--build=x86_64-linux --host=x86_64-smitec2-linux
--target=x86_64-smitec2-linux --prefix=/usr --exec_prefix=/usr
--bindir=/usr/bin --sbindir=/usr/sbin --libexecdir=/usr/libexec
--datadir=/usr/share --sysconfdir=/etc --sharedstatedir=/com
--localstatedir=/var --libdir=/usr/lib
--includedir=/usr/include/xenomai --oldincludedir=/usr/include
--infodir=/usr/share/info --mandir=/usr/share/man
--disable-silent-rules
--with-libtool-sysroot=/opt/yocto/dunfell-x86_64/build-/tmp/work/corei7-64-poky-linux/xenomai/3.2.3-r1/recipe-sysroot --with-core=cobalt --enable-smp --enable-pshared --enable-debug=symbols --enable-dlopen-libs --disable-staticQuoted 2 lines
Thanks, regards
Hi all,
I made a "minimal" Yocto setup that allows to build an image which in Qemu shows the problem.
Quoted 6 lines
Yocto image is built into a docker container, to allow the maximum reproducibility. Test application is compiled by the SDK generated from the same Yocto.
If it could be useful to reproduce on your side the problem, I can share the Yocto setup, and the Qemu start script to run the image.
Sure - provided you used kas ;)
(just joking, I can translate myself)
Jan
Signature · 2 lines
Siemens AG, Technology Linux Expert Center
Quoted 154 lines · Jan Kiszka
Quoted 153 lines · Mauro S.
Quoted 140 lines · Mauro S.
Quoted 106 lines · Jan Kiszka
Quoted 105 lines · Mauro S.
Quoted 81 lines · Jan Kiszka
Quoted 80 lines · Mauro S.
Quoted 40 lines · Jan Kiszka
Quoted 39 lines · Mauro S.
Hi,
I'm back after doing more tests also on real hardware.
Here is a summary:
- custom image: kernel 5.4.255 + xenomai 3.2.3, built by Yocto Dunfell
(GCC 9.5.0)
- xenomai-image: kernel 5.4.228 (and its initrd.img) + xenomai 3.2.4,
built by isar in xenomai image (GCC 12.2.0)I confirm that the problem shows only with my own kernel + rootfs, both
on QEMU and on real hardware.
Other combinations:
- xenomai-image kernel (and its initrd.img) + xenomai-image rootfs
- xenomai-image kernel (and its initrd.img) + my rootfs
- my kernel + xenomai-image rootfs
don't show the problem, both on QEMU and on real hardware.Furthermore, I compiled the xenomai-image kernel forcing the 5.4.255
version and using my defconfig: the kernel became identical to mine,
then I expected to see the problem using this kernel with my rootfs. But
-surprise- the problem does NOT show.xenomai-image uses xenomai 3.2.4, but I don't see relevant changes between 3.2.4 and 3.2.3 (mine) in code linked into kernel sources. Then, could really the problem be triggered by the GCC compiler version
used to build the kernel OR the rootfs?
Actually, my kernel with the xenomai-image rootfs does not show the problem, then seems that the problem shows only when using GCC 9.5.0 on
both sides.Quoted 7 lines
Quoted 2 lines
Or is it a dormant bug that some versions of GCC hide?
One option. Did you already try switching to a different, likely newer
toolchain while keeping the rest?No, for the moment: I should port the whole custom meta layer (that contains kernel and xenomai recipes) to a recent Yocto version. This means that also other userspace components will change: would that influence our testing?
Quoted 12 lines
But it could also be that the compiler brings in some noise to a rather
narrow race window, widening it so that it becomes much more likely to
be hit.Quoted 5 lines
I can share with you my rootfs and my kernel and the QEMU startup args,
or other things that could help you, and I'm open to suggestions about
other tests to do.Quoted 3 lines
Problem may be that we will have to be able to reproduce variations of
both in order to try out instrumentations.Right, I overlooked this aspect.
Quoted 7 lines
I'm also still puzzled that it takes both your self-built kernel and userland to trigger the issue. We only have similar but not identical
code for both when it comes to xnsync_fast_*. Hmm, maybe it is worth to
compare the disassembly oflib/cobalt/internal.o...Quoted 9 lines
Quoted 4 lines
Yes, this really puzzles me too.
Attached the disassembly (obtained with objdump -dSlf) of the two libcobalt.so.2.0.0, with the two libraries too.There seems to be a difference between the two toolchains in the selected TLS models. Could you check for both
CONFIG_XENO_TLS_MODELininclude/xeno_config.h?Yes sure.
GCC 9.5.0:
#defineCONFIG_XENO_TLS_MODEL"initial-exec"GCC 12.2.0:
#defineCONFIG_XENO_TLS_MODEL"global-dynamic"
(I got this from build/tmp/schroot-overlay/isar-builder-.... in xenomai-images build)For completeness of information, in my Xenomai recipe I have the following configuration flags
Quoted 7 lines
Quoted 3 lines
--with-core=cobalt --enable-smp --enable-pshared
--enable-debug=symbolsOK, and does the issue disappear with your setup when you add --enable-dlopen-libs?
I added --enable-dlopen-libs to the recipe (rebuilding the rootfs and the toolcain and recompiling the test application with the new toolchain), but the problem still happen. Maybe it takes a bit more time (about 30 minutes) but it happens.
Quoted 4 lines
But it still did no make it appear on my setup when I removed it. We might be unlucky that there are multiple parameters with the right value needed.
Yes, probably we are unlucky.
Anyway, the whole config flags passed by Yocto to Xenomai lib's configure is:
--build=x86_64-linux --host=x86_64-smitec2-linux
--target=x86_64-smitec2-linux --prefix=/usr --exec_prefix=/usr
--bindir=/usr/bin --sbindir=/usr/sbin --libexecdir=/usr/libexec
--datadir=/usr/share --sysconfdir=/etc --sharedstatedir=/com
--localstatedir=/var --libdir=/usr/lib
--includedir=/usr/include/xenomai --oldincludedir=/usr/include
--infodir=/usr/share/info --mandir=/usr/share/man
--disable-silent-rules
--with-libtool-sysroot=/opt/yocto/dunfell-x86_64/build-/tmp/work/corei7-64-poky-linux/xenomai/3.2.3-r1/recipe-sysroot --with-core=cobalt --enable-smp --enable-pshared --enable-debug=symbols --enable-dlopen-libs --disable-staticQuoted 2 lines
Thanks, regards
Hi all,
I made a "minimal" Yocto setup that allows to build an image which in Qemu shows the problem.
Yocto image is built into a docker container, to allow the maximum reproducibility. Test application is compiled by the SDK generated from the same Yocto.
Quoted 6 lines
Quoted 2 lines
If it could be useful to reproduce on your side the problem, I can share the Yocto setup, and the Qemu start script to run the image.
Sure - provided you used kas ;)
(just joking, I can translate myself)
Sorry, I was in a rush, I had no time to arrange a kas setup :-) But I would have liked to do it.
I'm sending you all the information privately.
Thank you
Signature · 1 line
Mauro S.