Commit Graph

162 Commits

Author SHA1 Message Date
Joel Sherrill
2a1449c517 score/src/[t-z]*.c: Change license to BSD-2
Updates #3053.
2022-02-28 10:28:04 -06:00
Sebastian Huber
e429e9742a score: Simplify thread wait state handling
Remove the THREAD_WAIT_STATE_READY_AGAIN and simply use the initial value to
indicate that a thread does not wait on something.  Rename
THREAD_WAIT_FLAGS_INITIAL to THREAD_WAIT_STATE_READY.  This change is necessary
so that _Thread_Continue() can be called for threads which never waited on
something (for example dormant threads).

Update #4546.
2021-11-23 11:00:28 +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
Sebastian Huber
3fe07115a0 score: Improve variable names in thread init 2021-09-22 18:31:46 +02:00
Sebastian Huber
c2f2404840 score: Simplify _Thread_Try_initialize()
Move a code block to its own new function
_Thread_Initialize_scheduler_and_wait_nodes().  Add comments.
2021-09-22 18:31:46 +02:00
Sebastian Huber
e0aba8cb9e score: Fix task stack initialization
Do not adjust the stack area begin address since this may confuse the
stack allocator and result in failed stack frees.

Account for the alignment overhead in the stack space size estimate.

Check that the stack size is in the expected interval.
2021-03-27 18:05:05 +01:00
Sebastian Huber
c9a41b0043 score: Add Thread_Configuration::cpu_time_budget
Move the CPU time budget to the thread configuration.  This simplifies
_Thread_Initialize().
2021-03-16 12:48:37 +01:00
Sebastian Huber
524839568d score: Ensure stack alignment requirement
Make sure that a user-provided stack size is the minimum size allocated
for the stack.

Make sure we meet the stack alignment requirement also for CPU ports
with CPU_STACK_ALIGNMENT > CPU_HEAP_ALIGNMENT.
2021-03-05 06:58:33 +01:00
Sebastian Huber
1ac4a85ebf score: Fix thread initialization
Close the thread object if a thread create extension fails.  Also call
the delete extension to avoid resource leaks in early extensions if a
late extension fails.

Close #4270.
2021-02-26 09:23:02 +01:00
Sebastian Huber
0b263b0eb7 score: Remove _Objects_Open()
Use the type safe _Objects_Open_u32() instead.  Return the object
identifier to enforce a common usage pattern.
2021-02-24 09:22:36 +01:00
Sebastian Huber
9278f3d04f score: Canonicalize Doxygen @file comments
Use common phrases for the file brief descriptions.

Update #3706.
2020-12-02 07:45:53 +01:00
Sebastian Huber
dd734d467d score: Fix _Thread_Initialize()
Fix an error cleanup path in SMP configurations to avoid a NULL pointer access.

Update #3959.
2020-09-11 15:47:02 +02:00
Sebastian Huber
aedd92d147 score: Add stack free handler to TCB
This avoids a dependency to the stack free function in the thread
destruction.

Update #3959.
2020-08-31 17:30:17 +02:00
Sebastian Huber
159db41166 score: Use _Freechain_Push()
The nodes are never NULL.

Update #3959.
2020-08-31 17:30:17 +02:00
Sebastian Huber
354c2b50a3 score: Add <rtems/score/freechainimpl.h>
Hide implementation details.

Update #3959.
2020-08-31 17:30:17 +02:00
Sebastian Huber
80cf60efec Canonicalize config.h include
Use the following variant which was already used by most source files:

  #ifdef HAVE_CONFIG_H
  #include "config.h"
  #endif
2020-04-16 07:30:00 +02:00
Sebastian Huber
01c97e643a score: Fix label defined but not used warning
Update #3835.
2020-02-25 14:50:43 +01:00
Sebastian Huber
e50e42b820 score: _Scheduler_Is_non_preempt_mode_supported()
If the non-preempt mode for threads is supported depends on the
scheduler implementation.  Add
_Scheduler_Is_non_preempt_mode_supported() to indicate this.

Update #3876.
2020-02-25 07:18:35 +01:00
Sebastian Huber
1ada3e55f6 score: Add _SMP_Need_inter_processor_interrupts()
Test for the proper system condition instead of using the
rtems_configuration_is_smp_enabled() workaround.

Update #3876.
2020-02-25 07:18:35 +01:00
Sebastian Huber
d252e20ab5 score: Simplify _Thread_Initialize()
Allocate new thread queue heads during objects information extend.  This
removes an error case and the last dependency on the workspace in
_Thread_Initialize().

Update #3835.
2020-02-12 09:08:41 +01:00
Sebastian Huber
01d59443b0 score: Move thread stack allocation
Move thread stack allocation to caller side of _Thread_Initialize().

Update #3835.
2020-02-12 09:08:36 +01:00
Sebastian Huber
4c9deb6c10 score: Add _Stack_Extend_size()
Update #3835.
2020-02-12 09:08:36 +01:00
Sebastian Huber
a08dcb2f7c score: Add Thread_Configuration
Add the Thread_Configuration structure to reduce the parameter count of
_Thread_Initialize().  This makes it easier to add more parameters in
the future.  It simplifies the code generation since most architectures
do not have that many registers available for function parameters.

Update #3835.
2020-02-12 09:08:36 +01:00
Sebastian Huber
f4dbf37dd4 score: Simplify TLS area allocation
Use the stack area to allocate the TLS area.

