Commit Graph

26214 Commits

Author SHA1 Message Date
Sebastian Huber
f570b07199 score: Rename Priority_bit_map_Control
Rename Priority_bit_map_Control in Priority_bit_map_Word.
2014-04-03 11:13:26 +02:00
Sebastian Huber
3f5f2ce229 score: PR788: Add INTERNAL_ERROR_RESOURCE_IN_USE
Issue a fatal error in case a thread is deleted which still owns
resources (e.g. a binary semaphore with priority inheritance or ceiling
protocol).  The resource count must be checked quite late since RTEMS
task variable destructors, POSIX key destructors, POSIX cleanup handler,
the Newlib thread termination extension or other thread termination
extensions may release resources.  In this context it would be quite
difficult to return an error status to the caller.

An alternative would be to place threads with a non-zero resource count
not on the zombie chain.  Thus we have a resource leak instead of a
fatal error.  The terminator thread can see this error if we return an
RTEMS_RESOURCE_IN_USE status for the rtems_task_delete() for example.
2014-04-03 11:13:25 +02:00
Sebastian Huber
499492793b score: Move __log2table to separate file 2014-04-01 14:10:23 +02:00
Sebastian Huber
8e980e6168 bsps/powerpc: Fix linker command files 2014-04-01 14:10:23 +02:00
Sebastian Huber
10b0c3f9d3 bsps/powerpc: PR757: Fix PPC_IRQ_TRACE for ppc601
We could probably also remove the ppc601 support entirely.
2014-04-01 14:10:23 +02:00
Sebastian Huber
3ccfd98bc1 libtests/newlib01: New test 2014-04-01 14:10:22 +02:00
Sebastian Huber
57db5f13fb smptests/smpthreadlife01: Avoid bad profiling stat 2014-04-01 14:10:22 +02:00
Sebastian Huber
25a978354c ringbuf: Fix ISR lock initialization/destruction 2014-04-01 14:10:22 +02:00
Sebastian Huber
91e7b0c5ae score: PR2172: _Thread_queue_Extract()
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.
2014-04-01 14:10:22 +02:00
Sebastian Huber
8118b67065 libchip: Avoid __DEVOLATILE() 2014-03-31 18:31:52 +02:00
Sebastian Huber
b9b014ea7e smptests/smpthreadlife01: Typo 2014-03-31 15:49:35 +02:00
Sebastian Huber
a881ff299e smptests/smpthreadlife01: Add test cases 2014-03-31 15:46:03 +02:00
Daniel Cederman
1d9818dcb3 LEON3: UT699 and GR712 sleep-mode d-cache fix
See errata of respective chip. Some code-cleanup as well.
2014-03-31 13:32:48 +02:00
Sebastian Huber
ab816bcb01 sptests/sptask_err04: Fix broken test 2014-03-31 10:14:43 +02:00
Pavel Pisa
3c21ad7db0 SPI SD-Card: adapt common driver code to block devices core API changes. 2014-03-31 10:14:43 +02:00
Sebastian Huber
600bb68fa1 score: _Thread_queue_Extract_with_proxy()
Drop the return status, since it is nowhere used.
2014-03-31 10:14:43 +02:00
Sebastian Huber
03e8928753 score: Delete CORE_mutex_Control::lock
The holder field is enough to determine if a mutex is locked or not.

This leads also to better error status codes in case a
rtems_semaphore_release() is done for a mutex without having the
ownership.
2014-03-31 10:14:42 +02:00
Sebastian Huber
b1ce11614b score: Delete CORE_mutex_Control::holder_id
We can use the holder pointer to get the identifier if necessary.
2014-03-31 10:14:42 +02:00
Sebastian Huber
cb8d3e7b8f score: Delete CORE_mutex_Control::blocked_count 2014-03-31 10:14:42 +02:00
Sebastian Huber
f0b4fd9c2e score: Do not reset resource count during restart
This fixes an integer underflow problem in case resources are released
after a thread restart.

Add new test sptests/spthreadlife01.
2014-03-31 10:14:35 +02:00
Sebastian Huber
23fec9f0e1 score: PR2152: Use allocator mutex for objects
Use allocator mutex for objects allocate/free.  This prevents that the
thread dispatch latency depends on the workspace/heap fragmentation.
2014-03-31 08:29:44 +02:00
Sebastian Huber
346845730c score: Use thread life protection for API mutexes
This prevents that asynchronous thread deletion can lead to an unusable
allocator or once mutex.
2014-03-31 08:29:43 +02:00
Sebastian Huber
fb7199d3a2 score: Relax Giant lock usage for API mutexes
It is no longer necessary to protect the workspace allocations with the
Giant lock due to the thread life cycle re-implementation.
2014-03-31 08:29:43 +02:00
Sebastian Huber
1b1be254e7 score: Thread life cycle re-implementation
The thread deletion is now supported on SMP.

This change fixes the following PRs:

PR1814: SMP race condition between stack free and dispatch

PR2035: psxcancel reveals NULL pointer access in _Thread_queue_Extract()

The POSIX cleanup handler are now called in the right context (should be
called in the context of the terminating thread).

http://pubs.opengroup.org/onlinepubs/009695399/functions/xsh_chap02_09.html

