| Commit message (Collapse) | Author | Files | Lines |
|
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.
|
|
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.
|
|
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.
|
|
Get rid of the mp_id parameter used for some thread queue methods. Use
THREAD_QUEUE_QUEUE_TO_OBJECT() instead.
|
|
|
|
We must call the MP callout for proxies if we unblock them after a
thread queue extraction. This was missing in
_Thread_queue_Flush_critical(). Move thread remove timer and unblock
code to new function _Thread_Remove_timer_and_unblock().
|
|
Use _RBTree_Insert_inline() for priority thread queues.
Update #2556.
|
|
Update #2555.
|
|
Add _Thread_queue_Is_lock_owner() in case RTEMS_DEBUG is defined.
|
|
|
|
|
|
Replace _Thread_queue_Flush() with _Thread_queue_Flush_critical() and
add a filter function for customization of the thread queue flush
operation.
Update #2555.
|
|
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.
|
|
Change _Thread_queue_Flush() into a macro that invokes
_Thread_queue_Do_flush() with the parameter set defined by
RTEMS_MULTIPROCESSING. For multiprocessing configurations add the
object identifier to avoid direct use of the thread wait information.
Use mp_ prefix for multiprocessing related parameters.
Rename Thread_queue_Flush_callout to Thread_queue_MP_callout since this
type will be re-used later for other operations as well.
|
|
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.
|
|
|
|
|
|
|
|
This enables external libraries to use thread locks since they are
independent of the actual RTEMS build configuration, e.g. profiling
enabled or disabled.
|
|
This makes it possible to use _Thread_queue_Extract_locked() for barrier
operations which extract all threads on the queue in one critical
section.
|
|
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).
|
|
Separate the thread queue heads and lock from the operations. This
enables the support for light weight objects which only support one
queuing discipline.
|
|
|
|
|
|
Use a parameter for _Thread_queue_Enqueue() instead to reduce memory
usage.
|
|
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.
|
|
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.
|
|
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.
|
|
Remove thread queue parameter from _Thread_queue_Extract() since the
current thread queue is stored in the thread control block.
|
|
|
|
|
|
Use a parameter for _Thread_queue_Enqueue() instead to reduce memory
usage.
|
|
This function was identical to _Thread_queue_Timeout(). This makes
_Thread_queue_Enqueue_with_handler() obsolete.
|
|
It makes no sense to use this indirection since the type for timeout
values is Watchdog_Interval.
|
|
Since the thread current priority change and thread queue requeue is
performed in one critical section it is possible to simplify the thread
queue requeue procedure. Add a thread queue agnostic thread priority
change handler so that we are able to use alternative thread queue
implementations.
Update #2273.
|
|
|
|
|
|
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.
|
|
|
|
This function is only used by _Thread_Change_priority(). Make it static
to avoid the function call overhead in the performance critical function
_Thread_Change_priority().
|
|
Add _Thread_queue_Extract_with_return_code(). On SMP this sequence in
_Thread_queue_Process_timeout() was broken:
[...]
/*
* After we enable interrupts here, a lot may happen in the
* meantime, e.g. nested interrupts may release the resource that
* times out here. So we enter _Thread_queue_Extract()
* speculatively. Inside this function we check the actual status
* under ISR disable protection. This ensures that exactly one
* executing context performs the extract operation (other parties
* may call _Thread_queue_Dequeue()). If this context won, then
* we have a timeout.
*
* We can use the_thread_queue pointer here even if
* the_thread->Wait.queue is already set to NULL since the extract
* operation will only use the thread queue discipline to select
* the right extract operation. The timeout status is set during
* thread queue initialization.
*/
we_did_it = _Thread_queue_Extract( the_thread_queue, the_thread );
if ( we_did_it ) {
the_thread->Wait.return_code = the_thread_queue->timeout_status;
}
[...]
In case _Thread_queue_Extract() successfully extracted a thread, then
this thread may start execution on a remote processor immediately and
read the the_thread->Wait.return_code before we update it here with the
timeout status. Thus it observes a successful operation even if it
timed out.
|
|
Drop the return status, since it is nowhere used.
|
|
|
|
|
|
Return if the executing context performed the extract operation since
interrupts may interfere.
|
|
Add thread parameter to _Thread_queue_Enqueue_with_handler() to avoid
access to global _Thread_Executing.
|
|
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.
|
|
|
|
|
|
|