Commit Graph

72 Commits

Author SHA1 Message Date
Sebastian Huber
df8d7bd76f score: Use processor mask in _SMP_Multicast_action
Processor_mask is the internal data type to deal with processor sets.
2019-04-12 09:44:48 +02:00
Sebastian Huber
7c19e50bdd score: Fix per-CPU data allocation
Allocate the per-CPU data for secondary processors directly from the
heap areas before heap initialization and not via
_Workspace_Allocate_aligned().  This avoids dependency on the workspace
allocator.  It fixes also a problem on some platforms (e.g. QorIQ) where
at this early point in the system initialization the top of the RAM is
used by low-level startup code on secondary processors (boot pages).

Update #3507.
2018-12-18 08:50:08 +01:00
Sebastian Huber
709796209c score: Add thread pin/unpin support
Add support to temporarily pin a thread to its current processor.  This
may be used to access per-processor data structures in critical sections
with enabled thread dispatching, e.g. a pinned thread is allowed to
block.

Update #3508.
2018-09-10 10:38:45 +02:00
Sebastian Huber
ffd46178c7 score: Fix _Scheduler_EDF_SMP_Set_affinity()
Commit 8744498752 broke the
_Scheduler_EDF_SMP_Set_affinity() implementation.  We must test the
overall affinity against the online processors.
2018-07-18 07:16:27 +02:00
Sebastian Huber
b422aa3f4a tests: Remove configure feature checks
Update #3409.
2018-05-02 07:11:03 +02:00
Chris Johns
aa567bc1cc configure: Add subdir-objects to all automake flags.
This option silences warning with automake-1.16.1 allowing us to
upgrade to that version.

This change has been tested with automake-1.12.6 and automake-1.16.1.
It seems version 1.16.1 configures slower than 1.12.6 for the same
source and BSP. The newer versions is 6 second slower.

Close #3387.
2018-04-11 11:52:29 +10:00
Chris Johns
8074fa0b83 testsuite/smptests: Merged nested Makefile.am files into one Makefile.am
This change is part of the testsuite Makefile.am reorganization.

Update #3382
2018-04-10 08:24:54 +10:00
Sebastian Huber
0c5d22f509 smptests/smpopenmp01: New test 2018-02-02 15:01:19 +01:00
Chris Johns
2afb22b7e1 Remove make preinstall
A speciality of the RTEMS build system was the make preinstall step.  It
copied header files from arbitrary locations into the build tree.  The
header files were included via the -Bsome/build/tree/path GCC command
line option.

This has at least seven problems:

* The make preinstall step itself needs time and disk space.

* Errors in header files show up in the build tree copy.  This makes it
  hard for editors to open the right file to fix the error.

* There is no clear relationship between source and build tree header
  files.  This makes an audit of the build process difficult.

* The visibility of all header files in the build tree makes it
  difficult to enforce API barriers.  For example it is discouraged to
  use BSP-specifics in the cpukit.

* An introduction of a new build system is difficult.

* Include paths specified by the -B option are system headers.  This
  may suppress warnings.

* The parallel build had sporadic failures on some hosts.

This patch removes the make preinstall step.   All installed header
files are moved to dedicated include directories in the source tree.
Let @RTEMS_CPU@ be the target architecture, e.g. arm, powerpc, sparc,
etc.  Let @RTEMS_BSP_FAMILIY@ be a BSP family base directory, e.g.
erc32, imx, qoriq, etc.

The new cpukit include directories are:

* cpukit/include

* cpukit/score/cpu/@RTEMS_CPU@/include

* cpukit/libnetworking

The new BSP include directories are:

* bsps/include

* bsps/@RTEMS_CPU@/include

* bsps/@RTEMS_CPU@/@RTEMS_BSP_FAMILIY@/include

There are build tree include directories for generated files.

The include directory order favours the most general header file, e.g.
it is not possible to override general header files via the include path
order.

The "bootstrap -p" option was removed.  The new "bootstrap -H" option
should be used to regenerate the "headers.am" files.

Update #3254.
2018-01-25 08:45:26 +01:00
Sebastian Huber
34487537ce score: Add simple affinity support to EDF SMP
Update #3059.
2017-07-10 07:49:36 +02:00
Sebastian Huber
7adf4941a8 smptests/smpschededf01: New test
Update #3056.
2017-06-29 15:21:30 +02:00
Sebastian Huber
f3d9f2288e score: Add SMP EDF scheduler
Update #3056.
2017-06-29 11:28:32 +02:00
Sebastian Huber
1dbce41bb8 smptests: Split smpscheduler03
Split smpscheduler03 to run the tests with only one processor.

