urcu.git
3 years agoVersion 0.9.7 stable-0.9 v0.9.7
Mathieu Desnoyers [Wed, 22 Apr 2020 12:55:50 +0000 (08:55 -0400)] 
Version 0.9.7

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
3 years agoFix: tls-compat.h exposes compiler-dependent public configuration
Mathieu Desnoyers [Mon, 20 Apr 2020 15:30:49 +0000 (11:30 -0400)] 
Fix: tls-compat.h exposes compiler-dependent public configuration

Exposing the storage class chosen by ax_tls.m4 in a public header is
a bad idea, because if a recent gcc is used when configuring
liburcu, thus detecting C11, it will choose _Thread_local. Then, if an
external project uses urcu/tls-compat.h with an older gcc (e.g. 4.8),
it will fail to build, because that storage class is unknown, and
__thread should be used instead.

Therefore, use a preprocessor conditional on __cplusplus to detect C++11
(and use thread_local). Else, the STDC version is used to select
_Thread_local. Else check if _MSC_VER is defined to select
__declspec(thread), or else rely on __thread as fallback.

Remove ax_tls.m4 because it is now unused.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
4 years agoFix: tap array subscript has type char warning
Mathieu Desnoyers [Fri, 10 Apr 2020 12:30:54 +0000 (08:30 -0400)] 
Fix: tap array subscript has type char warning

On architectures where "char" is signed, it should be cast to unsigned
char before being passed as parameter to isdigit or isspace. Based on
their man page:

       These  functions  check  whether  c,  which  must  have the value of an
       unsigned char or EOF, falls into a certain character class according to
       the  specified  locale.

Passing a signed char as parameter is invalid if the values fall into
the negative range of the signed char.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
4 years agoFix: urcu/futex.h: users of struct timespec should include time.h
Mathieu Desnoyers [Mon, 27 May 2019 15:50:20 +0000 (11:50 -0400)] 
Fix: urcu/futex.h: users of struct timespec should include time.h

Fixes: #1187
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
4 years agoCleanup: update code layout to fix old gcc warning
Mathieu Desnoyers [Mon, 6 May 2019 13:56:19 +0000 (09:56 -0400)] 
Cleanup: update code layout to fix old gcc warning

Some CI jobs show:

urcu-pointer.o
13:46:22 In file included from urcu.c:49:0:
13:46:22 urcu-wait.h:70:9: warning: missing initializer for field 'lock' of 'struct cds_wfs_stack' [-Wmissing-field-initializers]
13:46:22   struct urcu_wait_queue name = URCU_WAIT_QUEUE_HEAD_INIT(name)
13:46:22          ^
13:46:22 urcu.c:150:8: note: in expansion of macro 'DEFINE_URCU_WAIT_QUEUE'
13:46:22  static DEFINE_URCU_WAIT_QUEUE(gp_waiters);
13:46:22         ^
13:46:22 In file included from urcu-wait.h:27:0,
13:46:22                  from urcu.c:49:
13:46:22 ../include/urcu/wfstack.h:92:18: note: 'lock' declared here
13:46:22   pthread_mutex_t lock;
13:46:22

Change code layout so not to confuse old gcc.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
4 years agoFix: typo CPPLAGS in examples Makefile
Michael Jeanson [Mon, 22 Apr 2019 16:04:04 +0000 (12:04 -0400)] 
Fix: typo CPPLAGS in examples Makefile

Overriding CPPFLAGS throught the environment was ignored for the
examples.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 years agoUpdate dead link in lgpl-relicensing.txt
Michael Jeanson [Thu, 7 Mar 2019 20:53:54 +0000 (15:53 -0500)] 
Update dead link in lgpl-relicensing.txt

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 years agoVersion 0.9.6 v0.9.6
Mathieu Desnoyers [Mon, 14 Jan 2019 18:46:54 +0000 (10:46 -0800)] 
Version 0.9.6

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 years agotest_rwlock: Add per-thread count to verbose output
Michael Jeanson [Fri, 23 Nov 2018 20:27:07 +0000 (15:27 -0500)] 
test_rwlock: Add per-thread count to verbose output

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 years agoAdd *.exe to gitignore for Cygwin
Michael Jeanson [Fri, 23 Nov 2018 20:27:06 +0000 (15:27 -0500)] 
Add *.exe to gitignore for Cygwin

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 years agoFix: pthread_rwlock initialization on Cygwin
Michael Jeanson [Fri, 23 Nov 2018 21:47:18 +0000 (16:47 -0500)] 
Fix: pthread_rwlock initialization on Cygwin

On Cygwin the PTHREAD_RWLOCK_INITIALIZER macro is not
sufficient to get a properly initialized pthread_rwlock_t
struct. Use the pthread_rwlock_init function instead which
should work on all platforms.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
5 years agoFix: compat_futex_noasync on Cygwin
Michael Jeanson [Fri, 23 Nov 2018 20:27:04 +0000 (15:27 -0500)] 
Fix: compat_futex_noasync on Cygwin

