Skip to contentSkip to conversation

RT thread seems blocked

DISCUSSION Bradley Valdenebro Peter (DC-AE/ESW52) 2 participants 7 messages Mar 17, 2020 – Mar 25, 2020

lore
Share & tools
lore
#0 lore raw

Hello Xenomai team,

We are running a Xenomai/Linux setup on a Zynq Z-7020 SoC (We run Linux on CPU0 and Xenomai on CPU1):
- Linux version 4.4.0-xilinx (gcc version 8.3.0 (Buildroot 2019.02-00080-gc31d48e) ) #1 SMP PREEMPT
- ipipe ARM patch #8
- Xenomai 3.0.10

Lately we have been experiencing that our highest priority real time Xenomai thread halts for around 1ms every now and then. We see it happening during different points in our thread.

This thread is triggered by an interrupt generated from the Zynq fpga logic every 125us. We have an fpga counter which is incremented every time an interrupt is generated. We can see in our logging that we can miss up to 4 counts (~1ms) and we do not know what is going on during that time.

We have tried using the ipipe-tracer but that gives some overhead and the issue isn't reproducible. The same with ftrace.

Switching from Xenomai 3.0.10 to 3.1 we see the number of occurrences decrease but still we see them. It is quite difficult to reproduce. It happens around once every 24 hours.

Have you got any ideas?
Are there any known Xenomai/ipipe bugs that could explain this behaviour?

Thanks in advance for your support.

Best regards.
Peter Bradley
​

#1 lore raw
Quoted 12 lines · On 17.03.20 11:22, Bradley Valdenebro Peter (DC-AE/ESW52) via Xenomai wrote:

Hello Xenomai team,

We are running a Xenomai/Linux setup on a Zynq Z-7020 SoC (We run Linux on CPU0 and Xenomai on CPU1):
- Linux version 4.4.0-xilinx (gcc version 8.3.0 (Buildroot 2019.02-00080-gc31d48e) ) #1 SMP PREEMPT
- ipipe ARM patch #8
- Xenomai 3.0.10

Lately we have been experiencing that our highest priority real time Xenomai thread halts for around 1ms every now and then. We see it happening during different points in our thread.

This thread is triggered by an interrupt generated from the Zynq fpga logic every 125us. We have an fpga counter which is incremented every time an interrupt is generated. We can see in our logging that we can miss up to 4 counts (~1ms) and we do not know what is going on during that time.

Quoted 9 lines

We have tried using the ipipe-tracer but that gives some overhead and the issue isn't reproducible. The same with ftrace.

Switching from Xenomai 3.0.10 to 3.1 we see the number of occurrences decrease but still we see them. It is quite difficult to reproduce. It happens around once every 24 hours.

Have you got any ideas?
Are there any known Xenomai/ipipe bugs that could explain this behaviour?

Already tried ipipe-4.4.y-cip head? I can't promise it helps, but it does contain quite a few fixes, compared to your baseline.

Jan

Signature · 2 lines
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux
#2 lore raw

Hello Jan,

Following your advice we changed our setup and we are now running the following:

	$ uname -a
		Linux wom03 4.14.110-mainline #1 SMP PREEMPT Tue Mar 17 17:25:22 CET 2020 armv7l GNU/Linux
	$ cat /proc/xenomai/version
		3.1
	$ cat /proc/ipipe/version
		7
It is still early to say but it is looking better.
We will keep you updated.

Best regards,

Peter Bradley
​
-----Original Message-----
From: Jan Kiszka <[email protected]>
Sent: 17 March 2020 11:45
To: Bradley Valdenebro Peter (DC-AE/ESW52) <[email protected]>; [email protected]
Subject: Re: RT thread seems blocked

Quoted 12 lines · On 17.03.20 11:22, Bradley Valdenebro Peter (DC-AE/ESW52) via Xenomai wrote:

Hello Xenomai team,

We are running a Xenomai/Linux setup on a Zynq Z-7020 SoC (We run Linux on CPU0 and Xenomai on CPU1):
- Linux version 4.4.0-xilinx (gcc version 8.3.0 (Buildroot 2019.02-00080-gc31d48e) ) #1 SMP PREEMPT
- ipipe ARM patch #8
- Xenomai 3.0.10

Lately we have been experiencing that our highest priority real time Xenomai thread halts for around 1ms every now and then. We see it happening during different points in our thread.

This thread is triggered by an interrupt generated from the Zynq fpga logic every 125us. We have an fpga counter which is incremented every time an interrupt is generated. We can see in our logging that we can miss up to 4 counts (~1ms) and we do not know what is going on during that time.

Quoted 9 lines

We have tried using the ipipe-tracer but that gives some overhead and the issue isn't reproducible. The same with ftrace.

Switching from Xenomai 3.0.10 to 3.1 we see the number of occurrences decrease but still we see them. It is quite difficult to reproduce. It happens around once every 24 hours.