Update #3835.
2020-02-12 09:08:36 +01:00
Sebastian Huber
fc398fde77 score: Simplify FP context allocation
Use the stack area to allocate the FP context.  This considerably
simplifies the application configuration since the task count no longer
influences the configured work space size.  With this change the stack
space size is overestimated since an FP context for each thread is
accounted.  Memory constraint applications can use the stack size for
fine tuning.

Update #3835.
2020-02-12 09:08:36 +01:00
Sebastian Huber
0bde56b1b4 score: Simplify thread stack free
Update #3835.
2020-02-12 09:08:36 +01:00
Sebastian Huber
a0211fc9f9 score: Simplify thread stack allocation
Remove superfluous Thread_Control::Start::stack member.

Update #3835.
2020-02-12 09:08:35 +01:00
Sebastian Huber
4c20da4be4 doxygen: Rename Score* groups in RTEMSScore*
Update #3706
2019-04-04 09:18:55 +02:00
Sebastian Huber
3bd3999936 Adjust interrupt mode tests for some CPU ports
In case the robust thread dispatch is enabled by the CPU port, then the
interrupt level must not be changed through the task mode.

Update #3000.
2019-01-09 10:35:33 +01:00
Sebastian Huber
38cb59ee0b Separate task mode checks
Update #3000.
2019-01-09 10:35:24 +01:00
Sebastian Huber
21275b58a5 score: Static Objects_Information initialization
Statically allocate the objects information together with the initial
set of objects either via <rtems/confdefs.h>.  Provide default object
informations with zero objects via librtemscpu.a.  This greatly
simplifies the workspace size estimate.  RTEMS applications which do not
use the unlimited objects option are easier to debug since all objects
reside now in statically allocated objects of the right types.

Close #3621.
2018-12-14 07:03:29 +01:00
Sebastian Huber
0da9d805cd score: Rename Objects_Information::size
Rename Objects_Information::size to Objects_Information::object_size.
Change its type from size_t to uint16_t and move it to reduce the size
of Objects_Information.

Update #3621.
2018-12-07 14:22:01 +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
b2dbb634ec score: Remove CPU_set_Control
Use Processor_mask instead.

Update #2514.
2017-10-11 07:37:58 +02:00
Sebastian Huber
76d119857f score: Introduce _SMP_Get_online_processors()
Update #3059.
2017-07-07 07:55:03 +02:00
Sebastian Huber
78515554fd score: Move processor affinity to Thread_Control
Update #3059.
2017-07-07 07:28:29 +02:00
Sebastian Huber
7a462cc60d score: Fix warning 2017-02-15 11:09:32 +01:00
Sebastian Huber
e366f774a7 score: Add _Thread_queue_Object_name
Add the special thread queue name _Thread_queue_Object_name to mark
thread queues embedded in an object with identifier.  Using the special
thread state STATES_THREAD_QUEUE_WITH_IDENTIFIER is not reliable for
this purpose since the thread wait information and thread state are
protected by different SMP locks in separate critical sections.  Remove
STATES_THREAD_QUEUE_WITH_IDENTIFIER.

Add and use _Thread_queue_Object_initialize().

Update #2858.
2017-01-31 09:38:07 +01:00
Sebastian Huber
70488f5655 score: Fix _Thread_Initialize() 2017-01-31 09:38:07 +01:00
Sebastian Huber
27bfcd88f7 score: Delete _CPU_Context_Fp_start()
Since the FP area pointer is passed by reference in
_CPU_Context_Initialize_fp() the optional FP area adjustment via
_CPU_Context_Fp_start() is superfluous.  It is also wrong with respect
to memory management, e.g. pointer passed to _Workspace_Free() may be
not the one returned by _Workspace_Allocate().

Close #1400.
2017-01-26 07:31:09 +01:00
Sebastian Huber
537f00ebe8 score: Restrict task interrupt level to 0 on SMP
Update #2811.
2016-11-18 07:30:35 +01:00
Sebastian Huber
05ca53ddf6 rtems: Add scheduler processor add/remove
Update #2797.
2016-11-10 09:22:09 +01:00
Sebastian Huber
2dd098a635 score: Introduce Thread_Scheduler_control::home
Replace Thread_Scheduler_control::control and
Thread_Scheduler_control::own_control with new
Thread_Scheduler_control::home.

Update #2556.
2016-11-02 10:05:45 +01:00
Sebastian Huber
7f7424329e score: Delete Thread_Scheduler_control::own_node
Update #2556.
2016-11-02 10:05:45 +01:00
Sebastian Huber
c0f1f52763 score: Delete Thread_Scheduler_control::node
Update #2556.
2016-11-02 10:05:45 +01:00
Sebastian Huber
97f7dac660 score: Delete _Scheduler_Ask_for_help_if_necessary
Delete Thread_Control::Resource_node.

Update #2556.
2016-11-02 10:05:44 +01:00
Sebastian Huber
ebdd2a3431 score: Add scheduler node requests
Add the ability to add/remove scheduler nodes to/from the set of
scheduler nodes available to the schedulers for a particular thread.

Update #2556.
2016-11-02 10:05:42 +01:00
Sebastian Huber
07a32d1932 score: Add thread scheduler lock
Update #2556.
2016-11-02 10:05:42 +01:00
Sebastian Huber
4e02681b2f score: Simplify ISR lock name 2016-09-27 07:39:22 +02:00
Sebastian Huber
266d3835d8 score: Manage scheduler nodes via thread queues
Update #2556.
2016-09-21 08:59:32 +02:00