Commit Graph

31116 Commits

Author SHA1 Message Date
Konstantin Belousov
6d3c12549f timecounter: Merge FreeBSD change r303383
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.
2017-10-12 07:04:11 +02:00
Konstantin Belousov
d310aa7c61 timecounter: Merge FreeBSD change r303382
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.
2017-10-12 07:04:11 +02:00
Pedro Giffuni
f6c9460160 timecounter: Merge FreeBSD change r298981
sys/sys: minor spelling fixes.

While the changes are minor, these headers are very visible.

MFC after:	2 weeks

Update #3175.
2017-10-12 07:04:11 +02:00
Pedro Giffuni
65f2cd7a75 timecounter: Merge FreeBSD change r298819
sys/kern: spelling fixes in comments.

No functional change.

Update #3175.
2017-10-12 07:04:10 +02:00
Ngie Cooper
4cd742ed1d timecounter: Merge FreeBSD change r290257
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.
2017-10-12 07:04:10 +02:00
Konstantin Belousov
f013c1476e timecounter: Merge FreeBSD change r288216
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.
2017-10-12 07:04:10 +02:00
Ian Lepore
2b6d00f533 timecounter: Merge FreeBSD change r304285
Constify the pointers to eventtimer and timecounter name strings.

The need for this appears as soon as you try to set the names to something
that isn't a "quoted literal".  (I'm actually confused why quoted strings
aren't a problem as well, we must have some warning disabled.)

Update #3175.
2017-10-12 07:04:10 +02:00
Ian Lepore
f1463c8bdd timecounter: Merge FreeBSD change r286701
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.
2017-10-12 07:04:10 +02:00
Ian Lepore
749468112b timecounter: Merge FreeBSD change r286429
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.
2017-10-12 07:04:10 +02:00
Ian Lepore
ec349b5836 timecounter: Merge FreeBSD change r286423
RFC 2783 requires a status of ETIMEDOUT, not EWOULDBLOCK, on a timeout.

Update #3175.
2017-10-12 07:04:10 +02:00
Konstantin Belousov
016306354f timecounter: Merge FreeBSD change r285286
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.
2017-10-12 07:04:10 +02:00
Konstantin Belousov
4d0ade962d timecounter: Merge FreeBSD change r284256
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.
2017-10-12 07:04:10 +02:00
Ian Lepore
51304ddeb7 timecounter: Merge FreeBSD change r282424
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.
2017-10-12 07:04:09 +02:00
Ian Lepore
0aef6fb350 timecounter: Merge FreeBSD change r280012
Use sbuf_printf() for sysctl strings instead of stack buffers and snprintf().

Update #3175.
2017-10-12 07:04:09 +02:00
Hans Petter Selasky
ea0b339bbc timecounter: Merge FreeBSD change r279728
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.
2017-10-12 07:04:09 +02:00
Sebastian Huber
ed9a6fd8ac posix: Use right time format in adjtime()
Update #2740.
2017-10-12 07:04:09 +02:00
Joel Sherrill
dfa9a2e7ea xz/README: Correct URL
Closes #2829.
2017-10-11 21:37:10 -05:00
Joel Sherrill
14e5a0824b Fix warnings for using C/ObjC specific GCC flags with C++
Closes #3181.
2017-10-11 21:32:32 -05:00
Joel Sherrill
871c23caba Fix spprofiling01 overriding recipe warning
Closes #3084.
2017-10-11 20:18:58 -05:00
Sebastian Huber
16aaf73bbb smpaffinity01: Fix test case
Update #2514.
2017-10-11 08:33:56 +02:00
Sebastian Huber
157c767868 posix: Include missing <limits.h> 2017-10-11 07:54:08 +02:00
Sebastian Huber
b2dbb634ec score: Remove CPU_set_Control
Use Processor_mask instead.

Update #2514.
2017-10-11 07:37:58 +02:00
Sebastian Huber
a3ad4afba8 posix: Validate affinity sets by the scheduler
Update #2514.
2017-10-11 07:37:54 +02:00
Sebastian Huber
db3a3decbd score: Add _Thread_queue_Dispatch_disable() 2017-10-10 10:03:48 +02:00
Sebastian Huber
bd5be58fa6 posix: Unconditional thread attribute support
Update #2514.
2017-10-10 07:18:09 +02:00
Sebastian Huber
4f9ed26655 posix: Constify default thread processor affinity
Set default thread processor affinity to all processors of the
pre-allocated set.  This allows to constify the
_POSIX_Threads_Default_attributes.

Update #2514.
2017-10-10 07:17:51 +02:00
Sebastian Huber
8c5267a268 posix: Simplify pthread_attr_setstack()
Simplify

