summaryrefslogtreecommitdiffstats
path: root/cpukit/score/src/scheduleredfsmp.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Update company nameSebastian Huber2023-05-201-1/+1
| | | | | The embedded brains GmbH & Co. KG is the legal successor of embedded brains GmbH.
* score/src/[n-s]*.c: Change license to BSD-2Joel Sherrill2022-02-281-3/+22
| | | | Updates #3053.
* score: Restrict affinity for EDF SMP schedulerSebastian Huber2021-11-231-6/+27
| | | | | | | | | | | | | | | | | | The SMP EDF scheduler supports a one-to-one and one-to-all thread to processor affinity. It accepted affinity sets which are a proper subset of the online processor containing at least two processors owned by the scheduler. In this case it used a one-to-one thread to processor affinity. This leads to undefined behaviour if a processor is removed since the higher level check in rtems_scheduler_remove_processor() does not account for this implementation detail. Restrict the affinity set accepted by the SMP EDF scheduler to 1. all online processors, or 2. exactly one processor owned by the scheduler. Close #4545.
* score: _Scheduler_SMP_Schedule_highest_ready()Sebastian Huber2021-11-231-4/+2
| | | | | | | | | Simplify callers of _Scheduler_SMP_Schedule_highest_ready(). Move the node state change and the extraction from scheduled into _Scheduler_SMP_Schedule_highest_ready(). Move the idle thread release to the caller which have more information about the presence of an idle thread. Update #4531.
* score: Remove victim thread from CPU allocationSebastian Huber2021-11-231-13/+9
| | | | Update #4531.
* score: Fix SMP EDF priority group orderingSebastian Huber2021-11-231-13/+61
| | | | | | | | | | | | | | | | | | | | | | | | 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.
* score: Rework idle handling in SMP schedulersSebastian Huber2021-11-231-11/+54
| | | | | | | | | | | | | | | | | | This patch fixes an issue with the idle thread handling in the SMP scheduler framework used for the MrsP locking protocol. The approach to use a simple chain of unused idle threads is broken for schedulers which support thread to processor affinity. The reason is that the thread to processor affinity introduces another ordering indicator which may under certain conditions lead to a reordering of idle threads in the scheduled chain. This reordering is not propagated to the chain of unused idle threads. This could lead to use an idle thread for a sticky scheduler node which is already in use. This locks up the system in infinite loops in the thread context switch procedure. To fix this, the SMP scheduler implementations must now provide callbacks to get and release an unused idle thread. Update #4531.
* score: Add SMP scheduler make/clean stickySebastian Huber2021-11-231-1/+35
| | | | | | | | | | | | | | | | | | | | This patch fixes the following broken behaviour: While a thread is scheduled on a helping scheduler, while it does not own a MrsP semaphore, if it obtains a MrsP semaphore, then no scheduler node using an idle thread and the ceiling priority of the semaphore is unblocked for the home scheduler. This could lead to priority inversion issues and is not in line with the MrsP protocol. Introduce two new scheduler operations which are only enabled if RTEMS_SMP is defined. The operations are used to make the scheduler node of the home scheduler sticky and to clean the sticky property. This helps to keep the sticky handing out of the frequently used priority update operation. Close #4532.
* score: Optimize SMP EDF move to ready operationSebastian Huber2021-11-231-7/+13
| | | | | | | | If a node is moved from the scheduled chain to the ready queue, then we know that it is the highest priority ready node. So, it can be prepended to the ready queue without doing any comparisons. Update #4531.
* score: Rework affine ready queue handlingSebastian Huber2021-11-231-40/+66
| | | | | | | | Rework the handling of the affine ready queue for the EDF SMP scheduler. Do the queue handling in the node insert, move, and extract operations. Remove the queue handling from _Scheduler_EDF_SMP_Allocate_processor(). Update #4531.
* score: Use extract from scheduled callbacksSebastian Huber2021-11-231-0/+5
| | | | | | | Use the extract from scheduled callback provided by the scheduler implementation in the SMP scheduler framework. Update #4531.
* score: Remove return value from enqueue scheduledSebastian Huber2021-11-231-2/+2
| | | | | | The return value was unused. Remove it. Update #4531.
* Return status code for _Scheduler_Set_affinity()Sebastian Huber2021-04-271-3/+3
| | | | | This avoids having conditional statements to get the API-specific status code.
* score: Remove double assignmentSebastian Huber2021-02-011-2/+1
| | | | This fix relates to a Coverity issue (UNUSED_VALUE).
* score: Canonicalize Doxygen @file commentsSebastian Huber2020-12-021-2/+10
| | | | | | Use common phrases for the file brief descriptions. Update #3706.
* Canonicalize config.h includeSebastian Huber2020-04-161-2/+2
| | | | | | | | Use the following variant which was already used by most source files: #ifdef HAVE_CONFIG_H #include "config.h" #endif
* doxygen: Rename Score* groups in RTEMSScore*Sebastian Huber2019-04-041-1/+1
| | | | Update #3706
* score: Add thread pin/unpin supportSebastian Huber2018-09-101-23/+73
| | | | | | | | | Add support to temporarily pin a thread to its current processor. This may be used to access per-processor data structures in critical sections with enabled thread dispatching, e.g. a pinned thread is allowed to block. Update #3508.
* score: Fix EDF SMP schedulerSebastian Huber2018-09-031-1/+24
| | | | | Fix a special case: block a one-to-one scheduled thread while having a non-empty affine ready queue on the same processor.
* score: Generalize SMP scheduler block supportSebastian Huber2018-09-031-1/+2
| | | | | | Add extract from scheduled function to the _Scheduler_SMP_Block() operation. This allows a scheduler implementation to do extra work in case a scheduled node is blocked.
* score: Fix _Scheduler_EDF_SMP_Set_affinity()Sebastian Huber2018-07-181-7/+5
| | | | | | Commit 8744498752ad4f0eaf9fb5640c6a0e0f2dc92fda broke the _Scheduler_EDF_SMP_Set_affinity() implementation. We must test the overall affinity against the online processors.
* score: Optimize scheduler priority updatesSebastian Huber2017-11-201-139/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Thread priority changes may append or prepend the thread to its priority group on the scheduler ready queue. Previously, a separate priority value and a prepend-it flag in the scheduler node were used to propagate a priority change to the scheduler. Now, use an append-it bit in the priority control and reduce the plain priority value to 63 bits. This change leads to a significant code size reduction (about 25%) of the SMP schedulers. The negligible increase of the standard priority scheduler is due to some additional shift operations (SCHEDULER_PRIORITY_MAP() and SCHEDULER_PRIORITY_UNMAP()). Before: text filename 136 sparc-rtems5/c/erc32/cpukit/score/src/libscore_a-schedulersimpleblock.o 464 sparc-rtems5/c/erc32/cpukit/score/src/libscore_a-schedulersimplechangepriority.o 24 sparc-rtems5/c/erc32/cpukit/score/src/libscore_a-schedulersimple.o 108 sparc-rtems5/c/erc32/cpukit/score/src/libscore_a-schedulersimpleschedule.o 292 sparc-rtems5/c/erc32/cpukit/score/src/libscore_a-schedulersimpleunblock.o 264 sparc-rtems5/c/erc32/cpukit/score/src/libscore_a-schedulersimpleyield.o text filename 280 sparc-rtems5/c/erc32/cpukit/score/src/libscore_a-schedulerpriorityblock.o 488 sparc-rtems5/c/erc32/cpukit/score/src/libscore_a-schedulerprioritychangepriority.o 200 sparc-rtems5/c/erc32/cpukit/score/src/libscore_a-schedulerpriority.o 164 sparc-rtems5/c/erc32/cpukit/score/src/libscore_a-schedulerpriorityschedule.o 328 sparc-rtems5/c/erc32/cpukit/score/src/libscore_a-schedulerpriorityunblock.o 200 sparc-rtems5/c/erc32/cpukit/score/src/libscore_a-schedulerpriorityyield.o text filename 24112 arm-rtems5/c/imx7/cpukit/score/src/libscore_a-scheduleredfsmp.o text filename 37204 sparc-rtems5/c/gr740/cpukit/score/src/libscore_a-scheduleredfsmp.o text filename 42236 powerpc-rtems5/c/qoriq_e6500_32/cpukit/score/src/libscore_a-scheduleredfsmp.o After: text filename 136 sparc-rtems5/c/erc32/cpukit/score/src/libscore_a-schedulersimpleblock.o 272 sparc-rtems5/c/erc32/cpukit/score/src/libscore_a-schedulersimplechangepriority.o 24 sparc-rtems5/c/erc32/cpukit/score/src/libscore_a-schedulersimple.o 108 sparc-rtems5/c/erc32/cpukit/score/src/libscore_a-schedulersimpleschedule.o 292 sparc-rtems5/c/erc32/cpukit/score/src/libscore_a-schedulersimpleunblock.o 264 sparc-rtems5/c/erc32/cpukit/score/src/libscore_a-schedulersimpleyield.o text filename 280 sparc-rtems5/c/erc32/cpukit/score/src/libscore_a-schedulerpriorityblock.o 488 sparc-rtems5/c/erc32/cpukit/score/src/libscore_a-schedulerprioritychangepriority.o 208 sparc-rtems5/c/erc32/cpukit/score/src/libscore_a-schedulerpriority.o 164 sparc-rtems5/c/erc32/cpukit/score/src/libscore_a-schedulerpriorityschedule.o 332 sparc-rtems5/c/erc32/cpukit/score/src/libscore_a-schedulerpriorityunblock.o 200 sparc-rtems5/c/erc32/cpukit/score/src/libscore_a-schedulerpriorityyield.o text filename 18860 arm-rtems5/c/imx7/cpukit/score/src/libscore_a-scheduleredfsmp.o text filename 28520 sparc-rtems5/c/gr740/cpukit/score/src/libscore_a-scheduleredfsmp.o text filename 32664 powerpc-rtems5/c/qoriq_e6500_32/cpukit/score/src/libscore_a-scheduleredfsmp.o
* score: Adjust _Scheduler_EDF_SMP_Insert_ready()Sebastian Huber2017-11-171-6/+4
| | | | | Use only one parameter to compute the next generation. Use index 0 for LIFO ordering, and index 1 for FIFO ordering.
* score: Fix _Scheduler_Set_affinity()Sebastian Huber2017-10-281-5/+4
|
* score: Simplify SMP get lowest scheduledSebastian Huber2017-10-281-3/+2
| | | | | | There is no need to pass in the order relation since the scheduled threads reside on an already ordered chain. The caller will decide what to do with the lowest scheduled thread.
* score: Add simple affinity support to EDF SMPSebastian Huber2017-07-101-74/+371
| | | | Update #3059.
* score: Fix formatSebastian Huber2017-07-051-14/+7
|
* score: Add SMP EDF schedulerSebastian Huber2017-06-291-0/+499
Update #3056.