summaryrefslogtreecommitdiffstats
path: root/cpukit/include/rtems/score/userextimpl.h (unfollow)
Commit message (Collapse)AuthorFilesLines
2022-09-19Do not use RTEMS_INLINE_ROUTINESebastian Huber1-2/+2
Directly use "static inline" which is available in C99 and later. This brings the RTEMS implementation closer to standard C. Close #3935.
2022-02-28cpukit/include/rtems/score/[s-z]*.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.
2020-12-02score: Canonicalize Doxygen @file commentsSebastian Huber1-1/+2
Use common phrases for the file brief descriptions. Update #3706.
2020-02-28score: Fix context switch extensions (SMP)Sebastian Huber1-0/+11
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-05-13doxygen: score: adjust doc in userextimpl.h to doxygen guidelinesAndreas Dachsberger1-4/+152
Update #3706.
2019-04-12score: Use an ISR lock for Per_CPU_Control::LockSebastian Huber1-14/+9
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-04doxygen: Rename Score* groups in RTEMSScore*Sebastian Huber1-2/+2
Update #3706
2019-04-02doxygen: Reviewed cpukit/include/rtems/scoreAndreas Dachsberger1-7/+3
Update #3706.
2019-02-08score: Fix _User_extensions_Thread_switch() (SMP)Sebastian Huber1-3/+11
We have to read the first node again once we obtained the lock since it may have aready changed.
2018-11-12score: Move internal structures to userextdata.hSebastian Huber1-1/+1
Update #3598.
2018-11-12score: Avoid include of <rtems/score/thread.h>Sebastian Huber1-1/+2
Update #3598.
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-01-26score: Fix user extensions orderSebastian Huber1-2/+2
Use forward and reverse order for initial and dynamic extensions. This is the behaviour documented in the C Users Guide. Change thread terminate order to backward to be in line with the thread delete order. Change fatal error order to forward to ensure that initial extensions are called first due the peculiar execution context of fatal error extensions, see _Terminate() documentation. Update #2692.
2016-12-09score: Remove fatal is internal indicatorSebastian Huber1-3/+1
The fatal is internal indicator is redundant since the fatal source and error code uniquely identify a fatal error. Keep the fatal user extension is internal parameter for backward compatibility and set it to false always. Update #2825.
2016-11-18score: Allow interrupts during thread dispatchSebastian Huber1-1/+12
Use a processor-specific interrupt frame during context switches in case the executing thread is longer executes on the processor and the heir thread is about to start execution. During this period we must not use a thread stack for interrupt processing. Update #2809.
2016-04-18score: Use chain iterator for user extensionsSebastian Huber1-12/+96
Add a lock and use a chain iterator for safe iteration during concurrent user extension addition and removal. Ensure that dynamically added thread delete and fatal extensions are called in reverse order. Update #2555. Update #2692.
2015-06-26score: Simplify <rtems/system.h>Sebastian Huber1-0/+1
Drop the <rtems/score/percpu.h> include since this file exposes a lot of implementation details.
2014-05-07score: Implement forced thread migrationSebastian Huber1-5/+13
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-03-31score: Thread life cycle re-implementationSebastian Huber1-0/+16
The thread deletion is now supported on SMP. This change fixes the following PRs: PR1814: SMP race condition between stack free and dispatch PR2035: psxcancel reveals NULL pointer access in _Thread_queue_Extract() The POSIX cleanup handler are now called in the right context (should be called in the context of the terminating thread). http://pubs.opengroup.org/onlinepubs/009695399/functions/xsh_chap02_09.html Add a user extension the reflects a thread termination event. This is used to reclaim the Newlib reentrancy structure (may use file operations), the POSIX cleanup handlers and the POSIX key destructors.
2014-03-21Change all references of rtems.com to rtems.org.Chris Johns1-1/+1
2013-07-22score: Create chain implementation headerSebastian Huber1-0/+1
Move implementation specific parts of chain.h and chain.inl into new header file chainimpl.h. The chain.h contains now only the application visible API.
2013-01-10cpukit: Use Consistent Beginning of Doxygen Group NotationJoel Sherrill1-6/+3
This is the result of a sed script which converts all uses of @{ into a consistent form.
2013-01-10cpukit: Add EOL on files missing EOL at EOFJoel Sherrill1-1/+1
2012-12-28score: Doxygen Clean Up Task #2Mathew Kallada1-2/+6
2012-11-29score misc: Score misc: Clean up Doxygen #6 (GCI 2012)Christopher Kerl1-1/+1
This patch is a task from GCI 2012 which improves the Doxygen comments in the RTEMS source. http://www.google-melange.com/gci/task/view/google/gci2012/7976215
2012-11-22score: Inline _User_extensions_Thread_switch()Sebastian Huber1-2/+16
The _User_extensions_Thread_switch() function is only used in _Thread_Dispatch().
2012-11-22score: Add and use <rtems/score/userextimpl.h>Sebastian Huber1-0/+235
This file contains the parts of <rtems/score/userext.h> that are only necessary for the RTEMS implementation.