* pthread_attr_setstack(), and
* pthread_attr_setstacksize().

Update #2514.
2017-10-10 07:11:29 +02:00
Sebastian Huber
da9f5f1133 posix: Remove rtems_pthread_attribute_compare()
Update #2514.
Close #3174.
2017-10-09 15:54:20 +02:00
Sebastian Huber
af9115f35c posix: Simplify POSIX_API_Control
Return stack area via pthread_getattr_np().

Simplify

* pthread_attr_setaffinity_np(), and
* pthread_attr_getaffinity_np()

and let the scheduler do the more sophisticated error checks.

Make

* pthread_setaffinity_np(),
* pthread_getaffinity_np(),
* pthread_attr_setaffinity_np(), and
* pthread_attr_getaffinity_np()

available in all configurations.

Update #2514.
Close #3145.
Close #3168.
2017-10-09 14:52:58 +02:00
Sebastian Huber
65012bfebb score: Change Timestamp_Control to sbintime_t
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.
2017-10-09 08:30:07 +02:00
Sebastian Huber
2256946e9c score: Use struct timespec for TOD
Use the timestamps only for uptime based values.  Use struct timespec
for the absolute time values (TOD).

Update #2740.
2017-10-09 08:30:03 +02:00
Sebastian Huber
c0623a9941 score: Simplify _Timestamp_Add_to()
Update #2740.
2017-10-09 08:17:17 +02:00
Sebastian Huber
80933ab316 bsps/powerpc: Fix robust thread dispatch again
Use the saved MSR to account for FPU and AltiVec settings.

Update #2811.
2017-10-09 07:38:15 +02:00
Sebastian Huber
6489bcbfee psxtests/psx05: Fix timeout calculation
Update #3111.
2017-10-09 07:23:32 +02:00
Joel Sherrill
19cbd1943d pc386/.../bspreset.c: Readd proper reset code.
The removal of the Edison code removed the wrong part of the
conditional.

Closes #3172.
2017-10-08 22:26:13 -05:00
Sebastian Huber
098b67b676 posix: Resurrect signal support
This was accidentally removed during a merge conflict by
89fc9345de.
2017-10-06 20:01:39 +02:00
Sebastian Huber
587afc3400 confdefs: Fix typo 2017-10-06 14:20:00 +02:00
Sebastian Huber
170df3d9b1 bsp/imx: Add SPI bus driver
Update #3090.
2017-10-06 12:49:30 +02:00
Sebastian Huber
54380f4244 bsp/imx: Add imx_iomux_configure_pins()
Update #3090.
2017-10-06 12:49:30 +02:00
Sebastian Huber
e316be750c bsp/imx: Import iomux from FreeBSD
Update #3090.
2017-10-06 12:49:29 +02:00
Sebastian Huber
b39cda6ca4 bsp/imx: Fix I2C registration with path
Update #3090.
2017-10-06 12:49:29 +02:00
Sebastian Huber
8bdbefedd5 libdl: Fix warnings
Update #3155.
2017-10-06 09:43:17 +02:00
Sebastian Huber
4e38aed005 libdl: Use 64-bit ELF on 64-bit targets
Update #3155.
2017-10-06 09:43:17 +02:00
Sebastian Huber
900fda4567 rtems: Fix format warnings
Update #3111.
2017-10-06 09:43:17 +02:00
Sebastian Huber
de59c065c5 posix: Implement self-contained POSIX mutex
POSIX mutexes are now available in all configurations and no longer
depend on --enable-posix.

Update #2514.
Update #3112.
2017-10-05 14:29:02 +02:00
Sebastian Huber
5222488573 posix: Implement self-contained POSIX condvar
POSIX condition variables are now available in all configurations and no
longer depend on --enable-posix.

Update #2514.
Update #3113.
2017-10-05 14:29:02 +02:00
Sebastian Huber
89fc9345de posix: Implement self-contained POSIX rwlocks
POSIX rwlocks are now available in all configurations and no longer
depend on --enable-posix.

Update #2514.
Update #3115.
2017-10-05 14:29:02 +02:00
Sebastian Huber
e67929c4c0 posix: Implement self-contained POSIX barriers
POSIX barriers are now available in all configurations and no longer
depend on --enable-posix.

Update #2514.
Update #3114.
2017-10-05 14:29:01 +02:00
Sebastian Huber
c090db7405 posix: Implement self-contained POSIX semaphores
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.
2017-10-05 14:29:01 +02:00
Sebastian Huber
47b1e31f11 posix: Optimize pthread_once_t
Reduce size of pthread_once_t and make it zero-initialized.

Update #3142.
2017-10-05 14:29:01 +02:00