Commit Graph
1404 Commits
Author SHA1 Message Date
Sebastian Huber 50aef135a4 score: Add _Thread_MP_Extract_proxy()
Remove _Thread_queue_Extract_with_proxy() and move the proxy extraction
to _Thread_MP_Extract_proxy().  Move similar code blocks of the previous
caller of _Thread_queue_Extract_with_proxy() to helper functions.

Update #4546.
2021-11-23 11:00:28 +01:00
Sebastian Huber c69a70a597 rtems: Fix rtems_scheduler_remove_processor()
Return an error status for the following error condition in
rtems_scheduler_remove_processor():

While an attempt is made to remove a processor from a scheduler, while
the processor is the only processor owned by the scheduler, if a thread
exists which uses the scheduler as a helping scheduler, then the
processor shall not be removed.

The reason is that ask for help requests and withdraw node requests are
processed asynchronously in any order.  An ask for help request carried
out on a scheduler without a processor is undefined behaviour.

Update error status description.

Update #4544.
2021-11-23 11:00:28 +01:00
Sebastian Huber 6443c9dbb7 score: Fix assertion in SMP scheduler framework
Properly assert that the scheduled chain is not empty.  Fix formatting.

Close #4531.
2021-11-23 11:00:28 +01:00
Sebastian Huber fc64e837c3 score: Rework ask for help requests
Process ask for help requests on the current processor.  This avoids
using inter-processor interrupts to make the system behaviour a bit more
predictable.

Update #4531.
2021-11-23 11:00:28 +01:00
Sebastian Huber 4d90289e71 score: _Scheduler_SMP_Schedule_highest_ready()
Simplify callers of _Scheduler_SMP_Schedule_highest_ready().  Move the node
state change and the extraction from scheduled into
_Scheduler_SMP_Schedule_highest_ready().  Move the idle thread release to the
caller which have more information about the presence of an idle thread.

Update #4531.
2021-11-23 11:00:28 +01:00
Sebastian Huber d0434b8863 score: Remove victim thread from CPU allocation
Update #4531.
2021-11-23 11:00:28 +01:00
Sebastian Huber c6362f640a score: Move _Scheduler_Unblock_node()
Move _Scheduler_Unblock_node() into _Scheduler_SMP_Unblock().  This simplifies
the code and makes it easier to review.

Update #4531.
2021-11-23 11:00:28 +01:00
Sebastian Huber dcd8b939ba score: Move _Scheduler_Block_node()
Move _Scheduler_Block_node() into _Scheduler_SMP_Block().  This simplifies the
code and makes it easier to review.

Update #4531.
2021-11-23 11:00:28 +01:00
Sebastian Huber f767ef8059 score: Simplify _Scheduler_SMP_Yield()
There is not need to actively ask for help in a yield operation.  The helping
is already done on demand by the other scheduler operations.
2021-11-23 11:00:28 +01:00
Sebastian Huber 6d20f0c525 score: Add node to insert to Chain_Node_order
This allows to use additional members of the nodes for comparision.

Update #4534.
2021-11-23 11:00:28 +01:00
Sebastian Huber ff20bc9816 score: Rework idle handling in SMP schedulers
This patch fixes an issue with the idle thread handling in the SMP
scheduler framework used for the MrsP locking protocol.  The approach to
use a simple chain of unused idle threads is broken for schedulers which
support thread to processor affinity.  The reason is that the thread to
processor affinity introduces another ordering indicator which may under
certain conditions lead to a reordering of idle threads in the scheduled
chain.  This reordering is not propagated to the chain of unused idle
threads.  This could lead to use an idle thread for a sticky scheduler
node which is already in use.  This locks up the system in infinite
loops in the thread context switch procedure.

To fix this, the SMP scheduler implementations must now provide
callbacks to get and release an unused idle thread.

Update #4531.
2021-11-23 11:00:28 +01:00
Sebastian Huber 3d6ebde1ac score: Add SMP scheduler make/clean sticky
This patch fixes the following broken behaviour:

  While a thread is scheduled on a helping scheduler, while it does not
  own a MrsP semaphore, if it obtains a MrsP semaphore, then no
  scheduler node using an idle thread and the ceiling priority of the
  semaphore is unblocked for the home scheduler.

This could lead to priority inversion issues and is not in line
with the MrsP protocol.

Introduce two new scheduler operations which are only enabled if
RTEMS_SMP is defined.  The operations are used to make the scheduler
node of the home scheduler sticky and to clean the sticky property.
This helps to keep the sticky handing out of the frequently used
priority update operation.

Close #4532.
2021-11-23 11:00:28 +01:00
Sebastian Huber 3781709f28 score: Add SMP scheduler idle exchange callback
Update #4531.
2021-11-23 11:00:28 +01:00
Sebastian Huber 9d3e821279 score: Rework affine ready queue handling
Rework the handling of the affine ready queue for the EDF SMP scheduler.
Do the queue handling in the node insert, move, and extract operations.
Remove the queue handling from _Scheduler_EDF_SMP_Allocate_processor().

