Commit Graph

971 Commits

Author SHA1 Message Date
Sebastian Huber
43633ae262 testsuites: Avoid clock driver 2014-10-14 12:12:32 +02:00
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
7f8a978e6b sptests/sp07: Minimize thread dispatch latency
Do not use sprintf() in thread dispatch critical sections to avoid
corruption of profiling samples.  Update test to reflect thread the life
cycle changes.
2014-09-16 15:43:15 +02:00
Sebastian Huber
f9eca790ac sptests/spintrcritical_support: Optimize busy loop 2014-09-12 16:06:29 +02:00
Sebastian Huber
73b5d8bf20 sptests/spintrcritical10: Avoid undefined memory 2014-09-12 16:06:26 +02:00
Sebastian Huber
e09f8b0808 sptests/spfatal07: Fix end of test message 2014-09-10 14:46:03 +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
8028089000 tests: Rework interrupt critical tests
This avoids test durations of more than one hour on fast targets, since
fast targets can count a lot during one clock tick period, so the minor
loop iteration count was quite high.  Estimate now the test body
duration to iterate only through the interesting time window.

Add and use interrupt_critical_section_test().
2014-09-10 07:12:55 +02:00
Sebastian Huber
07b4594cb4 sptests/spcontext01: Fix warning 2014-09-08 07:53:02 +02:00
Joel Sherrill
a864016f3a spcpuset01: Use %zd for size_t to eliminate warning 2014-09-04 09:08:05 -05:00
Joel Sherrill
9aa6ddf0ce spfreechain01/init.c: Use %zd for size_t to eliminate warning 2014-09-04 09:08:05 -05:00
Joel Sherrill
e1462e162a sp19: Eliminate warnings 2014-09-04 09:08:05 -05:00
Joel Sherrill
be4992b193 raspberrypi: Use shared bspreset.c 2014-09-04 09:07:56 -05:00
Sebastian Huber
4030cccfef tests: Add documentation 2014-09-01 11:01:04 +02:00
Sebastian Huber
96ec8ee80a rtems: Add more clock tick functions
Add rtems_clock_tick_later(), rtems_clock_tick_later_usec() and
rtems_clock_tick_before().
2014-08-26 10:21:27 +02:00
Hesham ALMatary
23b14f87cf sptests/spcache01: Make inline assembly conditional to account for OpenRISC l.nop instruction. 2014-08-25 11:12:16 -05:00
Sebastian Huber
bba3507723 score: PR2179: Fix initially locked PI mutex 2014-08-20 08:17:49 +02:00
Sebastian Huber
0b9fe3ec66 sptests/sprbtree01: Add random ops test case 2014-08-08 11:11:27 +02:00
Sebastian Huber
993f5acd25 rbtree: Simplify insert and extract
Simplify _RBTree_Insert() and _RBTree_Extract().  Remove more
superfluous NULL pointer checks.  Change _RBTree_Is_root() to use only
the node.  Add parent parameter to _RBTree_Sibling().  Delete
_RBTree_Grandparent() and _RBTree_Parent_sibling().
2014-08-07 15:59:29 +02:00
Sebastian Huber
4752550f80 rbtree: Simplify _RBTree_Rotate()
Add and use _RBTree_Direction().
2014-08-07 15:59:25 +02:00
Sebastian Huber
d472d21780 sptests/sprbtree01: Check tree layout 2014-08-05 15:17:51 +02:00
Sebastian Huber
888edf69a9 sptests/sprbtree01: Reduce stack usage 2014-08-05 15:17:43 +02:00
Sebastian Huber
60fe374247 rbtree: Add and use RBTree_Compare_result 2014-08-05 09:30:37 +02:00
Sebastian Huber
40dcafaf80 Add and use RTEMS_CONTAINER_OF() 2014-08-05 09:30:33 +02:00
Sebastian Huber
b767683a5e rbtree: Rename find header in find control
Simplify _RBTree_Find_control().  Avoid superfluous NULL pointer checks.
2014-07-29 14:05:17 +02:00
Sebastian Huber
6e93c836e2 rbtree: Simplify off-tree handling
Only use the parent pointer, since this pointer is never NULL for nodes
which are part of a tree.