The futex_noasync compat code uses a weak symbol to share state across
different shared object which is not possible on Windows with the
Portable Executable format. Use the async compat code for both cases.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoVersion 0.9.5 v0.9.5
Mathieu Desnoyers [Tue, 23 Jan 2018 20:19:56 +0000 (15:19 -0500)] 
Version 0.9.5

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoFix: don't use overlapping mmap mappings on Cygwin
Michael Jeanson [Fri, 28 Jul 2017 15:51:15 +0000 (11:51 -0400)] 
Fix: don't use overlapping mmap mappings on Cygwin

The allocation scheme used by the mmap based RCU hash table is to make a
large unaccessible mapping to reserve memory without allocating it.
Then smaller chunks are allocated by overlapping read/write mappings which
do allocate memory. Deallocation is done by an overlapping unaccessible
mapping.

This scheme was tested on Linux, macOS and Solaris. However, on Cygwin the
mmap wrapper is based on the Windows NtMapViewOfSection API which doesn't
support overlapping mappings.

An alternative to the overlapping mappings is to use mprotect to change the
protection on chunks of the large mapping, read/write to allocate and none
to deallocate. This works perfecty on Cygwin and Solaris but on Linux a
call to madvise is also required to deallocate and it just doesn't work on
macOS.

For this reason, we keep to original scheme on all platforms except Cygwin.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoFix: don't use membarrier SHARED syscall command in liburcu-bp
Mathieu Desnoyers [Wed, 6 Sep 2017 20:35:59 +0000 (16:35 -0400)] 
Fix: don't use membarrier SHARED syscall command in liburcu-bp

One main user of liburcu-bp (lttng-ust) invokes synchronize_rcu()
repeatedly, without batching (does not use call_rcu).

Those delays introduced by sys_membarrier SHARED command significantly
impacts application startup time. Therefore, revert to not using the
membarrier SHARED command.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoTests fix: add missing Cygwin thread id
Michael Jeanson [Thu, 20 Jul 2017 21:33:47 +0000 (17:33 -0400)] 
Tests fix: add missing Cygwin thread id

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoFix: assignment from incompatible pointer type warnings
Michael Jeanson [Thu, 20 Jul 2017 21:33:46 +0000 (17:33 -0400)] 
Fix: assignment from incompatible pointer type warnings

On some platforms, mmap returns a caddr_t pointer which generates
compiler warnings, cast to the proper pointer type to eliminate them.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoTests fix: unused variable warnings
Michael Jeanson [Thu, 20 Jul 2017 21:33:45 +0000 (17:33 -0400)] 
Tests fix: unused variable warnings

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoVersion 0.9.4 v0.9.4
Mathieu Desnoyers [Tue, 13 Jun 2017 00:02:02 +0000 (20:02 -0400)] 
Version 0.9.4

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
6 years agoFix: Don't override user variables within the build system
Michael Jeanson [Mon, 8 May 2017 20:05:46 +0000 (16:05 -0400)] 
Fix: Don't override user variables within the build system

Instead use the appropriatly prefixed AM_* variables as to not interfere
when a user variable is passed to a make command. The proper use of flag
variables is documented at :

https://www.gnu.org/software/automake/manual/automake.html#Flag-Variables-Ordering

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
7 years agoFix: uatomic arm32: add missing release barrier before uatomic_xchg
Mathieu Desnoyers [Mon, 5 Dec 2016 14:35:34 +0000 (09:35 -0500)] 
Fix: uatomic arm32: add missing release barrier before uatomic_xchg

__sync_lock_test_and_set() only imply a release barrier, but
uatomic_xchg() guarantees both acquire and release barrier semantics.
Therefore, add the missing release barrier.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
7 years agoTests: Add verbose support to test script
Michael Jeanson [Thu, 1 Dec 2016 16:56:08 +0000 (11:56 -0500)] 
Tests: Add verbose support to test script

Add support for the standard "V=1" to make the test runner script
verbose.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
7 years agoVersion 0.9.3 v0.9.3
Mathieu Desnoyers [Wed, 30 Nov 2016 21:08:54 +0000 (16:08 -0500)] 
Version 0.9.3

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
7 years agoFix: rcutorture: work-around signal issue on mac os x
Mathieu Desnoyers [Thu, 8 Sep 2016 02:11:53 +0000 (22:11 -0400)] 
Fix: rcutorture: work-around signal issue on mac os x

Our MacOS X test machine with the following config:

15.6.0 Darwin Kernel Version 15.6.0
root:xnu-3248.60.10~1/RELEASE_X86_64

