summaryrefslogtreecommitdiffstats
path: root/cpukit/include/rtems/score/percpu.h (unfollow)
Commit message (Collapse)AuthorFilesLines
2023-05-20Update company nameSebastian Huber1-1/+1
The embedded brains GmbH & Co. KG is the legal successor of embedded brains GmbH.
2022-09-19Do not use RTEMS_INLINE_ROUTINESebastian Huber1-3/+3
Directly use "static inline" which is available in C99 and later. This brings the RTEMS implementation closer to standard C. Close #3935.
2022-08-19percpu.h: Add pragma for gcc 12 warningRyan Long1-0/+8
Updates #4662
2022-02-28cpukit/include/rtems/score/[a-r]*.h: Change license to BSD-2Joel Sherrill1-3/+22
Updates #3053.
2021-12-09Avoid ISR_LOCK_MEMBER() since it confuses DoxygenSebastian Huber1-1/+3
If RTEMS_SMP is not defined, then Doxygen adds the comments intended for conditional the lock member to the next member.
2021-11-22cpukit: Enable debug for SMP AArch64Kinsey Moore1-9/+22
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-07-29score: Add _Per_CPU_Submit_job()Sebastian Huber1-4/+16
2021-07-28score: Simplify SMP processor state handlingSebastian Huber1-26/+16
The per-CPU states which control the SMP system initialization were added quite early during the SMP support development. Replace this initial implementation with a simplified one. There is no longer a global SMP lock required which serialized the state changes of all processors. The new implementation better integrates with the per-CPU jobs.
2021-07-28score: Remove processor event broadcast/receiveSebastian Huber1-1/+34
Remove _CPU_SMP_Processor_event_broadcast() and _CPU_SMP_Processor_event_receive(). These functions are hard to use since they are subject to the lost wake up problem.
2021-06-08score: Remove unused _Per_CPU_Initialize() declSebastian Huber1-7/+0
2021-05-17score: Add and use _Per_CPU_Is_ISR_in_progress()Sebastian Huber1-0/+10
Add _Per_CPU_Is_ISR_in_progress() as an optimized version of _ISR_Is_in_progress().
2020-12-02score: Canonicalize Doxygen @file commentsSebastian Huber1-3/+5
Use common phrases for the file brief descriptions. Update #3706.
2020-12-02score: Canonicalize Doxygen groupsSebastian Huber1-6/+8
Adjust group identifier and names to be in line with a common pattern. Use common phrases for the group brief descriptions. Update #3706.
2020-11-26score: Change _Per_CPU_Information declarationSebastian Huber1-1/+1
Change the _Per_CPU_Information declaration so that Doxygen can parse it. This attribute placement is also in line with the _Alignas() specifier of C11.
2020-02-28score: Fix context switch extensions (SMP)Sebastian Huber1-0/+7
In uniprocessor and SMP configurations, the context switch extensions were called during _Thread_Do_dispatch(): void _Thread_Do_dispatch( Per_CPU_Control *cpu_self, ISR_Level level ) { Thread_Control *executing; executing = cpu_self->executing; ... do { Thread_Control *heir; heir = _Thread_Get_heir_and_make_it_executing( cpu_self ); ... _User_extensions_Thread_switch( executing, heir ); ... _Context_Switch( &executing->Registers, &heir->Registers ); ... } while ( cpu_self->dispatch_necessary ); ... } In uniprocessor configurations, this is fine and the context switch extensions are called for all thread switches except the very first thread switch to the initialization thread. However, in SMP configurations, the context switch may be invalidated and updated in the low-level _Context_Switch() routine. See: https://docs.rtems.org/branches/master/c-user/symmetric_multiprocessing_services.html#thread-dispatch-details In case such an update happens, a thread will execute on the processor which was not seen in the previous call of the context switch extensions. This can confuse for example event record consumers which use events generated by a context switch extension. Fixing this is not straight forward. The context switch extensions call must move after the low-level context switch. The problem here is that we may end up in _Thread_Handler(). Adding the context switch extensions call to _Thread_Handler() covers now also the thread switch to the initialization thread. We also have to save the last executing thread (ancestor) of the processor. Registers or the stack cannot be used for this purpose. We have to add it to the per-processor information. Existing extensions may be affected, since now context switch extensions use the stack of the heir thread. The stack checker is affected by this. Calling the thread switch extensions in the low-level context switch is difficult since at this point an intermediate stack is used which is only large enough to enable servicing of interrupts. Update #3885.
2019-12-10score: Optimize _Per_CPU_Get_index()Sebastian Huber1-0/+5
Optimize _Per_CPU_Get_index() in uniprocessor configurations.
2019-05-20score: Add _Per_CPU_Wait_for_job()Sebastian Huber1-0/+14
2019-05-20score: Add _Per_CPU_Add_job()Sebastian Huber1-1/+14
2019-05-20score: Move per-processor job data structuresSebastian Huber1-3/+56
This enables re-use for other purposes, e.g. replacement for SMP_MESSAGE_TEST.
2019-05-10score: Adjust PER_CPU_CONTROL_SIZE_APPROXSebastian Huber1-3/+6
Account for recent Per_CPU_Control structure member additions.
2019-04-12score: Remove _SMP_Before_multitasking_action()Sebastian Huber1-8/+0
Use _SMP_Multicast_action() instead.
2019-04-12score: Rework SMP multicast actionSebastian Huber1-0/+40
Use a FIFO list of jobs per processor to carry out the SMP multicast action. Use a done indicator per job to reduce the bus traffic a bit.
2019-04-12score: Use an ISR lock for Per_CPU_Control::LockSebastian Huber1-83/+78
The use of a hand crafted lock for Per_CPU_Control::Lock was necessary at some point in the SMP support development, but it is no longer justified.
2019-04-12score: Remove unused macrosSebastian Huber1-28/+0
2019-04-11score: Rename _SMP_Get_processor_count()Sebastian Huber1-2/+2
Rename _SMP_Get_processor_count() in _SMP_Get_processor_maximum() to be in line with the API level rtems_scheduler_get_processor_maximum(). Update #3732.
2019-04-04doxygen: Rename Score* groups in RTEMSScore*Sebastian Huber1-1/+1
Update #3706
2019-02-28Remove explicit file names from @fileSebastian Huber1-1/+1
This makes the @file documentation independent of the actual file name. Update #3707.
2019-01-29Add low level event recording supportSebastian Huber1-0/+4
Add low level event recording infrastructure for system and user defined events. The infrastructure is able to record high frequency events such as * SMP lock acquire/release, * interrupt entry/exit, * thread switches, * UMA zone allocate/free, and * Ethernet packet input/output, etc. It allows post-mortem analysis in fatal error handlers, e.g. the last events are in the record buffer, the newest event overwrites the oldest event. It is possible to detect record buffer overflows for consumers that expect a continuous stream of events, e.g. to display the system state in real-time. The implementation supports high-end SMP machines (more than 1GHz processor frequency, more than four processors). Add a new API instead. The implementation uses per-processor data structures and no atomic read-modify-write operations. It is uses per-processor ring buffers to record the events. The CPU counter is used to get the time of events. It is combined with periodic uptime events to synchronize it with CLOCK_REALTIME. The existing capture engine tries to solve this problem also, but its performance is not good enough for high-end production systems. The main issues are the variable-size buffers and the use of SMP locks for synchronization. To fix this, the API would change significantly. Update #3665.
2018-09-10score: Add flexible per-CPU dataSebastian Huber1-1/+8
Update #3507.
2018-06-29score: Increase PER_CPU_CONTROL_SIZE_APPROXSebastian Huber1-1/+1
Increase the PER_CPU_CONTROL_SIZE_APPROX on 64-bit targets. Update #3433.
2018-06-27Rework initialization and interrupt stack supportSebastian Huber1-35/+18
Statically initialize the interrupt stack area (_Configuration_Interrupt_stack_area_begin, _Configuration_Interrupt_stack_area_end, and _Configuration_Interrupt_stack_size) via <rtems/confdefs.h>. Place the interrupt stack area in a special section ".rtemsstack.interrupt". Let BSPs define the optimal placement of this section in their linker command files (e.g. in a fast on-chip memory). This change makes makes the CPU_HAS_SOFTWARE_INTERRUPT_STACK and CPU_HAS_HARDWARE_INTERRUPT_STACK CPU port defines superfluous, since the low level initialization code has all information available via global symbols. This change makes the CPU_ALLOCATE_INTERRUPT_STACK CPU port define superfluous, since the interrupt stacks are allocated by confdefs.h for all architectures. There is no need for BSP-specific linker command file magic (except the section placement), see previous ARM linker command file as a bad example. Remove _CPU_Install_interrupt_stack(). Initialize the hardware interrupt stack in _CPU_Initialize() if necessary (e.g. m68k_install_interrupt_stack()). The optional _CPU_Interrupt_stack_setup() is still useful to customize the registration of the interrupt stack area in the per-CPU information. The initialization stack can reuse the interrupt stack, since * interrupts are disabled during the sequential system initialization, and * the boot_card() function does not return. This stack resuse saves memory. Changes per architecture: arm: * Mostly replace the linker symbol based configuration of stacks with the standard <rtems/confdefs.h> configuration via CONFIGURE_INTERRUPT_STACK_SIZE. The size of the FIQ, ABT and UND mode stack is still defined via linker symbols. These modes are rarely used in applications and the default values provided by the BSP should be sufficient in most cases. * Remove the bsp_processor_count linker symbol hack used for the SMP support. This is possible since the interrupt stack area is now allocated by the linker and not allocated from the heap. This makes some configure.ac stuff obsolete. Remove the now superfluous BSP variants altcycv_devkit_smp and realview_pbx_a9_qemu_smp. bfin: * Remove unused magic linker command file allocation of initialization stack. Maybe a previous linker command file copy and paste problem? In the start.S the initialization stack is set to a hard coded value. lm32, m32c, mips, nios2, riscv, sh, v850: * Remove magic linker command file allocation of initialization stack. Reuse interrupt stack for initialization stack. m68k: * Remove magic linker command file allocation of initialization stack. Reuse interrupt stack for initialization stack. powerpc: * Remove magic linker command file allocation of initialization stack. Reuse interrupt stack for initialization stack. * Used dedicated memory region (REGION_RTEMSSTACK) for the interrupt stack on BSPs using the shared linkcmds.base (replacement for REGION_RWEXTRA). sparc: * Remove the hard coded initialization stack. Use the interrupt stack for the initialization stack on the boot processor. This saves 16KiB of RAM. Update #3459.
2018-02-02score: Introduce new monotonic clockSebastian Huber1-5/+13
Rename PER_CPU_WATCHDOG_MONOTONIC to PER_CPU_WATCHDOG_TICKS. Add new PER_CPU_WATCHDOG_MONOTONIC which is based on the system uptime (measured by timecounter). Close #3264.
2018-01-25Remove make preinstallChris Johns1-0/+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