Have you got any ideas?
Are there any known Xenomai/ipipe bugs that could explain this behaviour?

Already tried ipipe-4.4.y-cip head? I can't promise it helps, but it does contain quite a few fixes, compared to your baseline.

Jan

--
Siemens AG, Corporate Technology, CT RDA IOT SES-DE Corporate Competence Center Embedded Linux

#3 lore raw
In reply to Jan Kiszka

Hello,

We run some tests during the weekend and although we have less occurrences we still indeed see them.

One interesting thing we see besides the 1ms stalling is that sometimes we see over 100us between IRQ and ISR start. At this point we do not know how to proceed further. Any help or suggestion is greatly appreciated.

Met vriendelijke groeten / Best regards,

Peter Bradley
DC-AE/ESW52

Tel. +31 40 257-8858
​

-----Original Message-----
From: Bradley Valdenebro Peter (DC-AE/ESW52)
Sent: 20 March 2020 11:14
To: 'Jan Kiszka' <[email protected]>; [email protected]
Subject: RE: RT thread seems blocked

Hello Jan,

Following your advice we changed our setup and we are now running the following:

	$ uname -a
		Linux wom03 4.14.110-mainline #1 SMP PREEMPT Tue Mar 17 17:25:22 CET 2020 armv7l GNU/Linux
	$ cat /proc/xenomai/version
		3.1
	$ cat /proc/ipipe/version
		7
It is still early to say but it is looking better.
We will keep you updated.

Best regards,

Peter Bradley
​
-----Original Message-----
From: Jan Kiszka <[email protected]>
Sent: 17 March 2020 11:45
To: Bradley Valdenebro Peter (DC-AE/ESW52) <[email protected]>; [email protected]
Subject: Re: RT thread seems blocked

Quoted 12 lines · On 17.03.20 11:22, Bradley Valdenebro Peter (DC-AE/ESW52) via Xenomai wrote:

Hello Xenomai team,

We are running a Xenomai/Linux setup on a Zynq Z-7020 SoC (We run Linux on CPU0 and Xenomai on CPU1):
- Linux version 4.4.0-xilinx (gcc version 8.3.0 (Buildroot 2019.02-00080-gc31d48e) ) #1 SMP PREEMPT
- ipipe ARM patch #8
- Xenomai 3.0.10

Lately we have been experiencing that our highest priority real time Xenomai thread halts for around 1ms every now and then. We see it happening during different points in our thread.

This thread is triggered by an interrupt generated from the Zynq fpga logic every 125us. We have an fpga counter which is incremented every time an interrupt is generated. We can see in our logging that we can miss up to 4 counts (~1ms) and we do not know what is going on during that time.

Quoted 9 lines

We have tried using the ipipe-tracer but that gives some overhead and the issue isn't reproducible. The same with ftrace.

Switching from Xenomai 3.0.10 to 3.1 we see the number of occurrences decrease but still we see them. It is quite difficult to reproduce. It happens around once every 24 hours.

Have you got any ideas?
Are there any known Xenomai/ipipe bugs that could explain this behaviour?

Already tried ipipe-4.4.y-cip head? I can't promise it helps, but it does contain quite a few fixes, compared to your baseline.

Jan

--
Siemens AG, Corporate Technology, CT RDA IOT SES-DE Corporate Competence Center Embedded Linux

#4 lore raw
Quoted 7 lines · On 24.03.20 12:43, Bradley Valdenebro Peter (DC-AE/ESW52) wrote:

Hello,

We run some tests during the weekend and although we have less occurrences we still indeed see them.

One interesting thing we see besides the 1ms stalling is that sometimes we see over 100us between IRQ and ISR start. At this point we do not know how to proceed further. Any help or suggestion is greatly appreciated.

That is usually where you should start to look into tracing. Option A is event-level tracing via standard ftrace. Use

trace-cmd record -e "cobalt*" -e sched -e signal

to record such a trace. Ideally instrument the point where the latency is off in your application via xnftrace_printf() (will leave a mark in that recorded trace). Check via "trace-cmd report" if the schedule around that peak is what you would expect.

For digging even deeper, down to function level: https://gitlab.denx.de/Xenomai/xenomai/-/wikis/Using_The_I_Pipe_Tracer, specifically look into xntrace_user_freeze(), calling that from your application when you spot an excessive latency to stop the trace.

If the result is not clear to you, share it to get a community inspection.

Jan

Signature · 2 lines
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux
#5 lore raw

Hello,

Thanks for your support Jan.

We have already tried with ftrace and we couldn't reproduce the issue. We think because the introduced overhead. We usually record the following events:

sudo trace-cmd start -e ipi -e irq -e rcu -e workqueue_execute_end -e workqueue_execute_start -e mm_page_alloc -e mm_page_free
-e sched_migrate_task -e sched_switch -e cobalt_irq_exit -e cobalt_irq_entry -e cobalt_thread_migrate -e cobalt_switch_context -e cobalt_head_sysexit -e cobalt_clock_entry -e cobalt_clock_exit

