Commit Graph

183 Commits

Author SHA1 Message Date
Sebastian Huber
a38ced2683 score: Rework global construction
Ensure that the global construction is performed in the context of the
first initialization thread.  On SMP this was not guaranteed in the
previous implementation.
2014-10-13 14:30:22 +02:00
Sebastian Huber
6f1e1b308c sptests/spintrcritical22: New test 2014-09-19 14:25:34 +02:00
Sebastian Huber
4984ee4aa2 sptests/sp39: Convert to sptests/spintrcritical21
Use interrupt critical section test support.  Do not print end of test
message in case of failure.
2014-09-10 07:12:55 +02:00
Sebastian Huber
f6fc635943 sptests/spsem03: New test 2014-06-03 12:01:13 +02:00
Sebastian Huber
3e2011394d score: Add Resource Handler
A resource is something that has at most one owner at a time and may
have multiple rivals in case an owner is present.  The owner and rivals
are impersonated via resource nodes.  A resource is represented via the
resource control structure.  The resource controls and nodes are
organized as trees.  It is possible to detect deadlocks via such a
resource tree.  The _Resource_Iterate() function can be used to iterate
through such a resource tree starting at a top node.
2014-06-03 08:15:16 +02:00
Sebastian Huber
8fcafdd553 score: Multiprocessor Resource Sharing Protocol
Add basic support for the Multiprocessor Resource Sharing Protocol
(MrsP).

The Multiprocessor Resource Sharing Protocol (MrsP) is defined in A.
Burns and A.J.  Wellings, A Schedulability Compatible Multiprocessor
Resource Sharing Protocol - MrsP, Proceedings of the 25th Euromicro
Conference on Real-Time Systems (ECRTS 2013), July 2013.  It is a
generalization of the Priority Ceiling Protocol to SMP systems.  Each
MrsP semaphore uses a ceiling priority per scheduler instance.  These
ceiling priorities can be specified with rtems_semaphore_set_priority().
A task obtaining or owning a MrsP semaphore will execute with the
ceiling priority for its scheduler instance as specified by the MrsP
semaphore object.  Tasks waiting to get ownership of a MrsP semaphore
will not relinquish the processor voluntarily.  In case the owner of a
MrsP semaphore gets preempted it can ask all tasks waiting for this
semaphore to help out and temporarily borrow the right to execute on one
of their assigned processors.

The help out feature is not implemented with this patch.
2014-05-28 10:50:41 +02:00
Sebastian Huber
f39f667a69 score: Simplify _Thread_Change_priority()
The function to change a thread priority was too complex.  Simplify it
with a new scheduler operation.  This increases the average case
performance due to the simplified logic.  The interrupt disabled
critical section is a bit prolonged since now the extract, update and
enqueue steps are executed atomically.  This should however not impact
the worst-case interrupt latency since at least for the Deterministic
Priority Scheduler this sequence can be carried out with a wee bit of
instructions and no loops.

Add _Scheduler_Change_priority() to replace the sequence of
  - _Thread_Set_transient(),
  - _Scheduler_Extract(),
  - _Scheduler_Enqueue(), and
  - _Scheduler_Enqueue_first().

Delete STATES_TRANSIENT, _States_Is_transient() and
_Thread_Set_transient() since this state is now superfluous.

With this change it is possible to get rid of the
SCHEDULER_SMP_NODE_IN_THE_AIR state.  This considerably simplifies the
implementation of the new SMP locking protocols.
2014-05-15 12:18:44 +02:00
Sebastian Huber
0712d172d0 score: Task get/set affinity
Make rtems_task_get_affinity() and rtems_task_set_affinity() available
on non-SMP configurations.  Allow larger CPU sets.
2014-04-15 08:37:12 +02:00
Joel Sherrill
d507c03731 Disable per task variables when SMP is enabled
Per task variables are inherently unsafe in SMP systems. This
patch disables them from the build and adds warnings in the
appropriate documentation and configuration sections.
2014-04-04 14:27:27 -05: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
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
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
Bjorn Larsson
0cf41e54dc spintr_err01: New test split from sp09.
This test contains the interrupt catch error tests from sp09
screen 9.
2014-03-28 12:32:19 -05:00
Bjorn Larsson
9c88bc6e80 spratemon_err01: New test split from sp09. 2014-03-28 12:32:10 -05:00
Christian Mauderer
5c0c0cf2a6 privateenv: Use POSIX keys instead of task variables. 2014-03-27 14:50:36 +01:00
Sebastian Huber
4dad4b8411 sapi: Add profiling application level support 2014-03-14 08:46:49 +01:00
Sebastian Huber
3378be955a sptests/spcache01: New test 2014-02-24 16:12:03 +01:00
Sebastian Huber
95d0c98cac score: Fix thread TLS area initialization
Do not use _TLS_Size here since this will lead GCC to assume that this
symbol is not 0 and the later > 0 test will be optimized away.
2014-02-24 12:50:32 +01:00
Sebastian Huber
b39e055a49 score: Delete INTERNAL_ERROR_SHUTDOWN_WHEN_NOT_UP
This error case is no longer required since rtems_shutdown_executive()
can be called anytime, anywhere
2014-02-19 09:59:39 +01:00
Sebastian Huber
24bf11eca1 score: Add CPU counter support
Add a CPU counter interface to allow access to a free-running counter.
It is useful to measure short time intervals.  This can be used for
example to enable profiling of critical low-level functions.

