Ignore:
Timestamp:
Nov 21, 2014, 10:01:34 AM (5 years ago)
Author:
Luca Bonato <lohathe@…>
Branches:
4.11, master
Children:
26f4cdd
Parents:
6570876
git-author:
Luca Bonato <lohathe@…> (11/21/14 10:01:34)
git-committer:
Sebastian Huber <sebastian.huber@…> (11/24/14 07:01:15)
Message:

smp: Fix scheduler helping protocol

New test case for smptests/smpmrsp01.

Fix _Scheduler_Block_node() in case the node is in the
SCHEDULER_HELP_ACTIVE_RIVAL helping state. For example a
rtems_task_suspend() on a task waiting for a MrsP semaphore.

Fix _Scheduler_Unblock_node() in case the node is in the
SCHEDULER_SMP_NODE_READY state. For example a rtems_task_resume() on a
task owning or waiting for a MrsP semaphore.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • cpukit/score/include/rtems/score/schedulersmpimpl.h

    r6570876 rcceb19f4  
    794794  Scheduler_SMP_Node *node = _Scheduler_SMP_Thread_get_node( thread );
    795795  bool is_scheduled = node->state == SCHEDULER_SMP_NODE_SCHEDULED;
    796   bool block = _Scheduler_Block_node(
     796  bool block;
     797
     798  _Assert( is_scheduled || node->state == SCHEDULER_SMP_NODE_READY );
     799
     800  block = _Scheduler_Block_node(
    797801    context,
     802    thread,
    798803    &node->Base,
    799804    is_scheduled,
    800805    _Scheduler_SMP_Get_idle_thread
    801806  );
    802 
    803807  if ( block ) {
    804808    _Scheduler_SMP_Node_change_state( node, SCHEDULER_SMP_NODE_BLOCKED );
     
    839843
    840844  if ( unblock ) {
    841     _Scheduler_SMP_Node_change_state( node, SCHEDULER_SMP_NODE_READY );
    842 
    843     needs_help = ( *enqueue_fifo )( context, &node->Base, thread );
     845    if ( node->state != SCHEDULER_SMP_NODE_READY ) {
     846      _Scheduler_SMP_Node_change_state( node, SCHEDULER_SMP_NODE_READY );
     847
     848      needs_help = ( *enqueue_fifo )( context, &node->Base, thread );
     849    } else {
     850      _Assert( node->state == SCHEDULER_SMP_NODE_READY );
     851      _Assert( node->Base.idle == NULL );
     852
     853      if ( node->Base.accepts_help == thread ) {
     854        _Assert( node->Base.help_state == SCHEDULER_HELP_ACTIVE_OWNER );
     855        needs_help = thread;
     856      } else {
     857        _Assert( node->Base.help_state == SCHEDULER_HELP_ACTIVE_RIVAL );
     858        needs_help = NULL;
     859      }
     860    }
    844861  } else {
    845862    needs_help = NULL;
Note: See TracChangeset for help on using the changeset viewer.