Update #4531.
2021-11-23 11:00:28 +01:00
Sebastian Huber a53229bbb6 score: Use extract from scheduled callbacks
Use the extract from scheduled callback provided by the scheduler
implementation in the SMP scheduler framework.

Update #4531.
2021-11-23 11:00:28 +01:00
Sebastian Huber 757a10964f score: Remove return value from enqueue scheduled
The return value was unused.  Remove it.

Update #4531.
2021-11-23 11:00:28 +01:00
Sebastian Huber 6286a40aa3 score: Scheduler insert after move
Insert nodes after moving the second node to reduce the items in the
data structure for the insert operation.  This also avoids having two
nodes for the same processor inserted into the scheduled chain.

Update #4531.
2021-11-23 11:00:28 +01:00
Sebastian Huber 81659420b0 score: Add missing idle thread exchanges
Update #4531.
2021-11-23 11:00:28 +01:00
Sebastian Huber e787091764 score: Add missing idle thread releases
Update #4531.
2021-11-23 11:00:28 +01:00
Sebastian Huber bd55f69f5b score: Simplify _Scheduler_Exchange_idle_thread()
Remove superfluous idle parameter.

Update #4531.
2021-11-23 11:00:28 +01:00
Sebastian Huber f0f60a1ec3 score: Change _Scheduler_Try_to_schedule_node()
Add the victim node as parameter instead of the idle thread.

Update #4531.
2021-11-23 11:00:28 +01:00
Sebastian Huber 7ae4f56929 score: Not set CPU in _Scheduler_Use_idle_thread()
Do not set the CPU of the idle thread in _Scheduler_Use_idle_thread().  This
helps to use _Scheduler_Try_to_schedule_node() under more general conditions in
the future, for example in case the owner and user of a node are not the same.

Update #4531.
2021-11-23 11:00:28 +01:00
Sebastian Huber 45e942d1ae score: Rename _Scheduler_Set_idle_thread()
Rename _Scheduler_Set_idle_thread() in _Scheduler_Node_set_idle_user() and move
it to <rtems/score/schedulernodeimpl.h>.

Update #4531.
2021-11-23 11:00:28 +01:00
Sebastian Huber 577262a737 score: Add red-black tree append/prepend
These functions are a faster alternative to _RBTree_Insert_inline() if
it is known that the new node is the maximum/minimum node.

Update #4531.
2021-11-23 11:00:28 +01:00
Sebastian Huber 3c0760414e score: Simplify _Scheduler_Generic_block()
If we block the executing thread and it is not the heir thread, then there is
no need to run the schedule operation.  The scheduler already selected a new
heir.
2021-11-23 11:00:28 +01:00
Kinsey Moore 50cf19320d cpukit: Enable debug for SMP AArch64
Ensure when both RTEMS_DEBUG is specified and pointers are large that
enough space is allocated to accomodate the Per_CPU_Control structure.
This changes the calculation to be more compositional instead of trying
to list out every permutation of options possible.
2021-11-22 15:51:40 -06:00
Sebastian Huber 9b6362da71 rtems: Use RTEMS_WHO_AM_I for rtems_task_ident() 2021-11-18 19:59:14 +01:00
Sebastian Huber 99fdfcdd87 rtems: Add signal header to implementation group 2021-11-17 20:10:05 +01:00
Sebastian Huber c47daf6f68 config: Fix IO driver table initialization
Check all IO driver table configuration options which are used to initialize
_IO_Driver_address_table[].  Checks for the following settings were missing:

* CONFIGURE_BSP_PREREQUISITE_DRIVERS

* CONFIGURE_APPLICATION_PREREQUISITE_DRIVERS

* CONFIGURE_APPLICATION_NEEDS_WATCHDOG_DRIVER

* CONFIGURE_APPLICATION_EXTRA_DRIVERS

Update #3875.
2021-11-17 09:16:17 +01:00
Sebastian Huber 32cee88357 config: CONFIGURE_DISABLE_BSP_SETTINGS
Evaluate CONFIGURE_DISABLE_BSP_SETTINGS for each affected application
configuration option.  This makes the code easier to review since the influence
of CONFIGURE_DISABLE_BSP_SETTINGS is locally visible in the code.

Update #3875.
2021-11-17 09:16:17 +01:00
Sebastian Huber ccbcfb679d rtems: Add new clock manager directives
Update #4527.
2021-11-15 11:14:12 +01:00
Sebastian Huber ee57a7f1a1 score: Fix _CORE_ceiling_mutex_Set_priority()
We have to use a second thread queue context to acquire and release the
thread wait lock.