appears to have issues with liburcu-signal signal being delivered on top
of pthread_cond_wait. It seems to make the thread continue, and
therefore corrupt the rcu_head. Work around this issue by unregistering
the RCU read-side thread immediately after call_rcu (call_rcu needs us
to be registered RCU readers).

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
7 years agoFix: rcutorture should register thread using call_rcu
Mathieu Desnoyers [Wed, 7 Sep 2016 21:26:25 +0000 (17:26 -0400)] 
Fix: rcutorture should register thread using call_rcu

From rcu-api.txt:

`call_rcu` should be called from registered RCU read-side threads.
For the QSBR flavor, the caller should be online.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
7 years agoFix: remove AC_FUNC_MALLOC from configure.ac
Michael Jeanson [Mon, 27 Jun 2016 18:54:20 +0000 (14:54 -0400)] 
Fix: remove AC_FUNC_MALLOC from configure.ac

AC_FUNC_MALLOC fails cross-compile builds and is
only used to detect non-standard glibc behavior where
malloc(0) does not return a null pointer.

We don't depend on that behavior since we would have
to ship a compat implementation of malloc() for this
macro to be of any use.

Keep it commented because autoscan will report it
as missing and it might get re-introduced.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
7 years agoFix: update ax_pthread macro to handle newer clang
Michael Jeanson [Thu, 23 Jun 2016 19:20:31 +0000 (15:20 -0400)] 
Fix: update ax_pthread macro to handle newer clang

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
7 years agoUpdate library current version due to adding destroy API
Mathieu Desnoyers [Thu, 23 Jun 2016 13:09:55 +0000 (09:09 -0400)] 
Update library current version due to adding destroy API

Both current and age need to be updated when adding an API.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
7 years agoFix: Use pthread_self to get threadid on OSX
Michael Jeanson [Wed, 22 Jun 2016 20:23:51 +0000 (16:23 -0400)] 
Fix: Use pthread_self to get threadid on OSX

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
7 years agoFix: examples: use destroy API for queues/stacks
Mathieu Desnoyers [Wed, 22 Jun 2016 20:46:00 +0000 (16:46 -0400)] 
Fix: examples: use destroy API for queues/stacks

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
7 years agoUpdate library age due to new stack/queue destroy API
Mathieu Desnoyers [Wed, 22 Jun 2016 20:41:53 +0000 (16:41 -0400)] 
Update library age due to new stack/queue destroy API

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
7 years agoFix: tests: invoke destroy APIs for queues/stacks
Mathieu Desnoyers [Wed, 22 Jun 2016 20:21:43 +0000 (16:21 -0400)] 
Fix: tests: invoke destroy APIs for queues/stacks

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
7 years agoFix: add missing destroy functions to queues/stack APIs
Mathieu Desnoyers [Wed, 22 Jun 2016 20:20:25 +0000 (16:20 -0400)] 
Fix: add missing destroy functions to queues/stack APIs

Queues and stack APIs that invoke pthread_mutex_init() should have a
"destroy" counterpart which calls pthread_mutex_destroy(), ortherwise
this causes small memory leaks on platforms where pthread_mutex_init
performs memory allocation.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
7 years agoFix: add missing __cds_wfcq_init for LGPL API
Mathieu Desnoyers [Wed, 22 Jun 2016 20:17:37 +0000 (16:17 -0400)] 
Fix: add missing __cds_wfcq_init for LGPL API

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
7 years agoFix: memory leak on hash table destroy
Mathieu Desnoyers [Wed, 22 Jun 2016 19:50:21 +0000 (15:50 -0400)] 
Fix: memory leak on hash table destroy

There is a missing call to pthread_mutex_destroy(3) to match
pthread_mutex_init(3) in the hash table creation.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
7 years agoFix: Add failover for platforms without nproc
Michael Jeanson [Wed, 22 Jun 2016 19:16:18 +0000 (15:16 -0400)] 
Fix: Add failover for platforms without nproc

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
7 years agoFix: use clock_get_time for caa_get_cycles fallback on MacOSX
Mathieu Desnoyers [Wed, 22 Jun 2016 16:32:34 +0000 (12:32 -0400)] 
Fix: use clock_get_time for caa_get_cycles fallback on MacOSX

Use clock_get_time as fallback to read time for caa_get_cycles on
MacOSX. It should not matter much in practice, since x86 uses the cycle
counter.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
7 years agoFix: syscall-compat.h MacOSX support
Mathieu Desnoyers [Wed, 22 Jun 2016 15:34:26 +0000 (11:34 -0400)] 
Fix: syscall-compat.h MacOSX support

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
7 years agoFix: Add solaris-build.md to dist
Michael Jeanson [Tue, 21 Jun 2016 20:52:52 +0000 (16:52 -0400)] 
Fix: Add solaris-build.md to dist

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
7 years agoPort: build shared libraries in Cygwin
Sebastien Boisvert [Thu, 2 Jun 2016 03:02:31 +0000 (23:02 -0400)] 
Port: build shared libraries in Cygwin

