Commit Graph

31116 Commits

Author SHA1 Message Date
Sebastian Huber
cea5ff7001 score: Add _Watchdog_Nanoseconds_per_tick
Move it from the configuration to a separate variable.

Update #3117.
Update #3182.
2017-10-24 09:37:28 +02:00
Sebastian Huber
7ed377bc69 score: _Watchdog_Is_far_future_monotonic_timespec
Update #3117.
Update #3182.
2017-10-24 09:37:28 +02:00
Sebastian Huber
d16d07fbb8 score: Add _Watchdog_Is_valid_interval_timespec()
Update #3117.
Update #3182.
2017-10-24 09:37:27 +02:00
Sebastian Huber
adaf5c232e score: _Watchdog_Is_far_future_realtime_timespec()
Update #3117.
Update #3182.
2017-10-24 09:37:27 +02:00
Sebastian Huber
ecef369875 score: Rename _Watchdog_Ticks_from_*()
Rename _Watchdog_Ticks_from_*() to _Watchdog_Realtime_from_*().

This highlights that these routines are used for the CLOCK_REALTIME
watchdogs (in contrast to CLOCK_MONOTONIC).

Update #3117.
Update #3182.
2017-10-24 09:37:27 +02:00
Sebastian Huber
381ef5c833 confdefs: Warn about problematic ticks per second
A non-integer clock ticks per second value may lead to inaccurate time
format conversions.

Update #3117.
Update #3182.
2017-10-24 09:37:27 +02:00
Sebastian Huber
e0dc6efcf0 rtems: Simplify RTEMS_MILLISECONDS_TO_MICROSECONDS
Remove the cast so that it can be used in C pre-processor directives.

Update #3117.
Update #3182.
2017-10-24 09:37:27 +02:00
Sebastian Huber
27cfe7c86b score: Add _Watchdog_Ticks_per_second
This value is frequently used.  Avoid the function call overhead and the
integer division at run-time.

Update #3117.
Update #3182.
2017-10-24 09:37:22 +02:00
Sebastian Huber
028786263f score: Add _Thread_Add_timeout_ticks()
Replace _Thread_Timer_insert_monotonic() with
_Thread_Add_timeout_ticks().

Update #3117.
Update #3182.
2017-10-24 09:29:59 +02:00
Sebastian Huber
d85c94c0d2 psxclockrealtime01: New test
Update #3182.
2017-10-24 09:29:59 +02:00
Sebastian Huber
a0d0910765 posix: Do not touch msg priority in case of error 2017-10-24 09:29:59 +02:00
Sebastian Huber
0e1ad7fa58 tmtests/tmfine01: Reduce test context size
Reduce test context size in non-SMP configurations.

Close #3200.
2017-10-24 09:27:06 +02:00
Sebastian Huber
88e84c2236 testsuite: Fix build
Updates #3170.
2017-10-23 13:49:22 +02:00
Chris Johns
36d974ba4e testsuite: Remove warnings. 2017-10-23 16:25:45 +11:00
Chris Johns
98c6d50145 testsuite: Use printk for all test output where possible.
- Remove the printf support leaving the direct printk support configured
  with TESTS_USE_PRINTK and all other output goes via a buffered vsniprintf
  call to printk.
- Control the test's single init for functions and global data with
  TEST_INIT and not CONFIGURE_INIT. They are now separate.

Updates #3170.
2017-10-23 16:25:45 +11:00
Sebastian Huber
eeb8d8387f posix: Fix POSIX disabled build
Update #2514.
2017-10-23 07:13:12 +02:00
Sebastian Huber
a05861d471 libtests/tar01: Fix build dependencies 2017-10-21 12:17:23 +02:00
Sebastian Huber
6d6f6a2007 score: Fix warning 2017-10-21 10:44:58 +02:00
Sebastian Huber
dbb30e2607 posix: Fix POSIX disabled build
Update #2514.
2017-10-18 09:17:32 +02:00
Christian Mauderer
248f8679a7 bsps/arm: Remove DWT based clock.
It seems that the DWT CYCCNT does not advance when the CPU waits on a
WFI instruction.

That leads to the effect that for example on the atsamv BSP a sleep(1)
needs something in the range of a few minutes (depending on the
configured systick). A debugger might disables some deep sleep modes so
that the problem only appears if the application is executed without a
debugger.
2017-10-18 09:02:01 +02:00
Christian Mauderer
205d8d71a6 sptests/sptimecounter04: New test
Ensure that the time flow of CLOCK_REALTIME and CLOCK_MONOTONIC is close to
the clock driver ticks time flow.
2017-10-18 09:01:57 +02:00
Sebastian Huber
6087f33e31 tmtests/tmfine01: Add test cases
Update #2674.
Update #3112.
Update #3113.
Update #3114.
Update #3115.
2017-10-18 08:50:17 +02:00
Sebastian Huber
67015b617e dev/serial: Lazy update of NS16550 settings
Updates of the line control and baud divisor while transfers are in
progress may lead to unpredictable behaviour on some chips. Perform the
updates only if necessary.

