summaryrefslogtreecommitdiffstats
path: root/cpukit/score/src (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* score: Make SMP only code explicitSebastian Huber2022-06-234-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.
* kern_tc.c: Provide a weak hardpps() implementationSebastian Huber2022-06-231-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.
* score: Use right clock for threadq timeoutsSebastian Huber2022-06-231-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.
* kern_tc.c: Update pps_event() for uniprocessor configurationsGabriel Moyano2022-06-101-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
* score: Fix pps_fetch()Sebastian Huber2022-05-271-1/+2
| | | | | | Return early only if there was a timeout, otherwise return the PPS info. Update #2349.
* score: Reformat for code coverageSebastian Huber2022-05-231-2/+18
| | | | Close #2349.
* timepps.h: PPS_SYNC defined by defaultGabriel Moyano2022-05-231-10/+0
| | | | Update #2349.
* kern_ntptime.c: Add define in order to remove warningGabriel Moyano2022-05-231-0/+3
| | | | Update #2349.
* kern_tc.c: Enable PPS API supportGabriel Moyano2022-05-231-4/+0
| | | | Update #2349.
* kern_tc.c: Add definitions required by PPS APIGabriel Moyano2022-05-231-0/+6
| | | | Update #2349.
* score: Rename tc_getfrequency()Gabriel Moyano2022-05-231-1/+1
| | | | | | Rename tc_getfrequency() to _Timecounter_Get_frequency(). Update #2349.
* kern_tc.c: Replace FreeBSD event mechanism by adding pointers to functionGabriel Moyano2022-05-231-0/+41
| | | | Update #2349.
* kern_tc.c: Add atomic dependencies required by the PPS APIGabriel Moyano2022-05-231-0/+7
| | | | Update #2349.
* kern_ntptime.c: Add lmax() qmin() definitionsGabriel Moyano2022-05-231-0/+2
| | | | Update #2349.
* kern_ntptime.c: Disable freebsd featuresGabriel Moyano2022-05-231-1/+3
| | | | Update #2349.
* score: Add SPDX License IdentifierSebastian Huber2022-05-184-4/+12
| | | | | | Remove URL in copyright notice. Update #3053.
* score: Fix SMP priority affinity scheduler yieldSebastian Huber2022-05-131-0/+1
|
* score: Add SMP priority affinity scheduler yieldTian Ye2022-05-121-0/+18
|
* score/src: Add file headers and licensesRyan Long2022-05-043-0/+81
| | | | | These files had no header, copyright, or license. Based on git history, added appropriate copyright and license.
* heap: Fix heap statistics with protection enabledSebastian Huber2022-04-281-0/+9
| | | | Close #4644.
* Remove duplicate SPDX lines accidentally addedJoel Sherrill2022-04-084-8/+0
|
* smp: Add fatal errorSebastian Huber2022-03-241-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.
* score: Add _IO_Relax()Sebastian Huber2022-03-241-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.
* cpukit/: Scripted embedded brains header file clean upJoel Sherrill2022-03-1044-264/+0
| | | | Updates #4625.
* SMP: Fix start multitasking for some targetsSebastian Huber2022-03-091-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.
* score: Disable thread dispatching earlierSebastian Huber2022-03-082-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().
* mpci: Fix RTEMS_DEBUG supportSebastian Huber2022-03-081-1/+1
|
* score/src/[t-z]*.c: Change license to BSD-2Joel Sherrill2022-02-2853-159/+1166
| | | | Updates #3053.
* score/src/[n-s]*.c: Change license to BSD-2Joel Sherrill2022-02-2896-288/+2120
| | | | Updates #3053.
* score/src/[a-m]*.c: Change license to BSD-2Joel Sherrill2022-02-2851-153/+1122
| | | | Updates #3053.
* score/src/schedulersimple*.c: Replace found in found in with found inJoel Sherrill2022-02-234-4/+4
| | | | Updates #3053.
* kern_ntptime.c: Port to RTEMSSebastian Huber2022-02-212-3/+141
| | | | | | Remove previous adjtime() implementation. Update #2348.
* kern_ntptime.c: Import from FreeBSDSebastian Huber2022-02-211-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.
* kern_tc: unify timecounter to bintime delta conversionAndriy Gapon2022-02-211-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
* timecounter: Initialize tc_lock earlierMark Johnston2022-02-211-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
* score: Optimize Workspace Handler initializationSebastian Huber2021-11-301-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.
* score: Split wkspace.cSebastian Huber2021-11-303-15/+98
| | | | Splitting the file avoids unnecessary link-time dependencies.
* wkspace.c: Change license to BSD-2-ClauseSebastian Huber2021-11-301-5/+24
| | | | | | Change licence according to file history. Update #3053.
* score: Properly continue the thread during restartSebastian Huber2021-11-231-3/+3
| | | | | | | | | | The _Thread_queue_Extract() does not deal with potential priority updates and the SMP locking protocol handling. Use _Thread_queue_Continue(). For the POSIX signals processing this is currently probably unnecessary, however, the use case is similar to the restart so use the same appoach. Close #4546.
* score: _Thread_queue_Surrender_no_priority()Sebastian Huber2021-11-231-15/+1
| | | | | | | Simplify _Thread_queue_Surrender_no_priority() and use _Thread_queue_Resume(). Update #4546.
* score: Move _Thread_queue_Extract()Sebastian Huber2021-11-232-34/+60
| | | | | | | Move _Thread_queue_Extract() since this function is not used by the core services (threads, semaphores, mutexes, message queues). Update #4546.
* score: Simplify thread wait state handlingSebastian Huber2021-11-233-12/+7
| | | | | | | | | | 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.
* score: Add _Thread_MP_Extract_proxy()Sebastian Huber2021-11-232-29/+25
| | | | | | | | Remove _Thread_queue_Extract_with_proxy() and move the proxy extraction to _Thread_MP_Extract_proxy(). Move similar code blocks of the previous caller of _Thread_queue_Extract_with_proxy() to helper functions. Update #4546.
* score: Remove thread timer earlierSebastian Huber2021-11-231-2/+2
| | | | | | | The earlier we remove the thread timer the less likely is a superfluous thread timeout processing. Update #4546.
* score: Restrict affinity for EDF SMP schedulerSebastian Huber2021-11-231-6/+27
| | | | | | | | | | | | | | | | | | The SMP EDF scheduler supports a one-to-one and one-to-all thread to processor affinity. It accepted affinity sets which are a proper subset of the online processor containing at least two processors owned by the scheduler. In this case it used a one-to-one thread to processor affinity. This leads to undefined behaviour if a processor is removed since the higher level check in rtems_scheduler_remove_processor() does not account for this implementation detail. Restrict the affinity set accepted by the SMP EDF scheduler to 1. all online processors, or 2. exactly one processor owned by the scheduler. Close #4545.
* score: Rework ask for help requestsSebastian Huber2021-11-232-19/+12
| | | | | | | | Process ask for help requests on the current processor. This avoids using inter-processor interrupts to make the system behaviour a bit more predictable. Update #4531.
* score: _Scheduler_SMP_Schedule_highest_ready()Sebastian Huber2021-11-235-20/+10
| | | | | | | | | Simplify callers of _Scheduler_SMP_Schedule_highest_ready(). Move the node state change and the extraction from scheduled into _Scheduler_SMP_Schedule_highest_ready(). Move the idle thread release to the caller which have more information about the presence of an idle thread. Update #4531.
* score: Remove victim thread from CPU allocationSebastian Huber2021-11-232-20/+12
| | | | Update #4531.
* score: Fix SMP EDF priority group orderingSebastian Huber2021-11-231-13/+61
| | | | | | | | | | | | | | | | | | | | | | | | The SMP EDF scheduler supports one-to-one and one-to-all thread to processor affinities. The one-to-one thread to processor affinity introduces a constraint on the ordering of threads. The implementation uses one ready queue for threads which have a one-to-all affinity and one for each one-to-one affinity group. To order threads across the ready queues, a generation number is used. However, the approach to update the generation number each time a thread is inserted into a ready queue was wrong. The generation number needs to be updated only in the enqueue and enqueue scheduled operations where an insert priority is available. The scheduled chain needs to take the generation number into account. An example scenario which shows the bug is this. Let T be a high priority task affine to processor X. Let A be a lower priority task affine to processor X. Let B be a lower priority task with no affinity to a particular processor which executes on processor Y. Let B be in the same priority group than A and after A. Let T set the affinity to all processors. Now A (higher priority relative to B) should execute on X and T (high priority) should execute on Y. Close #4534.
* score: Add node to insert to Chain_Node_orderSebastian Huber2021-11-232-4/+8
| | | | | | This allows to use additional members of the nodes for comparision. Update #4534.