Skip to contentSkip to conversation

Monitoring Xenomai scheduler switches

Xenomai-help Tschaeche IT-Services 4 participants 5 messages May 20, 2010 – May 25, 2010

lore
Share & tools
lore
#0 lore raw

Hi,

we started an application which monitors task switches using Xenomai 2.5.3.

For monitoring primary domain switches we hooked in our code by using rt_task_add_hook(T_HOOK_SWITCH) (storing a timestamp and the Xenomai task ID in an array, which is read later by user space appl from shared memory).

It seems, that our code is not called when Xenomai switches to the ROOT task.

We already had this issue with Xenomai 2.4.10 and solved it by applying the attached patch.

How can we catch these Xenomai scheduler events in 2.5.3?

What is the reason for filtering them out?

Best regards,

Olli

ksrc/nucleus/pod.c +1 -1
Index: xenomai-2.4.10/ksrc/nucleus/pod.c
===================================================================
@@ -2561,7 +2561,7 @@
 		nkpod->schedhook(runthread, XNRUNNING);
 #endif /* __XENO_SIM__ */
 
-	if (!emptyq_p(&nkpod->tswitchq) && !xnthread_test_state(runthread, XNROOT)) {
+	if (!emptyq_p(&nkpod->tswitchq)) {
 		trace_mark(xn_nucleus, thread_callout,
 			   "thread %p thread_name %s hook %s",
 			   runthread, xnthread_name(runthread), "SWITCH");
#1 lore raw

Hi,

Quoted 9 lines

we started an application which monitors task switches using Xenomai 2.5.3.

For monitoring primary domain switches we hooked in our code by using rt_task_add_hook(T_HOOK_SWITCH) (storing a timestamp and the Xenomai task ID in an array, which is read later by user space appl from shared memory).

This is not related to your actual question:

Do you want to monitor task switches for debugging or is it part of your application? If for debugging, have you ever used lttng? I know it takes a while to install it but it's quite reliable and can give you much more than the info when a certain task switch occured.

Regards, Andreas

#2 lore raw
In reply to Tschaeche IT-Services
Quoted 10 lines · Tschaeche IT-Services

Hi,

we started an application which monitors task switches using Xenomai 2.5.3.

For monitoring primary domain switches we hooked in our code by using rt_task_add_hook(T_HOOK_SWITCH) (storing a timestamp and the Xenomai task ID in an array, which is read later by user space appl from shared memory).

Quoted 8 lines

It seems, that our code is not called when Xenomai switches to the ROOT task.

We already had this issue with Xenomai 2.4.10 and solved it by applying the attached patch.

How can we catch these Xenomai scheduler events in 2.5.3?

What is the reason for filtering them out?

The nucleus switch hook service was created to implement the equivalent service provided by RTOSes such as vxworks, psos, vrtx, etc... And we wrongly assumed that for these RTOSes the switch hook was not called when switching to the idle task. So, your patch is indeed neeeded. We also probably need to change code in some places to avoid missing the switches which take place when changing mode.

Signature · 1 line
					    Gilles.
#3 lore raw
In reply to Tschaeche IT-Services
Quoted 10 lines · Tschaeche IT-Services

Hi,

we started an application which monitors task switches using Xenomai 2.5.3.

For monitoring primary domain switches we hooked in our code by using rt_task_add_hook(T_HOOK_SWITCH) (storing a timestamp and the Xenomai task ID in an array, which is read later by user space appl from shared memory).

Quoted 8 lines

It seems, that our code is not called when Xenomai switches to the ROOT task.

We already had this issue with Xenomai 2.4.10 and solved it by applying the attached patch.

How can we catch these Xenomai scheduler events in 2.5.3?

What is the reason for filtering them out?

No valid one. Patch queued in my tree, thanks.

Quoted 8 lines

Best regards,

Olli
_______________________________________________
Xenomai-help mailing list
[email protected]
https://mail.gna.org/listinfo/xenomai-help

Signature · 1 line
Philippe.
#4 lore raw
Quoted 11 lines · Philippe Gerum
Quoted 9 lines

...
It seems, that our code is not called when Xenomai switches to the ROOT task.

We already had this issue with Xenomai 2.4.10
and solved it by applying the attached patch.

How can we catch these Xenomai scheduler events in 2.5.3?

What is the reason for filtering them out?

No valid one. Patch queued in my tree, thanks.

Just tested your queued patch for 2.5.3 in our build. Looks great now: we are able to trace all context switches now :-)

Thanks,

Olli

Signature · 4 lines
Tschaeche IT-Services       Tel.:  +49/9134/9089850
Dr.-Ing. Oliver Tschäche    Mobil: +49/176/20435601
Welluckenweg 4              Email: [email protected]
91077 Neunkirchen