Add a user extension the reflects a thread termination event.  This is
used to reclaim the Newlib reentrancy structure (may use file
operations), the POSIX cleanup handlers and the POSIX key destructors.
2014-03-31 08:29:43 +02:00
Sebastian Huber
226c731e7a score: Replace _Thread_Reset()
Replace _Thread_Reset() with _Thread_Start_life_change().  This function
can be later used for the _Thread_Close() implementation.
2014-03-31 08:29:43 +02:00
Sebastian Huber
8690b53c85 score: Add parameter to _Thread_Restart()
The executing thread will be later used for a common implementation with
_Thread_Close().
2014-03-31 08:29:43 +02:00
Sebastian Huber
391ad3ee4f score: Fix thread restart extensions context
Run the thread restart extensions in the context of the restarted
thread.  Run them with thread dispatching enabled.
2014-03-31 08:29:43 +02:00
Sebastian Huber
084c5cc746 score: Reduce _Thread_Reset() parameters
Move thread entry parameters out of _Thread_Reset() to enable
re-usablity of this function.
2014-03-31 08:29:43 +02:00
Sebastian Huber
dcd5e2609b score: Move _Thread_Reset() and make static 2014-03-31 08:29:43 +02:00
Sebastian Huber
5c731a8348 score: Use thread action for thread restart
The thread restart is now supported on SMP.  New test
smptests/smpthreadlife01.
2014-03-31 08:29:43 +02:00
Sebastian Huber
8061f568de score: Delete post-switch API extensions
Use thread post-switch actions instead.
2014-03-31 08:29:43 +02:00
Sebastian Huber
fc521e2df6 posix: Use thread action for signals 2014-03-31 08:29:43 +02:00
Sebastian Huber
6fd1bdb7af rtems: Use thread action for signals 2014-03-31 08:29:42 +02:00
Sebastian Huber
0dd732ddac score: Add thread actions
Thread actions are the building block for efficient implementation of
  - Classic signals delivery,
  - POSIX signals delivery,
  - thread restart notification,
  - thread delete notification,
  - forced thread migration on SMP configurations, and
  - the Multiprocessor Resource Sharing Protocol (MrsP).
2014-03-31 08:29:42 +02:00
Sebastian Huber
a5ac9da307 score: Add and use thread get/set CPU functions 2014-03-31 08:29:42 +02:00
Sebastian Huber
c2225d7356 score: Add _Scheduler_Change_priority_if_higher()
Add _Scheduler_Set_priority_if_higher().
2014-03-31 08:29:42 +02:00
Sebastian Huber
298d0fda9d score: Add _Scheduler_Highest_priority_of_two()
Use inline functions instead of macros for
_Scheduler_Is_priority_lower_than() and
_Scheduler_Is_priority_higher_than().
2014-03-31 08:29:42 +02:00
Sebastian Huber
7552e77c96 score: PR2151: _Thread_queue_Extract_with_proxy()
Avoid NULL pointer access.
2014-03-31 08:29:42 +02:00
Sebastian Huber
79e2d9b65e score: Add per-CPU state function
Add _Per_CPU_State_wait_for_ready_to_start_multitasking().  Add new
fatal SMP error SMP_FATAL_SHUTDOWN_EARLY.
2014-03-31 08:29:42 +02:00
Sebastian Huber
ecd8c8add2 tests/fatal: Fix test names 2014-03-31 08:29:42 +02:00
Sebastian Huber
d98217ccd1 psxtests/psxconfig01: Fix for POSIX keys config 2014-03-31 08:29:42 +02:00
Sebastian Huber
2c83ac3658 smptests/smpfatal03: Fix end of test output 2014-03-31 08:29:42 +02:00
Sebastian Huber
5a13ef9d71 sptests/sp44: Fix end of test output 2014-03-31 08:29:42 +02:00
Bjorn Larsson
df367faddb sptests: New tests split from sp09 screen 1 and screen 2.
Split sp09 screen 1 into new test sptask_err04.
Split sp09 screen 2 into new tests sptask__err02 and spclock_err01,
as well as moving one verification into sptimer_err01.
2014-03-28 13:09:06 -05:00
Bjorn Larsson
719c7e55e4 sptask_err03: New test split from sp09 screen 3. 2014-03-28 13:09:06 -05:00
Bjorn Larsson
4327a7b759 spevent_err03: New test split from sp09 screen 4. 2014-03-28 13:09:06 -05:00
Bjorn Larsson
d6f65e40ea sptests: split sp09 screen 5,6 into spsem_err01, spsem_err02, and sptask_err01.
sp09 screen 5 split into spsem_err01, sp09 screen 6 split into
spsem_err02, and sptask_err01.
2014-03-28 13:08:57 -05:00
Bjorn Larsson
a3707d893c sptests: Split sp09 screens 7,8 into spmsg1_err01 and spmsgq_err02.
spmsgq_err01 test replaces rtems_message_queue_XXX error tests from
sp09 screen 7.  spmsgq_err02 replaces rtems_message_queue_XXX error
tests from sp09 screen 8.
2014-03-28 12:32:47 -05:00
Bjorn Larsson
abc833bd56 spport_err01: New test split from sp09
This test verifies rtems_port_XXX error tests from sp09 screen 9.
2014-03-28 12:32:38 -05:00
Bjorn Larsson
34244b7a74 spsignal_err01: New test split from sp09.
This test moves rtems_signal_send error testing from sp09
screen 9 into its own test.
2014-03-28 12:32:29 -05:00