summaryrefslogtreecommitdiffstats
path: root/cpukit/score/src (unfollow)
Commit message (Collapse)AuthorFilesLines
2022-09-12score: Prevent an out of bounds warningSebastian Huber1-2/+7
Update #4702.
2022-09-09score: Remove _CPU_Counter_difference()Sebastian Huber1-4/+1
All CPU ports used the same _CPU_Counter_difference() implementation. Remove this CPU port interface and mandate a monotonically increasing CPU counter. Close #3456.
2022-07-28score: Use PTHREAD_CANCELED for _Thread_Cancel()Sebastian Huber1-5/+5
The rtems_task_delete() directive is basically just a combined pthread_cancel() and pthread_join(). In addition, it removes the PTHREAD_DETACHED state. The exit value returned by pthread_join() of threads cancelled by rtems_task_delete() should reflect this by getting a PTHREAD_CANCELED value instead of NULL which could be a normal exit value. Close #4680.
2022-07-28score: Use priority inheritance for thread joinSebastian Huber2-68/+59
Threads may join the thread termination of another thread using the pthread_join() or rtems_task_delete() directives. The thread cancel operation used a special case priority boosting mechanism implemented by _Thread_Raise_real_priority(). The problem was that this approach * is not transitive, * does not account for priority adjustments of the calling task while waiting for the join, * does not support clustered scheduling, and * does not detect deadlocks. All these problems are fixed by using a priority inheritance thread queue for the join operation. Close #4679.
2022-07-26score: Remove PRIORITY_PSEUDO_ISR thread prioritySebastian Huber16-69/+43
The uniprocessor schedulers had some special case logic for the PRIORITY_PSEUDO_ISR priority. Tasks with a priority of PRIORITY_PSEUDO_ISR were allowed to preempt a not preemptible task. If other higher priority task are made ready while a PRIORITY_PSEUDO_ISR task preempts a not preemptible task, then the other tasks run before the not preemptible task. This made the RTEMS_NO_PREEMPT mode ineffective. Remove the PRIORITY_PSEUDO_ISR special case logic. This simplifies the uniprocessor schedulers. Move the uniprocessor-specific scheduler support to the new header file <rtems/score/scheduleruniimpl.h>. Close #2365.
2022-07-18score: Fix unlimited objects supportSebastian Huber1-5/+7
Commit 21275b58a5a69c3c838082ffc8a7a3641f32ea9a ("score: Static Objects_Information initialization") introduced an off-by-one error in the maintenance of inactive objects. Close #4677.
2022-07-18score: Fix _Objects_Active_count()Sebastian Huber1-5/+13
With unlimited objects the object maximum may be larger than the sum of active and inactive objects. Update #4677.
2022-07-15score: Extend memory dirty/zero actionsSebastian Huber3-2/+61
Dirty or zero also the part of the .noinit section used by RTEMS. Close #4678.
2022-07-07score: Use RTEMS_SMP in _Thread_Create_idle()Sebastian Huber1-1/+5
Conditional expressions with inline functions are not optimized away if optimization is disabled. Avoid such expressions to prevent dead branches.
2022-07-07score: Conditional _Thread_Priority_replace()Sebastian Huber1-0/+2
This function is only used in SMP configurations.
2022-07-04score: Add _CPU_Use_thread_local_storage()Sebastian Huber1-0/+5
At some point during system initialization, the idle threads are created. Afterwards, the boot processor basically executes within the context of an idle thread with thread dispatching disabled. On some architectures, the thread-local storage area of the associated thread must be set in dedicated processor registers. Add the new CPU port function to do this: void _CPU_Use_thread_local_storage( const Context_Control *context ) Close #4672.
2022-07-04gcov: Add functions to dump the gcov informationSebastian Huber3-0/+243
Update #4670.
2022-06-23score: Make SMP only code explicitSebastian Huber4-3/+31
Conditional expressions with inline functions are not optimized away if optimization is disabled. Avoid such expressions to prevent dead branches. It helps also during code review to immediately see if a loop is used or not.
2022-06-23kern_tc.c: Provide a weak hardpps() implementationSebastian Huber1-0/+12
The real implementation of hardpps() is defined in kern_ntptime.c. Use it only if the NTP support is needed by the application. Update #2349.
2022-06-23score: Use right clock for threadq timeoutsSebastian Huber1-2/+2
Use CLOCK_REALTIME and CLOCK_MONOTONIC for relative thread queue timeouts instead of CLOCK_REALTIME_COARSE and CLOCK_MONOTONIC_COARSE. This fixes an issue with clock_nanosleep() in combination with clock_gettime(). Close #4669.
2022-06-10kern_tc.c: Update pps_event() for uniprocessor configurationsGabriel Moyano1-0/+6
Since pps->capgen equal to zero is not a special value in uniprocessor configurations, there is no need to check for this condition. Update #2349
2022-05-27score: Fix pps_fetch()Sebastian Huber1-1/+2
Return early only if there was a timeout, otherwise return the PPS info. Update #2349.
2022-05-23score: Reformat for code coverageSebastian Huber1-2/+18
Close #2349.
2022-05-23timepps.h: PPS_SYNC defined by defaultGabriel Moyano1-10/+0
Update #2349.
2022-05-23kern_ntptime.c: Add define in order to remove warningGabriel Moyano1-0/+3
Update #2349.
2022-05-23kern_tc.c: Enable PPS API supportGabriel Moyano1-4/+0
Update #2349.
2022-05-23kern_tc.c: Add definitions required by PPS APIGabriel Moyano1-0/+6
Update #2349.
2022-05-23score: Rename tc_getfrequency()Gabriel Moyano1-1/+1
Rename tc_getfrequency() to _Timecounter_Get_frequency(). Update #2349.
2022-05-23kern_tc.c: Replace FreeBSD event mechanism by adding pointers to functionGabriel Moyano1-0/+41
Update #2349.
2022-05-23kern_tc.c: Add atomic dependencies required by the PPS APIGabriel Moyano1-0/+7
Update #2349.
2022-05-23kern_ntptime.c: Add lmax() qmin() definitionsGabriel Moyano1-0/+2
Update #2349.
2022-05-23kern_ntptime.c: Disable freebsd featuresGabriel Moyano1-1/+3
Update #2349.
2022-05-18score: Add SPDX License IdentifierSebastian Huber4-4/+12
Remove URL in copyright notice. Update #3053.
2022-05-13score: Fix SMP priority affinity scheduler yieldSebastian Huber1-0/+1
2022-05-12score: Add SMP priority affinity scheduler yieldTian Ye1-0/+18
2022-05-04score/src: Add file headers and licensesRyan Long3-0/+81
These files had no header, copyright, or license. Based on git history, added appropriate copyright and license.
2022-04-28heap: Fix heap statistics with protection enabledSebastian Huber1-0/+9
Close #4644.
2022-04-08Remove duplicate SPDX lines accidentally addedJoel Sherrill4-8/+0
2022-03-24smp: Add fatal errorSebastian Huber1-0/+5
Add SMP-specifc SMP_FATAL_MULTITASKING_START_ON_NOT_ONLINE_PROCESSOR fatal error. This fatal error helps to diagnose a broken SMP startup sequence. Without this error a context switch using the NULL pointer for the thread control block happens which may be difficult to debug.
2022-03-24score: Add _IO_Relax()Sebastian Huber1-0/+53
This function may be used to burn a couple of processor cycles with minimum impact on the system bus. It may be used in busy wait loops. Since it is a global function, it is possible to wrap it in device driver test code.
2022-03-10cpukit/: Scripted embedded brains header file clean upJoel Sherrill44-264/+0
Updates #4625.
2022-03-09SMP: Fix start multitasking for some targetsSebastian Huber1-0/+3
The previous SMP multitasking start assumed that the initial heir thread of a processor starts execution in _Thread_Handler(). The _Thread_Handler() sets the interrupt state explicitly by _ISR_Set_level() before it calls the thread entry. Under certain timing conditions, processors may perform an initial context switch to a thread which already executes its thread body (see smptests/smpstart01). In this case, interrupts are disabled after the context switch on targets which do not save/restore the interrupt state during a context switch (aarch64, arm, and riscv). Close #4627.
2022-03-08score: Disable thread dispatching earlierSebastian Huber2-6/+6
Disable thread dispatching earlier on secondary processors. This ensures that fatal error and per-CPU job handlers are called with thread dispatching disabled. On the boot processor, the thread dispatching is already disabled by _Thread_Dispatch_initialization().
2022-03-08mpci: Fix RTEMS_DEBUG supportSebastian Huber1-1/+1
2022-02-28score/src/[t-z]*.c: Change license to BSD-2Joel Sherrill53-159/+1166
Updates #3053.
2022-02-28score/src/[n-s]*.c: Change license to BSD-2Joel Sherrill96-288/+2120
Updates #3053.
2022-02-28score/src/[a-m]*.c: Change license to BSD-2Joel Sherrill51-153/+1122
Updates #3053.
2022-02-23score/src/schedulersimple*.c: Replace found in found in with found inJoel Sherrill4-4/+4
Updates #3053.
2022-02-21kern_ntptime.c: Port to RTEMSSebastian Huber2-3/+141
Remove previous adjtime() implementation. Update #2348.
2022-02-21kern_ntptime.c: Import from FreeBSDSebastian Huber1-0/+1053
The file was imported from this repository: https://github.com/freebsd/freebsd.git This commit was used: commit 3ec0dc367bff27c345ad83240625b2057af391b9 Author: Sebastian Huber <sebastian.huber@embedded-brains.de> Date: Mon Feb 7 14:16:16 2022 -0700 kern_ntptime.c: Remove ntp_init() The ntp_init() function did set a couple of global objects to zero. These objects are in the .bss section and already initialized to zero during kernel or module loading. Update #2348.
2022-02-21kern_tc: unify timecounter to bintime delta conversionAndriy Gapon1-21/+21
There are two places where we convert from a timecounter delta to a bintime delta: tc_windup and bintime_off. Both functions use the same calculations when the timecounter delta is small. But for a large delta (greater than approximately an equivalent of 1 second) the calculations were different. Both functions use approximate calculations based on th_scale that avoid division. Both produce values slightly greater than a true value, calculated with division by tc_frequency, would be. tc_windup is slightly more accurate, so its result is closer to the true value and, thus, smaller than bintime_off result. As a consequence there can be a jump back in time when time hands are switched after a long period of time (a large delta). Just before the switch the time would be calculated with a large delta from th_offset_count in bintime_off. tc_windup does the switch using its own calculations of a new th_offset using the large delta. As explained earlier, the new th_offset may end up being less than the previously produced binuptime. So, for a period of time new binuptime values may be "back in time" comparing to values just before the switch. Such a jump must never happen. All the code assumes that the uptime is monotonically nondecreasing and some code works incorrectly when that assumption is broken. For example, we have observed sleepq_timeout() ignoring a timeout when the sbinuptime value obtained by the callout code was greater than the expiration value, but the sbinuptime obtained in sleepq_timeout() was less than it. In that case the target thread would never get woken up. The unified calculations should ensure the monotonic property of the uptime. The problem is quite rare as normally tc_windup should be called HZ times per second (typically 1000 or 100). But it may happen in VMs on very busy hypervisors where a VM's virtual CPU may not get an execution time slot for a second or more. Reviewed by: kib MFC after: 2 weeks Sponsored by: Panzura LLC
2022-02-21timecounter: Initialize tc_lock earlierMark Johnston1-1/+2
Hyper-V wants to register its MSR-based timecounter during SI_SUB_HYPERVISOR, before SI_SUB_LOCK, since an emulated 8254 may not be available for DELAY(). So we cannot use MTX_SYSINIT to initialize the timecounter lock. PR: 259878 Reviewed by: kib MFC after: 3 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D33014
2021-11-30score: Optimize Workspace Handler initializationSebastian Huber1-81/+4
The BSPs provide memory for the workspace initialization via _Memory_Get(). Most BSPs provide exactly one memory area. Only two BSPs provide more than one memory area (arm/altera-cyclone-v and bsps/powerpc/mpc55xxevb). Only if more than one memory area is provided, there is a need to use _Heap_Extend(). Provide two implementations to initialize the workspace handler and let the BSP select one of the implementations based on the number of provided memory areas. This gets rid of a dependency on _Heap_Extend(). It also avoids dead code sections for most BSPs.
2021-11-30score: Split wkspace.cSebastian Huber3-15/+98
Splitting the file avoids unnecessary link-time dependencies.
2021-11-30wkspace.c: Change license to BSD-2-ClauseSebastian Huber1-5/+24
Change licence according to file history. Update #3053.