summaryrefslogtreecommitdiffstats
path: root/cpukit/score/include/rtems/score/percpu.h (unfollow)
Commit message (Collapse)AuthorFilesLines
2018-01-25Remove make preinstallChris Johns1-851/+0
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.
2017-10-17score: Rename watchdog variantsSebastian Huber1-9/+13
Rename PER_CPU_WATCHDOG_RELATIVE in PER_CPU_WATCHDOG_MONOTONIC to highlight the corresponding POSIX CLOCK_MONOTONIC. Rename PER_CPU_WATCHDOG_ABSOLUTE in PER_CPU_WATCHDOG_REALTIME to highlight the corresponding POSIX CLOCK_REALTIME. Update #3117. Update #3182.
2017-09-27score: Rename to _Scheduler_ControlSebastian Huber1-1/+1
Rename struct Scheduler_Control to _Scheduler_Control to allow its use in standard header files, e.g. <pthread.h>. Update #3112.
2016-11-23score: Force Per_CPU_Control::executing alignmentSebastian Huber1-0/+7
This fixes the CPU ports with relaxed alignment restrictions, e.g. type alignment is less than the type size. Close #2822. Close #2823.
2016-11-21score: Group Per_CPU_Control members by alignmentSebastian Huber1-19/+19
Close #2820.
2016-11-18score: Add Per_CPU_Control::Interrupt_frameSebastian Huber1-3/+25
Update #2809.
2016-11-18score: Add Per_CPU_Control::isr_dispatch_disableSebastian Huber1-1/+13
Update #2751.
2016-11-10rtems: Add scheduler processor add/removeSebastian Huber1-0/+6
Update #2797.
2016-11-09score: Add scheduler to per-CPU informationSebastian Huber1-4/+17
This makes it possible to adjust the scheduler of a processor at run-time. Update #2797.
2016-11-07score: Add optional _CPU_Get_thread_executing()Sebastian Huber1-5/+13
2016-11-07score: Prevent assignment to _Thread_ExecutingSebastian Huber1-1/+1
2016-11-02score: Add new SMP scheduler helping protocolSebastian Huber1-0/+8
Update #2556.
2016-09-23score: Fix C/C++ compatibility issueSebastian Huber1-4/+6
Only use CPU_Per_CPU_control if it contains at least one filed. In GNU C empty structures have a size of zero. In C++ structures have a non-zero size. In case CPU_PER_CPU_CONTROL_SIZE is defined to zero, then this structure is not used anymore.
2016-06-29score: Fix SMP message handlingSebastian Huber1-5/+0
According to the C11 standard only atomic read-modify-write operations guarantee that the last value written in modification order is read, see "7.17.3 Order and consistency". Thus we must use a read-modify-write in _SMP_Inter_processor_interrupt_handler() to make sure we read an up-to-date message.
2016-05-20score: Remove the Giant lockSebastian Huber1-6/+0
Update #2555.
2016-05-20score: Rename _ISR_Disable() and _ISR_Enable()Sebastian Huber1-4/+4
Rename _ISR_Disable() into _ISR_Local_disable(). Rename _ISR_Enable() into _ISR_Local_enable(). Remove _Debug_Is_owner_of_giant(). This is a preparation to remove the Giant lock. Update #2555.
2016-05-20score: Rename _ISR_Disable_without_giant()Sebastian Huber1-6/+6
Rename _ISR_Disable_without_giant() into _ISR_Local_disable(). Rename _ISR_Enable_without_giant() into _ISR_Local_enable(). This is a preparation to remove the Giant lock. Update #2555.
2016-05-12score: Add _ISR_lock_Is_owner()Sebastian Huber1-0/+2
2016-03-22score: Fix for RTEMS_DEBUGSebastian Huber1-2/+2
The rtems_extension_create() no longer uses the Giant lock. Ensure that we call _User_extensions_Add_set() only in the right context. Update #2555.
2016-03-17score: Fix CPU time used by executing threadsSebastian Huber1-4/+11
The CPU time used of a thread was previously maintained per-processor mostly during _Thread_Dispatch(). However, on SMP configurations the actual processor of a thread is difficult to figure out since thread dispatching is a highly asynchronous process (e.g. via inter-processor interrupts). Only the intended processor of a thread is known to the scheduler easily. Do the CPU usage accounting during thread heir updates in the context of the scheduler operations. Provide the function _Thread_Get_CPU_time_used() to get the CPU usage of a thread using proper locks to get a consistent value. Close #2627.
2016-03-04score: Replace watchdog handler implementationSebastian Huber1-2/+51
Use a red-black tree instead of delta chains. Close #2344. Update #2554. Update #2555. Close #2606.
2016-03-04score: Add _SMP_Before_multitasking_action()Sebastian Huber1-0/+8
The use case for this is the Cortex-A9 MPCore which has per-processor registers (only accessible by a particular processor) for the global timer used by the clock driver. This might be useful for other drivers as well. Update #2554.
2016-03-04score: Add _Per_CPU_Is_boot_processor()Sebastian Huber1-0/+19
2016-03-04score: Rename Per_CPU_Control::startedSebastian Huber1-3/+3
Rename Per_CPU_Control::started into Per_CPU_Control::online to match standard nomenclature.
2016-02-03Optional POSIX Cleanup initializationSebastian Huber1-0/+7
Update #2408.
2015-09-28SMP: Fix and optimize thread dispatchingSebastian Huber1-9/+10
According to the C11 and C++11 memory models only a read-modify-write operation guarantees that we read the last value written in modification order. Avoid the sequential consistent thread fence and instead use the inter-processor interrupt to set the thread dispatch necessary indicator.
2015-07-30score: Rename struct Thread_ControlSebastian Huber1-5/+5
Add a leading underscore to the structure name to allow forward declarations in standard header files provided by Newlib and GCC.
2015-07-01score: Simplify _SMP_ticket_lock_Release()Sebastian Huber1-1/+0
Add a SMP lock statistics pointer to SMP_lock_Stats_context and drop the SMP lock statistics parameter from _SMP_ticket_lock_Release().
2015-06-26score: Hide SMP lock profiling impl if disabledSebastian Huber1-4/+13
The problem is that empty structures have a different size in C and C++.
2015-06-25score: Simplify <rtems/score/thread.h>Sebastian Huber1-6/+31
Avoid Thread_Control typedef in <rtems/score/percpu.h>. This helps to get rid of the <rtems/score/percpu.h> include in <rtems/score/thread.h> which exposes a lot of implementation details.
2015-06-25score: Move SMP CPU_USE_DEFERRED_FP_SWITCH checkSebastian Huber1-4/+0
2014-07-01score: Add PER_CPU_OFFSET_EXECUTINGSebastian Huber1-17/+21
Add PER_CPU_OFFSET_HEIR. Move Per_CPU_Control::executing and Per_CPU_Control::heir for easy offset calculation.
2014-06-05score: _Per_CPU_State_wait_for_non_initial_state()Sebastian Huber1-24/+15
Replace _Per_CPU_State_wait_for_ready_to_start_multitasking() with _Per_CPU_State_wait_for_non_initial_state(). Implement this function.
2014-05-07score: Implement forced thread migrationSebastian Huber1-5/+46
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-05score: Use atomic operations for SMP messagesSebastian Huber1-3/+4
2014-04-30score: TypoSebastian Huber1-1/+1
2014-04-28score: Add _CPU_Get_current_per_CPU_control()Sebastian Huber1-3/+7
Add optional method _CPU_Get_current_per_CPU_control() to obtain the per-CPU control of the current processor. This is optional. Not every CPU port needs this. It is only an optional optimization variant. In case this macro is undefined, the default implementation using the current processor index will be used.
2014-04-22score: Use common names for per-CPU variablesSebastian Huber1-29/+29
Use "cpu" for an arbitrary Per_CPU_Control variable. Use "cpu_self" for the Per_CPU_Control of the current processor. Use "cpu_index" for an arbitrary processor index. Use "cpu_index_self" for the processor index of the current processor. Use "cpu_count" for the processor count obtained via _SMP_Get_processor_count(). Use "cpu_max" for the processor maximum obtained by rtems_configuration_get_maximum_processors().
2014-04-15score: Add clustered/partitioned schedulingSebastian Huber1-0/+19
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-14score: Add _Per_CPU_Get_snapshot()Sebastian Huber1-3/+12
2014-03-31score: Add per-CPU state functionSebastian Huber1-0/+39
Add _Per_CPU_State_wait_for_ready_to_start_multitasking(). Add new fatal SMP error SMP_FATAL_SHUTDOWN_EARLY.
2014-03-21Change all references of rtems.com to rtems.org.Chris Johns1-1/+1
2014-03-14score: Add SMP lock profiling supportSebastian Huber1-3/+18
2014-03-14score: Add per-CPU profilingSebastian Huber1-0/+74
Add per-CPU profiling stats API. Implement the thread dispatch disable level profiling. The interrupt profiling must be implemented in CPU port specific parts (mostly assembler code). Add a support function _Profiling_Outer_most_interrupt_entry_and_exit() for this purpose.
2014-03-11score: Add local context to SMP lock APISebastian Huber1-16/+62
Add a local context structure to the SMP lock API for acquire and release pairs. This context can be used to store the ISR level and profiling information. It may be later used to enable more sophisticated lock algorithms, e.g. MCS locks. There is only one lock that cannot be used with a local context. This is the per-CPU lock since here we would have to transfer the local context through a context switch which is very complicated.
2014-03-06score: Fix per-CPU state documentationSebastian Huber1-3/+3
2014-03-06score: SMP initialization and shutdown changesSebastian Huber1-34/+48
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-02-19score: Add and use <rtems/score/smpimpl.h>Sebastian Huber1-7/+0
Collect SMP implementation specific parts in the <rtems/score/smpimpl.h> header file.
2013-08-09score: Per-CPU thread dispatch disable levelSebastian Huber1-3/+20
Use a per-CPU thread dispatch disable level. So instead of one global thread dispatch disable level we have now one instance per processor. This is a major performance improvement for SMP. On non-SMP configurations this may simplifiy the interrupt entry/exit code. The giant lock is still present, but it is now decoupled from the thread dispatching in _Thread_Dispatch(), _Thread_Handler(), _Thread_Restart_self() and the interrupt entry/exit. Access to the giant lock is now available via _Giant_Acquire() and _Giant_Release(). The giant lock is still implicitly acquired via _Thread_Dispatch_decrement_disable_level(). The giant lock is only acquired for high-level operations in interrupt handlers (e.g. release of a semaphore, sending of an event). As a side-effect this change fixes the lost thread dispatch necessary indication bug in _Thread_Dispatch(). A per-CPU thread dispatch disable level greatly simplifies the SMP support for the interrupt entry/exit code since no spin locks have to be acquired in this area. It is only necessary to get the current processor index and use this to calculate the address of the own per-CPU control. This reduces the interrupt latency considerably. All elements for the interrupt entry/exit code are now part of the Per_CPU_Control structure: thread dispatch disable level, ISR nest level and thread dispatch necessary. Nothing else is required (except CPU port specific stuff like on SPARC).
2013-08-09score: Add and use _Per_CPU_Acquire_all().Sebastian Huber1-0/+30
Add and use _Per_CPU_Release_all(). The context switch user extensions are invoked in _Thread_Dispatch(). This change is necessary to avoid the giant lock in _Thread_Dispatch().