Close #3198.
2017-10-18 07:21:54 +02:00
Sebastian Huber
37eb717f90 posix: Simplify _POSIX_Threads_Create_extension()
Move unblocked signals initialization to pthread_create().

Update #2514.
2017-10-17 12:10:31 +02:00
Sebastian Huber
3f3f42482d posix: Remove POSIX_API_Control::schedparam
Move sporadic server scheduler parameters to
POSIX_API_Control::Sporadic.  Remove redundant scheduler priority
parameter.

Update #2514.
2017-10-17 11:10:00 +02:00
Sebastian Huber
2be22d4f64 posix: Move POSIX_API_Control::thread
This member is only used by the sporadic server support.

Update #2514.
2017-10-17 10:21:03 +02:00
Sebastian Huber
2fcea4c473 posix: Fix _POSIX_Threads_Create_extension()
The thread POSIX API control must be fully initialized in
_POSIX_Threads_Create_extension(), otherwise a pthread_setschedparam()
is broken for all threads not created with pthread_create().
2017-10-17 10:12:10 +02:00
Sebastian Huber
91ce012ced score: Rename _Watchdog_Per_CPU_insert_monotonic()
Rename _Watchdog_Per_CPU_insert_monotonic() in
_Watchdog_Per_CPU_insert_ticks().

Update #3117.
Update #3182.
2017-10-17 08:15:40 +02:00
Sebastian Huber
bf2a53d272 score: Rename watchdog variants
Rename PER_CPU_WATCHDOG_RELATIVE in PER_CPU_WATCHDOG_MONOTONIC to
highlight the corresponding POSIX CLOCK_MONOTONIC.

Rename PER_CPU_WATCHDOG_ABSOLUTE in PER_CPU_WATCHDOG_REALTIME to
highlight the corresponding POSIX CLOCK_REALTIME.

Update #3117.
Update #3182.
2017-10-17 08:15:40 +02:00
Pavel Pisa
f4009d8b8e bsp/tms570: remove duplicate of TMS570_SCI_FLR_TX_EMPTY in console driver.
Initial idea has been that check for both, TMS570_SCI_FLR_TX_EMPTY
and TMS570_SCI_FLR_TXRDY is required before console driver parameters
update.

closes #2883.
2017-10-13 01:02:33 +02:00
Joel Sherrill
6ba029548c spthreadq01/init.c: Fix unused variable warnings 2017-10-12 12:56:24 -05:00
Joel Sherrill
05ec32aa56 lpc2362-testsuite.tcfg: Add fsrofs01 to excluded tests 2017-10-12 12:23:26 -05:00
Chris Johns
addeb53a64 doxygen: Set the Latex generation default to NO.
Closes #3130.
2017-10-12 08:49:37 -07:00
Sebastian Huber
6c99abd14f score: Remove unused function declaration 2017-10-12 11:42:45 +02:00
Sebastian Huber
ee537ea3dd ada-tests: Move to testsuites/ada
This solves a build dependency issue, e.g. building tests before
librtemsbsp.a exists.

Close #3079.
2017-10-12 10:53:16 +02:00
Sebastian Huber
b3874e1531 ada-tests: Use _SUBDIRS instead of SUBDIRS
Update #3079.
2017-10-12 09:04:17 +02:00
Christian Mauderer
16fcd56a42 bsp/atsam: Allow to change optimization settings.
Allow to overwrite the optimization settings during configuration.
2017-10-12 08:59:22 +02:00
Christian Mauderer
2ae0acbb71 bsp/atsam: Add bsp_restart. 2017-10-12 08:59:22 +02:00
Sebastian Huber
16db540a59 Use right time format in _times()
Update #2740.
Close #3179.
2017-10-12 07:24:44 +02:00
Sebastian Huber
5850054098 posix: Fix const qualifier warning
Update #2514.
Update #3179.
2017-10-12 07:18:28 +02:00
Sebastian Huber
9c0cefbfa5 confdefs: Add warnings for obsolete options
Update #2674.
Close #3112.
Close #3113.
Close #3114.
Close #3115.
Close #3116.
2017-10-12 07:13:38 +02:00
Sebastian Huber
d8b6f1c10f timecounter: Update FreeBSD identifiers
Update #3175.
2017-10-12 07:05:07 +02:00
Konstantin Belousov
bcbbe76396 timecounter: Merge FreeBSD change r324528
The th_bintime, th_microtime and th_nanotime members of the timehand all cache the last system time (uptime + boottime). Only the format differs. Do not re-calculate the bintime and simply use the value used to calculate the microtime and nanotime.