Close #4356.
2021-11-15 09:53:17 +01:00
Sebastian Huber 16b50ac63c score: Always check if a prio ceiling is defined
Priority ceiling semaphores (in contrast to MrsP semaphores) have only
one priority ceiling which is defined for the home scheduler of the task
which created the semaphore.  Always check during a semaphore seize that
the home scheduler of the calling task is equal to this scheduler.

This avoids a scheduler mismatch if the semphore is acquired after the
calling thread blocked on the semaphore.
2021-11-15 09:53:17 +01:00
Sebastian Huber 7a591d0cd4 score: Fix thread pinning assertions 2021-11-15 09:53:17 +01:00
Sebastian Huber ffb8833dd2 score: Add _Timecounter_Set_NTP_update_second()
Allow the installation of an NTP update second handler which may be used by an
NTP service.

Update #2348.
2021-11-15 08:56:54 +01:00
Sebastian Huber 240a1f79b1 score: Introduce CPU budget operations
This patch set replaces the CPU budget algorithm enumeration with a set of CPU
budget operations which implement a particular CPU budget algorithm.  This
helps to hide the CPU budget algorithm implementation details from the general
thread handling.  The CPU budget callouts are turned into CPU budget
operations.  This slightly reduces the size of the thread control block.

All schedulers used the default scheduler tick implementation.  The tick
scheduler operation is removed and the CPU budget operations are directly used
in _Watchdog_Tick() if the executing thread uses a CPU budget algorithm.  This
is performance improvement for all threads which do not use a CPU budget
algorithm (default behaviour).
2021-11-15 08:56:53 +01:00
Kinsey Moore 4812a8b572 cpukit: Add signal mapping support
This adds a confdef option allowing an application to request mapping
machine exceptions to POSIX signals. This is required for some languages
such as Ada.
2021-10-29 12:40:56 -05:00
Sebastian Huber 24922d0f54 rtems: rtems_rate_monotonic_get_status()
Mention that resetting the processor usage time of tasks has no impact
on the period status and statistics.

Remove no longer relevant RTEMS_NOT_DEFINED error status.

Update #4528.
2021-10-25 08:16:09 +02:00
Sebastian Huber f1723d1293 rtems: Regenerate for IDLE task allocator option
Update #4524.
2021-10-25 08:02:45 +02:00
Sebastian Huber 28632b558c score: Fix typo 2021-10-25 08:01:02 +02:00
Sebastian Huber 0221da5f56 rtems: Fix rate monotonic statistics
The rate monotonic period statistics were affected by
rtems_cpu_usage_reset().  The logic to detect and work around a CPU
usage reset was broken.

The Thread_Contol::cpu_time_used is changed to contain the processor
time used throughout the entire lifetime of the thread.  The new member
Thread_Contol::cpu_time_used_at_last_reset is added to contain the
processor time used at the time of the last reset through
rtems_cpu_usage_reset().  This decouples the resets of the CPU usage and
the rate monotonic period statistics.

Update #4528.
2021-10-25 08:01:02 +02:00
Sebastian Huber a4112bd8af score: Simplify _Watchdog_Next_first() 2021-10-25 08:01:02 +02:00
Joel Sherrill 822ebb4cae Add support for IDLE Thread stack allocator
Add a stack allocator hook specifically for allocation of IDLE thread stacks.
This allows the user to decide if IDLE thread stacks are statically allocated
or handled by the same custom allocator mechanism as other thread stacks.

Closes #4524.
2021-10-11 08:42:25 -05:00
Sebastian Huber 3bb97a30b1 score: Always check queue in _Thread_Wait_cancel()
Commit 18c8a270c2 removed
_Thread_queue_Do_nothing_extract() so we have to check for a non-NULL
queue in all configurations.
2021-10-06 10:41:14 +02:00
Sebastian Huber 226d0e9218 score: Optimize EDF SMP scheduler ops
The schedule operation is only called by rtems_task_mode().  It is
called if preempt mode of the executing thread changes from disabled to
enabled.  Since the EDF SMP scheduler does not support the disabled
preemption mode, the schedule operation is never called.
2021-10-06 08:37:50 +02:00
Sebastian Huber 344bb536a4 rtems: Generate <rtems/cpuuse.h>
Write the documentation from scratch.
2021-10-06 08:37:50 +02:00
Sebastian Huber e9063644ae posix: Remove "RTEMS" from POSIX API group
Clarify group description.

Update #3706.
2021-10-06 08:37:50 +02:00
Sebastian Huber 8b762a88c1 scoe: Move workspace group definition
Define the group in the header file which is used by <rtems/confdefs.h>.

Update #3706.
2021-10-06 08:37:50 +02:00
Sebastian Huber 5a6f94da45 rtems: Add ASR implementation to existing group
Update #3706.
2021-10-06 08:37:50 +02:00
Sebastian Huber a950c1355b score: Add Hash Handler to group
Update #3706.
2021-10-06 08:37:49 +02:00