stalled xeno domain
Hi Philippe,
debugging is nice, tracing is still nicer. As you suggested, I extended the tracer with per-domain stall flags (needs some output clean-up, preliminary patch attached nevertheless).
And here is the result (full trace attached):
Quoted 42 lines
:| (0x51) 0x000000c8 -1113+ 1.112 __ipipe_sync_stage+0x142 (ipipe_suspend_domain+0x56) :| fn -1112+ 1.789 __ipipe_sync_stage+0xe (ipipe_suspend_domain+0x56) :| *(0x50) 0x00000064 -1110+ 1.293 __ipipe_sync_stage+0x97 (ipipe_suspend_domain+0x56) : *fn -1109+ 1.398 do_IRQ+0x8 (__ipipe_sync_stage+0xcf) : *fn -1107+ 2.105 __do_IRQ+0xc (do_IRQ+0x21) : *fn -1105+ 1.631 handle_IRQ_event+0xd (__do_IRQ+0x9e) : *fn -1104+ 2.413 timer_interrupt+0x9 (handle_IRQ_event+0x40) : *fn -1101+ 3.022 mark_offset_tsc+0xe (timer_interrupt+0x31) : *fn -1098+ 2.721 do_timer+0x9 (timer_interrupt+0x37) :| *fn -1096+ 2.112 __ipipe_handle_irq+0xe (common_interrupt+0x18) :| *fn -1093+ 1.210 __ipipe_ack_common_irq+0xc (__ipipe_handle_irq+0xc0) :| *(0x50) 0x00000064 -1092+ 1.218 __ipipe_ack_common_irq+0x31 (__ipipe_handle_irq+0xc0) :| *fn -1091+ 1.834 mask_and_ack_8259A+0xb (__ipipe_ack_common_irq+0x5d) :| *(0x50) 0x00000064 -1089+ 1.345 __ipipe_ack_common_irq+0x9d (__ipipe_handle_irq+0xc0) :| *fn -1088 0.924 ipipe_suspend_domain+0xb (__ipipe_handle_irq+0x174) :| *(0x51) 0x000000c8 -1087+ 1.172 ipipe_suspend_domain+0x26 (__ipipe_handle_irq+0x174) :| *fn -1086+ 2.030 __ipipe_sync_stage+0xe (ipipe_suspend_domain+0x56) :| **(0x50) 0x000000c8 -1084+ 1.330 __ipipe_sync_stage+0x97 (ipipe_suspend_domain+0x56) :| **fn -1082 0.879 xnintr_clock_handler+0x8 (__ipipe_sync_stage+0x12b) :| **fn -1082+ 1.218 xnintr_irq_handler+0xb (xnintr_clock_handler+0x18) :| **fn -1080+ 1.233 xnpod_announce_tick+0x9 (xnintr_irq_handler+0x2a) :| **(0x50) 0x000000c8 -1079+ 1.736 xnpod_announce_tick+0x20 (xnintr_irq_handler+0x2a) :| **fn -1077+ 2.984 xntimer_do_tick_aperiodic+0xe (xnpod_announce_tick+0x36) :| **fn -1074+ 2.751 xnthread_timeout_handler+0x8 (xntimer_do_tick_aperiodic+0x18d) :| **fn -1072+ 1.864 xnpod_resume_thread+0xe (xnthread_timeout_handler+0x1d) :| **(0x50) 0x000000c8 -1070+ 4.699 xnpod_resume_thread+0x2b (xnthread_timeout_handler+0x1d) :| **(0x50) 0x000000c8 -1065+ 1.586 xnpod_resume_thread+0x2bf (xnthread_timeout_handler+0x1d) :| **(0x01) 0x00001237 -1063+ 2.661 xntimer_do_tick_aperiodic+0x309 (xnpod_announce_tick+0x36) :| **(0x50) 0x000000c8 -1061+ 1.263 xnpod_announce_tick+0x4f (xnintr_irq_handler+0x2a) :| **fn -1060+ 1.255 rthal_irq_end+0x8 (xnintr_irq_handler+0x46) :| **fn -1058+ 2.007 enable_8259A_irq+0x9 (rthal_irq_end+0x2e) :| **fn -1056+ 1.924 xnpod_schedule+0xe (xnintr_irq_handler+0x6e) :| **(0x50) 0x000000c8 -1054! 15.368 xnpod_schedule+0x53 (xnintr_irq_handler+0x6e) :| **fn -1039! 13.300 __switch_to+0xc (xnpod_schedule+0x689) :| **(0x50) 0x000000c8 -1026+ 1.766 xnpod_schedule+0x951 (xnpod_suspend_thread+0x27c) :| **(0x50) 0x000000c8 -1024! 18.195 xnpod_suspend_thread+0x2bb (rt_task_sleep+0x54) : **fn -1006+ 1.624 __ipipe_syscall_root+0x9 (system_call+0x20) : **fn -1004+ 1.406 __ipipe_dispatch_event+0xe (__ipipe_syscall_root+0x58) : **fn -1003+ 4.323 hisyscall_event+0xe (__ipipe_dispatch_event+0x5e) : **fn -998+ 1.398 __rt_task_sleep+0xa (hisyscall_event+0x23c) : **fn -997+ 1.789 __copy_from_user_ll+0xa (__rt_task_sleep+0x1a) : **fn -995! 15.345 rt_task_sleep+0xa (__rt_task_sleep+0x25)
Quoted 8 lines
: **fn -980 0.879 __ipipe_syscall_root+0x9 (system_call+0x20) : **fn -979+ 1.308 __ipipe_dispatch_event+0xe (__ipipe_syscall_root+0x58) : **fn -978+ 2.451 hisyscall_event+0xe (__ipipe_dispatch_event+0x5e) : **fn -975+ 1.631 sys_rtdm_ioctl+0x8 (hisyscall_event+0x23c) : **fn -974+ 1.255 _rtdm_ioctl+0xc (sys_rtdm_ioctl+0x1b) : **fn -972+ 4.180 rtdm_context_get+0xa (_rtdm_ioctl+0x20) : **fn -968+ 1.203 __ipipe_syscall_root+0x9 (system_call+0x20) : **fn -967+ 1.345 __ipipe_dispatch_event+0xe (__ipipe_syscall_root+0x58)
The '*' mark a stalled domain, root domain on the right. It seems to me that xnpod_suspend_thread() leaves the xeno domain stalled on wake up. This gets recovered somehow later.
But here we see a different effect which finally causes the tick to get frozen:
Quoted 23 lines
: fn -504+ 2.075 sched_clock+0xd (schedule+0x112) : fn -502 0.992 __ipipe_stall_root+0x8 (schedule+0x18e) : *(0x50) 0x00000064 -501+ 4.022 __ipipe_stall_root+0x32 (schedule+0x18e) : *fn -497+ 1.977 __ipipe_dispatch_event+0xe (schedule+0x412) : *fn -495+ 4.210 schedule_event+0xd (__ipipe_dispatch_event+0x5e) : **(0x50) 0x000000c8 -491+ 1.428 schedule_event+0x261 (__ipipe_dispatch_event+0x5e) :| **fn -490+ 2.067 xnpod_schedule_runnable+0xe (schedule_event+0x28b) :| **fn -488 0.954 ipipe_unstall_pipeline_from+0xc (schedule_event+0x2c1) :| *(0x51) 0x000000c8 -487+ 4.646 ipipe_unstall_pipeline_from+0x25 (schedule_event+0x2c1) :| *fn -482+ 7.248 __switch_to+0xc (xnpod_schedule+0x689) :| **(0x50) 0x000000c8 -475+ 1.421 xnpod_schedule+0x77f (xnpod_suspend_thread+0x27c) :| **(0x50) 0x000000c8 -473+ 1.481 xnpod_schedule+0x951 (xnpod_suspend_thread+0x27c) :| **(0x50) 0x000000c8 -472+ 1.654 xnpod_suspend_thread+0x2bb (xnshadow_relax+0x136) :| **(0x50) 0x000000c8 -470+ 2.917 xnshadow_relax+0x154 (hisyscall_event+0x2ec) :| **fn -467+ 1.375 ipipe_reenter_root+0xb (xnshadow_relax+0x204) :| **fn -466 0.954 __ipipe_unstall_root+0x8 (ipipe_reenter_root+0x26) :| * (0x51) 0x00000064 -465+ 3.789 __ipipe_unstall_root+0x25 (ipipe_reenter_root+0x26) : * fn -461+ 1.578 send_sig+0x8 (xnshadow_relax+0x228) : * fn -460+ 1.496 send_sig_info+0xb (send_sig+0x1d) : * fn -458 0.909 __ipipe_test_and_stall_root+0x9 (send_sig_info+0x38) : **(0x50) 0x00000064 -457+ 1.699 __ipipe_test_and_stall_root+0x27 (send_sig_info+0x38) : **fn -455+ 1.203 specific_send_sig_info+0xb (send_sig_info+0x69) : **fn -454+ 1.706 __ipipe_test_root+0x8 (specific_send_sig_info+0x16)
Quoted 8 lines
: **fn -453+ 3.360 sig_ignored+0x9 (specific_send_sig_info+0x29) : **fn -449+ 1.714 send_signal+0xb (specific_send_sig_info+0x55) : **fn -447+ 3.142 __sigqueue_alloc+0x9 (send_signal+0x3f) : **fn -444+ 1.210 kmem_cache_alloc+0xa (__sigqueue_alloc+0x42) : **fn -443 0.909 __ipipe_test_and_stall_root+0x9 (kmem_cache_alloc+0x12) : **(0x50) 0x00000064 -442+ 2.180 __ipipe_test_and_stall_root+0x27 (kmem_cache_alloc+0x12) : **fn -440+ 1.218 __ipipe_restore_root+0x8 (kmem_cache_alloc+0x52) : **fn -439+ 1.315 __ipipe_stall_root+0x8 (__ipipe_restore_root+0x11)
No more recovery from the xeno stall, no more timer ticks.
The special traces were generated via
#define ipipe_mark_domain_stall(ipd,cpuid) \ ipipe_trace_special(0x50, ipd->priority) #define ipipe_mark_domain_unstall(ipd,cpuid) \ ipipe_trace_special(0x51, ipd->priority)
Any ideas? I do not find anything fishy yet that we may have introduced to cause this problem.
Jan
kernel/ipipe/core.c +1 -3
@@ -40,7 +40,7 @@ipipe_spinlock_t __ipipe_pipelock =IPIPE_SPIN_LOCK_UNLOCKED ; -struct list_head __ipipe_pipeline; +LIST_HEAD (__ipipe_pipeline);unsigned long __ipipe_virtual_irq_map =0 ;
@@ -66,8 +66,6 @@* secondary CPUs are still lost in space. */ -INIT_LIST_HEAD (&__ipipe_pipeline); - ipd->name ="Linux" ; ipd->domid =IPIPE_ROOT_ID ; ipd->priority =IPIPE_ROOT_PRIO ;
kernel/ipipe/tracer.c +28 -0
@@ -51,6 +51,7 @@#define IPIPE_TFLG_HWIRQ_OFF 0x0100#define IPIPE_TFLG_FREEZING 0x0200 +#define IPIPE_TFLG_DOMSTATE_SHIFT 12/* bits 12..15: domain stalled? */ struct ipipe_trace_point {
@@ -118,6 +119,24 @@static void __ipipe_print_symname (struct seq_file *m,unsigned long eip); +static notrace void +__ipipe_store_domain_states (struct ipipe_trace_point *point,int cpu_id) +{ +int i =IPIPE_TFLG_DOMSTATE_SHIFT ; +struct list_head *pos; + +list_for_each_prev (pos, &__ipipe_pipeline) { +struct ipipe_domain *ipd = + list_entry(pos, struct ipipe_domain, p_link); + +if (test_bit (IPIPE_STALL_FLAG , &ipd->cpudata[cpu_id].status)) + point->flags |= (1 << i); + +if (++i >IPIPE_TFLG_DOMSTATE_SHIFT +3 ) +break ; + } +} + static notrace int __ipipe_get_free_trace_path(int old, int cpu_id) {int new_active = old;
@@ -282,6 +301,8 @@ point->v = v;ipipe_read_tsc (point->timestamp); +__ipipe_store_domain_states (point, cpu_id); +/* forward to next point buffer */ next_pos =WRAP_POINT_NO (pos+1 ); tp->trace_pos = next_pos;
@@ -617,6 +638,7 @@ {char mark =' ' ;int point_no = point - print_path->point; +int i;if (print_path->end == point_no) mark ='<' ;
@@ -626,6 +648,12 @@ mark =':' ;seq_printf (m,"%c%c" , mark, (point->flags &IPIPE_TFLG_HWIRQ_OFF ) ?'|' :' ' ); + +if (verbose_trace) +for (i =IPIPE_TFLG_DOMSTATE_SHIFT +3 ; + i >=IPIPE_TFLG_DOMSTATE_SHIFT ; i--) +seq_printf (m,"%c" , + (point->flags & (1 << i)) ?'*' :' ' ); } static void
Quoted 102 lines · Jan Kiszka
Hi Philippe,
debugging is nice, tracing is still nicer. As you suggested, I extended the tracer with per-domain stall flags (needs some output clean-up, preliminary patch attached nevertheless).
And here is the result (full trace attached):
Quoted 42 lines
:| (0x51) 0x000000c8 -1113+ 1.112 __ipipe_sync_stage+0x142 (ipipe_suspend_domain+0x56) :| fn -1112+ 1.789 __ipipe_sync_stage+0xe (ipipe_suspend_domain+0x56) :| *(0x50) 0x00000064 -1110+ 1.293 __ipipe_sync_stage+0x97 (ipipe_suspend_domain+0x56) : *fn -1109+ 1.398 do_IRQ+0x8 (__ipipe_sync_stage+0xcf) : *fn -1107+ 2.105 __do_IRQ+0xc (do_IRQ+0x21) : *fn -1105+ 1.631 handle_IRQ_event+0xd (__do_IRQ+0x9e) : *fn -1104+ 2.413 timer_interrupt+0x9 (handle_IRQ_event+0x40) : *fn -1101+ 3.022 mark_offset_tsc+0xe (timer_interrupt+0x31) : *fn -1098+ 2.721 do_timer+0x9 (timer_interrupt+0x37) :| *fn -1096+ 2.112 __ipipe_handle_irq+0xe (common_interrupt+0x18) :| *fn -1093+ 1.210 __ipipe_ack_common_irq+0xc (__ipipe_handle_irq+0xc0) :| *(0x50) 0x00000064 -1092+ 1.218 __ipipe_ack_common_irq+0x31 (__ipipe_handle_irq+0xc0) :| *fn -1091+ 1.834 mask_and_ack_8259A+0xb (__ipipe_ack_common_irq+0x5d) :| *(0x50) 0x00000064 -1089+ 1.345 __ipipe_ack_common_irq+0x9d (__ipipe_handle_irq+0xc0) :| *fn -1088 0.924 ipipe_suspend_domain+0xb (__ipipe_handle_irq+0x174) :| *(0x51) 0x000000c8 -1087+ 1.172 ipipe_suspend_domain+0x26 (__ipipe_handle_irq+0x174) :| *fn -1086+ 2.030 __ipipe_sync_stage+0xe (ipipe_suspend_domain+0x56) :| **(0x50) 0x000000c8 -1084+ 1.330 __ipipe_sync_stage+0x97 (ipipe_suspend_domain+0x56) :| **fn -1082 0.879 xnintr_clock_handler+0x8 (__ipipe_sync_stage+0x12b) :| **fn -1082+ 1.218 xnintr_irq_handler+0xb (xnintr_clock_handler+0x18) :| **fn -1080+ 1.233 xnpod_announce_tick+0x9 (xnintr_irq_handler+0x2a) :| **(0x50) 0x000000c8 -1079+ 1.736 xnpod_announce_tick+0x20 (xnintr_irq_handler+0x2a) :| **fn -1077+ 2.984 xntimer_do_tick_aperiodic+0xe (xnpod_announce_tick+0x36) :| **fn -1074+ 2.751 xnthread_timeout_handler+0x8 (xntimer_do_tick_aperiodic+0x18d) :| **fn -1072+ 1.864 xnpod_resume_thread+0xe (xnthread_timeout_handler+0x1d) :| **(0x50) 0x000000c8 -1070+ 4.699 xnpod_resume_thread+0x2b (xnthread_timeout_handler+0x1d) :| **(0x50) 0x000000c8 -1065+ 1.586 xnpod_resume_thread+0x2bf (xnthread_timeout_handler+0x1d) :| **(0x01) 0x00001237 -1063+ 2.661 xntimer_do_tick_aperiodic+0x309 (xnpod_announce_tick+0x36) :| **(0x50) 0x000000c8 -1061+ 1.263 xnpod_announce_tick+0x4f (xnintr_irq_handler+0x2a) :| **fn -1060+ 1.255 rthal_irq_end+0x8 (xnintr_irq_handler+0x46) :| **fn -1058+ 2.007 enable_8259A_irq+0x9 (rthal_irq_end+0x2e) :| **fn -1056+ 1.924 xnpod_schedule+0xe (xnintr_irq_handler+0x6e) :| **(0x50) 0x000000c8 -1054! 15.368 xnpod_schedule+0x53 (xnintr_irq_handler+0x6e) :| **fn -1039! 13.300 __switch_to+0xc (xnpod_schedule+0x689) :| **(0x50) 0x000000c8 -1026+ 1.766 xnpod_schedule+0x951 (xnpod_suspend_thread+0x27c) :| **(0x50) 0x000000c8 -1024! 18.195 xnpod_suspend_thread+0x2bb (rt_task_sleep+0x54) : **fn -1006+ 1.624 __ipipe_syscall_root+0x9 (system_call+0x20) : **fn -1004+ 1.406 __ipipe_dispatch_event+0xe (__ipipe_syscall_root+0x58) : **fn -1003+ 4.323 hisyscall_event+0xe (__ipipe_dispatch_event+0x5e) : **fn -998+ 1.398 __rt_task_sleep+0xa (hisyscall_event+0x23c) : **fn -997+ 1.789 __copy_from_user_ll+0xa (__rt_task_sleep+0x1a) : **fn -995! 15.345 rt_task_sleep+0xa (__rt_task_sleep+0x25)Quoted 8 lines
: **fn -980 0.879 __ipipe_syscall_root+0x9 (system_call+0x20) : **fn -979+ 1.308 __ipipe_dispatch_event+0xe (__ipipe_syscall_root+0x58) : **fn -978+ 2.451 hisyscall_event+0xe (__ipipe_dispatch_event+0x5e) : **fn -975+ 1.631 sys_rtdm_ioctl+0x8 (hisyscall_event+0x23c) : **fn -974+ 1.255 _rtdm_ioctl+0xc (sys_rtdm_ioctl+0x1b) : **fn -972+ 4.180 rtdm_context_get+0xa (_rtdm_ioctl+0x20) : **fn -968+ 1.203 __ipipe_syscall_root+0x9 (system_call+0x20) : **fn -967+ 1.345 __ipipe_dispatch_event+0xe (__ipipe_syscall_root+0x58)The '*' mark a stalled domain, root domain on the right. It seems to me that
xnpod_suspend_thread()leaves the xeno domain stalled on wake up. This gets recovered somehow later.But here we see a different effect which finally causes the tick to get frozen:
Quoted 23 lines
: fn -504+ 2.075 sched_clock+0xd (schedule+0x112) : fn -502 0.992 __ipipe_stall_root+0x8 (schedule+0x18e) : *(0x50) 0x00000064 -501+ 4.022 __ipipe_stall_root+0x32 (schedule+0x18e) : *fn -497+ 1.977 __ipipe_dispatch_event+0xe (schedule+0x412) : *fn -495+ 4.210 schedule_event+0xd (__ipipe_dispatch_event+0x5e) : **(0x50) 0x000000c8 -491+ 1.428 schedule_event+0x261 (__ipipe_dispatch_event+0x5e) :| **fn -490+ 2.067 xnpod_schedule_runnable+0xe (schedule_event+0x28b) :| **fn -488 0.954 ipipe_unstall_pipeline_from+0xc (schedule_event+0x2c1) :| *(0x51) 0x000000c8 -487+ 4.646 ipipe_unstall_pipeline_from+0x25 (schedule_event+0x2c1) :| *fn -482+ 7.248 __switch_to+0xc (xnpod_schedule+0x689) :| **(0x50) 0x000000c8 -475+ 1.421 xnpod_schedule+0x77f (xnpod_suspend_thread+0x27c) :| **(0x50) 0x000000c8 -473+ 1.481 xnpod_schedule+0x951 (xnpod_suspend_thread+0x27c) :| **(0x50) 0x000000c8 -472+ 1.654 xnpod_suspend_thread+0x2bb (xnshadow_relax+0x136) :| **(0x50) 0x000000c8 -470+ 2.917 xnshadow_relax+0x154 (hisyscall_event+0x2ec) :| **fn -467+ 1.375 ipipe_reenter_root+0xb (xnshadow_relax+0x204) :| **fn -466 0.954 __ipipe_unstall_root+0x8 (ipipe_reenter_root+0x26) :| * (0x51) 0x00000064 -465+ 3.789 __ipipe_unstall_root+0x25 (ipipe_reenter_root+0x26) : * fn -461+ 1.578 send_sig+0x8 (xnshadow_relax+0x228) : * fn -460+ 1.496 send_sig_info+0xb (send_sig+0x1d) : * fn -458 0.909 __ipipe_test_and_stall_root+0x9 (send_sig_info+0x38) : **(0x50) 0x00000064 -457+ 1.699 __ipipe_test_and_stall_root+0x27 (send_sig_info+0x38) : **fn -455+ 1.203 specific_send_sig_info+0xb (send_sig_info+0x69) : **fn -454+ 1.706 __ipipe_test_root+0x8 (specific_send_sig_info+0x16)Quoted 8 lines
: **fn -453+ 3.360 sig_ignored+0x9 (specific_send_sig_info+0x29) : **fn -449+ 1.714 send_signal+0xb (specific_send_sig_info+0x55) : **fn -447+ 3.142 __sigqueue_alloc+0x9 (send_signal+0x3f) : **fn -444+ 1.210 kmem_cache_alloc+0xa (__sigqueue_alloc+0x42) : **fn -443 0.909 __ipipe_test_and_stall_root+0x9 (kmem_cache_alloc+0x12) : **(0x50) 0x00000064 -442+ 2.180 __ipipe_test_and_stall_root+0x27 (kmem_cache_alloc+0x12) : **fn -440+ 1.218 __ipipe_restore_root+0x8 (kmem_cache_alloc+0x52) : **fn -439+ 1.315 __ipipe_stall_root+0x8 (__ipipe_restore_root+0x11)No more recovery from the xeno stall, no more timer ticks.
The special traces were generated via
Quoted 8 lines
#define ipipe_mark_domain_stall(ipd,cpuid) \ ipipe_trace_special(0x50, ipd->priority) #define ipipe_mark_domain_unstall(ipd,cpuid) \ ipipe_trace_special(0x51, ipd->priority)Any ideas? I do not find anything fishy yet that we may have introduced to cause this problem.
Hmm, what about this theory: the RT-thread which got woken up in the first trace snippet suffered from a leaking IRQ lock. Its broken flags got restored on wakeup, and also when the thread went for termination (second trace). Therefore, we see this leaking domain stall. Possible explanation?
This would move I-pipe and Xenomai out of the focus, leaving only the 16550A driver and our middleware messaging service (also a RTDM driver, currently my top favourite). My trace unfortunately does not last back far enough to answer this, I will have a look at this on Monday.
If it turned out to be the reason, we should consider putting some XENO_ASSERT guards in the return-to-user paths of RTDM services.
Jan
Quoted 116 lines · Jan Kiszka
Quoted 104 lines · Jan Kiszka
Hi Philippe,
debugging is nice, tracing is still nicer. As you suggested, I extended the tracer with per-domain stall flags (needs some output clean-up, preliminary patch attached nevertheless).
And here is the result (full trace attached):
Quoted 42 lines
:| (0x51) 0x000000c8 -1113+ 1.112 __ipipe_sync_stage+0x142 (ipipe_suspend_domain+0x56) :| fn -1112+ 1.789 __ipipe_sync_stage+0xe (ipipe_suspend_domain+0x56) :| *(0x50) 0x00000064 -1110+ 1.293 __ipipe_sync_stage+0x97 (ipipe_suspend_domain+0x56) : *fn -1109+ 1.398 do_IRQ+0x8 (__ipipe_sync_stage+0xcf) : *fn -1107+ 2.105 __do_IRQ+0xc (do_IRQ+0x21) : *fn -1105+ 1.631 handle_IRQ_event+0xd (__do_IRQ+0x9e) : *fn -1104+ 2.413 timer_interrupt+0x9 (handle_IRQ_event+0x40) : *fn -1101+ 3.022 mark_offset_tsc+0xe (timer_interrupt+0x31) : *fn -1098+ 2.721 do_timer+0x9 (timer_interrupt+0x37) :| *fn -1096+ 2.112 __ipipe_handle_irq+0xe (common_interrupt+0x18) :| *fn -1093+ 1.210 __ipipe_ack_common_irq+0xc (__ipipe_handle_irq+0xc0) :| *(0x50) 0x00000064 -1092+ 1.218 __ipipe_ack_common_irq+0x31 (__ipipe_handle_irq+0xc0) :| *fn -1091+ 1.834 mask_and_ack_8259A+0xb (__ipipe_ack_common_irq+0x5d) :| *(0x50) 0x00000064 -1089+ 1.345 __ipipe_ack_common_irq+0x9d (__ipipe_handle_irq+0xc0) :| *fn -1088 0.924 ipipe_suspend_domain+0xb (__ipipe_handle_irq+0x174) :| *(0x51) 0x000000c8 -1087+ 1.172 ipipe_suspend_domain+0x26 (__ipipe_handle_irq+0x174) :| *fn -1086+ 2.030 __ipipe_sync_stage+0xe (ipipe_suspend_domain+0x56) :| **(0x50) 0x000000c8 -1084+ 1.330 __ipipe_sync_stage+0x97 (ipipe_suspend_domain+0x56) :| **fn -1082 0.879 xnintr_clock_handler+0x8 (__ipipe_sync_stage+0x12b) :| **fn -1082+ 1.218 xnintr_irq_handler+0xb (xnintr_clock_handler+0x18) :| **fn -1080+ 1.233 xnpod_announce_tick+0x9 (xnintr_irq_handler+0x2a) :| **(0x50) 0x000000c8 -1079+ 1.736 xnpod_announce_tick+0x20 (xnintr_irq_handler+0x2a) :| **fn -1077+ 2.984 xntimer_do_tick_aperiodic+0xe (xnpod_announce_tick+0x36) :| **fn -1074+ 2.751 xnthread_timeout_handler+0x8 (xntimer_do_tick_aperiodic+0x18d) :| **fn -1072+ 1.864 xnpod_resume_thread+0xe (xnthread_timeout_handler+0x1d) :| **(0x50) 0x000000c8 -1070+ 4.699 xnpod_resume_thread+0x2b (xnthread_timeout_handler+0x1d) :| **(0x50) 0x000000c8 -1065+ 1.586 xnpod_resume_thread+0x2bf (xnthread_timeout_handler+0x1d) :| **(0x01) 0x00001237 -1063+ 2.661 xntimer_do_tick_aperiodic+0x309 (xnpod_announce_tick+0x36) :| **(0x50) 0x000000c8 -1061+ 1.263 xnpod_announce_tick+0x4f (xnintr_irq_handler+0x2a) :| **fn -1060+ 1.255 rthal_irq_end+0x8 (xnintr_irq_handler+0x46) :| **fn -1058+ 2.007 enable_8259A_irq+0x9 (rthal_irq_end+0x2e) :| **fn -1056+ 1.924 xnpod_schedule+0xe (xnintr_irq_handler+0x6e) :| **(0x50) 0x000000c8 -1054! 15.368 xnpod_schedule+0x53 (xnintr_irq_handler+0x6e) :| **fn -1039! 13.300 __switch_to+0xc (xnpod_schedule+0x689) :| **(0x50) 0x000000c8 -1026+ 1.766 xnpod_schedule+0x951 (xnpod_suspend_thread+0x27c) :| **(0x50) 0x000000c8 -1024! 18.195 xnpod_suspend_thread+0x2bb (rt_task_sleep+0x54) : **fn -1006+ 1.624 __ipipe_syscall_root+0x9 (system_call+0x20) : **fn -1004+ 1.406 __ipipe_dispatch_event+0xe (__ipipe_syscall_root+0x58) : **fn -1003+ 4.323 hisyscall_event+0xe (__ipipe_dispatch_event+0x5e) : **fn -998+ 1.398 __rt_task_sleep+0xa (hisyscall_event+0x23c) : **fn -997+ 1.789 __copy_from_user_ll+0xa (__rt_task_sleep+0x1a) : **fn -995! 15.345 rt_task_sleep+0xa (__rt_task_sleep+0x25)Quoted 8 lines
: **fn -980 0.879 __ipipe_syscall_root+0x9 (system_call+0x20) : **fn -979+ 1.308 __ipipe_dispatch_event+0xe (__ipipe_syscall_root+0x58) : **fn -978+ 2.451 hisyscall_event+0xe (__ipipe_dispatch_event+0x5e) : **fn -975+ 1.631 sys_rtdm_ioctl+0x8 (hisyscall_event+0x23c) : **fn -974+ 1.255 _rtdm_ioctl+0xc (sys_rtdm_ioctl+0x1b) : **fn -972+ 4.180 rtdm_context_get+0xa (_rtdm_ioctl+0x20) : **fn -968+ 1.203 __ipipe_syscall_root+0x9 (system_call+0x20) : **fn -967+ 1.345 __ipipe_dispatch_event+0xe (__ipipe_syscall_root+0x58)The '*' mark a stalled domain, root domain on the right. It seems to me that
xnpod_suspend_thread()leaves the xeno domain stalled on wake up. This gets recovered somehow later.But here we see a different effect which finally causes the tick to get frozen:
Quoted 23 lines
: fn -504+ 2.075 sched_clock+0xd (schedule+0x112) : fn -502 0.992 __ipipe_stall_root+0x8 (schedule+0x18e) : *(0x50) 0x00000064 -501+ 4.022 __ipipe_stall_root+0x32 (schedule+0x18e) : *fn -497+ 1.977 __ipipe_dispatch_event+0xe (schedule+0x412) : *fn -495+ 4.210 schedule_event+0xd (__ipipe_dispatch_event+0x5e) : **(0x50) 0x000000c8 -491+ 1.428 schedule_event+0x261 (__ipipe_dispatch_event+0x5e) :| **fn -490+ 2.067 xnpod_schedule_runnable+0xe (schedule_event+0x28b) :| **fn -488 0.954 ipipe_unstall_pipeline_from+0xc (schedule_event+0x2c1) :| *(0x51) 0x000000c8 -487+ 4.646 ipipe_unstall_pipeline_from+0x25 (schedule_event+0x2c1) :| *fn -482+ 7.248 __switch_to+0xc (xnpod_schedule+0x689) :| **(0x50) 0x000000c8 -475+ 1.421 xnpod_schedule+0x77f (xnpod_suspend_thread+0x27c) :| **(0x50) 0x000000c8 -473+ 1.481 xnpod_schedule+0x951 (xnpod_suspend_thread+0x27c) :| **(0x50) 0x000000c8 -472+ 1.654 xnpod_suspend_thread+0x2bb (xnshadow_relax+0x136) :| **(0x50) 0x000000c8 -470+ 2.917 xnshadow_relax+0x154 (hisyscall_event+0x2ec) :| **fn -467+ 1.375 ipipe_reenter_root+0xb (xnshadow_relax+0x204) :| **fn -466 0.954 __ipipe_unstall_root+0x8 (ipipe_reenter_root+0x26) :| * (0x51) 0x00000064 -465+ 3.789 __ipipe_unstall_root+0x25 (ipipe_reenter_root+0x26) : * fn -461+ 1.578 send_sig+0x8 (xnshadow_relax+0x228) : * fn -460+ 1.496 send_sig_info+0xb (send_sig+0x1d) : * fn -458 0.909 __ipipe_test_and_stall_root+0x9 (send_sig_info+0x38) : **(0x50) 0x00000064 -457+ 1.699 __ipipe_test_and_stall_root+0x27 (send_sig_info+0x38) : **fn -455+ 1.203 specific_send_sig_info+0xb (send_sig_info+0x69) : **fn -454+ 1.706 __ipipe_test_root+0x8 (specific_send_sig_info+0x16)Quoted 8 lines
: **fn -453+ 3.360 sig_ignored+0x9 (specific_send_sig_info+0x29) : **fn -449+ 1.714 send_signal+0xb (specific_send_sig_info+0x55) : **fn -447+ 3.142 __sigqueue_alloc+0x9 (send_signal+0x3f) : **fn -444+ 1.210 kmem_cache_alloc+0xa (__sigqueue_alloc+0x42) : **fn -443 0.909 __ipipe_test_and_stall_root+0x9 (kmem_cache_alloc+0x12) : **(0x50) 0x00000064 -442+ 2.180 __ipipe_test_and_stall_root+0x27 (kmem_cache_alloc+0x12) : **fn -440+ 1.218 __ipipe_restore_root+0x8 (kmem_cache_alloc+0x52) : **fn -439+ 1.315 __ipipe_stall_root+0x8 (__ipipe_restore_root+0x11)No more recovery from the xeno stall, no more timer ticks.
The special traces were generated via
Quoted 8 lines
#define ipipe_mark_domain_stall(ipd,cpuid) \ ipipe_trace_special(0x50, ipd->priority) #define ipipe_mark_domain_unstall(ipd,cpuid) \ ipipe_trace_special(0x51, ipd->priority)Any ideas? I do not find anything fishy yet that we may have introduced to cause this problem.
Quoted 5 lines
Hmm, what about this theory: the RT-thread which got woken up in the first trace snippet suffered from a leaking IRQ lock. Its broken flags got restored on wakeup, and also when the thread went for termination (second trace). Therefore, we see this leaking domain stall. Possible explanation?
The incoming thread - after the last switch from the deleted thread - always restores its own interrupt flag, so I don't think an IRQ lock leakage from the deleted thread could cause what we are seing.
Signature · 1 line
Philippe.
Quoted 116 lines · Jan Kiszka
Quoted 100 lines · Jan Kiszka
Hi Philippe,
debugging is nice, tracing is still nicer. As you suggested, I extended the tracer with per-domain stall flags (needs some output clean-up, preliminary patch attached nevertheless).
And here is the result (full trace attached):
Quoted 42 lines
:| (0x51) 0x000000c8 -1113+ 1.112 __ipipe_sync_stage+0x142 (ipipe_suspend_domain+0x56) :| fn -1112+ 1.789 __ipipe_sync_stage+0xe (ipipe_suspend_domain+0x56) :| *(0x50) 0x00000064 -1110+ 1.293 __ipipe_sync_stage+0x97 (ipipe_suspend_domain+0x56) : *fn -1109+ 1.398 do_IRQ+0x8 (__ipipe_sync_stage+0xcf) : *fn -1107+ 2.105 __do_IRQ+0xc (do_IRQ+0x21) : *fn -1105+ 1.631 handle_IRQ_event+0xd (__do_IRQ+0x9e) : *fn -1104+ 2.413 timer_interrupt+0x9 (handle_IRQ_event+0x40) : *fn -1101+ 3.022 mark_offset_tsc+0xe (timer_interrupt+0x31) : *fn -1098+ 2.721 do_timer+0x9 (timer_interrupt+0x37) :| *fn -1096+ 2.112 __ipipe_handle_irq+0xe (common_interrupt+0x18) :| *fn -1093+ 1.210 __ipipe_ack_common_irq+0xc (__ipipe_handle_irq+0xc0) :| *(0x50) 0x00000064 -1092+ 1.218 __ipipe_ack_common_irq+0x31 (__ipipe_handle_irq+0xc0) :| *fn -1091+ 1.834 mask_and_ack_8259A+0xb (__ipipe_ack_common_irq+0x5d) :| *(0x50) 0x00000064 -1089+ 1.345 __ipipe_ack_common_irq+0x9d (__ipipe_handle_irq+0xc0) :| *fn -1088 0.924 ipipe_suspend_domain+0xb (__ipipe_handle_irq+0x174) :| *(0x51) 0x000000c8 -1087+ 1.172 ipipe_suspend_domain+0x26 (__ipipe_handle_irq+0x174) :| *fn -1086+ 2.030 __ipipe_sync_stage+0xe (ipipe_suspend_domain+0x56) :| **(0x50) 0x000000c8 -1084+ 1.330 __ipipe_sync_stage+0x97 (ipipe_suspend_domain+0x56) :| **fn -1082 0.879 xnintr_clock_handler+0x8 (__ipipe_sync_stage+0x12b) :| **fn -1082+ 1.218 xnintr_irq_handler+0xb (xnintr_clock_handler+0x18) :| **fn -1080+ 1.233 xnpod_announce_tick+0x9 (xnintr_irq_handler+0x2a) :| **(0x50) 0x000000c8 -1079+ 1.736 xnpod_announce_tick+0x20 (xnintr_irq_handler+0x2a) :| **fn -1077+ 2.984 xntimer_do_tick_aperiodic+0xe (xnpod_announce_tick+0x36) :| **fn -1074+ 2.751 xnthread_timeout_handler+0x8 (xntimer_do_tick_aperiodic+0x18d) :| **fn -1072+ 1.864 xnpod_resume_thread+0xe (xnthread_timeout_handler+0x1d) :| **(0x50) 0x000000c8 -1070+ 4.699 xnpod_resume_thread+0x2b (xnthread_timeout_handler+0x1d) :| **(0x50) 0x000000c8 -1065+ 1.586 xnpod_resume_thread+0x2bf (xnthread_timeout_handler+0x1d) :| **(0x01) 0x00001237 -1063+ 2.661 xntimer_do_tick_aperiodic+0x309 (xnpod_announce_tick+0x36) :| **(0x50) 0x000000c8 -1061+ 1.263 xnpod_announce_tick+0x4f (xnintr_irq_handler+0x2a) :| **fn -1060+ 1.255 rthal_irq_end+0x8 (xnintr_irq_handler+0x46) :| **fn -1058+ 2.007 enable_8259A_irq+0x9 (rthal_irq_end+0x2e) :| **fn -1056+ 1.924 xnpod_schedule+0xe (xnintr_irq_handler+0x6e) :| **(0x50) 0x000000c8 -1054! 15.368 xnpod_schedule+0x53 (xnintr_irq_handler+0x6e) :| **fn -1039! 13.300 __switch_to+0xc (xnpod_schedule+0x689) :| **(0x50) 0x000000c8 -1026+ 1.766 xnpod_schedule+0x951 (xnpod_suspend_thread+0x27c) :| **(0x50) 0x000000c8 -1024! 18.195 xnpod_suspend_thread+0x2bb (rt_task_sleep+0x54) : **fn -1006+ 1.624 __ipipe_syscall_root+0x9 (system_call+0x20) : **fn -1004+ 1.406 __ipipe_dispatch_event+0xe (__ipipe_syscall_root+0x58) : **fn -1003+ 4.323 hisyscall_event+0xe (__ipipe_dispatch_event+0x5e) : **fn -998+ 1.398 __rt_task_sleep+0xa (hisyscall_event+0x23c) : **fn -997+ 1.789 __copy_from_user_ll+0xa (__rt_task_sleep+0x1a) : **fn -995! 15.345 rt_task_sleep+0xa (__rt_task_sleep+0x25)Quoted 8 lines
: **fn -980 0.879 __ipipe_syscall_root+0x9 (system_call+0x20) : **fn -979+ 1.308 __ipipe_dispatch_event+0xe (__ipipe_syscall_root+0x58) : **fn -978+ 2.451 hisyscall_event+0xe (__ipipe_dispatch_event+0x5e) : **fn -975+ 1.631 sys_rtdm_ioctl+0x8 (hisyscall_event+0x23c) : **fn -974+ 1.255 _rtdm_ioctl+0xc (sys_rtdm_ioctl+0x1b) : **fn -972+ 4.180 rtdm_context_get+0xa (_rtdm_ioctl+0x20) : **fn -968+ 1.203 __ipipe_syscall_root+0x9 (system_call+0x20) : **fn -967+ 1.345 __ipipe_dispatch_event+0xe (__ipipe_syscall_root+0x58)The '*' mark a stalled domain, root domain on the right. It seems to me that
xnpod_suspend_thread()leaves the xeno domain stalled on wake up. This gets recovered somehow later.But here we see a different effect which finally causes the tick to get frozen:
Quoted 23 lines
: fn -504+ 2.075 sched_clock+0xd (schedule+0x112) : fn -502 0.992 __ipipe_stall_root+0x8 (schedule+0x18e) : *(0x50) 0x00000064 -501+ 4.022 __ipipe_stall_root+0x32 (schedule+0x18e) : *fn -497+ 1.977 __ipipe_dispatch_event+0xe (schedule+0x412) : *fn -495+ 4.210 schedule_event+0xd (__ipipe_dispatch_event+0x5e) : **(0x50) 0x000000c8 -491+ 1.428 schedule_event+0x261 (__ipipe_dispatch_event+0x5e) :| **fn -490+ 2.067 xnpod_schedule_runnable+0xe (schedule_event+0x28b) :| **fn -488 0.954 ipipe_unstall_pipeline_from+0xc (schedule_event+0x2c1) :| *(0x51) 0x000000c8 -487+ 4.646 ipipe_unstall_pipeline_from+0x25 (schedule_event+0x2c1) :| *fn -482+ 7.248 __switch_to+0xc (xnpod_schedule+0x689) :| **(0x50) 0x000000c8 -475+ 1.421 xnpod_schedule+0x77f (xnpod_suspend_thread+0x27c) :| **(0x50) 0x000000c8 -473+ 1.481 xnpod_schedule+0x951 (xnpod_suspend_thread+0x27c) :| **(0x50) 0x000000c8 -472+ 1.654 xnpod_suspend_thread+0x2bb (xnshadow_relax+0x136) :| **(0x50) 0x000000c8 -470+ 2.917 xnshadow_relax+0x154 (hisyscall_event+0x2ec) :| **fn -467+ 1.375 ipipe_reenter_root+0xb (xnshadow_relax+0x204) :| **fn -466 0.954 __ipipe_unstall_root+0x8 (ipipe_reenter_root+0x26) :| * (0x51) 0x00000064 -465+ 3.789 __ipipe_unstall_root+0x25 (ipipe_reenter_root+0x26) : * fn -461+ 1.578 send_sig+0x8 (xnshadow_relax+0x228) : * fn -460+ 1.496 send_sig_info+0xb (send_sig+0x1d) : * fn -458 0.909 __ipipe_test_and_stall_root+0x9 (send_sig_info+0x38) : **(0x50) 0x00000064 -457+ 1.699 __ipipe_test_and_stall_root+0x27 (send_sig_info+0x38) : **fn -455+ 1.203 specific_send_sig_info+0xb (send_sig_info+0x69) : **fn -454+ 1.706 __ipipe_test_root+0x8 (specific_send_sig_info+0x16)Quoted 8 lines
: **fn -453+ 3.360 sig_ignored+0x9 (specific_send_sig_info+0x29) : **fn -449+ 1.714 send_signal+0xb (specific_send_sig_info+0x55) : **fn -447+ 3.142 __sigqueue_alloc+0x9 (send_signal+0x3f) : **fn -444+ 1.210 kmem_cache_alloc+0xa (__sigqueue_alloc+0x42) : **fn -443 0.909 __ipipe_test_and_stall_root+0x9 (kmem_cache_alloc+0x12) : **(0x50) 0x00000064 -442+ 2.180 __ipipe_test_and_stall_root+0x27 (kmem_cache_alloc+0x12) : **fn -440+ 1.218 __ipipe_restore_root+0x8 (kmem_cache_alloc+0x52) : **fn -439+ 1.315 __ipipe_stall_root+0x8 (__ipipe_restore_root+0x11)No more recovery from the xeno stall, no more timer ticks.
The special traces were generated via
Quoted 8 lines
#define ipipe_mark_domain_stall(ipd,cpuid) \ ipipe_trace_special(0x50, ipd->priority) #define ipipe_mark_domain_unstall(ipd,cpuid) \ ipipe_trace_special(0x51, ipd->priority)Any ideas? I do not find anything fishy yet that we may have introduced to cause this problem.
Hmm, what about this theory: the RT-thread which got woken up in the first trace snippet suffered from a leaking IRQ lock. Its broken flags got restored on wakeup, and also when the thread went for termination (second trace). Therefore, we see this leaking domain stall. Possible explanation?
Quoted 4 lines
This would move I-pipe and Xenomai out of the focus, leaving only the 16550A driver and our middleware messaging service (also a RTDM driver, currently my top favourite). My trace unfortunately does not last back far enough to answer this, I will have a look at this on Monday.
I should stop blaming others: it was a leaking lock in xeno_16550A. :D
Quoted 4 lines
If it turned out to be the reason, we should consider putting some
XENO_ASSERTguards in the return-to-user paths of RTDM services.
This was done yesterday and immediately pulled out the offending code a few minutes ago.
Philippe, do you see any remaining issues, e.g. that the leak survived the task termination? Does this have any meaning for correct driver and skin code?
Jan
Quoted 137 lines · Jan Kiszka
Quoted 121 lines · Jan Kiszka
Quoted 104 lines · Jan Kiszka
Hi Philippe,
debugging is nice, tracing is still nicer. As you suggested, I extended the tracer with per-domain stall flags (needs some output clean-up, preliminary patch attached nevertheless).
And here is the result (full trace attached):
Quoted 42 lines
:| (0x51) 0x000000c8 -1113+ 1.112 __ipipe_sync_stage+0x142 (ipipe_suspend_domain+0x56) :| fn -1112+ 1.789 __ipipe_sync_stage+0xe (ipipe_suspend_domain+0x56) :| *(0x50) 0x00000064 -1110+ 1.293 __ipipe_sync_stage+0x97 (ipipe_suspend_domain+0x56) : *fn -1109+ 1.398 do_IRQ+0x8 (__ipipe_sync_stage+0xcf) : *fn -1107+ 2.105 __do_IRQ+0xc (do_IRQ+0x21) : *fn -1105+ 1.631 handle_IRQ_event+0xd (__do_IRQ+0x9e) : *fn -1104+ 2.413 timer_interrupt+0x9 (handle_IRQ_event+0x40) : *fn -1101+ 3.022 mark_offset_tsc+0xe (timer_interrupt+0x31) : *fn -1098+ 2.721 do_timer+0x9 (timer_interrupt+0x37) :| *fn -1096+ 2.112 __ipipe_handle_irq+0xe (common_interrupt+0x18) :| *fn -1093+ 1.210 __ipipe_ack_common_irq+0xc (__ipipe_handle_irq+0xc0) :| *(0x50) 0x00000064 -1092+ 1.218 __ipipe_ack_common_irq+0x31 (__ipipe_handle_irq+0xc0) :| *fn -1091+ 1.834 mask_and_ack_8259A+0xb (__ipipe_ack_common_irq+0x5d) :| *(0x50) 0x00000064 -1089+ 1.345 __ipipe_ack_common_irq+0x9d (__ipipe_handle_irq+0xc0) :| *fn -1088 0.924 ipipe_suspend_domain+0xb (__ipipe_handle_irq+0x174) :| *(0x51) 0x000000c8 -1087+ 1.172 ipipe_suspend_domain+0x26 (__ipipe_handle_irq+0x174) :| *fn -1086+ 2.030 __ipipe_sync_stage+0xe (ipipe_suspend_domain+0x56) :| **(0x50) 0x000000c8 -1084+ 1.330 __ipipe_sync_stage+0x97 (ipipe_suspend_domain+0x56) :| **fn -1082 0.879 xnintr_clock_handler+0x8 (__ipipe_sync_stage+0x12b) :| **fn -1082+ 1.218 xnintr_irq_handler+0xb (xnintr_clock_handler+0x18) :| **fn -1080+ 1.233 xnpod_announce_tick+0x9 (xnintr_irq_handler+0x2a) :| **(0x50) 0x000000c8 -1079+ 1.736 xnpod_announce_tick+0x20 (xnintr_irq_handler+0x2a) :| **fn -1077+ 2.984 xntimer_do_tick_aperiodic+0xe (xnpod_announce_tick+0x36) :| **fn -1074+ 2.751 xnthread_timeout_handler+0x8 (xntimer_do_tick_aperiodic+0x18d) :| **fn -1072+ 1.864 xnpod_resume_thread+0xe (xnthread_timeout_handler+0x1d) :| **(0x50) 0x000000c8 -1070+ 4.699 xnpod_resume_thread+0x2b (xnthread_timeout_handler+0x1d) :| **(0x50) 0x000000c8 -1065+ 1.586 xnpod_resume_thread+0x2bf (xnthread_timeout_handler+0x1d) :| **(0x01) 0x00001237 -1063+ 2.661 xntimer_do_tick_aperiodic+0x309 (xnpod_announce_tick+0x36) :| **(0x50) 0x000000c8 -1061+ 1.263 xnpod_announce_tick+0x4f (xnintr_irq_handler+0x2a) :| **fn -1060+ 1.255 rthal_irq_end+0x8 (xnintr_irq_handler+0x46) :| **fn -1058+ 2.007 enable_8259A_irq+0x9 (rthal_irq_end+0x2e) :| **fn -1056+ 1.924 xnpod_schedule+0xe (xnintr_irq_handler+0x6e) :| **(0x50) 0x000000c8 -1054! 15.368 xnpod_schedule+0x53 (xnintr_irq_handler+0x6e) :| **fn -1039! 13.300 __switch_to+0xc (xnpod_schedule+0x689) :| **(0x50) 0x000000c8 -1026+ 1.766 xnpod_schedule+0x951 (xnpod_suspend_thread+0x27c) :| **(0x50) 0x000000c8 -1024! 18.195 xnpod_suspend_thread+0x2bb (rt_task_sleep+0x54) : **fn -1006+ 1.624 __ipipe_syscall_root+0x9 (system_call+0x20) : **fn -1004+ 1.406 __ipipe_dispatch_event+0xe (__ipipe_syscall_root+0x58) : **fn -1003+ 4.323 hisyscall_event+0xe (__ipipe_dispatch_event+0x5e) : **fn -998+ 1.398 __rt_task_sleep+0xa (hisyscall_event+0x23c) : **fn -997+ 1.789 __copy_from_user_ll+0xa (__rt_task_sleep+0x1a) : **fn -995! 15.345 rt_task_sleep+0xa (__rt_task_sleep+0x25)Quoted 8 lines
: **fn -980 0.879 __ipipe_syscall_root+0x9 (system_call+0x20) : **fn -979+ 1.308 __ipipe_dispatch_event+0xe (__ipipe_syscall_root+0x58) : **fn -978+ 2.451 hisyscall_event+0xe (__ipipe_dispatch_event+0x5e) : **fn -975+ 1.631 sys_rtdm_ioctl+0x8 (hisyscall_event+0x23c) : **fn -974+ 1.255 _rtdm_ioctl+0xc (sys_rtdm_ioctl+0x1b) : **fn -972+ 4.180 rtdm_context_get+0xa (_rtdm_ioctl+0x20) : **fn -968+ 1.203 __ipipe_syscall_root+0x9 (system_call+0x20) : **fn -967+ 1.345 __ipipe_dispatch_event+0xe (__ipipe_syscall_root+0x58)The '*' mark a stalled domain, root domain on the right. It seems to me that
xnpod_suspend_thread()leaves the xeno domain stalled on wake up. This gets recovered somehow later.But here we see a different effect which finally causes the tick to get frozen:
Quoted 23 lines
: fn -504+ 2.075 sched_clock+0xd (schedule+0x112) : fn -502 0.992 __ipipe_stall_root+0x8 (schedule+0x18e) : *(0x50) 0x00000064 -501+ 4.022 __ipipe_stall_root+0x32 (schedule+0x18e) : *fn -497+ 1.977 __ipipe_dispatch_event+0xe (schedule+0x412) : *fn -495+ 4.210 schedule_event+0xd (__ipipe_dispatch_event+0x5e) : **(0x50) 0x000000c8 -491+ 1.428 schedule_event+0x261 (__ipipe_dispatch_event+0x5e) :| **fn -490+ 2.067 xnpod_schedule_runnable+0xe (schedule_event+0x28b) :| **fn -488 0.954 ipipe_unstall_pipeline_from+0xc (schedule_event+0x2c1) :| *(0x51) 0x000000c8 -487+ 4.646 ipipe_unstall_pipeline_from+0x25 (schedule_event+0x2c1) :| *fn -482+ 7.248 __switch_to+0xc (xnpod_schedule+0x689) :| **(0x50) 0x000000c8 -475+ 1.421 xnpod_schedule+0x77f (xnpod_suspend_thread+0x27c) :| **(0x50) 0x000000c8 -473+ 1.481 xnpod_schedule+0x951 (xnpod_suspend_thread+0x27c) :| **(0x50) 0x000000c8 -472+ 1.654 xnpod_suspend_thread+0x2bb (xnshadow_relax+0x136) :| **(0x50) 0x000000c8 -470+ 2.917 xnshadow_relax+0x154 (hisyscall_event+0x2ec) :| **fn -467+ 1.375 ipipe_reenter_root+0xb (xnshadow_relax+0x204) :| **fn -466 0.954 __ipipe_unstall_root+0x8 (ipipe_reenter_root+0x26) :| * (0x51) 0x00000064 -465+ 3.789 __ipipe_unstall_root+0x25 (ipipe_reenter_root+0x26) : * fn -461+ 1.578 send_sig+0x8 (xnshadow_relax+0x228) : * fn -460+ 1.496 send_sig_info+0xb (send_sig+0x1d) : * fn -458 0.909 __ipipe_test_and_stall_root+0x9 (send_sig_info+0x38) : **(0x50) 0x00000064 -457+ 1.699 __ipipe_test_and_stall_root+0x27 (send_sig_info+0x38) : **fn -455+ 1.203 specific_send_sig_info+0xb (send_sig_info+0x69) : **fn -454+ 1.706 __ipipe_test_root+0x8 (specific_send_sig_info+0x16)Quoted 8 lines
: **fn -453+ 3.360 sig_ignored+0x9 (specific_send_sig_info+0x29) : **fn -449+ 1.714 send_signal+0xb (specific_send_sig_info+0x55) : **fn -447+ 3.142 __sigqueue_alloc+0x9 (send_signal+0x3f) : **fn -444+ 1.210 kmem_cache_alloc+0xa (__sigqueue_alloc+0x42) : **fn -443 0.909 __ipipe_test_and_stall_root+0x9 (kmem_cache_alloc+0x12) : **(0x50) 0x00000064 -442+ 2.180 __ipipe_test_and_stall_root+0x27 (kmem_cache_alloc+0x12) : **fn -440+ 1.218 __ipipe_restore_root+0x8 (kmem_cache_alloc+0x52) : **fn -439+ 1.315 __ipipe_stall_root+0x8 (__ipipe_restore_root+0x11)No more recovery from the xeno stall, no more timer ticks.
The special traces were generated via
Quoted 8 lines
#define ipipe_mark_domain_stall(ipd,cpuid) \ ipipe_trace_special(0x50, ipd->priority) #define ipipe_mark_domain_unstall(ipd,cpuid) \ ipipe_trace_special(0x51, ipd->priority)Any ideas? I do not find anything fishy yet that we may have introduced to cause this problem.
Hmm, what about this theory: the RT-thread which got woken up in the first trace snippet suffered from a leaking IRQ lock. Its broken flags got restored on wakeup, and also when the thread went for termination (second trace). Therefore, we see this leaking domain stall. Possible explanation?
Quoted 4 lines
This would move I-pipe and Xenomai out of the focus, leaving only the 16550A driver and our middleware messaging service (also a RTDM driver, currently my top favourite). My trace unfortunately does not last back far enough to answer this, I will have a look at this on Monday.
I should stop blaming others: it was a leaking lock in
xeno_16550A. :DQuoted 3 lines
If it turned out to be the reason, we should consider putting some
XENO_ASSERTguards in the return-to-user paths of RTDM services.
Quoted 7 lines
This was done yesterday and immediately pulled out the offending code a few minutes ago.
Philippe, do you see any remaining issues, e.g. that the leak survived the task termination? Does this have any meaning for correct driver and skin code?
The only way I could see this leakage survive a switch transition would require it to happen over the root context, not over a primary context. Was it the case?
Signature · 1 line
Philippe.
Quoted 221 lines · Philippe Gerum
Quoted 220 lines · Jan Kiszka
Quoted 201 lines · Jan Kiszka
Quoted 184 lines · Jan Kiszka
Hi Philippe,
debugging is nice, tracing is still nicer. As you suggested, I extended the tracer with per-domain stall flags (needs some output clean-up, preliminary patch attached nevertheless).
And here is the result (full trace attached):
Quoted 91 lines
:| (
0x51)0x000000c8-1113+ 1.112__ipipe_sync_stage+0x142
(ipipe_suspend_domain+0x56)
:| fn -1112+ 1.789__ipipe_sync_stage+0xe
(ipipe_suspend_domain+0x56)
:| *(0x50)0x00000064-1110+ 1.293__ipipe_sync_stage+0x97
(ipipe_suspend_domain+0x56)
: *fn -1109+ 1.398do_IRQ+0x8
(__ipipe_sync_stage+0xcf): *fn -1107+ 2.105 __do_IRQ+0xc (do_IRQ+0x21) : *fn -1105+ 1.631 handle_IRQ_event+0xd(
__do_IRQ+0x9e)
: *fn -1104+ 2.413timer_interrupt+0x9
(handle_IRQ_event+0x40)
: *fn -1101+ 3.022mark_offset_tsc+0xe
(timer_interrupt+0x31)
: *fn -1098+ 2.721do_timer+0x9
(timer_interrupt+0x37)
:| *fn -1096+ 2.112__ipipe_handle_irq+0xe
(common_interrupt+0x18)
:| *fn -1093+ 1.210__ipipe_ack_common_irq+0xc
(__ipipe_handle_irq+0xc0)
:| *(0x50)0x00000064-1092+ 1.218__ipipe_ack_common_irq+0x31
(__ipipe_handle_irq+0xc0)
:| *fn -1091+ 1.834mask_and_ack_8259A+0xb
(__ipipe_ack_common_irq+0x5d)
:| *(0x50)0x00000064-1089+ 1.345__ipipe_ack_common_irq+0x9d
(__ipipe_handle_irq+0xc0)
:| *fn -1088 0.924ipipe_suspend_domain+0xb
(__ipipe_handle_irq+0x174)
:| *(0x51)0x000000c8-1087+ 1.172ipipe_suspend_domain+0x26
(__ipipe_handle_irq+0x174)
:| *fn -1086+ 2.030__ipipe_sync_stage+0xe
(ipipe_suspend_domain+0x56)
:| **(0x50)0x000000c8-1084+ 1.330__ipipe_sync_stage+0x97
(ipipe_suspend_domain+0x56)
:| **fn -1082 0.879xnintr_clock_handler+0x8
(__ipipe_sync_stage+0x12b)
:| **fn -1082+ 1.218xnintr_irq_handler+0xb
(xnintr_clock_handler+0x18)
:| **fn -1080+ 1.233xnpod_announce_tick+0x9
(xnintr_irq_handler+0x2a)
:| **(0x50)0x000000c8-1079+ 1.736xnpod_announce_tick+0x20
(xnintr_irq_handler+0x2a)
:| **fn -1077+ 2.984xntimer_do_tick_aperiodic+0xe(xnpod_announce_tick+0x36)
:| **fn -1074+ 2.751xnthread_timeout_handler+0x8(xntimer_do_tick_aperiodic+0x18d)
:| **fn -1072+ 1.864xnpod_resume_thread+0xe
(xnthread_timeout_handler+0x1d)
:| **(0x50)0x000000c8-1070+ 4.699xnpod_resume_thread+0x2b
(xnthread_timeout_handler+0x1d)
:| **(0x50)0x000000c8-1065+ 1.586xnpod_resume_thread+0x2bf
(xnthread_timeout_handler+0x1d)
:| **(0x01)0x00001237-1063+ 2.661xntimer_do_tick_aperiodic+0x309(xnpod_announce_tick+0x36)
:| **(0x50)0x000000c8-1061+ 1.263xnpod_announce_tick+0x4f
(xnintr_irq_handler+0x2a)
:| **fn -1060+ 1.255rthal_irq_end+0x8
(xnintr_irq_handler+0x46)
:| **fn -1058+ 2.007enable_8259A_irq+0x9
(rthal_irq_end+0x2e)
:| **fn -1056+ 1.924xnpod_schedule+0xe
(xnintr_irq_handler+0x6e)
:| **(0x50)0x000000c8-1054! 15.368xnpod_schedule+0x53(xnintr_irq_handler+0x6e)
:| **fn -1039! 13.300__switch_to+0xc
(xnpod_schedule+0x689)
:| **(0x50)0x000000c8-1026+ 1.766xnpod_schedule+0x951
(xnpod_suspend_thread+0x27c)
:| **(0x50)0x000000c8-1024! 18.195xnpod_suspend_thread+0x2bb(rt_task_sleep+0x54)
: **fn -1006+ 1.624__ipipe_syscall_root+0x9
(system_call+0x20)
: **fn -1004+ 1.406__ipipe_dispatch_event+0xe
(__ipipe_syscall_root+0x58)
: **fn -1003+ 4.323hisyscall_event+0xe
(__ipipe_dispatch_event+0x5e)
: **fn -998+ 1.398__rt_task_sleep+0xa
(hisyscall_event+0x23c)
: **fn -997+ 1.789__copy_from_user_ll+0xa
(__rt_task_sleep+0x1a)
: **fn -995! 15.345rt_task_sleep+0xa
(__rt_task_sleep+0x25)
: **fn -980 0.879__ipipe_syscall_root+0x9
(system_call+0x20)
: **fn -979+ 1.308__ipipe_dispatch_event+0xe
(__ipipe_syscall_root+0x58)
: **fn -978+ 2.451hisyscall_event+0xe
(__ipipe_dispatch_event+0x5e)
: **fn -975+ 1.631sys_rtdm_ioctl+0x8
(hisyscall_event+0x23c)Quoted 8 lines
: **fn -974+ 1.255
_rtdm_ioctl+0xc
(sys_rtdm_ioctl+0x1b)
: **fn -972+ 4.180rtdm_context_get+0xa
(_rtdm_ioctl+0x20)
: **fn -968+ 1.203__ipipe_syscall_root+0x9
(system_call+0x20)
: **fn -967+ 1.345__ipipe_dispatch_event+0xe
(__ipipe_syscall_root+0x58)The '*' mark a stalled domain, root domain on the right. It seems to me that
xnpod_suspend_thread()leaves the xeno domain stalled on wake up. This gets recovered somehow later.But here we see a different effect which finally causes the tick to get frozen:
Quoted 54 lines
: fn -504+ 2.075
sched_clock+0xd
(schedule+0x112)
: fn -502 0.992__ipipe_stall_root+0x8
(schedule+0x18e)
: *(0x50)0x00000064-501+ 4.022__ipipe_stall_root+0x32
(schedule+0x18e)
: *fn -497+ 1.977__ipipe_dispatch_event+0xe
(schedule+0x412)
: *fn -495+ 4.210schedule_event+0xd
(__ipipe_dispatch_event+0x5e)
: **(0x50)0x000000c8-491+ 1.428schedule_event+0x261
(__ipipe_dispatch_event+0x5e)
:| **fn -490+ 2.067xnpod_schedule_runnable+0xe
(schedule_event+0x28b)
:| **fn -488 0.954ipipe_unstall_pipeline_from+0xc(schedule_event+0x2c1)
:| *(0x51)0x000000c8-487+ 4.646ipipe_unstall_pipeline_from+0x25(schedule_event+0x2c1)
:| *fn -482+ 7.248__switch_to+0xc
(xnpod_schedule+0x689)
:| **(0x50)0x000000c8-475+ 1.421xnpod_schedule+0x77f
(xnpod_suspend_thread+0x27c)
:| **(0x50)0x000000c8-473+ 1.481xnpod_schedule+0x951
(xnpod_suspend_thread+0x27c)
:| **(0x50)0x000000c8-472+ 1.654xnpod_suspend_thread+0x2bb
(xnshadow_relax+0x136)
:| **(0x50)0x000000c8-470+ 2.917xnshadow_relax+0x154
(hisyscall_event+0x2ec)
:| **fn -467+ 1.375ipipe_reenter_root+0xb
(xnshadow_relax+0x204)
:| **fn -466 0.954__ipipe_unstall_root+0x8
(ipipe_reenter_root+0x26)
:| * (0x51)0x00000064-465+ 3.789__ipipe_unstall_root+0x25
(ipipe_reenter_root+0x26)
: * fn -461+ 1.578send_sig+0x8
(xnshadow_relax+0x228)
: * fn -460+ 1.496send_sig_info+0xb
(send_sig+0x1d)
: * fn -458 0.909__ipipe_test_and_stall_root+0x9(send_sig_info+0x38)
: **(0x50)0x00000064-457+ 1.699__ipipe_test_and_stall_root+0x27(send_sig_info+0x38)
: **fn -455+ 1.203specific_send_sig_info+0xb
(send_sig_info+0x69)
: **fn -454+ 1.706__ipipe_test_root+0x8
(specific_send_sig_info+0x16)
: **fn -453+ 3.360sig_ignored+0x9
(specific_send_sig_info+0x29)
: **fn -449+ 1.714send_signal+0xb
(specific_send_sig_info+0x55)
: **fn -447+ 3.142__sigqueue_alloc+0x9
(send_signal+0x3f)
: **fn -444+ 1.210kmem_cache_alloc+0xa
(__sigqueue_alloc+0x42)Quoted 8 lines
: **fn -443 0.909
__ipipe_test_and_stall_root+0x9(kmem_cache_alloc+0x12)
: **(0x50)0x00000064-442+ 2.180__ipipe_test_and_stall_root+0x27(kmem_cache_alloc+0x12)
: **fn -440+ 1.218__ipipe_restore_root+0x8
(kmem_cache_alloc+0x52)
: **fn -439+ 1.315__ipipe_stall_root+0x8
(__ipipe_restore_root+0x11)No more recovery from the xeno stall, no more timer ticks.
The special traces were generated via
Quoted 8 lines
#define ipipe_mark_domain_stall(ipd,cpuid) \ ipipe_trace_special(0x50, ipd->priority) #define ipipe_mark_domain_unstall(ipd,cpuid) \ ipipe_trace_special(0x51, ipd->priority)Any ideas? I do not find anything fishy yet that we may have introduced to cause this problem.
Hmm, what about this theory: the RT-thread which got woken up in the first trace snippet suffered from a leaking IRQ lock. Its broken flags got restored on wakeup, and also when the thread went for termination (second trace). Therefore, we see this leaking domain stall. Possible explanation?
Quoted 4 lines
This would move I-pipe and Xenomai out of the focus, leaving only the 16550A driver and our middleware messaging service (also a RTDM driver, currently my top favourite). My trace unfortunately does not last back far enough to answer this, I will have a look at this on Monday.
I should stop blaming others: it was a leaking lock in
xeno_16550A. :DQuoted 3 lines
If it turned out to be the reason, we should consider putting some
XENO_ASSERTguards in the return-to-user paths of RTDM services.This was done yesterday and immediately pulled out the offending code a few minutes ago.
Quoted 9 lines
Quoted 4 lines
Philippe, do you see any remaining issues, e.g. that the leak survived the task termination? Does this have any meaning for correct driver and skin code?
The only way I could see this leakage survive a switch transition would require it to happen over the root context, not over a primary context. Was it the case?
The task had to leave from primary mode. If I forced it to secondary before terminating, the problem did not show up.
Jan
Quoted 6 lines · Jan Kiszka
Quoted 6 lines
Quoted 5 lines
Philippe, do you see any remaining issues, e.g. that the leak survived the task termination? Does this have any meaning for correct driver and skin code?
Quoted 9 lines
Quoted 4 lines
The only way I could see this leakage survive a switch transition would require it to happen over the root context, not over a primary context. Was it the case?
The task had to leave from primary mode. If I forced it to secondary before terminating, the problem did not show up.
But does the code causing the leakage could have been run by different contexts in sequence, including the root one?
Signature · 1 line
Philippe.
Quoted 13 lines · Philippe Gerum
Quoted 12 lines · Jan Kiszka
Quoted 10 lines
Quoted 5 lines
Philippe, do you see any remaining issues, e.g. that the leak survived the task termination? Does this have any meaning for correct driver and skin code?
The only way I could see this leakage survive a switch transition would require it to happen over the root context, not over a primary context. Was it the case?
Quoted 7 lines
Quoted 3 lines
The task had to leave from primary mode. If I forced it to secondary before terminating, the problem did not show up.
But does the code causing the leakage could have been run by different contexts in sequence, including the root one?
I don't think so. Bugs in our software aside, there should be no switch to secondary mode until termination. Moreover, we installed a SIGXCPU handler, and that one didn't trigger as well.
I just constructed a simple test by placing rthal_local_irq_disable() in rt_timer_spin and setting up this user space app:
#include <stdio.h>
#include <signal.h>
#include <native/task.h>
#include <native/timer.h>
RT_TASK task;
void func(void *arg)
{
rt_timer_spin(0);
}void terminate(int sig)
{
printf("joining...\n");
rt_task_join(&task);
rt_task_delete(&task);
printf("done\n");
}int main()
{
signal(SIGINT, terminate);
rt_task_spawn(&task, "lockup", 0, 10, T_FPU | T_JOINABLE | T_WARNSW,
func, NULL);
pause();
return 0;
}Should this lock up (as it currently does) or rather continue to run normally after the RT-task terminated? BTW, I'm still not sure if we are hunting shadows (is IRQs off a legal state for user space in some skin?) or a real problem - i.e. is it worth the time.
Jan
Quoted 64 lines · Jan Kiszka
Quoted 13 lines · Philippe Gerum
Quoted 11 lines · Jan Kiszka
Quoted 9 lines
Quoted 4 lines
Philippe, do you see any remaining issues, e.g. that the leak survived the task termination? Does this have any meaning for correct driver and skin code?
The only way I could see this leakage survive a switch transition would require it to happen over the root context, not over a primary context. Was it the case?
Quoted 7 lines
Quoted 3 lines
The task had to leave from primary mode. If I forced it to secondary before terminating, the problem did not show up.
But does the code causing the leakage could have been run by different contexts in sequence, including the root one?
I don't think so. Bugs in our software aside, there should be no switch to secondary mode until termination. Moreover, we installed a SIGXCPU handler, and that one didn't trigger as well.
I just constructed a simple test by placing
rthal_local_irq_disable()inrt_timer_spinand setting up this user space app:#include <
stdio.h>
#include <signal.h>
#include <native/task.h>
#include <native/timer.h>
RT_TASKtask;void
func(void *arg){ rt_timer_spin(0); }void terminate(int sig)
{ printf("joining...\n"); rt_task_join(&task); rt_task_delete(&task); printf("done\n"); }int
main(){ signal(SIGINT, terminate); rt_task_spawn(&task, "lockup", 0, 10, T_FPU | T_JOINABLE | T_WARNSW, func, NULL); pause(); return 0; }
Quoted 5 lines
Should this lock up (as it currently does) or rather continue to run normally after the RT-task terminated? BTW, I'm still not sure if we are hunting shadows (is IRQs off a legal state for user space in some skin?) or a real problem - i.e. is it worth the time.
IRQS off in user-space - aside of the particular semantics introduced by the interrupt shielding - is not a correct state, but it is for kernel based RT threads, so I would expect the real-time core to be robust wrt this kind of situation. I'm going to put this issue on my work queue anyway, I don't like unexplained software thingies getting too close to the Twilight Zone...
Signature · 1 line
Philippe.
Quoted 64 lines · Jan Kiszka
Quoted 13 lines · Philippe Gerum
Quoted 11 lines · Jan Kiszka
Quoted 9 lines
Quoted 4 lines
Philippe, do you see any remaining issues, e.g. that the leak survived the task termination? Does this have any meaning for correct driver and skin code?
The only way I could see this leakage survive a switch transition would require it to happen over the root context, not over a primary context. Was it the case?
Quoted 7 lines
Quoted 3 lines
The task had to leave from primary mode. If I forced it to secondary before terminating, the problem did not show up.
But does the code causing the leakage could have been run by different contexts in sequence, including the root one?
I don't think so. Bugs in our software aside, there should be no switch to secondary mode until termination. Moreover, we installed a SIGXCPU handler, and that one didn't trigger as well.
I just constructed a simple test by placing
rthal_local_irq_disable()inrt_timer_spinand setting up this user space app:#include <
stdio.h>
#include <signal.h>
#include <native/task.h>
#include <native/timer.h>
RT_TASKtask;void
func(void *arg){ rt_timer_spin(0); }void terminate(int sig)
{ printf("joining...\n"); rt_task_join(&task); rt_task_delete(&task); printf("done\n"); }int
main(){ signal(SIGINT, terminate); rt_task_spawn(&task, "lockup", 0, 10, T_FPU | T_JOINABLE | T_WARNSW, func, NULL); pause(); return 0; }
Quoted 5 lines
Should this lock up (as it currently does) or rather continue to run normally after the RT-task terminated? BTW, I'm still not sure if we are hunting shadows (is IRQs off a legal state for user space in some skin?) or a real problem - i.e. is it worth the time.
I've just tested this frag against the current SVN head, patching rt_timer_spin() as required, and cannot reproduce the lockup. As expected, the incoming root thread reinstates the correct stall bit (i.e. clears it) after the RT thread terminates. Any chance some potentially troublesome stuff exists in your setup?
Signature · 1 line
Philippe.
Quoted 69 lines · Philippe Gerum
Quoted 68 lines · Jan Kiszka
Quoted 17 lines · Philippe Gerum
Quoted 15 lines · Jan Kiszka
Quoted 13 lines
Quoted 6 lines
Philippe, do you see any remaining issues, e.g. that the leak survived
the task termination? Does this have any meaning for correct driver and
skin code?The only way I could see this leakage survive a switch transition would
require it to happen over the root context, not over a primary context.
Was it the case?Quoted 7 lines
Quoted 3 lines
The task had to leave from primary mode. If I forced it to secondary before terminating, the problem did not show up.
But does the code causing the leakage could have been run by different contexts in sequence, including the root one?
I don't think so. Bugs in our software aside, there should be no switch to secondary mode until termination. Moreover, we installed a SIGXCPU handler, and that one didn't trigger as well.
I just constructed a simple test by placing
rthal_local_irq_disable()inrt_timer_spinand setting up this user space app:#include <
stdio.h>
#include <signal.h>
#include <native/task.h>
#include <native/timer.h>
RT_TASKtask;void
func(void *arg){ rt_timer_spin(0); }void terminate(int sig)
{ printf("joining...\n"); rt_task_join(&task); rt_task_delete(&task); printf("done\n"); }int
main(){ signal(SIGINT, terminate); rt_task_spawn(&task, "lockup", 0, 10, T_FPU | T_JOINABLE | T_WARNSW, func, NULL); pause(); return 0; }
Quoted 8 lines
Quoted 5 lines
Should this lock up (as it currently does) or rather continue to run normally after the RT-task terminated? BTW, I'm still not sure if we are hunting shadows (is IRQs off a legal state for user space in some skin?) or a real problem - i.e. is it worth the time.
I've just tested this frag against the current SVN head, patching
rt_timer_spin()as required, and cannot reproduce the lockup. As
Are you sure that you actually used the modified native skin for the test?
Quoted 4 lines
expected, the incoming root thread reinstates the correct stall bit (i.e. clears it) after the RT thread terminates. Any chance some potentially troublesome stuff exists in your setup?
I just re-verified this behaviour on a slightly different setup (still 2.6.15-ipipe-1.2-02, xeno trunk), and I'm going to try this on a third box with 2.6.16+tracing soon. So far I still have a stuck timer IRQ after the test.
Jan
Quoted 80 lines · Jan Kiszka
Quoted 78 lines · Philippe Gerum
Quoted 75 lines · Jan Kiszka
Quoted 18 lines · Philippe Gerum
Quoted 15 lines · Jan Kiszka
Quoted 13 lines
Quoted 6 lines
Philippe, do you see any remaining issues, e.g. that the leak survived
the task termination? Does this have any meaning for correct driver and
skin code?The only way I could see this leakage survive a switch transition would
require it to happen over the root context, not over a primary context.
Was it the case?Quoted 7 lines
Quoted 3 lines
The task had to leave from primary mode. If I forced it to secondary before terminating, the problem did not show up.
But does the code causing the leakage could have been run by different contexts in sequence, including the root one?
I don't think so. Bugs in our software aside, there should be no switch to secondary mode until termination. Moreover, we installed a SIGXCPU handler, and that one didn't trigger as well.
I just constructed a simple test by placing
rthal_local_irq_disable()inrt_timer_spinand setting up this user space app:#include <
stdio.h>
#include <signal.h>
#include <native/task.h>
#include <native/timer.h>
RT_TASKtask;void
func(void *arg){ rt_timer_spin(0); }void terminate(int sig)
{ printf("joining...\n"); rt_task_join(&task); rt_task_delete(&task); printf("done\n"); }int
main(){ signal(SIGINT, terminate); rt_task_spawn(&task, "lockup", 0, 10, T_FPU | T_JOINABLE | T_WARNSW, func, NULL); pause(); return 0; }Should this lock up (as it currently does) or rather continue to run normally after the RT-task terminated? BTW, I'm still not sure if we are hunting shadows (is IRQs off a legal state for user space in some skin?) or a real problem - i.e. is it worth the time.
Quoted 6 lines
Quoted 2 lines
I've just tested this frag against the current SVN head, patching
rt_timer_spin()as required, and cannot reproduce the lockup. AsAre you sure that you actually used the modified native skin for the test?
Yep, checked twice.
Quoted 14 lines
Quoted 5 lines
expected, the incoming root thread reinstates the correct stall bit (i.e. clears it) after the RT thread terminates. Any chance some potentially troublesome stuff exists in your setup?
I just re-verified this behaviour on a slightly different setup (still 2.6.15-ipipe-1.2-02, xeno trunk), and I'm going to try this on a third box with 2.6.16+tracing soon. So far I still have a stuck timer IRQ after the test.
Jan
Signature · 1 line
Philippe.