Link: https://lists.lttng.org/pipermail/lttng-dev/2016-May/026081.html
Signed-off-by: Sebastien Boisvert <sboisvert@gydle.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
7 years agoPort: fix compatibility header for Cygwin
Sebastien Boisvert [Thu, 2 Jun 2016 03:01:37 +0000 (23:01 -0400)] 
Port: fix compatibility header for Cygwin

Signed-off-by: Sebastien Boisvert <sboisvert@gydle.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
7 years agoAdd GNU Hurd support to syscall-compat.h
Michael Jeanson [Mon, 30 May 2016 19:58:03 +0000 (15:58 -0400)] 
Add GNU Hurd support to syscall-compat.h

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
7 years agoAdd support for aarch64_be
Mathieu Desnoyers [Thu, 19 May 2016 20:08:50 +0000 (16:08 -0400)] 
Add support for aarch64_be

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
7 years agoFix: urcu-bp: re-initialize list head on library exit
Mathieu Desnoyers [Wed, 18 May 2016 18:50:01 +0000 (14:50 -0400)] 
Fix: urcu-bp: re-initialize list head on library exit

In case an application would try to create threads after the urcu-bp
library destructor has run, make sure the arena chunk list is
re-initialized after the memory mappings are unmapped.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
7 years agoFix: examples make distcheck failure
Mathieu Desnoyers [Tue, 10 May 2016 22:22:00 +0000 (18:22 -0400)] 
Fix: examples make distcheck failure

"make distcheck" marks each source file on the srcdir in the extracted
dist tarball read-only. The examples copy from the srcdir into the
builddir before running the "make" examples, but this keeps the
read-only flag on the builddir directories, which fails the build
because the resulting objects cannot be created.

Fix this by ensuring the copied target directory for each example is
user-writeable.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
7 years agoVersion 0.9.2 v0.9.2
Mathieu Desnoyers [Tue, 26 Apr 2016 21:16:46 +0000 (17:16 -0400)] 
Version 0.9.2

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agowfcqueue: add C++ compatibility API
Mathieu Desnoyers [Tue, 8 Mar 2016 00:24:20 +0000 (19:24 -0500)] 
wfcqueue: add C++ compatibility API

Introduce __cds_wfcq_head_cast and cds_wfcq_head_cast for compability
of wfcqueue with c++. Those are effect-less in C, where transparent
unions are supported. However, in C++, those transform struct
cds_wfcq_head and struct __cds_wfcq_head pointers to
cds_wfcq_head_ptr_t.

Reviewed-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Tested-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: CDS_WFCQ_WOULDBLOCK typing for c++
Mathieu Desnoyers [Sat, 5 Mar 2016 15:09:33 +0000 (10:09 -0500)] 
Fix: CDS_WFCQ_WOULDBLOCK typing for c++

Reviewed-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Tested-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: configure.ac: check for possibly required libs for clock_gettime
Olof Johansson [Wed, 10 Feb 2016 09:39:50 +0000 (10:39 +0100)] 
Fix: configure.ac: check for possibly required libs for clock_gettime

