summaryrefslogtreecommitdiffstats
path: root/cpukit/score/src/threadrestart.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* score: Rework thread priority managementSebastian Huber2016-09-211-34/+27
| | | | | | | | | | | | | | | | | | | | | | | | | 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.
* score: Introduce _Thread_Get_priority()Sebastian Huber2016-09-081-2/+2
| | | | Avoid direct access to thread internal data fields.
* score: Introduce Thread_queue_Lock_contextSebastian Huber2016-09-081-1/+1
| | | | | | 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.
* score: Simplify thread queue acquire/releaseSebastian Huber2016-09-081-4/+1
|
* score: Simplify _Thread_Finalize_life_change()Sebastian Huber2016-08-051-7/+1
|
* score: Turn thread lock into thread wait lockSebastian Huber2016-07-271-2/+1
| | | | | | | | | 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.
* cpukit: Add and use Watchdog_Discipline.Gedare Bloom2016-07-251-1/+1
| | | | | | | | | 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
* score: Change scheduler node init and destroySebastian Huber2016-07-011-1/+4
| | | | | | Provide the scheduler node to initialize or destroy to the corresponding operations. This makes it possible to have more than one scheduler node per thread.
* score: Workaround for #2751Sebastian Huber2016-07-011-0/+4
| | | | | | | | | | | | | | | The ARM and PowerPC interrupt epilogues call _Thread_Dispatch() with interrupts disabled (counter example: SPARC). On SMP configurations, since inter-processor interrupts set the thread dispatch necessary indicator this prevents a thread dispatch notification in post-switch handlers (which all run with interrupts disabled). On all configurations, this is a serious issue for the interrupt latency. Update #2751
* score: Fix thread delete race condition on SMPSebastian Huber2016-06-161-6/+17
|
* score: _CORE_mutex_Check_dispatch_for_seize()Sebastian Huber2016-05-301-8/+10
| | | | | | | | | | | 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().
* score: Add _Thread_queue_Context_set_MP_callout()Sebastian Huber2016-05-301-1/+1
| | | | | | 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.
* score: Add Status_Control for all APIsSebastian Huber2016-05-261-6/+4
| | | | | | | | | | | Unify the status codes of the Classic and POSIX API to use the new enum Status_Control. This eliminates the Thread_Control::Wait::timeout_code field and the timeout parameter of _Thread_queue_Enqueue_critical() and _MPCI_Send_request_packet(). It gets rid of the status code translation tables and instead uses simple bit operations to get the status for a particular API. This enables translation of status code constants at compile time. Add _Thread_Wait_get_status() to avoid direct access of thread internal data structures.
* score: Move thread queue MP callout to contextSebastian Huber2016-05-251-14/+17
| | | | | | | | 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.
* score: Get rid of mp_id parameterSebastian Huber2016-05-251-1/+0
| | | | | Get rid of the mp_id parameter used for some thread queue methods. Use THREAD_QUEUE_QUEUE_TO_OBJECT() instead.
* posix: Rework thread cancellationSebastian Huber2016-05-201-3/+3
| | | | | | | | Add Thread_Life_state::THREAD_LIFE_CHANGE_DEFERRED and rework the POSIX thread cancellation to use the thread life states. Update #2555. Update #2626.
* posix: Rework pthread_join()Sebastian Huber2016-05-201-4/+88
| | | | | | | | | Rework pthread_join() to use _Thread_Join(). Close #2402. Update #2555. Update #2626. Close #2714.
* score: Simplify _Thread_Life_action_handler()Sebastian Huber2016-05-201-65/+29
| | | | | | | | Use _Thread_Change_life_locked() to avoid duplicated code. Avoid Giant lock in _Thread_Life_action_handler(). Update #2555. Update #2626.
* score: Rework _Thread_Cancel()Sebastian Huber2016-05-201-54/+31
| | | | | | | Rework _Thread_Cancel() to use _Thread_Change_life_locked(). Update #2555. Update #2626.
* score: Rework _Thread_Restart_other()Sebastian Huber2016-05-201-9/+79
| | | | | | | | | Rework _Thread_Restart_other() to use _Thread_Change_life_locked(). Cope with concurrent change requests by means of a pending request counter. Update #2555. Update #2626.
* score: Split _Thread_Restart()Sebastian Huber2016-05-201-14/+82
| | | | | | | | | | | Split _Thread_Restart() into _Thread_Restart_self() and _Thread_Restart_other(). Move content of existing _Thread_Restart_self() into new _Thread_Restart_self(). Avoid Giant lock for thread restart. _Thread_Restart_self() is a no-return function and used by _Thread_Global_construction(). Update #2555. Update #2626.
* score: Add _Thread_Join() and _Thread_Cancel()Sebastian Huber2016-05-201-20/+61
| | | | | | | | Split _Thread_Close() into _Thread_Join() and _Thread_Cancel() to prepare for a re-use in pthread_join() and pthread_cancel(). Update #2555. Update #2626.
* score: Rework _Thread_Exit()Sebastian Huber2016-05-201-4/+16
| | | | | | | Rework _Thread_Exit() to use _Thread_Change_life_locked(). Update #2555. Update #2626.
* score: Add _Thread_Raise_real_priority()Sebastian Huber2016-05-201-14/+16
| | | | | Update #2555. Update #2626.
* score: Add Thread_Change_life()Sebastian Huber2016-05-201-39/+56
| | | | | | | | | Add _Thread_Change_life_locked() as a general function to alter the thread life state. Use it to implement _Thread_Set_life_protection() as a first step. Update #2555. Update #2626.
* score: Delete unused variableSebastian Huber2016-05-201-6/+3
| | | | | Update #2555. Update #2626.
* score: Avoid superfluous life protectionSebastian Huber2016-05-201-3/+0
| | | | | | | | Disable thread dispatching is enough to prevent deletion of the executing thread. There is no need for an additional life protection. Update #2555. Update #2626.
* score: Add _Thread_Exit()Sebastian Huber2016-05-201-4/+14
| | | | | | | | The goal is to make _Thread_Exit() a no-return function in follow up patches. Update #2555. Update #2626.
* score: Introduce thread state lockSebastian Huber2016-05-121-18/+26
| | | | Update #2556.
* score: Use chain iterator for user extensionsSebastian Huber2016-04-181-0/+2
| | | | | | | | | | | Add a lock and use a chain iterator for safe iteration during concurrent user extension addition and removal. Ensure that dynamically added thread delete and fatal extensions are called in reverse order. Update #2555. Update #2692.
* score: Add and use RTEMS_UNREACHABLESebastian Huber2016-03-231-4/+2
|
* posix: Use per-thread lookup tree for POSIX KeysSebastian Huber2016-03-181-0/+1
| | | | | | Yields higher performance on SMP systems. Close #2625.
* score: Destroy thread timer lockSebastian Huber2016-03-181-4/+1
| | | | Update #2554.
* score: Replace watchdog handler implementationSebastian Huber2016-03-041-4/+8
| | | | | | | | | Use a red-black tree instead of delta chains. Close #2344. Update #2554. Update #2555. Close #2606.
* score: Introduce Thread_Entry_informationSebastian Huber2016-01-111-6/+4
| | | | | | | This avoids potential dead code in _Thread_Handler(). It gets rid of the dangerous function pointer casts. Update #2514.
* score: Untangle thread actionsSebastian Huber2015-12-111-2/+13
| | | | | | | Remove the thread action handler parameter from _Thread_Action_initialize() and instead set it later in _Thread_Add_post_switch_action(). This avoids a dependency on the thread action handler via the thread initialization.
* score: Use a plain ticket lock for thread locksSebastian Huber2015-07-301-1/+2
| | | | | | This enables external libraries to use thread locks since they are independent of the actual RTEMS build configuration, e.g. profiling enabled or disabled.
* score: Add potpourri lock statisticsSebastian Huber2015-07-301-0/+1
| | | | | | | These SMP lock statistics are used for all lock objects that lack a storage space for the statistics. Examples are lock objects used in external libraries which are independent of the actual RTEMS build configuration.
* score: Introduce Thread_queue_HeadsSebastian Huber2015-07-231-4/+9
| | | | | | | | | | | | | 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).
* score: Rework _Thread_Change_priority()Sebastian Huber2015-05-191-12/+34
| | | | | | | | | | | | | Move the writes to Thread_Control::current_priority and Thread_Control::real_priority into _Thread_Change_priority() under the protection of the thread lock. Add a filter function to _Thread_Change_priority() to enable specialized variants. Avoid race conditions during a thread priority restore with the new Thread_Control::priority_restore_hint for an important average case optimizations used by priority inheritance mutexes. Update #2273.
* score: Add header to _Watchdog_Remove()Sebastian Huber2015-05-191-2/+2
| | | | | | | | Add watchdog header parameter to _Watchdog_Remove() to be in line with the other operations. Add _Watchdog_Remove_ticks() and _Watchdog_Remove_seconds() for convenience. Update #2307.
* score: Add thread lockSebastian Huber2015-03-241-0/+4
| | | | Update #2273.
* score: Simplify and fix signal deliverySebastian Huber2015-03-051-1/+0
| | | | | | | Deliver the POSIX signals after the thread state was updated to avoid race-conditions on SMP configurations. Update #2273.
* score: Fix thread deletion on SMPSebastian Huber2014-06-231-5/+5
| | | | | | Close the thread object in _Thread_Make_zombie() so that all blocking operations that use _Thread_Get() in the corresponding release directive can find a terminating thread and can complete the operation.
* score: Replace _Scheduler_Allocate/Free()Sebastian Huber2014-06-041-1/+1
| | | | | | | | Replace _Scheduler_Allocate() with _Scheduler_Node_initialize(). Remove the return status and thus the node initialization must be always successful. Rename _Scheduler_Free() to _Scheduler_Node_destroy().
* score: Add and use _Thread_Owns_resources()Sebastian Huber2014-06-031-1/+1
|
* score: _Thread_Set_life_protection()Sebastian Huber2014-05-211-4/+0
| | | | | | | Enable usage of _Thread_Set_life_protection() in thread dispatch critical sections. This can be used to enable the thread life-protection with thread dispatching disabled and then enable thread dispatching.
* score: Add STATES_RESTARTINGSebastian Huber2014-05-141-1/+1
| | | | Use separate state for thread restart.
* score: Implement forced thread migrationSebastian Huber2014-05-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current implementation of task migration in RTEMS has some implications with respect to the interrupt latency. It is crucial to preserve the system invariant that a task can execute on at most one processor in the system at a time. This is accomplished with a boolean indicator in the task context. The processor architecture specific low-level task context switch code will mark that a task context is no longer executing and waits that the heir context stopped execution before it restores the heir context and resumes execution of the heir task. So there is one point in time in which a processor is without a task. This is essential to avoid cyclic dependencies in case multiple tasks migrate at once. Otherwise some supervising entity is necessary to prevent life-locks. Such a global supervisor would lead to scalability problems so this approach is not used. Currently the thread dispatch is performed with interrupts disabled. So in case the heir task is currently executing on another processor then this prolongs the time of disabled interrupts since one processor has to wait for another processor to make progress. It is difficult to avoid this issue with the interrupt latency since interrupts normally store the context of the interrupted task on its stack. In case a task is marked as not executing we must not use its task stack to store such an interrupt context. We cannot use the heir stack before it stopped execution on another processor. So if we enable interrupts during this transition we have to provide an alternative task independent stack for this time frame. This issue needs further investigation.
* score: Simplify thread control initializationSebastian Huber2014-04-151-2/+0
| | | | | | | | | | | The thread control block contains fields that point to application configuration dependent memory areas, like the scheduler information, the API control blocks, the user extension context table, the RTEMS notepads and the Newlib re-entrancy support. Account for these areas in the configuration and avoid extra workspace allocations for these areas. This helps also to avoid heap fragementation and reduces the per thread memory due to a reduced heap allocation overhead.