Notice: We have migrated to GitLab launching 2024-05-01 see here: https://gitlab.rtems.org/

#2365 closed defect (fixed)

Task pre-emption disable is broken due to pseudo ISR tasks

Reported by: Sebastian Huber Owned by: Sebastian Huber
Priority: lowest Milestone: 6.1
Component: score Version: 4.10
Severity: critical Keywords: qualification
Cc: Blocked By:
Blocking:

Description (last modified by Sebastian Huber)

We have for example:

Scheduler_Void_or_thread _Scheduler_priority_Unblock (
  const Scheduler_Control *scheduler,
  Thread_Control          *the_thread
)
{
  Scheduler_priority_Context *context =
    _Scheduler_priority_Get_context( scheduler );
  Scheduler_priority_Node *node = _Scheduler_priority_Thread_get_node( the_thread );

  _Scheduler_priority_Ready_queue_enqueue(
    &the_thread->Object.Node,
    &node->Ready_queue,
    &context->Bit_map
  );

  /* TODO: flash critical section? */

  /*
   *  If the thread that was unblocked is more important than the heir,
   *  then we have a new heir.  This may or may not result in a
   *  context switch.
   *
   *  Normal case:
   *    If the current thread is preemptible, then we need to do
   *    a context switch.
   *  Pseudo-ISR case:
   *    Even if the thread isn't preemptible, if the new heir is
   *    a pseudo-ISR system task, we need to do a context switch.
   */
  if ( the_thread->current_priority < _Thread_Heir->current_priority ) {
    _Scheduler_Update_heir(
      the_thread,
      the_thread->current_priority == PRIORITY_PSEUDO_ISR
    );
  }

  SCHEDULER_RETURN_VOID_OR_NULL;
}

So the unblock event of a pseudo ISR task (MPCI or timer server) may pre-empt a task with disabled pre-emption. Suppose a higher priority task than the non-preemptible task is ready. Then this task gets scheduled once the pseudo ISR task blocks again.

Change History (8)

comment:1 Changed on 06/12/15 at 12:00:01 by Sebastian Huber <sebastian.huber@…>

In [changeset:"0562060f074eea3fdcf5274aa3b7cbc8fe14993d/rtems"]:

sptests/sptasknopreempt01: New test

Update #2365.

comment:2 Changed on 06/12/15 at 12:12:15 by Sebastian Huber

Description: modified (diff)

comment:3 Changed on 01/26/17 at 07:16:00 by Sebastian Huber

Milestone: 4.11.14.11.2

comment:4 Changed on 02/15/17 at 13:44:44 by Sebastian Huber

Milestone: 4.11.2Indefinite
Owner: set to Needs Funding
Status: newassigned

comment:5 Changed on 07/15/22 at 08:39:46 by Sebastian Huber

Milestone: Indefinite6.1
Owner: changed from Needs Funding to Sebastian Huber
Status: assignedaccepted

comment:6 Changed on 07/26/22 at 09:18:04 by Sebastian Huber <sebastian.huber@…>

In [changeset:"f1eb94b1430b63f0818dea5b047e3ebbcb7f370f/rtems-docs" f1eb94b/rtems-docs]:

c-user: Do not mention pseudo-interrupt priority

Update #2365.

comment:7 Changed on 07/26/22 at 09:23:16 by Sebastian Huber <sebastian.huber@…>

Resolution: fixed
Status: acceptedclosed

In [changeset:"7fe6d60bf08df975c395515074c85976d9e4e3fb/rtems" 7fe6d60/rtems]:

score: Remove PRIORITY_PSEUDO_ISR thread priority

The uniprocessor schedulers had some special case logic for the
PRIORITY_PSEUDO_ISR priority. Tasks with a priority of PRIORITY_PSEUDO_ISR
were allowed to preempt a not preemptible task. If other higher priority task
are made ready while a PRIORITY_PSEUDO_ISR task preempts a not preemptible
task, then the other tasks run before the not preemptible task. This made the
RTEMS_NO_PREEMPT mode ineffective.

Remove the PRIORITY_PSEUDO_ISR special case logic. This simplifies the
uniprocessor schedulers. Move the uniprocessor-specific scheduler support to
the new header file <rtems/score/scheduleruniimpl.h>.

Close #2365.

comment:8 Changed on 07/26/22 at 09:25:19 by Sebastian Huber

Keywords: qualification added
Note: See TracTickets for help on using tickets.