fix ximulator xnarch_program_next_timer_shot.
PATCH 1/1 fix ximulator xnarch_program_next_timer_shot.
Hi,
when xnarch_program_next_timer_shot is passed a null delay and there is no other timed event pending, the mvm terminates with the message:
"nothing to schedule".
The attached patch fixes this, though I am not sure it is the best way to fix it.
Signature · 1 line
Gilles Chanteperdrix.
asm-sim/bits/timer.h +1 -1
@@ -22,7 +22,7 @@static inline void xnarch_program_timer_shot (unsigned long delay) {/* 1 tsc unit of the virtual CPU == 1 ns. */ -mvm_program_timer (delay); +mvm_program_timer (delay ?:1 ); }static inline int xnarch_send_timer_ipi (xnarch_cpumask_t mask)
Quoted 6 lines · Gilles Chanteperdrix
Hi,
when
xnarch_program_next_timer_shotis passed a null delay and there is no other timed event pending, the mvm terminates with the message:
"nothing to schedule".
Actually, this is a purely event-driven engine, so if we manage to raise this condition, this basically means that there is nothing to do next for the engine, and no mean to get busy afterwise, since only handling some event may schedule another event in the engine's queue. Chicken-and-egg issue.
Quoted 2 lines
The attached patch fixes this, though I am not sure it is the best way to fix it.
Looks good. The only thing that still bothers me is that, at some point, it seems that we are triggering an immediate shot. Even if this situation is clearly possible in the real environment, I find it a bit suspicious in the simulated one. Maybe this is related to the timer adjustement code that may raise such situation (which would explain it then)?
Quoted 19 lines
plain text document attachment (xeno-sim-program-null-delay.diff)
Index:include/asm-sim/bits/timer.h
===================================================================asm-sim/bits/timer.h +1
-1@@ -22,7 +22,7 @@static inline void xnarch_program_timer_shot (unsigned long delay) {/* 1 tsc unit of the virtual CPU == 1 ns. */ -mvm_program_timer (delay); +mvm_program_timer (delay ?:1 ); }static inline int xnarch_send_timer_ipi (xnarch_cpumask_t mask)_______________________________________________
Xenomai-core mailing list
[email protected]
https://mail.gna.org/listinfo/xenomai-core
Signature · 1 line
Philippe.
Quoted 10 lines · Philippe Gerum
Quoted 2 lines · Gilles Chanteperdrix
The attached patch fixes this, though I am not sure it is the best way to fix it.
Looks good. The only thing that still bothers me is that, at some point, it seems that we are triggering an immediate shot. Even if this situation is clearly possible in the real environment, I find it a bit suspicious in the simulated one. Maybe this is related to the timer adjustement code that may raise such situation (which would explain it then)?
Yes, this is because of the timer adjustment code. We enqueue timers with an already passed expiry date, so the timer code ends up calling xnarch_program_timer_shot with a null delay.
Signature · 1 line
Gilles Chanteperdrix
Quoted 12 lines · Gilles Chanteperdrix
Quoted 10 lines · Philippe Gerum
Quoted 2 lines · Gilles Chanteperdrix
The attached patch fixes this, though I am not sure it is the best way to fix it.
Looks good. The only thing that still bothers me is that, at some point, it seems that we are triggering an immediate shot. Even if this situation is clearly possible in the real environment, I find it a bit suspicious in the simulated one. Maybe this is related to the timer adjustement code that may raise such situation (which would explain it then)?
Quoted 4 lines
Yes, this is because of the timer adjustment code. We enqueue timers with an already passed expiry date, so the timer code ends up calling
xnarch_program_timer_shotwith a null delay.
Then your patch is definitely ok. Will merge for -rc2 along with the timer adjustment code.
Signature · 1 line
Philippe.