summaryrefslogtreecommitdiffstats
path: root/cpukit/score/src (follow)
Commit message (Collapse)AuthorAgeFilesLines
* timecounter: Merge FreeBSD change r304285Konstantin Belousov2017-10-121-5/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implement userspace gettimeofday(2) with HPET timecounter. Right now, userspace (fast) gettimeofday(2) on x86 only works for RDTSC. For older machines, like Core2, where RDTSC is not C2/C3 invariant, and which fall to HPET hardware, this means that the call has both the penalty of the syscall and of the uncached hw behind the QPI or PCIe connection to the sought bridge. Nothing can me done against the access latency, but the syscall overhead can be removed. System already provides mappable /dev/hpetX devices, which gives straight access to the HPET registers page. Add yet another algorithm to the x86 'vdso' timehands. Libc is updated to handle both RDTSC and HPET. For HPET, the index of the hpet device to mmap is passed from kernel to userspace, index might be changed and libc invalidates its mapping as needed. Remove cpu_fill_vdso_timehands() KPI, instead require that timecounters which can be used from userspace, to provide tc_fill_vdso_timehands{,32}() methods. Merge i386 and amd64 libc/<arch>/sys/__vdso_gettc.c into one source file in the new libc/x86/sys location. __vdso_gettc() internal interface is changed to move timecounter algorithm detection into the MD code. Measurements show that RDTSC even with the syscall overhead is faster than userspace HPET access. But still, userspace HPET is three-four times faster than syscall HPET on several Core2 and SandyBridge machines. Tested by: Howard Su <howard0su@gmail.com> Sponsored by: The FreeBSD Foundation MFC after: 1 month Differential revision: https://reviews.freebsd.org/D7473 Update #3175.
* timecounter: Merge FreeBSD change r303548Konstantin Belousov2017-10-121-13/+11
| | | | | | | | | | Cache getbintime(9) answer in timehands, similarly to getnanotime(9) and getmicrotime(9). Suggested and reviewed by: bde (previous version) Sponsored by: The FreeBSD Foundation MFC after: 1 month Update #3175.
* timecounter: Merge FreeBSD change r303387Konstantin Belousov2017-10-121-46/+74
| | | | | | | | | | | | | | | | | | | Prevent parallel tc_windup() calls, both parallel top-level calls from setclock() and from simultaneous top-level and interrupt. For this, tc_windup() is protected with a tc_setclock_mtx spinlock, in the try mode when called from hardclock interrupt. If spinlock cannot be obtained without spinning from the interrupt context, this means that top-level executes tc_windup() on other core and our try may be avoided. The boottimebin and boottime variables should be adjusted from tc_windup(). To be correct, they must be part of the timehands and read using lockless protocol. Remove the globals and reimplement the getboottime(9)/getboottimebin(9) KPI using the timehands read protocol. Tested by: pho (as part of the whole patch) Reviewed by: jhb (same) Discussed wit: bde Sponsored by: The FreeBSD Foundation MFC after: 1 month X-Differential revision: https://reviews.freebsd.org/D7302 Update #3175.
* timecounter: Merge FreeBSD change r303384Konstantin Belousov2017-10-121-2/+2
| | | | | | | | | | Style. Sponsored by: The FreeBSD Foundation MFC after: 1 month X-Differential revision: https://reviews.freebsd.org/D7302 Update #3175.
* timecounter: Merge FreeBSD change r303383Konstantin Belousov2017-10-121-23/+12
| | | | | | | | | | | | | | | Reduce number of timehands to just two. This is useful because consumers can now be only one tc_windup() call late. Use C99 initialization. Tested by: pho (as part of the whole patch) Reviewed by: jhb (same) Discussed with: bde Sponsored by: The FreeBSD Foundation MFC after: 1 month X-Differential revision: https://reviews.freebsd.org/D7302 Update #3175.
* timecounter: Merge FreeBSD change r303382Konstantin Belousov2017-10-121-23/+45
| | | | | | | | | | | | | | | | | | | | | | Hide the boottime and bootimebin globals, provide the getboottime(9) and getboottimebin(9) KPI. Change consumers of boottime to use the KPI. The variables were renamed to avoid shadowing issues with local variables of the same name. Issue is that boottime* should be adjusted from tc_windup(), which requires them to be members of the timehands structure. As a preparation, this commit only introduces the interface. Some uses of boottime were found doubtful, e.g. NLM uses boottime to identify the system boot instance. Arguably the identity should not change on the leap second adjustment, but the commit is about the timekeeping code and the consumers were kept bug-to-bug compatible. Tested by: pho (as part of the bigger patch) Reviewed by: jhb (same) Discussed with: bde Sponsored by: The FreeBSD Foundation MFC after: 1 month X-Differential revision: https://reviews.freebsd.org/D7302 Update #3175.
* timecounter: Merge FreeBSD change r298819Pedro Giffuni2017-10-121-1/+1
| | | | | | | | sys/kern: spelling fixes in comments. No functional change. Update #3175.
* timecounter: Merge FreeBSD change r290257Ngie Cooper2017-10-121-1/+8
| | | | | | | | | Define `fhard` in pps_event(..) only when PPS_SYNC is defined to mute an -Wunused-but-set-variable warning Reported by: FreeBSD_HEAD_amd64_gcc4.9 jenkins job Sponsored by: EMC / Isilon Storage Division Update #3175.
* timecounter: Merge FreeBSD change r288216Konstantin Belousov2017-10-121-7/+14
| | | | | | | | | | | | | | Use per-cpu values for base and last in tc_cpu_ticks(). The values are updated lockess, different CPUs write its own view of timecounter state. The critical section is done for safety, callers of tc_cpu_ticks() are supposed to already enter critical section, or to own a spinlock. The change fixes sporadical reports of too high values reported for the (W)CPU on platforms that do not provide cpu ticker and use tc_cpu_ticks(), in particular, arm*. Diagnosed and reviewed by: jhb Sponsored by: The FreeBSD Foundation MFC after: 1 week Update #3175.
* timecounter: Merge FreeBSD change r286701Ian Lepore2017-10-121-5/+13
| | | | | | | | | If a specific timecounter has been chosen via sysctl, and a new timecounter with higher quality registers (presumably in a module that has just been loaded), do not undo the user's choice by switching to the new timecounter. Document that behavior, and also the fact that there is no way to unregister a timecounter (and thus no way to unload a module containing one). Update #3175.
* timecounter: Merge FreeBSD change r286429Ian Lepore2017-10-121-0/+3
| | | | | | | | | | | | Only process the PPS event types currently enabled in pps_params.mode. This makes the PPS API behave correctly, but isn't ideal -- we still end up capturing PPS data for non-enabled edges, we just don't process the data into an event that becomes visible outside of kern_tc. That's because the event type isn't passed to pps_capture(), so it can't do the filtering. Any solution for capture filtering is going to require touching every driver. Update #3175.
* timecounter: Merge FreeBSD change r286423Ian Lepore2017-10-121-2/+6
| | | | | | RFC 2783 requires a status of ETIMEDOUT, not EWOULDBLOCK, on a timeout. Update #3175.
* timecounter: Merge FreeBSD change r285286Konstantin Belousov2017-10-121-81/+101
| | | | | | | | | | | | | | | | | | | Reimplement the ordering requirements for the timehands updates, and for timehands consumers, by using fences. Ensure that the timehands->th_generation reset to zero is visible before the data update is visible [*]. tc_setget() allowed data update writes to become visible before generation (but not on TSO architectures). Remove tc_setgen(), tc_getgen() helpers, use atomics inline [**]. Noted by: alc [*] Requested by: bde [**] Reviewed by: alc, bde Sponsored by: The FreeBSD Foundation MFC after: 3 weeks Update #3175.
* timecounter: Merge FreeBSD change r284256Konstantin Belousov2017-10-121-3/+2
| | | | | | | | | | | | | | | | | Tweaks for r284178: Do not include machine/atomic.h explicitely, the header is already included by sys/systm.h. Force inlining of tc_getgen() and tc_setgen(). The functions are used more than once, which causes compilers with non-aggressive inlining policies to generate calls. Suggested by: bde Sponsored by: The FreeBSD Foundation MFC after: 1 week Update #3175.
* timecounter: Merge FreeBSD change r282424Ian Lepore2017-10-121-3/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implement a mechanism for making changes in the kernel<->driver PPS interface without breaking ABI or API compatibility with existing drivers. The existing data structures used to communicate between the kernel and driver portions of PPS processing contain no spare/padding fields and no flags field or other straightforward mechanism for communicating changes in the structures or behaviors of the code. This makes it difficult to MFC new features added to the PPS facility. ABI compatibility is important; out-of-tree drivers in module form are known to exist. (Note that the existing api_version field in the pps_params structure must contain the value mandated by RFC 2783 and any RFCs that come along after.) These changes introduce a pair of abi-version fields which are filled in by the driver and the kernel respectively to indicate the interface version. The driver sets its version field before calling the new pps_init_abi() function. That lets the kernel know how much of the pps_state structure is understood by the driver and it can avoid using newer fields at the end of the structure that it knows about if the driver is a lower version. The kernel fills in its version field during the init call, letting the driver know what features and data the kernel supports. To implement the new version information in a way that is backwards compatible with code from before these changes, the high bit of the lightly-used 'kcmode' field is repurposed as a flag bit that indicates the driver is aware of the abi versioning scheme. Basically if this bit is clear that indicates a "version 0" driver and if it is set the driver_abi field indicates the version. These changes also move the recently-added 'mtx' field of pps_state from the middle to the end of the structure, and make the kernel code that uses this field conditional on the driver being abi version 1 or higher. It changes the only driver currently supplying the mtx field, usb_serial, to use pps_init_abi(). Reviewed by: hselasky@ Update #3175.
* timecounter: Merge FreeBSD change r280012Ian Lepore2017-10-121-0/+1
| | | | | | Use sbuf_printf() for sysctl strings instead of stack buffers and snprintf(). Update #3175.
* timecounter: Merge FreeBSD change r279728Hans Petter Selasky2017-10-121-11/+3
| | | | | | | | | Add mutex support to the pps_ioctl() API in the kernel. Bump kernel version to reflect structure change. PR: 196897 MFC after: 1 week Update #3175.
* score: Remove CPU_set_ControlSebastian Huber2017-10-114-181/+9
| | | | | | Use Processor_mask instead. Update #2514.
* posix: Validate affinity sets by the schedulerSebastian Huber2017-10-111-11/+8
| | | | Update #2514.
* score: Add _Thread_queue_Dispatch_disable()Sebastian Huber2017-10-102-15/+5
|
* score: Change Timestamp_Control to sbintime_tSebastian Huber2017-10-091-0/+19
| | | | | | | | The timestamp are based on the uptime. There is no need for a 64-bit seconds part. The signed 32-bit seconds part of the sbintime_t limits the uptime to roughly 68 years. Close #2740.
* score: Use struct timespec for TODSebastian Huber2017-10-093-11/+11
| | | | | | | Use the timestamps only for uptime based values. Use struct timespec for the absolute time values (TOD). Update #2740.
* posix: Implement self-contained POSIX mutexSebastian Huber2017-10-051-10/+1
| | | | | | | | POSIX mutexes are now available in all configurations and no longer depend on --enable-posix. Update #2514. Update #3112.
* posix: Implement self-contained POSIX rwlocksSebastian Huber2017-10-054-26/+21
| | | | | | | | POSIX rwlocks are now available in all configurations and no longer depend on --enable-posix. Update #2514. Update #3115.
* posix: Implement self-contained POSIX semaphoresSebastian Huber2017-10-051-60/+13
| | | | | | | | | | | | | | For semaphore object pointer and object validation see POSIX_SEMAPHORE_VALIDATE_OBJECT(). Destruction or close of a busy semaphore returns an error status. The object is not flushed. POSIX semaphores are now available in all configurations and no longer depend on --enable-posix. Update #2514. Update #3116.
* posix: Optimize pthread_once_tSebastian Huber2017-10-051-1/+1
| | | | | | Reduce size of pthread_once_t and make it zero-initialized. Update #3142.
* score: Simplify red-black tree debug supportSebastian Huber2017-09-272-5/+17
| | | | | | | | Make the RBTree_Node layout independent of RTEMS_DEBUG (and all other build configuration options). This allows the use of this structure in Newlib. Update #3112.
* score: Include missing <limits.h>Sebastian Huber2017-09-191-0/+2
| | | | | Update #2132. Close #3140.
* Include missing <limits.h>Sebastian Huber2017-08-251-0/+1
| | | | Update #2132.
* Include missing <string.h>Sebastian Huber2017-08-251-0/+2
| | | | Update #2133.
* score: Fix format specifierSebastian Huber2017-08-221-1/+1
| | | | Update #3082.
* score: Add optional _CPU_Context_Destroy()Sebastian Huber2017-07-251-1/+1
| | | | Update #3077.
* score: Fix warningSebastian Huber2017-07-181-1/+1
| | | | Update #3059.
* score: Add simple affinity support to EDF SMPSebastian Huber2017-07-106-92/+387
| | | | Update #3059.
* score: Add scheduler node to set affinity opSebastian Huber2017-07-073-14/+8
| | | | Update #3059.
* score: Introduce _SMP_Get_online_processors()Sebastian Huber2017-07-072-2/+5
| | | | Update #3059.
* score: Use processor mask for set affinitySebastian Huber2017-07-073-21/+27
| | | | Update #3059.
* score: Add processor set to scheduler contextSebastian Huber2017-07-071-3/+2
| | | | | | | Replace the simple processor count with the processor set owned by the scheduler instance. Update #3059.
* score: Move processor affinity to Thread_ControlSebastian Huber2017-07-075-81/+12
| | | | Update #3059.
* score: Add processor mask to/from cpu_set_tSebastian Huber2017-07-061-0/+75
| | | | Update #3059.
* score: Use <sys/bitset.h> for Processor_maskSebastian Huber2017-07-062-12/+12
| | | | | | | | Implement the Processor_mask via <sys/bitset.h>. Provide _Processor_mask_To_uint32_t() to enable its use in device specific routines, e.g. interrupt affinity register in an interrupt controller. Update #3059.
* score: Fix formatSebastian Huber2017-07-051-14/+7
|
* score: Avoid clash with <strings.h> provided fls()Sebastian Huber2017-07-051-1/+2
|
* score: Add assert to _Thread_Dispatch()Sebastian Huber2017-07-041-0/+1
| | | | Update #3060.
* score: Add SMP EDF schedulerSebastian Huber2017-06-293-16/+515
| | | | Update #3056.
* score: Add red-black tree node to Scheduler_NodeSebastian Huber2017-06-294-17/+23
| | | | | | | In SMP configurations, add a red-black tree node to Scheduler_Node to enable an EDF scheduler implementation. Update #3056.
* score: Remove rtems_ada_selfSebastian Huber2017-06-141-8/+0
| | | | | | This task variable is superfluous since we use thread-local storage now. Update #2289.
* Fix CPU_COPY() usageSebastian Huber2017-06-071-2/+2
| | | | | | | | The original CPU_COPY() support of Newlib <sys/cpuset.h> had the parameters in the wrong order. This is fixed in Newlib since 2017-05-22. Update #3023.
* SMP: Simplify SMP multicast actionsSebastian Huber2017-04-052-58/+51
|
* score: Fix scheduler yield in SMP configurationsSebastian Huber2017-03-071-0/+38
| | | | | | | | | Check that no ask help request is registered during unblock and yield scheduler operations. There is no need to ask for help if a scheduled thread yields, since this is already covered by the pre-emption detection. Update #2556.