Update #3056.
2017-06-29 11:15:38 +02:00
Chris Johns
258bda306b testsuite: Add a common test configuration. Fix configure.ac and Makefile.am errors.
- Add a top level test configuration file for test states that are common
  to all BSPs. This saves adding a test configuration (tcfg) file for
  every BSP.

- Add the test states 'user-input' and 'benchmark'. This
  lets 'rtems-test' stop the test rather than waiting for a timeout or
  letting a benchmark run without the user asking for it to run.

- Implement rtems-test-check in Python to make it faster. The shell script
  had grown to a point it was noticably slowing the build down.

- Fix the configure.ac and Makefile.am files for a number of the
  test directories. The files are difficiult to keep in sync with the
  number of tests and mistakes can happen such as tests being left
  out of the build. The test fsrofs01 is an example. Also a there was
  a mix of SUBDIRS and _SUBDIRS being used and only _SUBDIRS should be
  used.

- Fix the test fsrofs01 so it compiles.

Closes #2963.
2017-04-04 08:24:22 +10:00
Joel Sherrill
7a4b264574 Remove obsolete __RTEMS_HAVE_SYS_CPUSET_H__ 2017-01-11 09:45:32 -06:00
Sebastian Huber
84e6f15c82 score: Robust thread dispatch
On SMP configurations, it is a fatal error to call blocking operating
system with interrupts disabled, since this prevents delivery of
inter-processor interrupts. This could lead to executing threads which
are not allowed to execute resulting in undefined behaviour.

The ARM Cortex-M port has a similar problem, since the interrupt state
is not a part of the thread context.

Update #2811.
2016-11-23 12:52:06 +01:00
Sebastian Huber
05ca53ddf6 rtems: Add scheduler processor add/remove
Update #2797.
2016-11-10 09:22:09 +01:00
Sebastian Huber
3a27248054 score: First part of new MrsP implementation
Update #2556.
2016-11-02 10:05:43 +01:00
Sebastian Huber
57a00bc6af smptests/smpmutex02: New test
Update #2765.
2016-07-25 14:18:34 +02:00
Sebastian Huber
77ff5599e0 score: Introduce map priority scheduler operation
Introduce map/unmap priority scheduler operations to map thread priority
values from/to the user domain to/from the scheduler domain.  Use the
map priority operation to validate the thread priority.  The EDF
schedulers use this new operation to distinguish between normal
priorities and priorities obtain through a job release.

Update #2173.
Update #2556.
2016-06-22 14:36:40 +02:00
Sebastian Huber
ceb0f6597c score: Remove the Giant lock
Update #2555.
2016-05-20 07:50:37 +02:00
Sebastian Huber
981eed2176 score: Add dummy Strong APA scheduler
Start with a copy of the Priority SMP scheduler implementation.

Update #2510.
2016-05-02 07:46:17 +02:00
Sebastian Huber
03b900d3ed score: Replace watchdog handler implementation
Use a red-black tree instead of delta chains.

Close #2344.
Update #2554.
Update #2555.
Close #2606.
2016-03-04 13:36:10 +01:00
Sebastian Huber
3995e6d9c2 score: Implement SMP-specific priority queue 2015-09-04 13:25:03 +02:00
Daniel Cederman
8d8573acc8 smpcapture02: Add test of functionality to add custom entries to capture trace 2015-02-11 15:35:26 +01:00
Sebastian Huber
1207288022 Update bug report URL 2014-12-05 07:47:32 +01:00
Jennifer Averett
44da98f08f smpcapture01: New test. 2014-11-24 14:04:54 -06:00
Daniel Cederman
9a9ab85b45 smptests/smpcache01: Test the SMP cache manager
Invokes SMP cache management routines under different scenarios.
2014-08-22 13:10:59 +02:00
Jennifer Averett
247118bf51 smpschedsem01: new test.
This test verifies priority is inherited from a high priority
semaphore by a lower  priority task.
2014-07-11 10:12:48 -05:00
Jennifer Averett
7eb3fd4782 smpschedaffinity05: Add test for worst case migration for affintiy scheduler.
This test uses a combination of priority and affinity to cause
the tasks running on all 4 cores to change due to one task priority
change.
2014-07-11 10:12:48 -05:00
Jennifer Averett
61d26f939d smpschedaffinity04: New test.
This test walks a secondary high prority task across
all the cores.
2014-07-11 10:12:48 -05:00
Jennifer Averett
28d6674966 smpschedaffinity03: New test.
This task walks the affinity of self across all the cores.
2014-07-11 10:12:48 -05:00
Jennifer Averett
0929306933 smpschedaffinity02: New test.
This test checks setting the affinity of a secondary task
on a two core system.
2014-07-11 10:12:48 -05:00
Jennifer Averett
d88b0e7fc8 smpschedaffinity01: New test.
This test verifies that affinity is honored when set prior to task start.
2014-07-11 10:12:47 -05:00
Sebastian Huber
bd56356b58 smptests/smpwakeafter01: New test 2014-06-18 14:03:59 +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
d134adeba3 score: Fix race condition in SMP startup
Do not use the Per_CPU_Control::started in
_SMP_Start_multitasking_on_secondary_processor() since this field may be
not up to date when a secondary processor reads it.  Use the read-only
scheduler assignment instead.