Group all the updates under the relevant comment.  Remove obsoleted
XXX part.

Submitted by:	Sebastian Huber <sebastian.huber@embedded-brains.de>
MFC after:	1 week

Update #3175.
2017-10-12 07:04:12 +02:00
Eric van Gyzen
5167d0e76b timecounter: Merge FreeBSD change r315287
Add missing pieces of r315280

I moved this branch from github to a private server, and pulled from the
wrong one when committing r315280, so I failed to include two recent commits.
Thankfully, they were only cosmetic and were included in the review.
Specifically:

Add documentation, polish comments, and improve style(9).

Tested by:	pho (r315280)
MFC after:	2 weeks
Sponsored by:	Dell EMC
Differential Revision:	https://reviews.freebsd.org/D9791

Update #3175.
2017-10-12 07:04:11 +02:00
Eric van Gyzen
952b42b643 timecounter: Merge FreeBSD change r315280
When the RTC is adjusted, reevaluate absolute sleep times based on the RTC

POSIX 2008 says this about clock_settime(2):

    If the value of the CLOCK_REALTIME clock is set via clock_settime(),
    the new value of the clock shall be used to determine the time
    of expiration for absolute time services based upon the
    CLOCK_REALTIME clock.  This applies to the time at which armed
    absolute timers expire.  If the absolute time requested at the
    invocation of such a time service is before the new value of
    the clock, the time service shall expire immediately as if the
    clock had reached the requested time normally.

    Setting the value of the CLOCK_REALTIME clock via clock_settime()
    shall have no effect on threads that are blocked waiting for
    a relative time service based upon this clock, including the
    nanosleep() function; nor on the expiration of relative timers
    based upon this clock.  Consequently, these time services shall
    expire when the requested relative interval elapses, independently
    of the new or old value of the clock.

When the real-time clock is adjusted, such as by clock_settime(3),
wake any threads sleeping until an absolute real-clock time.
Such a sleep is indicated by a non-zero td_rtcgen.  The sleep functions
will set that field to zero and return zero to tell the caller
to reevaluate its sleep duration based on the new value of the clock.

At present, this affects the following functions:

    pthread_cond_timedwait(3)
    pthread_mutex_timedlock(3)
    pthread_rwlock_timedrdlock(3)
    pthread_rwlock_timedwrlock(3)
    sem_timedwait(3)
    sem_clockwait_np(3)

I'm working on adding clock_nanosleep(2), which will also be affected.

Reported by:	Sebastian Huber <sebastian.huber@embedded-brains.de>
Reviewed by:	jhb, kib
MFC after:	2 weeks
Relnotes:	yes
Sponsored by:	Dell EMC
Differential Revision:	https://reviews.freebsd.org/D9791

Update #3175.
2017-10-12 07:04:11 +02:00
Ed Schouten
a9219e7464 timecounter: Merge FreeBSD change r310053
Add labels to sysctls related to clocks.

Sysctls like kern.eventtimer.et.*.quality currently embed the name of
the clock device. This is problematic for the Prometheus metrics
exporter for two reasons:

- Some of those clocks have dashes in their names, which Prometheus
  doesn't allow to be used in metric names.
- It doesn't allow for extracting the same property of all clocks on the
  system from within a single query.

Attach these nodes to have a label, so that the Prometheus metrics
exporter gives these metric a uniform name with the name of the clock
attached as a label.

Reviewed by:	cem
Differential Revision:	https://reviews.freebsd.org/D8775

Update #3175.
2017-10-12 07:04:11 +02:00
Konstantin Belousov
748871578c timecounter: Merge FreeBSD change r304285
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.
2017-10-12 07:04:11 +02:00
Konstantin Belousov
c382cc8328 timecounter: Merge FreeBSD change r303548
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.
2017-10-12 07:04:11 +02:00
Konstantin Belousov
b48aeaf4cf timecounter: Merge FreeBSD change r303387
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.
2017-10-12 07:04:11 +02:00
Konstantin Belousov
464fd5dae3 timecounter: Merge FreeBSD change r303384
Style.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 month
X-Differential revision:	https://reviews.freebsd.org/D7302

Update #3175.
2017-10-12 07:04:11 +02:00