summaryrefslogtreecommitdiffstats
path: root/cpukit/score (follow)
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* arm: Add AARCH32_PMSA_DATA_READ_WRITE_DEFAULTSebastian Huber2021-11-301-8/+28
| | | | | | | Add default memory attributes for read-write data. The actual attributes depend on the RTEMS_SMP build option. Update #4202.
* arm: Fix AARCH32_PMSA_DATA_READ_WRITE_CACHEDSebastian Huber2021-11-301-1/+1
| | | | | | | Fix definition of AARCH32_PMSA_DATA_READ_WRITE_CACHED. Since AARCH32_PMSA_ATTR_AP_EL1_RW_EL0_NO is zero, this fix is only cosmetic. Update #4202.
* sparc: Add workaround for GRLIB-TN-0011Sebastian Huber2021-11-261-0/+12
| | | | | | | | | | Affected components are the GR712RC, UT699, UT699E, UT700, and LEON3FT-RTAX. Strictly, the workaround is only necessary if the MMU is enabled. Use __FIX_LEON3FT_B2BST to enable the workaround. This is not 100% appropriate, but the best thing we can use to enable the workaround. Close #4551.
* 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.
* score: Rework idle handling in SMP schedulersSebastian Huber2021-11-235-48/+259
| | | | | | | | | | | | | | | | | | This patch fixes an issue with the idle thread handling in the SMP scheduler framework used for the MrsP locking protocol. The approach to use a simple chain of unused idle threads is broken for schedulers which support thread to processor affinity. The reason is that the thread to processor affinity introduces another ordering indicator which may under certain conditions lead to a reordering of idle threads in the scheduled chain. This reordering is not propagated to the chain of unused idle threads. This could lead to use an idle thread for a sticky scheduler node which is already in use. This locks up the system in infinite loops in the thread context switch procedure. To fix this, the SMP scheduler implementations must now provide callbacks to get and release an unused idle thread. Update #4531.
* score: Add SMP scheduler make/clean stickySebastian Huber2021-11-238-14/+362
| | | | | | | | | | | | | | | | | | | | This patch fixes the following broken behaviour: While a thread is scheduled on a helping scheduler, while it does not own a MrsP semaphore, if it obtains a MrsP semaphore, then no scheduler node using an idle thread and the ceiling priority of the semaphore is unblocked for the home scheduler. This could lead to priority inversion issues and is not in line with the MrsP protocol. Introduce two new scheduler operations which are only enabled if RTEMS_SMP is defined. The operations are used to make the scheduler node of the home scheduler sticky and to clean the sticky property. This helps to keep the sticky handing out of the frequently used priority update operation. Close #4532.
* score: Optimize SMP EDF move to ready operationSebastian Huber2021-11-231-7/+13
| | | | | | | | If a node is moved from the scheduled chain to the ready queue, then we know that it is the highest priority ready node. So, it can be prepended to the ready queue without doing any comparisons. Update #4531.
* score: Rework affine ready queue handlingSebastian Huber2021-11-231-40/+66
| | | | | | | | Rework the handling of the affine ready queue for the EDF SMP scheduler. Do the queue handling in the node insert, move, and extract operations. Remove the queue handling from _Scheduler_EDF_SMP_Allocate_processor(). Update #4531.
* score: Use extract from scheduled callbacksSebastian Huber2021-11-235-0/+21
| | | | | | | Use the extract from scheduled callback provided by the scheduler implementation in the SMP scheduler framework. Update #4531.
* score: Remove return value from enqueue scheduledSebastian Huber2021-11-235-10/+10
| | | | | | The return value was unused. Remove it. Update #4531.
* score: Add red-black tree append/prependSebastian Huber2021-11-232-0/+116
| | | | | | | These functions are a faster alternative to _RBTree_Insert_inline() if it is known that the new node is the maximum/minimum node. Update #4531.
* cpukit: Consistize OAR copyright headersKinsey Moore2021-11-222-2/+2
| | | | | | These two OAR copyright headers are the only two in the codebase with a format that differs from the typical OAR copyright header. This makes all of the OAR copyright headers consistent.
* rtems: Add new clock manager directivesSebastian Huber2021-11-151-0/+56
| | | | Update #4527.
* score: Add _Timecounter_Set_NTP_update_second()Sebastian Huber2021-11-151-5/+25
| | | | | | | Allow the installation of an NTP update second handler which may be used by an NTP service. Update #2348.
* score: Optimize timehand updates for non-SMPSebastian Huber2021-11-151-8/+36
| | | | | | In uniprocessor configurations, the timehand updates are done with interrupts disabled. So, it is impossible to observe a generation number of zero.
* score: Port large time delta support to RTEMSSebastian Huber2021-11-151-3/+22
|
* score: Initialize timehand generation to UINT_MAXSebastian Huber2021-11-151-1/+1
| | | | | This leads to a timehand generation overflow right at the system start and helps to get code coverage in test programs.
* timecounter: Load the currently selected tc once in tc_windup()Mark Johnston2021-11-151-7/+16
| | | | | | | | Reported by: Sebastian Huber <sebastian.huber@embedded-brains.de> Reviewed by: kib MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32729
* kern_tc.c: Scaling/large delta recalculationSebastian Huber2021-11-151-38/+50
| | | | | | | | | | | | | | | | | | | | | This change is a slight performance optimization for systems with a slow 64-bit division. The th->th_scale and th->th_large_delta values only depend on the timecounter frequency and the th->th_adjustment. The timecounter frequency of a timehand only changes when a new timecounter is activated for the timehand. The th->th_adjustment is only changed by the NTP second update. The NTP second update is not done for every call of tc_windup(). Move the code block to recalculate the scaling factor and the large delta of a timehand to the new helper function recalculate_scaling_factor_and_large_delta(). Call recalculate_scaling_factor_and_large_delta() when a new timecounter is activated and a NTP second update occurred. MFC after: 1 week
* timecounter: Lock the timecounter listMark Johnston2021-11-151-10/+30
| | | | | | | | | | | | | | | | | Timecounter registration is dynamic, i.e., there is no requirement that timecounters must be registered during single-threaded boot. Loadable drivers may in principle register timecounters (which can be switched to automatically). Timecounters cannot be unregistered, though this could be implemented. Registered timecounters belong to a global linked list. Add a mutex to synchronize insertions and the traversals done by (mpsafe) sysctl handlers. No functional change intended. Reviewed by: imp, kib MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D32511
* timecounter: Let kern.timecounter.stepwarnings be set as a tunableMark Johnston2021-11-151-1/+1
| | | | MFC after: 1 week
* Remove "All Rights Reserved" fromEd Maste2021-11-151-1/+0
| | | | | | | | | FreeBSD Foundation sys/ copyrights These ones were unambiguous cases where the Foundation was the only listed copyright holder (in the associated license block). Sponsored by: The FreeBSD Foundation
* kern: clarify boot timeWarner Losh2021-11-151-1/+7
| | | | | | | | | | | | | | In FreeBSD, the current time is computed from uptime + boottime. Uptime is a continuous, smooth function that's monotonically increasing. To effect changes to the current time, boottime is adjusted. boottime is mutable and shouldn't be cached against future need. Document the current implementation, with the caveat that we may stop stepping boottime on resume in the future and will step uptime instead (noted in the commit message, but not in the code). Sponsored by: Netflix Reviewed by: phk, rpokala Differential Revision: https://reviews.freebsd.org/D30116
* Make kern.timecounter.hardware tunableKonstantin Belousov2021-11-151-5/+18
| | | | | | | Noted and reviewed by: kevans MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D29122
* Add ddb 'show timecounter' command.Konstantin Belousov2021-11-151-1/+31
| | | | | MFC after: 1 week Sponsored by: The FreeBSD Foundation
* Changes that improve DTrace FBT reliabilityRobert Watson2021-11-151-0/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | on freebsd/arm64: - Implement a dtrace_getnanouptime(), matching the existing dtrace_getnanotime(), to avoid DTrace calling out to a potentially instrumentable function. (These should probably both be under KDTRACE_HOOKS. Also, it's not clear to me that they are correct implementations for the DTrace thread time functions they are used in .. fixes for another commit.) - Don't allow FBT to instrument functions involved in EL1 exception handling that are involved in FBT trap processing: handle_el1h_sync() and do_el1h_sync(). - Don't allow FBT to instrument DDB and KDB functions, as that makes it rather harder to debug FBT problems. Prior to these changes, use of FBT on FreeBSD/arm64 rapidly led to kernel panics due to recursion in DTrace. Reliable FBT on FreeBSD/arm64 is reliant on another change from @andrew to have the aarch64 instrumentor more carefully check that instructions it replaces are against the stack pointer, which can otherwise lead to memory corruption. That change remains under review. MFC after: 2 weeks Reviewed by: andrew, kp, markj (earlier version), jrtc27 (earlier version) Differential revision: https://reviews.freebsd.org/D27766
* Remove double-calls to tc_get_timecount()Konstantin Belousov2021-11-151-3/+0
| | | | | | | | | | | to warm timecounters. It seems that second call does not add any useful state change for all implemented timecounters. Discussed with: bde Sponsored by: The FreeBSD Foundation MFC after: 3 weeks
* Mark more nodes as CTLFLAG_MPSAFEPawel Biernacki2021-11-151-13/+24
| | | | | | | | | | | | | | | | | | or CTLFLAG_NEEDGIANT (17 of many) r357614 added CTLFLAG_NEEDGIANT to make it easier to find nodes that are still not MPSAFE (or already are but aren’t properly marked). Use it in preparation for a general review of all nodes. This is non-functional change that adds annotations to SYSCTL_NODE and SYSCTL_PROC nodes using one of the soon-to-be-required flags. Mark all obvious cases as MPSAFE. All entries that haven't been marked as MPSAFE before are by default marked as NEEDGIANT Approved by: kib (mentor, blanket) Commented by: kib, gallatin, melifaro Differential Revision: https://reviews.freebsd.org/D23718
* Consolidate read code for timecountersKonstantin Belousov2021-11-151-145/+87
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | and fix possible overflow in bintime()/binuptime(). The algorithm to read the consistent snapshot of current timehand is repeated in each accessor, including the details proper rollup detection and synchronization with the writer. In fact there are only two different kind of readers: one for bintime()/binuptime() which has to do the in-place calculation, and another kind which fetches some member from struct timehand. Extract the logic into type-checked macros, GETTHBINTIME() for bintime calculation, and GETTHMEMBER() for safe read of a structure' member. This way, the synchronization is only written in bintime_off() and getthmember(). In bintime_off(), use overflow-safe calculation of th_scale * delta(timecounter). In tc_windup, pre-calculate the min delta value which overflows and require slow algorithm, into the new timehands th_large_delta member. This part with overflow fix was written by Bruce Evans. Reported by: Mark Millard <marklmi@yahoo.com> (the overflow issue) Tested by: pho Discussed with: emaste Sponsored by: The FreeBSD Foundation (kib) MFC after: 3 weeks
* Remove duplicated empty lines from kern/*.cMateusz Guzik2021-11-151-1/+0
| | | | No functional changes.
* Initialize timehands linkage much earlier.Konstantin Belousov2021-11-151-12/+22
| | | | | | Reported and tested by: trasz Sponsored by: The FreeBSD Foundation MFC after: 1 week
* Make timehands count selectable at boottime.Konstantin Belousov2021-11-151-5/+45
| | | | | | | | | | | Tested by: O'Connor, Daniel <darius@dons.net.au> Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D21563 This patch was modified by Sebastian Huber <sebastian.huber@embedded-brains.de> to adjust it for RTEMS. See comment in the patch.
* Instead of using an incomplete list of platformsOlivier Houchard2021-11-151-1/+2
| | | | | that uses 64bits time_t in 32bits mode, special case amd64, as i386 is the only arch that still uses 32bits time_t.
* Create a new macro for static DPCPU data.Andrew Turner2021-11-151-2/+2
| | | | | | | | | | | | | | On arm64 (and possible other architectures) we are unable to use static DPCPU data in kernel modules. This is because the compiler will generate PC-relative accesses, however the runtime-linker expects to be able to relocate these. In preparation to fix this create two macros depending on if the data is global or static. Reviewed by: bz, emaste, markj Sponsored by: ABT Systems Ltd Differential Revision: https://reviews.freebsd.org/D16140
* tc: bcopy -> memcpyMateusz Guzik2021-11-151-2/+1
|
* Move most of the contents of opt_compat.hBrooks Davis2021-11-151-1/+0
| | | | | | | | | | | | | | | | | | | | to opt_global.h. opt_compat.h is mentioned in nearly 180 files. In-progress network driver compabibility improvements may add over 100 more so this is closer to "just about everywhere" than "only some files" per the guidance in sys/conf/options. Keep COMPAT_LINUX32 in opt_compat.h as it is confined to a subset of sys/compat/linux/*.c. A fake _COMPAT_LINUX option ensure opt_compat.h is created on all architectures. Move COMPAT_LINUXKPI to opt_dontuse.h as it is only used to control the set of compiled files. Reviewed by: kib, cem, jhb, jtl Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D14941