Would changing to trace-cmd record -e "cobalt*" -e sched -e signal make a difference?

We have also tried using the ipipe tracer but there we also had no luck. We didn't use xntrace_user_freeze() but we monitored the trace IRQs-off times in /proc. Using xntrace_user_freeze() might be worth a try.

Best regards,

Peter Bradley
​
-----Original Message-----
From: Jan Kiszka <[email protected]>
Sent: 24 March 2020 12:53
To: Bradley Valdenebro Peter (DC-AE/ESW52) <[email protected]>; [email protected]
Subject: Re: RT thread seems blocked

Quoted 7 lines · On 24.03.20 12:43, Bradley Valdenebro Peter (DC-AE/ESW52) wrote:

Hello,

We run some tests during the weekend and although we have less occurrences we still indeed see them.

One interesting thing we see besides the 1ms stalling is that sometimes we see over 100us between IRQ and ISR start. At this point we do not know how to proceed further. Any help or suggestion is greatly appreciated.

That is usually where you should start to look into tracing. Option A is event-level tracing via standard ftrace. Use

trace-cmd record -e "cobalt*" -e sched -e signal

to record such a trace. Ideally instrument the point where the latency is off in your application via xnftrace_printf() (will leave a mark in that recorded trace). Check via "trace-cmd report" if the schedule around that peak is what you would expect.

For digging even deeper, down to function level:
https://gitlab.denx.de/Xenomai/xenomai/-/wikis/Using_The_I_Pipe_Tracer,
specifically look into xntrace_user_freeze(), calling that from your application when you spot an excessive latency to stop the trace.

If the result is not clear to you, share it to get a community inspection.

Jan

--
Siemens AG, Corporate Technology, CT RDA IOT SES-DE Corporate Competence Center Embedded Linux

#6 lore raw
Quoted 11 lines · On 25.03.20 08:59, Bradley Valdenebro Peter (DC-AE/ESW52) wrote:

Hello,

Thanks for your support Jan.

We have already tried with ftrace and we couldn't reproduce the issue. We think because the introduced overhead. We usually record the following events:

sudo trace-cmd start -e ipi -e irq -e rcu -e workqueue_execute_end -e workqueue_execute_start -e mm_page_alloc -e mm_page_free
-e sched_migrate_task -e sched_switch -e cobalt_irq_exit -e cobalt_irq_entry -e cobalt_thread_migrate -e cobalt_switch_context -e cobalt_head_sysexit -e cobalt_clock_entry -e cobalt_clock_exit

Would changing to trace-cmd record -e "cobalt*" -e sched -e signal make a difference?

If you already have troubles reproducing with your reduced event set, this won't be easier with the extended cobalt events. I would rather try to reduce the set further, maybe leaving out rcu, syscalls, allocations and maybe even interrupts.

Quoted 3 lines

We have also tried using the ipipe tracer but there we also had no luck. We didn't use xntrace_user_freeze() but we monitored the trace IRQs-off times in /proc. Using xntrace_user_freeze() might be worth a try.

If you can reproduce under enabled ipipe trace, then this makes sense.

Jan

Quoted 37 lines

Best regards,

Peter Bradley
​
-----Original Message-----
From: Jan Kiszka <[email protected]>
Sent: 24 March 2020 12:53
To: Bradley Valdenebro Peter (DC-AE/ESW52) <[email protected]>; [email protected]
Subject: Re: RT thread seems blocked

Quoted 7 lines · On 24.03.20 12:43, Bradley Valdenebro Peter (DC-AE/ESW52) wrote:

Hello,

We run some tests during the weekend and although we have less occurrences we still indeed see them.

One interesting thing we see besides the 1ms stalling is that sometimes we see over 100us between IRQ and ISR start. At this point we do not know how to proceed further. Any help or suggestion is greatly appreciated.

That is usually where you should start to look into tracing. Option A is event-level tracing via standard ftrace. Use

trace-cmd record -e "cobalt*" -e sched -e signal

to record such a trace. Ideally instrument the point where the latency is off in your application via xnftrace_printf() (will leave a mark in that recorded trace). Check via "trace-cmd report" if the schedule around that peak is what you would expect.

For digging even deeper, down to function level:
https://gitlab.denx.de/Xenomai/xenomai/-/wikis/Using_The_I_Pipe_Tracer,
specifically look into xntrace_user_freeze(), calling that from your application when you spot an excessive latency to stop the trace.

If the result is not clear to you, share it to get a community inspection.

Jan

--
Siemens AG, Corporate Technology, CT RDA IOT SES-DE Corporate Competence Center Embedded Linux

Signature · 2 lines
Siemens AG, Corporate Technology, CT RDA IOT SES-DE
Corporate Competence Center Embedded Linux