All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai] Question about scheduling and signals
@ 2014-05-24 19:05 Matthias Schneider
  2014-05-24 19:37 ` Gilles Chanteperdrix
  0 siblings, 1 reply; 7+ messages in thread
From: Matthias Schneider @ 2014-05-24 19:05 UTC (permalink / raw)
  To: xenomai@xenomai.org

Hi all,

currently I am trying to make the following FreeRTOS test case run on 
forge/mercury on linux preempt_rt:


//Task 1, prio 1 / SCHED_FIFO
for(;;) {
  (*pulCounter)++;
  if( *pulCounter >= priMAX_COUNT )
     vTaskSuspend(NULL); // -> wait for signal SIGRESM
}

//Task 2, prio 0 / SCHED_OTHER
vTaskSuspendAll(); //-> sched_lock
vTaskResume(xLimitedIncrementHandle); //-> sends SIGRESM
xTaskResumeAll(); //-> sched_unlock, seems not to unlock the waiting task
                  // right away (because signal is not yet delivered?)
if (ulCounter != priMAX_COUNT)
  raise(SIGABRT);

Consider task 1 in vTaskSuspend. Task 2 will take the "scheduler lock", i.e. 
raises its priority. vTaskResume will then signal task 1 to resume via 
sending SIGRESM. Once xTaskResumeAll lowers task 2's priority to 0, 
I would expect task 1 to be executed right away. However it seems that
this is not the case - SIGABRT is raised instead.

What I do not fully understand is the delivery of the signal to task 1, which 
should unblock it, allowing it to run once task calls xTaskResumeAll().
When the signal is sent, task 2 is still the highest priority task in the 
process and will thus simply go on with its execution. Now, the signal seems
to be queued for task 1 somehow, but it is unclear to me when it is 
actually delivered (apparently task 1 is not scheduled right away once task 2 
calls xTaskResumeAll). Could anyone point me into the right direction where
to find the solution to this behavior (i.e. source-code wise)? 

Actually I am starting to have doubts about this this test case actually being 
is worth the headaches since we already agreed on supporting 
vTaskSuspendAll/xTaskResumeAll only partially on xenomai-forge, but it would 
still be interesting to understand the mentioned behavior...

Thanks in advance for your help.

Matthias



^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-05-25  8:05 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-05-24 19:05 [Xenomai] Question about scheduling and signals Matthias Schneider
2014-05-24 19:37 ` Gilles Chanteperdrix
2014-05-24 19:55   ` Matthias Schneider
2014-05-24 20:01     ` Gilles Chanteperdrix
2014-05-24 20:50       ` Matthias Schneider
2014-05-24 21:17         ` Gilles Chanteperdrix
2014-05-25  8:05           ` Matthias Schneider

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.