summaryrefslogtreecommitdiffstats
path: root/cpukit/score/include/rtems/score/threadq.h (unfollow)
Commit message (Collapse)AuthorFilesLines
2018-01-25Remove make preinstallChris Johns1-595/+0
A speciality of the RTEMS build system was the make preinstall step. It copied header files from arbitrary locations into the build tree. The header files were included via the -Bsome/build/tree/path GCC command line option. This has at least seven problems: * The make preinstall step itself needs time and disk space. * Errors in header files show up in the build tree copy. This makes it hard for editors to open the right file to fix the error. * There is no clear relationship between source and build tree header files. This makes an audit of the build process difficult. * The visibility of all header files in the build tree makes it difficult to enforce API barriers. For example it is discouraged to use BSP-specifics in the cpukit. * An introduction of a new build system is difficult. * Include paths specified by the -B option are system headers. This may suppress warnings. * The parallel build had sporadic failures on some hosts. This patch removes the make preinstall step. All installed header files are moved to dedicated include directories in the source tree. Let @RTEMS_CPU@ be the target architecture, e.g. arm, powerpc, sparc, etc. Let @RTEMS_BSP_FAMILIY@ be a BSP family base directory, e.g. erc32, imx, qoriq, etc. The new cpukit include directories are: * cpukit/include * cpukit/score/cpu/@RTEMS_CPU@/include * cpukit/libnetworking The new BSP include directories are: * bsps/include * bsps/@RTEMS_CPU@/include * bsps/@RTEMS_CPU@/@RTEMS_BSP_FAMILIY@/include There are build tree include directories for generated files. The include directory order favours the most general header file, e.g. it is not possible to override general header files via the include path order. The "bootstrap -p" option was removed. The new "bootstrap -H" option should be used to regenerate the "headers.am" files. Update #3254.
2017-10-24score: Move thread queue timeout handlingSebastian Huber1-11/+22
Update #3117. Update #3182.
2017-10-24score: Rename function threadq support functionSebastian Huber1-1/+1
Rename _Thread_queue_Context_set_do_nothing_enqueue_callout() into _Thread_queue_Context_set_enqueue_do_nothing_extra(). More _Thread_queue_Context_set_enqueue_*() functions will follow. Update #3117. Update #3182.
2017-01-13score: Add Thread_queue_Queue::nameSebastian Huber1-0/+5
Update #2858.
2016-11-24score: Optimize _Thread_queue_Enqueue()Sebastian Huber1-0/+6
Move thread state for _Thread_queue_Enqueue() to the thread queue context. This reduces the parameter count of _Thread_queue_Enqueue() from five to four (ARM for example has only four function parameter registers). Since the thread state is used after several function calls inside _Thread_queue_Enqueue() this parameter was saved on the stack previously.
2016-11-23score: Rename _Thread_queue_Enqueue_critical()Sebastian Huber1-2/+2
Delete unused _Thread_queue_Enqueue() and rename _Thread_queue_Enqueue_critical() to _Thread_queue_Enqueue().
2016-11-23score: Add thread queue enqueue calloutSebastian Huber1-7/+25
Replace the expected thread dispatch disable level with a thread queue enqueue callout. This enables the use of _Thread_Dispatch_direct() in the thread queue enqueue procedure. This avoids impossible exection paths, e.g. Per_CPU_Control::dispatch_necessary is always true.
2016-09-21score: Scheduler node awareness for thread queuesSebastian Huber1-5/+6
Maintain the priority of a thread for each scheduler instance via the thread queue enqueue, extract, priority actions and surrender operations. This replaces the primitive priority boosting. Update #2556.
2016-09-21score: Rework thread priority managementSebastian Huber1-31/+86
Add priority nodes which contribute to the overall thread priority. The actual priority of a thread is now an aggregation of priority nodes. The thread priority aggregation for the home scheduler instance of a thread consists of at least one priority node, which is normally the real priority of the thread. The locking protocols (e.g. priority ceiling and priority inheritance), rate-monotonic period objects and the POSIX sporadic server add, change and remove priority nodes. A thread changes its priority now immediately, e.g. priority changes are not deferred until the thread releases its last resource. Replace the _Thread_Change_priority() function with * _Thread_Priority_perform_actions(), * _Thread_Priority_add(), * _Thread_Priority_remove(), * _Thread_Priority_change(), and * _Thread_Priority_update(). Update #2412. Update #2556.
2016-09-08score: Introduce Thread_queue_Lock_contextSebastian Huber1-52/+60
Introduce Thread_queue_Lock_context to contain the context necessary for thread queue lock and thread wait lock acquire/release operations to reduce the Thread_Control size.
2016-08-11score: Introduce thread queue surrender operationSebastian Huber1-0/+22
This is an optimization for _Thread_queue_Surrender(). It helps to encapsulate the priority boosting in the priority inheritance thread queue operations.
2016-08-03score: Fix and simplify thread wait locksSebastian Huber1-25/+4
There was a subtile race condition in _Thread_queue_Do_extract_locked(). It must first update the thread wait flags and then restore the default thread wait state. In the previous implementation this could lead under rare timing conditions to an ineffective _Thread_Wait_tranquilize() resulting to a corrupt system state. Update #2556.
2016-07-27score: Add deadlock detectionSebastian Huber1-1/+44
The mutex objects use the owner field of the thread queues for the mutex owner. Use this and add a deadlock detection to _Thread_queue_Enqueue_critical() for thread queues with an owner. Update #2412. Update #2556. Close #2765.
2016-07-27score: Turn thread lock into thread wait lockSebastian Huber1-10/+87
The _Thread_Lock_acquire() function had a potentially infinite run-time due to the lack of fairness at atomic operations level. Update #2412. Update #2556. Update #2765.
2016-07-27score: Priority inherit thread queue operationsSebastian Huber1-1/+8
Move the priority change due to priority interitance to the thread queue enqueue operation to simplify the locking on SMP configurations. Update #2412. Update #2556. Update #2765.
2016-07-25cpukit: Add and use Watchdog_Discipline.Gedare Bloom1-0/+12
Clock disciplines may be WATCHDOG_RELATIVE, WATCHDOG_ABSOLUTE, or WATCHDOG_NO_TIMEOUT. A discipline of WATCHDOG_RELATIVE with a timeout of WATCHDOG_NO_TIMEOUT is equivalent to a discipline of WATCHDOG_NO_TIMEOUT. updates #2732
2016-05-30score: _CORE_mutex_Check_dispatch_for_seize()Sebastian Huber1-0/+9
Move the safety check performed by _CORE_mutex_Check_dispatch_for_seize() out of the performance critical path and generalize it. Blocking on a thread queue with an unexpected thread dispatch disabled level is illegal in all system states. Add the expected thread dispatch disable level (which may be 1 or 2 depending on the operation) to Thread_queue_Context and use it in _Thread_queue_Enqueue_critical().
2016-05-30score: Add _Thread_queue_Context_set_MP_callout()Sebastian Huber1-0/+15
Add _Thread_queue_Context_set_MP_callout() to simplify _Thread_queue_Context_initialize(). This makes it possible to more easily add additional fields to Thread_queue_Context.
2016-05-30score: Adjust thread queue layoutSebastian Huber1-9/+17
Adjust thread queue layout according to Newlib. This makes it possible to use the same implementation for <sys/lock.h> and CORE mutexes in the future.
2016-05-25score: Move thread queue MP callout to contextSebastian Huber1-0/+12
Drop the multiprocessing (MP) dependent callout parameter from the thread queue extract, dequeue, flush and unblock methods. Merge this parameter with the lock context into new structure Thread_queue_Context. This helps to gets rid of the conditionally compiled method call helpers.
2016-05-12score: Add _Thread_queue_Is_lock_owner()Sebastian Huber1-3/+26
Add _Thread_queue_Is_lock_owner() in case RTEMS_DEBUG is defined.
2016-04-06score: Rework MP thread queue callout supportSebastian Huber1-0/+16
The thread queue implementation was heavily reworked to support SMP. This broke the multiprocessing support of the thread queues. This is fixed by this patch. A thread proxy is unblocked due to three reasons 1) timeout, 2) request satisfaction, and 3) extraction. In case 1) no MPCI message must be sent. This is ensured via the _Thread_queue_MP_callout_do_nothing() callout set during _Thread_MP_Allocate_proxy(). In case 2) and 3) an MPCI message must be sent. In case we interrupt the blocking operation during _Thread_queue_Enqueue_critical(), then this message must be sent by the blocking thread. For this the new fields Thread_Proxy_control::thread_queue_callout and Thread_Proxy_control::thread_queue_id are used. Delete the individual API MP callout types and use Thread_queue_MP_callout throughout. This type is only defined in multiprocessing configurations. Prefix the multiprocessing parameters with mp_ to ease code review. Multiprocessing specific parameters are optional due to use of a similar macro pattern. There is no overhead for non-multiprocessing configurations.
2016-03-29score: Remove Thread_queue_Queue::operations fieldSebastian Huber1-14/+0
Remove the Thread_queue_Queue::operations field to reduce the size of this structure. Add a thread queue operations parameter to the _Thread_queue_First(), _Thread_queue_First_locked(), _Thread_queue_Enqueue(), _Thread_queue_Dequeue() and _Thread_queue_Flush() functions. This is a preparation patch to reduce the size of several synchronization objects.
2015-09-04score: Implement SMP-specific priority queueSebastian Huber1-1/+43
2015-09-04score: DocumentationSebastian Huber1-2/+29
2015-07-30score: Use a plain ticket lock for thread locksSebastian Huber1-1/+7
This enables external libraries to use thread locks since they are independent of the actual RTEMS build configuration, e.g. profiling enabled or disabled.
2015-07-30score: Provide struct _Thread_queue_HeadsSebastian Huber1-1/+7
Use a leading underscore in the structure name to allow forward declarations in standard header files provided by Newlib and GCC.
2015-07-30score: Rename struct Thread_ControlSebastian Huber1-1/+1
Add a leading underscore to the structure name to allow forward declarations in standard header files provided by Newlib and GCC.
2015-07-23score: Introduce Thread_queue_HeadsSebastian Huber1-20/+10
Move the storage for the thread queue heads to the threads. Each thread provides a set of thread queue heads allocated from a dedicated memory pool. In case a thread blocks on a queue, then it lends its heads to the queue. In case the thread unblocks, then it takes a free set of threads from the queue. Since a thread can block on at most one queue this works. This mechanism is used in FreeBSD. The motivation for this change is to reduce the memory demands of the synchronization objects. On a 32-bit uni-processor configuration the Thread_queue_Control size is now 8 bytes, compared to 64 bytes in RTEMS 4.10 (other changes reduced the size as well).
2015-07-23score: Introduce Thread_queue_QueueSebastian Huber1-37/+42
Separate the thread queue heads and lock from the operations. This enables the support for light weight objects which only support one queuing discipline.
2015-06-25score: Simplify <rtems/score/thread.h>Sebastian Huber1-2/+2
Avoid Thread_Control typedef in <rtems/score/percpu.h>. This helps to get rid of the <rtems/score/percpu.h> include in <rtems/score/thread.h> which exposes a lot of implementation details.
2015-05-19score: Delete Thread_queue_Control::timeout_statusSebastian Huber1-5/+0
Use a parameter for _Thread_queue_Enqueue() instead to reduce memory usage.
2015-05-19score: New thread queue implementationSebastian Huber1-25/+0
Use thread wait flags for synchronization. The enqueue operation is now part of the initial critical section. This is the key change and enables fine grained locking on SMP for objects using a thread queue like semaphores and message queues. Update #2273.
2015-05-19score: More thread queue operationsSebastian Huber1-4/+102
Move thread queue discipline specific operations into Thread_queue_Operations. Use a separate node in the thread control block for the thread queue to make it independent of the scheduler data structures. Update #2273.
2015-05-19score: Add Thread_queue_OperationsSebastian Huber1-3/+46
Replace the Thread_Priority_control with more general Thread_queue_Operations which will be used for generic priority change, timeout, signal and wait queue operations in the future. Update #2273.
2015-05-19score: Add Thread_queue_Control::LockSebastian Huber1-0/+13
Move the complete thread queue enqueue procedure into _Thread_queue_Enqueue_critical(). It is possible to use the thread queue lock to protect state of the object embedding the thread queue. This enables per object fine grained locking in the future. Delete _Thread_queue_Enter_critical_section(). Update #2273.
2015-04-23score: Delete Thread_queue_Control::stateSebastian Huber1-4/+0
Use a parameter for _Thread_queue_Enqueue() instead to reduce memory usage.
2014-07-15Thread Queue: Merge discipline subroutines into main methodsJoel Sherrill1-3/+3
There was a lot of duplication between the discipline subroutines. With the transition to RBTrees for priority discipline, there were only a few lines of source code manipulating the data structure for FIFO and priority. Thus is made sense to fold these back into the main methods. As part of doing this all of the tests for discipline were changed to be in the same order.
2014-07-15Thread Queue Priority Discipline Reimplemented with RBTreeJoel Sherrill1-19/+4
2014-03-21Change all references of rtems.com to rtems.org.Chris Johns1-1/+1
2013-07-26score: Create threadq implementation headerSebastian Huber1-349/+63
Move implementation specific parts of tqdata.h, threadq.h and threadq.inl into new header file threadqimpl.h. The threadq.h contains now only the application visible API. Delete tqdata.h.
2013-07-26score: Delete threadq.inlSebastian Huber1-15/+11
2013-01-10cpukit: Fix many Doxygen warningsJoel Sherrill1-2/+12
2013-01-10cpukit: Add EOL on files missing EOL at EOFJoel Sherrill1-1/+1
2012-12-28score: Doxygen Clean Up Task #2Mathew Kallada1-25/+28
2012-11-30score misc: Score misc: Clean up Doxygen #9 (GCI 2012)Alex Ivanov1-14/+24
This patch is a task from GCI 2012 which improves the Doxygen comments in the RTEMS source. https://google-melange.appspot.com/gci/task/view/google/gci2012/7977211
2012-11-29score misc: Score misc: Clean up Doxygen #7 (GCI 2012)Alex Ivanov1-2/+20
This patch is a task from GCI 2012 which improves the Doxygen comments in the RTEMS source. https://google-melange.appspot.com/gci/task/view/google/gci2012/7986214
2012-11-29score misc: Score misc: Clean up Doxygen #6 (GCI 2012)Christopher Kerl1-5/+11
This patch is a task from GCI 2012 which improves the Doxygen comments in the RTEMS source. http://www.google-melange.com/gci/task/view/google/gci2012/7976215
2012-11-28Score misc: Clean up Doxygen #4 (GCI 2012)Alexandre Devienne1-3/+10
This patch is a task from GCI 2012 which improves the Doxygen comments in the RTEMS source. http://www.google-melange.com/gci/task/view/google/gci2012/7985215
2012-11-28score misc: Clean up Doxygen #3 (GCI 2012)Alex Ivanov1-0/+10
This patch is a task from GCI 2012 which improves the Doxygen comments in the RTEMS source. http://www.google-melange.com/gci/task/view/google/gci2012/7982215