#4534 closed defect (fixed)

SMP EDF scheduler violates priority group ordering

Reported by: Sebastian Huber Owned by: Sebastian Huber
Priority: normal Milestone: 6.1
Component: score Version: 5
Severity: normal Keywords: SMP, qualification
Cc: Blocked By:
Blocking:

Description (last modified by Sebastian Huber)

The SMP EDF scheduler supports one-to-one and one-to-all thread to processor affinities. The one-to-one thread to processor affinity introduces a constraint on the ordering of threads. The implementation uses one ready queue for threads which have a one-to-all affinity and one for each one-to-one affinity group. To order threads across the ready queues, a generation number is used. However, the approach to update the generation number each time a thread is inserted into a ready queue is wrong. The generation number need to be updated only in the enqueue and enqueue scheduled operations where an insert priority is available. The scheduled chain needs to take the generation number into account.

An example scenario which shows the bug is this. Let T be a high priority task affine to processor X. Let A be a lower priority task affine to processor X. Let B be a lower priority task with no affinity to a particular processor which executes on processor Y. Let B be in the same priority group than A and after A. Let T set the affinity to all processors. Now A (higher priority relative to B) should execute on X and T (high priority) should execute on Y.

Change History (3)

comment:1 Changed on 10/27/21 at 08:04:06 by Sebastian Huber

Description: modified (diff)

comment:2 Changed on 11/23/21 at 13:35:59 by Sebastian Huber <sebastian.huber@…>

In 6d20f0c5/rtems:

score: Add node to insert to Chain_Node_order

This allows to use additional members of the nodes for comparision.

Update #4534.

comment:3 Changed on 11/23/21 at 13:36:03 by Sebastian Huber <sebastian.huber@…>

Resolution: fixed
Status: assignedclosed

In b9990b8d/rtems:

score: Fix SMP EDF priority group ordering

The SMP EDF scheduler supports one-to-one and one-to-all thread to
processor affinities. The one-to-one thread to processor affinity
introduces a constraint on the ordering of threads. The implementation
uses one ready queue for threads which have a one-to-all affinity and
one for each one-to-one affinity group. To order threads across the
ready queues, a generation number is used. However, the approach to
update the generation number each time a thread is inserted into a ready
queue was wrong. The generation number needs to be updated only in the
enqueue and enqueue scheduled operations where an insert priority is
available. The scheduled chain needs to take the generation number into
account.

An example scenario which shows the bug is this. Let T be a high
priority task affine to processor X. Let A be a lower priority task
affine to processor X. Let B be a lower priority task with no affinity
to a particular processor which executes on processor Y. Let B be in
the same priority group than A and after A. Let T set the affinity to
all processors. Now A (higher priority relative to B) should execute on
X and T (high priority) should execute on Y.

Close #4534.

Note: See TracTickets for help on using tickets.