Rename functions from *_off_rbtree() to *_off_tree().
2014-07-29 14:05:08 +02:00
Sebastian Huber
639117fd12 rbtree: Update maximum node in LIFO order
The test sptests/sp35 showed a NULL pointer access due to an invalid
maximum node field (e.g. a tree with one element and NULL as the maximum
node).
2014-07-26 12:01:25 +02:00
Sebastian Huber
8abbbdde38 rbtree: Do not set node off-tree in extract 2014-07-22 12:31:41 +02:00
Sebastian Huber
d7a9469378 rbtree: Remove superfluous NULL pointer checks 2014-07-22 12:31:39 +02:00
Sebastian Huber
64939bc9ef rbtree: Reduce RBTree_Control size
Remove compare function and is unique indicator from the control
structure.  Rename RBTree_Compare_function to RBTree_Compare.  Rename
rtems_rbtree_compare_function to rtems_rbtree_compare.  Provide C++
compatible initializers.  Add compare function and is unique indicator
to _RBTree_Find(), _RBTree_Insert(), rtems_rbtree_find() and
rtems_rbtree_insert().  Remove _RBTree_Is_unique() and
rtems_rbtree_is_unique().  Remove compare function and is unique
indicator from _RBTree_Initialize_empty() and
rtems_rbtree_initialize_empty().
2014-07-15 10:03:48 -05:00
Joel Sherrill
9ba76ed8de sp59: Fix typos 2014-07-14 19:41:31 -05:00
Sebastian Huber
88525944f3 sptests/spcontext01: Avoid NULL pointer access 2014-07-01 12:03:12 +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
4edf348c33 score: PR2179: Fix initially locked PCP mutexes
Elevate the priority of the creating task to the ceiling priority in
case a semaphore is created as initially locked.
2014-05-23 08:57:32 +02:00
Chris Johns
eae0863a1c rtems: Fix sp2038 test.
Avoid using newlib's gmtime_r call which fails with a max signed int.
Add an RTEMS specific version for 1/1/1988 to 31/12/2100.

Update sp2038 to test every day from 1/1/1988 to 31/12/2100. Only days
need be tested as the code splits the seconds based on days.
2014-05-22 16:38:01 +10:00
Sebastian Huber
82f9074308 score: _Thread_Set_life_protection()
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.
2014-05-21 11:48:25 +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
beab7329fc score: Introduce scheduler nodes
Rename scheduler per-thread information into scheduler nodes using
Scheduler_Node as the base type.  Use inheritance for specialized
schedulers.

Move the scheduler specific states from the thread control block into
the scheduler node structure.

Validate the SMP scheduler node state transitions in case RTEMS_DEBUG is
defined.
2014-05-14 14:46:19 +02:00
Sebastian Huber
11b05f11d4 score: Fix CPU context usage on SMP
We must not alter the is executing indicator in
_CPU_Context_Initialize() since this would cause an invalid state during
a self restart.

The is executing indicator must be valid at creation time since
otherwise _Thread_Kill_zombies() uses an undefined value for not started
threads.  This could result in a system life lock.
2014-05-08 13:02:40 +02:00
Sebastian Huber
38b59a6d30 score: Implement forced thread migration
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.
2014-05-07 14:26:28 +02:00
Joel Sherrill
3324383ce0 testsuites: Remove BSP_SMALL_MEMORY 2014-05-06 18:31:00 -05:00
Chris Johns
1461b648b7 testsuite: Add a per BSP test check for tests not to build.
Provide a file per BSP to list tests that do not build for a BSP. This change
removes the BSP_SMALL_MEMORY hack from the code. That hack was a
mistake.

Provide configuration files for each BSP with tests that cannot build.
2014-05-05 10:24:41 +10:00
Sebastian Huber
03b7789ec7 score: Statically initialize _ISR_Vector_table 2014-04-29 09:51:22 +02:00
Sebastian Huber
c5831a3f9a score: Add clustered/partitioned scheduling
Clustered/partitioned scheduling helps to control the worst-case
latencies in the system.  The goal is to reduce the amount of shared
state in the system and thus prevention of lock contention.  Modern
multi-processor systems tend to have several layers of data and
instruction caches.  With clustered/partitioned scheduling it is
possible to honour the cache topology of a system and thus avoid
expensive cache synchronization traffic.

We have clustered scheduling in case the set of processors of a system
is partitioned into non-empty pairwise-disjoint subsets.  These subsets
are called clusters.  Clusters with a cardinality of one are partitions.
Each cluster is owned by exactly one scheduler instance.
2014-04-15 10:41:44 +02:00
Sebastian Huber
27270b0d6c rtems: Add task get/set scheduler 2014-04-15 09:29:35 +02:00
Sebastian Huber
1b67535d86 rtems: Add scheduler get processors 2014-04-15 09:29:35 +02:00
Sebastian Huber
b427a92adf rtems: Add scheduler identification 2014-04-15 09:29:31 +02:00