On some platforms, you have to link with rt to get clock_gettime. This
solves errors like:

 undefined reference to `clock_gettime'

Fixes: #996
Signed-off-by: Olof Johansson <olof.johansson@axis.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: handle reference count overflow
Mathieu Desnoyers [Tue, 19 Jan 2016 20:23:01 +0000 (15:23 -0500)] 
Fix: handle reference count overflow

The urcu refcounting API features a look and feel similar to the Linux
kernel reference counting API, which has been the subject of
CVE-2016-0728 (use-after-free). Therefore, improve the urcu refcounting
API by dealing with reference counting overflow.

For urcu_ref_get(), handle this by comparing the prior value with
LONG_MAX before updating it with a cmpxchg. When an overflow would
occur, trigger a abort() rather than allowing the overflow (which is a
use-after-free security concern).

For urcu_ref_get_unless_zero(), in addition to compare the prior value
to 0, also compare it to LONG_MAX, and return failure (false) in both
cases.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: compat_futex should work-around futex signal-restart kernel bug
Mathieu Desnoyers [Fri, 4 Dec 2015 07:03:02 +0000 (08:03 +0100)] 
Fix: compat_futex should work-around futex signal-restart kernel bug

When testing liburcu on a 3.18 Linux kernel, 2-core MIPS (cpu model :
Ingenic JZRISC V4.15  FPU V0.0), we notice that a blocked sys_futex
FUTEX_WAIT returns -1, errno=ENOSYS when interrupted by a SA_RESTART
signal handler. This spurious ENOSYS behavior causes hangs in liburcu
0.9.x. Running a MIPS 3.18 kernel under a QEMU emulator exhibits the
same behavior. This might affect earlier kernels.

This issue appears to be fixed in 3.19 since commit e967ef022 "MIPS: Fix
restart of indirect syscalls", but nevertheless, we should try to handle
this kernel bug more gracefully than a user-space hang due to unexpected
spurious ENOSYS return value.

Therefore, fallback on the "async-safe" version of compat_futex in those
situations where FUTEX_WAIT returns ENOSYS. This async-safe fallback has
the nice property of being OK to use concurrently with other FUTEX_WAKE
and FUTEX_WAIT futex() calls, because it's simply a busy-wait scheme.

The 4.2 kernel on parisc, and likely newer kernels too, are also
affected by a similar issue.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
CC: Michael Jeanson <mjeanson@efficios.com>
CC: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
CC: Ralf Baechle <ralf@linux-mips.org>
CC: linux-mips@linux-mips.org
CC: linux-kernel@vger.kernel.org
CC: "James E.J. Bottomley" <jejb@parisc-linux.org>
CC: Helge Deller <deller@gmx.de>
CC: linux-parisc@vger.kernel.org
8 years agoSupport for Xeon-Phi with newer MPSS
Didier Nadeau [Wed, 16 Dec 2015 20:02:47 +0000 (15:02 -0500)] 
Support for Xeon-Phi with newer MPSS

The Xeon-Phi is now considered as a new architecture instead of a
vendor in MPSS version 3.4.4. This change is backward compatible with
previous MPSS versions.

Signed-off-by: Didier Nadeau <didier.nadeau@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agosparc64: allocate membarrier system call number
Mathieu Desnoyers [Mon, 16 Nov 2015 16:33:55 +0000 (11:33 -0500)] 
sparc64: allocate membarrier system call number

Now that the membarrier system call is allocated on sparc, allocate
its number in our architecture header if the system headers don't
allocate it. This allows using the membarrier system call as soon as
implemented in the kernel, even if the distribution has old kernel
headers.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agohppa: allocate membarrier system call number
Mathieu Desnoyers [Mon, 16 Nov 2015 16:31:10 +0000 (11:31 -0500)] 
hppa: allocate membarrier system call number

Now that the membarrier system call is allocated on hppa (parisc),
allocate its number in our architecture header if the system headers
don't allocate it. This allows using the membarrier system call as soon
as implemented in the kernel, even if the distribution has old kernel
headers.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix build on non-Linux Debian ports
Michael Jeanson [Thu, 12 Nov 2015 16:27:47 +0000 (11:27 -0500)] 
Fix build on non-Linux Debian ports

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: urcu-signal: smp_mb_master() needs registry lock
Mathieu Desnoyers [Fri, 30 Oct 2015 21:11:55 +0000 (17:11 -0400)] 
Fix: urcu-signal: smp_mb_master() needs registry lock

The signal-based urcu flavor calls smp_mb_master() within the wait_gp()
function. Since commit "Fix: deadlock when thread join is issued in
read-side C.S.", wait_gp() is called without the registry lock held.

Ensure that the registry lock is only released around the wait per se,
not around the call to smp_mb_master(), otherwise we end up iterating on
a non-consistent thread registry in smp_mb_master().

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: rculfhash only needs to include urcu-pointers.h
Mathieu Desnoyers [Wed, 28 Oct 2015 19:57:22 +0000 (15:57 -0400)] 
Fix: rculfhash only needs to include urcu-pointers.h

rculfhash is not meant to use a specific urcu flavor, but rather receive
the flavor to use as parameter to _cds_lfht_new().

All we need is the API of urcu-pointers.h, so include that instead.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: out-of-tree benchmark/regtest
Mathieu Desnoyers [Fri, 16 Oct 2015 23:09:00 +0000 (19:09 -0400)] 
Fix: out-of-tree benchmark/regtest

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoVersion 0.9.1 v0.9.1
Mathieu Desnoyers [Fri, 16 Oct 2015 22:36:55 +0000 (18:36 -0400)] 
Version 0.9.1

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: add missing regtest and benchmark files to dist tarball
Mathieu Desnoyers [Fri, 16 Oct 2015 21:53:49 +0000 (17:53 -0400)] 
Fix: add missing regtest and benchmark files to dist tarball

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: add missing run.sh to benchmark makefile
Mathieu Desnoyers [Fri, 16 Oct 2015 20:48:45 +0000 (16:48 -0400)] 
Fix: add missing run.sh to benchmark makefile

This fixes make regtest on a distribution tarball.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoVersion 0.9.0 v0.9.0
Mathieu Desnoyers [Fri, 16 Oct 2015 19:31:56 +0000 (15:31 -0400)] 
Version 0.9.0

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoBump soname major to 4
Mathieu Desnoyers [Fri, 16 Oct 2015 19:28:57 +0000 (15:28 -0400)] 
Bump soname major to 4

The tls-compat.h header now emits different symbols, we therefore need
to bump the soname to 4:0:0.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoCleanup: remove trailing tab
Mathieu Desnoyers [Fri, 16 Oct 2015 19:24:15 +0000 (15:24 -0400)] 
Cleanup: remove trailing tab

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: Use proper macro to detect stdbool.h
Michael Jeanson [Thu, 8 Oct 2015 19:54:15 +0000 (15:54 -0400)] 
Fix: Use proper macro to detect stdbool.h

Using AC_HEADER_STDBOOL make more sense since we don't use
gnulib and it works with older autoconf versions.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoConfigure: Add missing checks
Michael Jeanson [Wed, 7 Oct 2015 18:43:49 +0000 (14:43 -0400)] 
Configure: Add missing checks

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoPort: Add Solaris build instructions
Michael Jeanson [Tue, 6 Oct 2015 11:50:28 +0000 (07:50 -0400)] 
Port: Add Solaris build instructions

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: regtest outputs valid TAP protocol
Michael Jeanson [Mon, 5 Oct 2015 21:41:59 +0000 (17:41 -0400)] 
Fix: regtest outputs valid TAP protocol

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoPort: Detect nproc bin name in benchmark scripts
Michael Jeanson [Mon, 5 Oct 2015 19:03:34 +0000 (15:03 -0400)] 
Port: Detect nproc bin name in benchmark scripts

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoPort: Add Solaris getcpu support
Michael Jeanson [Fri, 2 Oct 2015 19:37:55 +0000 (15:37 -0400)] 
Port: Add Solaris getcpu support

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoPort: Fixes to build system for portability
Michael Jeanson [Fri, 2 Oct 2015 19:43:16 +0000 (15:43 -0400)] 
Port: Fixes to build system for portability

Move our own m4 scripts to m4/. Scripts in this directory are
automatically included.

Make nproc command configurable.
Make grep command configurable.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoPort: Add Solaris support to tests/common/thread-id.h
Michael Jeanson [Tue, 29 Sep 2015 10:38:08 +0000 (06:38 -0400)] 
Port: Add Solaris support to tests/common/thread-id.h

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoPort: Add Solaris support to urcu/syscall-compat.h
Michael Jeanson [Tue, 29 Sep 2015 10:37:48 +0000 (06:37 -0400)] 
Port: Add Solaris support to urcu/syscall-compat.h

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoPort: replace bzero() by memset()
Michael Jeanson [Tue, 29 Sep 2015 10:02:14 +0000 (06:02 -0400)] 
Port: replace bzero() by memset()

bzero() was deprecated in POSIX 2001 and removed from POSIX 2008,
while memset() is part of the C standard.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoPort: make bootstrap script work on most shell
Michael Jeanson [Fri, 2 Oct 2015 15:01:52 +0000 (11:01 -0400)] 
Port: make bootstrap script work on most shell

The "-e" switch, which tests if a file or directory exists, is not
implemented in all shells. Use "-d" instead which is more widely
available.

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agotests: rcutorture: use parameters rather than random
Mathieu Desnoyers [Thu, 1 Oct 2015 19:01:14 +0000 (15:01 -0400)] 
tests: rcutorture: use parameters rather than random

Ensure those tests are reproducible by passing the kind of callrcu
worker as parameter to the test rather than randomly choosing it within
the test.

Expand the regression_tests list to invoke the test with all kinds of
callrcu workers.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: only define membarrier system call on Linux
Mathieu Desnoyers [Tue, 29 Sep 2015 15:56:28 +0000 (11:56 -0400)] 
Fix: only define membarrier system call on Linux

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoRefactor tests
Mathieu Desnoyers [Mon, 28 Sep 2015 23:27:02 +0000 (19:27 -0400)] 
Refactor tests

- Migrate benchmarks and regression tests to tap,
- Replace the "bench" make target by "short_bench" and "long_bench".
  The short benchmark is 3 seconds per test, and the long one is 30
  seconds per test,
- make regtest now invokes the benchmarks with only 1 second per
  benchmark.
- Now use "nproc" command to detect the number of available CPUs rather
  than hardcoding a value.
- rcutorture in "stress" mode is now executed.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: cast caa_cycles_t to unsigned long long
Mathieu Desnoyers [Mon, 28 Sep 2015 23:30:14 +0000 (19:30 -0400)] 
Fix: cast caa_cycles_t to unsigned long long

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agocaa_get_cycles: caa_ prefix for type, use CLOCK_MONOTONIC
Mathieu Desnoyers [Mon, 28 Sep 2015 16:58:59 +0000 (12:58 -0400)] 
caa_get_cycles: caa_ prefix for type, use CLOCK_MONOTONIC

clock_gettime() of CLOCK_MONOTONIC mimicks better the behavior of a
cycle counter, since it is not affected by NTP major time updates.

Also, now prefix "cycles_t" with a caa_ prefix, so it does not clash
with application namespaces. Anyway, caa_get_cycles() is mostly used in
testing.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoCleanup: remove trailing whitespaces at EOL
Mathieu Desnoyers [Mon, 28 Sep 2015 15:50:51 +0000 (11:50 -0400)] 
Cleanup: remove trailing whitespaces at EOL

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoCleanup: move generic caa_get_cycles to arch/generic.h
Mathieu Desnoyers [Mon, 28 Sep 2015 15:44:49 +0000 (11:44 -0400)] 
Cleanup: move generic caa_get_cycles to arch/generic.h

Eliminate some code duplication. It also implements a "generic"
caa_get_cycles() on architectures where its support is not implemented.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agotile: allocate membarrier system call number
Mathieu Desnoyers [Mon, 28 Sep 2015 15:36:55 +0000 (11:36 -0400)] 
tile: allocate membarrier system call number

Now that the membarrier system call is allocated on tile, allocate
its number in our architecture header if the system headers don't
allocate it. This allows using the membarrier system call as soon as
implemented in the kernel, even if the distribution has old kernel
headers.

Do so by creating headers specifically for tile, which rely on the
gcc atomic and memory barrier builtins.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoia64: allocate membarrier system call number
Mathieu Desnoyers [Mon, 28 Sep 2015 15:34:08 +0000 (11:34 -0400)] 
ia64: allocate membarrier system call number

Now that the membarrier system call is allocated on ia64, allocate
its number in our architecture header if the system headers don't
allocate it. This allows using the membarrier system call as soon as
implemented in the kernel, even if the distribution has old kernel
headers.

Do so by creating headers specifically for ia64, which rely on the
gcc atomic and memory barrier builtins.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoaarch64: allocate membarrier system call number
Mathieu Desnoyers [Mon, 28 Sep 2015 15:27:55 +0000 (11:27 -0400)] 
aarch64: allocate membarrier system call number

Now that the membarrier system call is allocated on aarch64, allocate
its number in our architecture header if the system headers don't
allocate it. This allows using the membarrier system call as soon as
implemented in the kernel, even if the distribution has old kernel
headers.

Do so by creating headers specifically for aarch64, which rely on the
gcc atomic and memory barrier builtins.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agopowerpc64le: use "ppc" architecture
Mathieu Desnoyers [Mon, 28 Sep 2015 15:16:57 +0000 (11:16 -0400)] 
powerpc64le: use "ppc" architecture

powerpc64le has been originally added to urcu with the "gcc" generic
architecture support. After testing, it appears that the "ppc"
architecture works as well.

Move to the "ppc" architecture so it becomes the same as other powerpc
32/64 (big endian) architectures.

Doing so wires up the membarrier system call on powerpc64le.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoarm: allocate membarrier system call number
Mathieu Desnoyers [Mon, 28 Sep 2015 14:46:54 +0000 (10:46 -0400)] 
arm: allocate membarrier system call number

Now that the membarrier system call is allocated on ARM, allocate its
number in our architecture header if the system headers don't allocate
it. This allows using the membarrier system call as soon as implemented
in the kernel, even if the distribution has old kernel headers.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agos390: allocate membarrier system call number
Mathieu Desnoyers [Sat, 26 Sep 2015 15:17:18 +0000 (11:17 -0400)] 
s390: allocate membarrier system call number

Now that the membarrier system call is allocated on s390/s390x, allocate
its number in our architecture header if the system headers don't
allocate it. This allows using the membarrier system call as soon as
implemented in the kernel, even if the distribution has old kernel
headers.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoppc: allocate membarrier system call number
Mathieu Desnoyers [Sat, 26 Sep 2015 15:15:02 +0000 (11:15 -0400)] 
ppc: allocate membarrier system call number

Now that the membarrier system call is allocated on powerpc, allocate
its number in our architecture header if the system headers don't
allocate it. This allows using the membarrier system call as soon as
implemented in the kernel, even if the distribution has old kernel
headers.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agolfstack: relax constraints on node re-use
Mathieu Desnoyers [Tue, 22 Sep 2015 16:15:02 +0000 (12:15 -0400)] 
lfstack: relax constraints on node re-use

The documentation of the RCU-based synchronization technique in lfstack
is too strict. It currently states that the cds_lfs_node structure
cannot be overwritten before a grace period has passed. However, lfstack
pop only use the next pointer as the replacement value when doing the
cmpxchg on the head. After the node has been pop'd from the stack,
concurrent cmpxchg trying to pop that same node will necessarily fail as
long as there is a grace period before pop/pop_all and re-adding the
node into the stack.

It is therefore sufficient to wait for a grace period between:
1) pop/pop_all and
2) freeing the node (to ensure existence for concurrent pop trying to
   read node->next) or re-adding the node into the stack.

This node re-use constraint relaxation is only possible because we don't
care about node->next content read by concurrent pop: it will be simply
discarded by the cmpxchg on head. Be careful not to apply this relaxed
constraint to other data structures which care about the content of the
node's next pointer (e.g. wfstack).

This relaxed constraint allows implementing efficient free-lists (memory
allocation) with a lock-free allocation/free based on lfstack: it allows
re-using the memory backing the free-list node immediately after
allocation. The only requirement with respect to this use-case is to
wait for a grace period before putting the node back into the free-list.

Also update the test_urcu_lfs to poison the next pointer immediately
after pop/pop_all to make sure we test this relaxed constraint.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
CC: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
CC: Lai Jiangshan <jiangshanlai@gmail.com>
CC: lttng-dev@lists.lttng.org
CC: rp@svcs.cs.pdx.edu
8 years agoFix: format string signedness
Mathieu Desnoyers [Mon, 21 Sep 2015 20:48:07 +0000 (16:48 -0400)] 
Fix: format string signedness

Detected by cppcheck.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoCleanup: tests: Branch condition evaluates to a garbage value
Mathieu Desnoyers [Mon, 21 Sep 2015 19:32:57 +0000 (15:32 -0400)] 
Cleanup: tests: Branch condition evaluates to a garbage value

scan-build reported this:

Logic error Branch condition evaluates to a garbage value tests
/benchmark /test_urcu_hash_rw.c 170
Logic error Branch condition evaluates to a garbage value tests
/benchmark /test_urcu_hash_rw.c 274

It should never happen based on code review, but silence this warning by
initializing to NULL.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: test: unchecked return value
Mathieu Desnoyers [Mon, 21 Sep 2015 16:38:37 +0000 (12:38 -0400)] 
Fix: test: unchecked return value

Fix Coverity issues:

CID 1021635 (#1 of 2): Unchecked return value (CHECKED_RETURN)7.
check_return: Calling pthread_mutex_unlock without checking return value
(as is done elsewhere 29 out of 33 times).

CID 1021634 (#2 of 2): Unchecked return value (CHECKED_RETURN)12.
check_return: Calling pthread_mutex_unlock without checking return value
(as is done elsewhere 29 out of 33 times).

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: test: side-effect in assertion
Mathieu Desnoyers [Mon, 21 Sep 2015 15:55:17 +0000 (11:55 -0400)] 
Fix: test: side-effect in assertion

Coverity detected:

CID 1021642 (#1 of 2): Side effect in assertion
(ASSERT_SIDE_EFFECT)assert_side_effect: Argument test_array of assert()
has a side effect because the variable is volatile. The containing
function might work differently in a non-debug build.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agox86: allocate membarrier system call number
Mathieu Desnoyers [Fri, 18 Sep 2015 21:53:11 +0000 (17:53 -0400)] 
x86: allocate membarrier system call number

Now that the membarrier system call is allocated on x86 32/64, allocate
its number in our architecture header if the system headers don't
allocate it. This allows using the membarrier system call as soon as
implemented in the kernel, even if the distribution has old kernel
headers.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agourcu-bp: use sys_membarrier when available
Mathieu Desnoyers [Fri, 18 Sep 2015 20:34:53 +0000 (16:34 -0400)] 
urcu-bp: use sys_membarrier when available

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoCleanup: urcu: remove unused membarrier "group" parameter
Mathieu Desnoyers [Fri, 18 Sep 2015 20:33:29 +0000 (16:33 -0400)] 
Cleanup: urcu: remove unused membarrier "group" parameter

Was planned in the 2010 implementation, but has never been used, and is
not needed with the current kernel membarrier implementation.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agourcu/ref.h: implement urcu_ref_get_unless_zero()
Mathieu Desnoyers [Thu, 17 Sep 2015 16:21:05 +0000 (12:21 -0400)] 
urcu/ref.h: implement urcu_ref_get_unless_zero()

Allows getting a reference atomically if the reference count is not
zero. Returns true if the reference is taken, false otherwise. This
needs to be used in conjunction with another synchronization technique
(e.g.  RCU or mutex) to ensure existence of the reference count.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: compat_futex: uninitialized ret variable
Mathieu Desnoyers [Tue, 15 Sep 2015 05:50:38 +0000 (01:50 -0400)] 
Fix: compat_futex: uninitialized ret variable

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agoFix: compat_futex_noasync: don't override return value
Mathieu Desnoyers [Mon, 14 Sep 2015 00:47:10 +0000 (20:47 -0400)] 
Fix: compat_futex_noasync: don't override return value

Fix error reported by Coverity:
** CID 1324336:  Code maintainability issues  (UNUSED_VALUE)
/compat_futex.c: 99 in compat_futex_noasync()

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
This page took 0.042754 seconds and 4 git commands to generate.