Add a new fatal error SMP_FATAL_MULTITASKING_START_ON_INVALID_PROCESSOR.
This prevents out-of-bounds access.

It is currently not possible to test these fatal errors.  One option
would be to fake values of the _CPU_SMP_Get_current_processor(), but
unfortunately this function is inline on some architectures.
2014-05-26 08:56:44 +02:00
Sebastian Huber
c0bff5e936 score: Split SMP scheduler enqueue function
Extract code from _Scheduler_SMP_Enqueue_ordered() and move it to the
new function _Scheduler_SMP_Enqueue_scheduled_ordered() to avoid
untestable execution paths.

Add and use function _Scheduler_SMP_Unblock().
2014-05-15 12:18:49 +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
Sebastian Huber
145becf075 score: Add SMP test message handler
This handler can be used to test the inter-processor interrupt
implementation.
2014-05-05 08:26:27 +02:00
Sebastian Huber
e239760f6a score: SMP_FATAL_SCHEDULER_WITHOUT_PROCESSORS
Avoid the SMP_FATAL_SCHEDULER_WITHOUT_PROCESSORS fatal error and make it
a run-time error in rtems_scheduler_ident() and _Scheduler_Get_by_id().
2014-05-05 08:26:27 +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
c3cd7e7b7b smptests/smpschedule01: Rename in smpscheduler01 2014-04-09 15:27:21 +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
4575ae0a40 smptests/smpload01: New test 2014-03-14 08:46:50 +01:00
Jennifer Averett
2ef0328958 smptests: Add smppsxaffinity02.
This method exercises the ability to dynamically get and set
the affinity of POSIX threads.

NOTE: There is no scheduler support for affinity. This is
simply a data integrity test.
2014-03-07 09:14:33 -06:00
Jennifer Averett
f3e6b18a4a smptests: Add smppsxaffinity01.
This test exercises the ability to obtain and modify
the affinity field of the POSIX thread attributes.
2014-03-07 09:13:35 -06:00
Jennifer Averett
a3e055fe8a smptests: Add smpaffinity01
This test exercises the new Classic API task affinity methods.
2014-03-07 09:13:14 -06:00
Sebastian Huber
ba25cc208c score: Add and use _Giant_Drop()
New test smptests/smpfatal03.
2014-03-06 09:43:58 +01:00
Sebastian Huber
7336be9d78 score: SMP initialization and shutdown changes
Rename _SMP_Request_other_cores_to_perform_first_context_switch() into
_SMP_Request_start_multitasking() since this requests now a multitasking
start on all configured and available processors.  The name corresponds
_Thread_Start_multitasking() and
_SMP_Start_multitasking_on_secondary_processor() actions issued in
response to this request.  Move in source file to right place.

Rename PER_CPU_STATE_READY_TO_BEGIN_MULTITASKING into
PER_CPU_STATE_READY_TO_START_MULTITASKING.

Rename PER_CPU_STATE_BEGIN_MULTITASKING into
PER_CPU_STATE_REQUEST_START_MULTITASKING.

Rename _SMP_Request_other_cores_to_shutdown() into
_SMP_Request_shutdown().

Add a per-CPU state lock to protect all changes.  This was necessary to
offer a controlled shutdown of the system (atomic read/writes alone are
not sufficient for this kind of synchronization).

Add documentation for Per_CPU_State.

Delete debug output.

New tests smptests/smpfatal01 and smptests/smpfatal02.
2014-03-06 09:43:57 +01:00