Add two busy wait functions rtems_counter_delay_ticks() and
rtems_counter_delay_nanoseconds() implemented via the CPU counter.
2014-02-14 10:28:29 +01:00
Sebastian Huber
022851aba5 Add thread-local storage (TLS) support
Tested and implemented on ARM, m68k, PowerPC and SPARC.  Other
architectures need more work.
2014-02-04 10:06:35 +01:00
Mandar Juvekar
255178ec35 sptests: Refactor sp09 into sppartition_err01 and sp09. 2014-01-02 13:22:36 -06:00
Mandar Juvekar
dfcb3ace79 spregion_err01: New test refactored from sp09 2013-12-30 09:18:51 -06:00
Chirayu Desai
7b5f6643b2 sptests: refactor sp09/screen13 into a new test spclock_err02 2013-12-24 09:53:59 -05:00
Jennifer Averett
fe011a59a4 sptests/spcpuset*: Add tests for fixed size cpu_set_t operations.
This adds five tests for <sys/cpuset.h>. It does not include
tests for CPU_XXX_S methods. The autotools should be able to
avoid enabling the tests unless the toolset has <sys/cpuset.h>.
2013-12-19 14:11:09 -06:00
Daniel Ramirez
07f4edc14b sptests: refactored sp09/screen14.c into two new tests 2013-12-11 20:11:08 -05:00
Chirayu Desai
54da1243eb sptests: add a test for page size
Bug: https://www.rtems.org/bugzilla/show_bug.cgi?id=1216
2013-12-06 10:45:28 -05:00
Sebastian Huber
ec987ec00a sptests/spintrcritical20: PR2140: New test 2013-08-23 12:56:19 +02:00
Sebastian Huber
6b0cd960e5 sptests/spintrcritical19: PR2136: New test 2013-08-08 14:11:23 +02:00
WeiY
693088951d clean up spatomic testcase 2013-08-01 16:48:25 +02:00
Zhongwei Yao
8fb2bea426 score: Add freechain 2013-07-24 11:11:21 +02:00
WeiY
2e7f579865 stdatomic.h support check when configure 2013-07-17 13:07:33 +02:00
Gedare Bloom
26ecc744b5 sptests: add test to demonstrate bug in strict order mutex 2013-05-20 09:41:18 -04:00
Gedare Bloom
9cdbf73497 sptests: add test for priority inversion with multiple locks 2013-05-20 09:37:53 -04:00
Sebastian Huber
39993d6d76 score: Add CPU context validation 2013-05-10 12:10:14 +02:00
WeiY
502693f50e Clear the atomic conditional compilation. 2013-05-01 10:28:48 -04:00
Ralf Corsépius
bdf9072032 Introduce AM_CONDITIONAL ATOMIC, cpuopt RTEMS_ATOMIC. 2013-02-14 23:47:31 +01:00
WeiY
9d23df2fbc score: atomic support for RTEMS automake and autoconf changes 2013-02-07 17:02:12 -05:00
Sebastian Huber
815994fd17 score: Add CPU_Exception_frame
Add CPU port type CPU_Exception_frame and function
_CPU_Exception_frame_print().

The CPU ports of avr, bfin, h8300, lm32, m32c, m32r, m68k, nios2, sh,
sparc64, and v850 use an empty default implementation of
_CPU_Exception_frame_print().

Add rtems_exception_frame and rtems_exception_frame_print().

Add RTEMS_FATAL_SOURCE_EXCEPTION for CPU exceptions.  Use rtems_fatal()
with source RTEMS_FATAL_SOURCE_EXCEPTION in CPU ports of i386, powerpc,
and sparc for unexpected exceptions.

Add third parameter to RTEMS_BSP_CLEANUP_OPTIONS() which controls the
BSP_PRINT_EXCEPTION_CONTEXT define used in the default
bsp_fatal_extension().

Add test sptests/spfatal26.
2012-11-27 17:03:40 +01:00
Sebastian Huber
dc6e830c10 sapi: Add and use rtems_internal_error_description 2012-11-15 15:33:11 +01:00
Sebastian Huber
44633fd65c sptests/spinternalerror01: New test 2012-11-13 09:37:57 +01:00
Sebastian Huber
0edf263139 rtems: Add system events
System events are similar to normal events.  They offer a second set of
events.  These events are intended for internal RTEMS use and should not
be used by applications (with the exception of the transient system
event).
2012-10-30 18:03:02 +01:00
Sebastian Huber
47a3cd8f73 score: Work area initialization API change
The work areas (RTEMS work space and C program heap) will be initialized
now in a separate step and are no longer part of
rtems_initialize_data_structures().  Initialization is performed with
tables of Heap_Area entries.  This allows usage of scattered memory
areas present on various small scale micro-controllers.

The sbrk() support API changes also.  The bsp_sbrk_init() must now deal
with a minimum size for the first memory chunk to take the configured
work space size into account.
2012-10-25 14:54:06 +02:00
Sebastian Huber
9b83a66546 score: Critical fix for thread dispatching
The changes in _Thread_Dispatch() of commits
dad36c52b8 and
d4dc7c8196 introduced a severe bug which
destroys the real-time properties of RTEMS completely.

Consider the following scenario.  We have three tasks L (lowest
priority), M (middle priority), and H (highest priority).  Now let a
thread dispatch from M to L happen.  An interrupt occurs in
_Thread_Dispatch() here:

void _Thread_Dispatch( void )
{
  [...]

post_switch:

  _ISR_Enable( level );

  <-- INTERRUPT
  <-- AFTER INTERRUPT

  _Thread_Unnest_dispatch();

  _API_extensions_Run_postswitch();
}

The interrupt event makes task H ready.  The interrupt code will see
_Thread_Dispatch_disable_level > 0 and thus doesn't perform a
_Thread_Dispatch().  Now we return to position "AFTER INTERRUPT".  This
means task L executes now although task H is ready!  Task H will execute
once someone calls _Thread_Dispatch().
2012-10-07 14:40:49 +02:00