Strange behaviour w/mutex&semaphore
Hi all,
I've a strange behaviour with the attached piece of code.
It's really simple: there are 3 tasks and we're spinning within the task in order to simulate task load.
It's a pure academic exercice, so don't try to think about the usefulness of this code ;-)
Actually, after insmod'ing the code into the kernel, the system freezes and the "meteoDataAcquisition" task is suspended runaway by the internal xenomai watchdog.
Why?
Anything wrong in this code?
Thanks for any advice.
Daniel
Quoted 9 lines · ROSSIER Daniel
Hi all,
I've a strange behaviour with the attached piece of code.
It's really simple: there are 3 tasks and we're spinning within the task in order to simulate task load.It's a pure academic exercice, so don't try to think about the usefulness of this code ;-)
Quoted 6 lines
Actually, after insmod'ing the code into the kernel, the system freezes and the "meteoDataAcquisition" task is suspended runaway by the internal xenomai watchdog.
Why?
Anything wrong in this code?
Check the values you assign to rt_task_set_periodic. Kind of... fast?
Quoted 13 lines
Thanks for any advice.
Daniel
------------------------------------------------------------------------
_______________________________________________
Xenomai-help mailing list
[email protected]
https://mail.gna.org/listinfo/xenomai-help
Quoted 23 lines
-----Message d'origine-----
De : [email protected] [mailto:[email protected]] Envoyé : jeudi, 20. juillet 2006 13:03
À : ROSSIER Daniel
Cc : [email protected]
Objet : Re: [Xenomai-help] Strange behaviour w/mutex&semaphoreQuoted 4 lines · ROSSIER Daniel
Hi all,
I've a strange behaviour with the attached piece of code. It's really simple: there are 3 tasks and we're spinning within the task
in order
Quoted 3 lines
to simulate task load.
It's a pure academic exercice, so don't try to think about the
usefulness of this code ;-)
Quoted 3 lines
Actually, after insmod'ing the code into the kernel, the system freezes
and
Quoted 8 lines
Quoted 1 line
the "meteoDataAcquisition" task is suspended runaway by the internal
xenomai watchdog.
Quoted 4 lines
Why?
Anything wrong in this code?
Check the values you assign to
rt_task_set_periodic. Kind of... fast?
No, with at these frequencies, there is no problem (the jiffy is at 1ms). Actually, putting TM_NOW in the rt_task_set_periodic() instead of 18 as it is, we noticed that it works. Removing the mutex & semaphore stuff, with the delay in set_periodic(), does not change the behaviour.
We came up with this issue after another one, actually, with a more sophisticated code showing a priority inversion. We reduce the code, and then find this issue. I do not know it both issues are related, but I'd like to solve this one first.
Quoted 15 lines
Quoted 14 lines
Thanks for any advice.
Daniel
------------------------------------------------------------------------
_______________________________________________
Xenomai-help mailing list
[email protected]
https://mail.gna.org/listinfo/xenomai-help
Quoted 26 lines · ROSSIER Daniel
Quoted 26 lines
-----Message d'origine-----
De : [email protected] [mailto:[email protected]] Envoyé : jeudi, 20. juillet 2006 13:03
À : ROSSIER Daniel
Cc : [email protected]
Objet : Re: [Xenomai-help] Strange behaviour w/mutex&semaphoreQuoted 4 lines · ROSSIER Daniel
Hi all,
I've a strange behaviour with the attached piece of code. It's really simple: there are 3 tasks and we're spinning within the task
in order
Quoted 3 lines
to simulate task load.
It's a pure academic exercice, so don't try to think about the
usefulness of this code ;-)
Quoted 3 lines
Actually, after insmod'ing the code into the kernel, the system freezes
and
Quoted 1 line
the "meteoDataAcquisition" task is suspended runaway by the internal
xenomai watchdog.
Quoted 1 line
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
Why?
Anything wrong in this code?
Check the values you assign to
rt_task_set_periodic. Kind of... fast?No, with at these frequencies, there is no problem (the jiffy is at 1ms).
There are two tasks with a period of 20 ms that are spinning 10 ms each. Does not this put a 100% load on the RT system ? If yes, then Linux has no time left to run. That is what the watchdog is here to avoid. You should try reducing the spinning time in order to let some time for Linux to run.
Signature · 1 line
Gilles Chanteperdrix.
Quoted 45 lines
-----Message d'origine-----
De : Gilles Chanteperdrix [mailto:[email protected]] Envoyé : jeudi, 20. juillet 2006 13:50
À : ROSSIER Daniel
Cc : [email protected]; [email protected]
Objet : RE: [Xenomai-help] Strange behaviour w/mutex&semaphoreQuoted 9 lines · ROSSIER Daniel
Quoted 9 lines
-----Message d'origine-----
De : [email protected] [mailto:[email protected]] Envoyé : jeudi, 20. juillet 2006 13:03
À : ROSSIER Daniel
Cc : [email protected]
Objet : Re: [Xenomai-help] Strange behaviour w/mutex&semaphoreQuoted 5 lines
Quoted 5 lines
Quoted 4 lines · ROSSIER Daniel
Hi all,
I've a strange behaviour with the attached piece of code. It's really simple: there are 3 tasks and we're spinning within the
task
Quoted 8 lines
Quoted 8 lines
in order
Quoted 3 lines
to simulate task load.
It's a pure academic exercice, so don't try to think about the
usefulness of this code ;-)
Quoted 3 lines
Actually, after insmod'ing the code into the kernel, the system
freezes
Quoted 2 lines
Quoted 2 lines
and
Quoted 1 line
the "meteoDataAcquisition" task is suspended runaway by the
internal
Quoted 8 lines
Quoted 7 lines
xenomai watchdog.
Quoted 4 lines
Why?
Anything wrong in this code?
Check the values you assign to
rt_task_set_periodic. Kind of... fast?
Quoted 8 lines
Quoted 2 lines
No, with at these frequencies, there is no problem (the jiffy is at 1ms).
There are two tasks with a period of 20 ms that are spinning 10 ms each. Does not this put a 100% load on the RT system ? If yes, then Linux has no time left to run. That is what the watchdog is here to avoid. You should try reducing the spinning time in order to let some time for Linux to run.
No, there are:
- a task "MeteoDataAcquisition", with a spin of 10ms, and a period of 1s (1000ms).
- a task "BusManagement", with a spin of 5ms, and a period of 20ms
- a task "ComHandling", with a spin of 10ms, and a period of 20ms.
So actually, the CPU load is 10/1000 + 5/20 + 10/20 = 0.76; and this gives Linux chance to run. (But again Gilles, it works with the following statement: rt_task_set_periodic(&meteoDataAcquisitionTask, TM_NOW, 1000);
I don't understand why it doesn't work with a delay of 18ms on the first release point of this task.
Quoted 3 lines
--
Daniel
Quoted 27 lines · ROSSIER Daniel
Quoted 27 lines
-----Message d'origine-----
De : [email protected] [mailto:[email protected]] Envoyé : jeudi, 20. juillet 2006 13:03
À : ROSSIER Daniel
Cc : [email protected]
Objet : Re: [Xenomai-help] Strange behaviour w/mutex&semaphoreQuoted 4 lines · ROSSIER Daniel
Hi all,
I've a strange behaviour with the attached piece of code. It's really simple: there are 3 tasks and we're spinning within the task
in order
Quoted 3 lines
to simulate task load.
It's a pure academic exercice, so don't try to think about the
usefulness of this code ;-)
Quoted 3 lines
Actually, after insmod'ing the code into the kernel, the system freezes
and
Quoted 1 line
the "meteoDataAcquisition" task is suspended runaway by the internal
xenomai watchdog.
Quoted 3 lines
Why?
Quoted 9 lines
Quoted 3 lines
Quoted 1 line
Anything wrong in this code?
Check the values you assign to
rt_task_set_periodic. Kind of... fast?No, with at these frequencies, there is no problem (the jiffy is at 1ms). Actually, putting
TM_NOWin thert_task_set_periodic()instead of 18 as it is, we noticed that it works. Removing the mutex & semaphore stuff, with the delay inset_periodic(), does not change the behaviour.
We came up with this issue after another one, actually, with a more sophisticated code showing a priority inversion. We reduce the code, and then find this issue. I do not know it both issues are related, but I'd like to solve this one first.
- rt_task_set_periodic(&meteoDataAcquisitionTask, 18, 1000);
+ rt_task_set_periodic(&meteoDataAcquisitionTask, rt_timer_read() + 18, 1000);
The current call should return with -ETIMEDOUT, in which case, the associated acquisition thread would enter a runaway loop, with rt_task_wait_period() systematically bailing out upon the same error, which in turn makes the task sucking all the available CPU. Then came the relentless watchdog...
Quoted 22 lines
Quoted 8 lines
Quoted 8 lines
Thanks for any advice.
Daniel
Quoted 7 lines
Quoted 6 lines
------------------------------------------------------------------------
_______________________________________________
Xenomai-help mailing list
[email protected]
https://mail.gna.org/listinfo/xenomai-help_______________________________________________
Xenomai-help mailing list
[email protected]
https://mail.gna.org/listinfo/xenomai-help
Signature · 1 line
Philippe.
Quoted 59 lines
-----Message d'origine-----
De : Philippe Gerum [mailto:[email protected]]
Envoyé : jeudi, 20. juillet 2006 14:04
À : ROSSIER Daniel
Cc : [email protected]; [email protected] Objet : RE: [Xenomai-help] Strange behaviour w/mutex&semaphoreQuoted 8 lines · ROSSIER Daniel
Quoted 8 lines
-----Message d'origine-----
De : [email protected] [mailto:[email protected]] Envoyé : jeudi, 20. juillet 2006 13:03
À : ROSSIER Daniel
Cc : [email protected]
Objet : Re: [Xenomai-help] Strange behaviour w/mutex&semaphoreQuoted 5 lines
Quoted 5 lines
Quoted 4 lines · ROSSIER Daniel
Hi all,
I've a strange behaviour with the attached piece of code. It's really simple: there are 3 tasks and we're spinning within the
task
Quoted 8 lines
Quoted 8 lines
in order
Quoted 3 lines
to simulate task load.
It's a pure academic exercice, so don't try to think about the
usefulness of this code ;-)
Quoted 3 lines
Actually, after insmod'ing the code into the kernel, the system
freezes
Quoted 11 lines
Quoted 9 lines
and
Quoted 1 line
the "meteoDataAcquisition" task is suspended runaway by the internal
xenomai watchdog.
Quoted 4 lines
Why?
Anything wrong in this code?
Check the values you assign to
rt_task_set_periodic. Kind of... fast?No, with at these frequencies, there is no problem (the jiffy is at
1ms). Actually, putting
TM_NOWin thert_task_set_periodic()instead of 18 as it is, we noticed that it works.Quoted 1 line
Removing the mutex & semaphore stuff, with the delay in
set_periodic(),does not change the behaviour.
Quoted 1 line
We came up with this issue after another one, actually, with a more
sophisticated code showing a priority inversion. We reduce the code, and then find this issue. I do not know it both issues are related, but I'd like
Quoted 2 lines
to solve this one first.
(quoted diff) +1
-1- rt_task_set_periodic(&meteoDataAcquisitionTask, 18, 1000); + rt_task_set_periodic(&meteoDataAcquisitionTask, rt_timer_read() + 18,1000);
Quoted 5 lines
The current call should return with
-ETIMEDOUT, in which case, the associated acquisition thread would enter a runaway loop, withrt_task_wait_period()systematically bailing out upon the same error, which in turn makes the task sucking all the available CPU. Then came the relentless watchdog...
Of course! It's absolute time as well explained in the API. Thanks a lot Philippe; I need some Holidays ;-) So, I will now post the real issue we have with the priority inversion, probably another easy fix to find out ;)
Quoted 20 lines
Quoted 10 lines
Quoted 10 lines
Quoted 10 lines
Thanks for any advice.
Daniel
--------------------------------------------------------------------
----
Quoted 9 lines
Quoted 6 lines
Quoted 5 lines
_______________________________________________
Xenomai-help mailing list
[email protected]
https://mail.gna.org/listinfo/xenomai-help
Quoted 7 lines
Quoted 4 lines
_______________________________________________
Xenomai-help mailing list
[email protected]
https://mail.gna.org/listinfo/xenomai-help--
Philippe.
Daniel