urcu.git
8 years agoHarmonize bootstrap script across projects
Michael Jeanson [Thu, 12 May 2016 15:05:40 +0000 (11:05 -0400)] 
Harmonize bootstrap script across projects

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 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>
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 agoSupport for NIOS2 architecture
Marek Vasut [Tue, 9 Feb 2016 18:30:22 +0000 (19:30 +0100)] 
Support for NIOS2 architecture

Add support for the Altera NIOS2 CPU archirecture. The atomic operations
are handled by the GCC. The memory barriers on this systems are entirely
trivial too, since the CPU does not support SMP at all.

Signed-off-by: Marek Vasut <marex@denx.de>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
8 years agourcu_ref_get_safe: introduce new API
Mathieu Desnoyers [Thu, 21 Jan 2016 16:45:58 +0000 (11:45 -0500)] 
urcu_ref_get_safe: introduce new API

Add a urcu_ref_get_safe API, which returns a boolean. It takes the value
"false" if a LONG_MAX overflow would occur (get is not performed in this
case), or true otherwise.

It warns the user (at compile-time) if the return value is unchecked.

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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 years agoFix: dynamic fallback to compat futex on sys_futex ENOSYS
Mathieu Desnoyers [Fri, 11 Sep 2015 14:33:43 +0000 (10:33 -0400)] 
Fix: dynamic fallback to compat futex on sys_futex ENOSYS

Some MIPS processors (e.g. Cavium Octeon II) dynamically check if the
CPU supports ll/sc within sys_futex, and return a ENOSYS errno if they
don't, even though the architecture implements sys_futex.

Handle this situation by always building the sys_futex compatibility
layer, and fall-back on it if sys_futex return a ENOSYS errno. This is
a tiny compat layer which adds very little space overhead.

This adds an unlikely branch on return from sys_futex, which should
not be an issue performance-wise (we've already taken a system call).

Since this is a fall-back mode, don't try to be clever, and don't cache
the result, so that the common cases (architectures with a properly
working sys_futex) don't get two conditional branches, just one.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
CC: Michael Jeanson <mjeanson@efficios.com>
CC: Jon Bernard <jbernard@debian.org>
9 years agoDetect RCU read-side overflows
Mathieu Desnoyers [Sun, 13 Sep 2015 15:46:04 +0000 (11:46 -0400)] 
Detect RCU read-side overflows

Use the urcu_assert() macro (enabled on DEBUG_RCU) to check for
unmatched rcu_read_lock() that eventually leads to nesting counter
overflow in urcu.h and urcu-bp.h. This won't necessarily point the the
exact rcu_read_lock() that is unmatched, but will at least detect the
overflow condition.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoDetect RCU read-side underflows
Mathieu Desnoyers [Sun, 13 Sep 2015 15:11:39 +0000 (11:11 -0400)] 
Detect RCU read-side underflows

Use the urcu_assert() macro (enabled on DEBUG_RCU) to check for
unmatched rcu_read_unlock() that leads to nesting counter underflow in
urcu.h and urcu-bp.h.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoIntroduce urcu_assert and registration check
Mathieu Desnoyers [Sun, 13 Sep 2015 14:48:03 +0000 (10:48 -0400)] 
Introduce urcu_assert and registration check

Add a "registered" flag to urcu.c and urcu-qsbr.c, set/cleared when a
thread is registered and unregistered. Add corresponding asserts in
those functions checking if a thread is registered or unregistered more
than once (which would be a bug in the way the application uses urcu).

Move the checks enabled on RCU_DEBUG to a single header: urcu/debug.h.
Add checks for the registered flag in RCU read-side lock functions (new
urcu_assert() checks, which are only built-in if RCU_DEBUG is defined at
compile-time).

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: volatile in assert()
Mathieu Desnoyers [Fri, 4 Sep 2015 05:09:39 +0000 (01:09 -0400)] 
Fix: volatile in assert()

From Coverity:
CID 1021642 (#1 of 3): 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>
9 years agoUpdate following changes to sys_membarrier ABI
Mathieu Desnoyers [Sat, 29 Aug 2015 03:15:33 +0000 (23:15 -0400)] 
Update following changes to sys_membarrier ABI

sys_membarrier underwent changes between its original implementation and
its upcoming inclusion into the Linux kernel. Update its use to follow
those changes.

Should the prior user-space code be built against a kernel header that
defines SYS_membarrier, and executed against that kernel, the following
scenarios may happen:

- -1 will be returned with EINVAL errno if the 2nd argument (flags) is
  non-zero (the previous ABI expected a single argument),
- (MEMBARRIER_EXPEDITED | MEMBARRIER_QUERY) defined as
  (1 << 0) | (1 << 16) will return -1 with EINVAL errno, because valid
  commands are now one-hot.

Therefore, should an incompatible user-space code try to use
sys_membarrier, it will simply think that the system does not have
membarrier support due to the negative return value upon query.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agouatomic: Specify complete types for atomic function calls
Khem Raj [Sun, 23 Aug 2015 04:38:30 +0000 (21:38 -0700)] 
uatomic: Specify complete types for atomic function calls

This was unearthed by clang compiler where it complained about parameter
mismatch, gcc doesnt notice this

urcu/uatomic/generic.h:190:10: error: address argument to atomic builtin
must be a pointer to integer or pointer ('void *' invalid)
                return __sync_add_and_fetch_4(addr, val);

Fixed all instances thusly.

[ Edit by Mathieu: use stdint.h types. ]

Signed-off-by: Khem Raj <raj.khem@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoCleanup: remove unused return value warning from tests
Mathieu Desnoyers [Wed, 29 Jul 2015 19:11:17 +0000 (15:11 -0400)] 
Cleanup: remove unused return value warning from tests

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: handle sys_futex() FUTEX_WAIT interrupted by signal
Mathieu Desnoyers [Mon, 6 Jul 2015 20:32:28 +0000 (16:32 -0400)] 
Fix: handle sys_futex() FUTEX_WAIT interrupted by signal

We need to handle EINTR returned by sys_futex() FUTEX_WAIT, otherwise a
signal interrupting this system call could make sys_futex return too
early, and therefore cause a synchronization issue.

Ensure that the futex compatibility layer returns meaningful errors and
errno when using poll() or pthread cond variables.

Reported-by: Gerd Gerats <geg@ngncc.de>
CC: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
CC: Lai Jiangshan <laijs@cn.fujitsu.com>
CC: Stephen Hemminger <shemminger@vyatta.com>
CC: Alan Stern <stern@rowland.harvard.edu>
CC: lttng-dev@lists.lttng.org
CC: rp@svcs.cs.pdx.edu
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: compat_futex.c: *uaddr should be read as volatile
Mathieu Desnoyers [Mon, 6 Jul 2015 19:01:22 +0000 (15:01 -0400)] 
Fix: compat_futex.c: *uaddr should be read as volatile

Ensure that a volatile read is used when reading *uaddr in the
compatibility implementation for sys_futex FUTEX_WAIT.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoCleanup: cast poll delay return value to void
Mathieu Desnoyers [Wed, 1 Jul 2015 14:03:39 +0000 (10:03 -0400)] 
Cleanup: cast poll delay return value to void

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agotests: Convert unit tests to TAP
Michael Jeanson [Tue, 30 Jun 2015 15:04:15 +0000 (11:04 -0400)] 
tests: Convert unit tests to TAP

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: make benchmark test run in oot build
Michael Jeanson [Tue, 30 Jun 2015 15:04:14 +0000 (11:04 -0400)] 
Fix: make benchmark test run in oot build

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: call_rcu_thread() affinity failure
Mathieu Desnoyers [Mon, 29 Jun 2015 22:45:07 +0000 (18:45 -0400)] 
Fix: call_rcu_thread() affinity failure

Make call_rcu_thread() affine itself more persistently

Currently, URCU simply fails if a call_rcu_thread() fails to affine
itself. This is problematic when execution is constrained by cgroup
and hotunplugged CPUs. This commit therefore makes call_rcu_thread()
retry setting its affinity every 256 grace periods, but only if it
detects that it migrated to a different CPU. Since sched_getcpu() is
cheap on many architectures, this check is less costly than going
through a system call.

Reported-by: Michael Jeanson <mjeanson@efficios.com>
Suggested-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoCleanup: cast poll delay return value to void
Mathieu Desnoyers [Mon, 29 Jun 2015 20:47:39 +0000 (16:47 -0400)] 
Cleanup: cast poll delay return value to void

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoCleanup: cast poll delay return value to void
Mathieu Desnoyers [Mon, 29 Jun 2015 20:36:01 +0000 (16:36 -0400)] 
Cleanup: cast poll delay return value to void

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoCleanup: cast poll delay return value to void
Mathieu Desnoyers [Mon, 29 Jun 2015 20:33:43 +0000 (16:33 -0400)] 
Cleanup: cast poll delay return value to void

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoCleanup: cast poll delay return value to void
Mathieu Desnoyers [Mon, 29 Jun 2015 20:32:46 +0000 (16:32 -0400)] 
Cleanup: cast poll delay return value to void

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoCleanup: cast poll() return value to void for delays
Mathieu Desnoyers [Mon, 29 Jun 2015 20:29:36 +0000 (16:29 -0400)] 
Cleanup: cast poll() return value to void for delays

Explicitly state that we don't care about poll return value in those
cases.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agourcu: fix deprecation warning with new glibc
Marc Kleine-Budde [Mon, 1 Jun 2015 13:16:30 +0000 (15:16 +0200)] 
urcu: fix deprecation warning with new glibc

This patch fixes the following warning:

/usr/include/features.h:148:3: warning: #warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" [-Wcpp]
 # warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE"

From http://man7.org/linux/man-pages/man7/feature_test_macros.7.html:

_BSD_SOURCE (deprecated since glibc 2.20)
[...]
Since glibc 2.20, this macro is deprecated.  It now has the same effect
as defining _DEFAULT_SOURCE, but generates a compile-time warning
(unless _DEFAULT_SOURCE is also defined).  Use _DEFAULT_SOURCE instead.
To allow code that requires _BSD_SOURCE in glibc 2.19 and earlier and
_DEFAULT_SOURCE in glibc 2.20 and later to compile without warnings,
define both _BSD_SOURCE and _DEFAULT_SOURCE.

Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agourcu: add cds_list_for_each_entry_safe_from macro
Jeff Layton [Thu, 30 Apr 2015 11:50:05 +0000 (07:50 -0400)] 
urcu: add cds_list_for_each_entry_safe_from macro

Same as cds_list_for_each_entry_safe, but starts at an arbitrary point
within the list instead of at the head.

Signed-off-by: Jeff Layton <jeff.layton@primarydata.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: deadlock when thread join is issued in read-side C.S.
Mathieu Desnoyers [Thu, 23 Apr 2015 18:00:23 +0000 (14:00 -0400)] 
Fix: deadlock when thread join is issued in read-side C.S.

The transitive dependency between:

RCU read-side C.S. -> synchronize_rcu -> rcu_gp_lock -> rcu_register_thread

and the dependency:

pthread_join -> awaiting for thread completion

Can block a thread on join, and thus have the side-effect of deadlocking
a thread doing a pthread_join while within a RCU read-side critical
section. This join would be awaiting for completion of register_thread or
rcu_unregister_thread, which may never complete because the rcu_gp_lock
is held by synchronize_rcu executed from another thread.

One solution to fix this is to add a new lock, rcu_registry_lock. This
lock now protects the thread registry. It is released between iterations
on the registry by synchronize_rcu, thus allowing thread
registration/unregistration to complete even though synchronize_rcu is
awaiting for RCU read-side critical sections to complete.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Reviewed-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
CC: Eugene Ivanov <Eugene.Ivanov@orc-group.com>
CC: Lai Jiangshan <laijs@cn.fujitsu.com>
CC: Stephen Hemminger <stephen@networkplumber.org>
9 years agoFix: rename RCU_DEBUG to DEBUG_RCU in urcu-qsbr.h
Mathieu Desnoyers [Thu, 23 Apr 2015 19:41:25 +0000 (15:41 -0400)] 
Fix: rename RCU_DEBUG to DEBUG_RCU in urcu-qsbr.h

Keep a mapping allowing to define RCU_DEBUG within urcu-qsbr.h for
compatibility purposes.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoCleanup some c99 pedantic warnings
Mathieu Desnoyers [Mon, 6 Apr 2015 16:50:07 +0000 (12:50 -0400)] 
Cleanup some c99 pedantic warnings

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoMark braced-groups within expressions with __extension__
Luca Boccassi [Wed, 25 Mar 2015 19:39:00 +0000 (19:39 +0000)] 
Mark braced-groups within expressions with __extension__

Braced-groups within expressions are not valid ISO C, so
if a macro uses them and it's included in a project built
with -pedantic, the build will fail. GCC and CLANG do
support them as extension, so marking them as such allows
the build to complete even with -pedantic.

Signed-off-by: Luca Boccassi <lboccass@brocade.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: compat_futex_noasync race condition
Mathieu Desnoyers [Tue, 17 Mar 2015 21:53:21 +0000 (17:53 -0400)] 
Fix: compat_futex_noasync race condition

The Userspace RCU compatibility layer around sys_futex has a race
condition which makes pretty much all "benchmark" tests hang pretty
quickly on non-Linux systems (tested on Mac OS X).

I narrowed it down to a bug in compat_futex_noasync: this compat layer
uses a single pthread mutex and condition variable for all callers,
independently of their uaddr. The FUTEX_WAKE performs a pthread cond
broadcast to all waiters. FUTEX_WAIT must then compare *uaddr with val
to see which thread has been awakened.

Unfortunately, the check was not done again after each return from
pthread_cond_wait(), thus causing the race.

This race affects threads using the futex_noasync() compatibility layer
concurrently, thus it affects only on non-Linux systems.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agotests: Use stderr redirection for time output
Mathieu Desnoyers [Mon, 16 Mar 2015 01:15:41 +0000 (21:15 -0400)] 
tests: Use stderr redirection for time output

Allows using Mac OS X time command in tests.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: use space after rpath for OS X ld
Mathieu Desnoyers [Mon, 16 Mar 2015 01:09:15 +0000 (21:09 -0400)] 
Fix: use space after rpath for OS X ld

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: move transparent union attribute after union declaration for clang
Mathieu Desnoyers [Mon, 16 Mar 2015 01:02:13 +0000 (21:02 -0400)] 
Fix: move transparent union attribute after union declaration for clang

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoConfigure: add check for used type
Jonathan Rajotte [Tue, 24 Feb 2015 03:29:24 +0000 (22:29 -0500)] 
Configure: add check for used type

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoConfigure: add missing check of headers
Jonathan Rajotte [Tue, 24 Feb 2015 03:29:23 +0000 (22:29 -0500)] 
Configure: add missing check of headers

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoConfigure: add missing check for funcs: memset, strerror
Jonathan Rajotte [Tue, 24 Feb 2015 03:29:22 +0000 (22:29 -0500)] 
Configure: add missing check for funcs: memset, strerror

Signed-off-by: Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: documentation: urcu-pointer.h: s/rcu_dereference_pointer/rcu_dereference/
Emilio G. Cota [Tue, 3 Feb 2015 17:53:46 +0000 (12:53 -0500)] 
Fix: documentation: urcu-pointer.h: s/rcu_dereference_pointer/rcu_dereference/

Signed-off-by: Emilio G. Cota <cota@braap.org>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agourcu-bp/urcu-qsbr: remove unneeded DEBUG_YIELD code
Lai Jiangshan [Tue, 2 Dec 2014 09:32:32 +0000 (17:32 +0800)] 
urcu-bp/urcu-qsbr: remove unneeded DEBUG_YIELD code

They were moved to debug-yield.c

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: call rcu should call internal RCU API
Mathieu Desnoyers [Thu, 13 Nov 2014 21:17:00 +0000 (16:17 -0500)] 
Fix: call rcu should call internal RCU API

Because call rcu implementation is included within RCU flavors, calling
the RCU API goes through the API for non-LGPL code (this is a special
case for the RCU flavor implementation c file). Since this is clearly
LGPL code, we can use the inline versions.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: silence gcc -Wextra warning
Mathieu Desnoyers [Fri, 24 Oct 2014 21:13:39 +0000 (17:13 -0400)] 
Fix: silence gcc -Wextra warning

It appears that just casting to "unsigned long" already has the semantic
we are looking for (checked by reading C99 standard and
experimentation): it sign-extends smaller signed integers, and does not
sign-extend unsigned integers.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agocompiler: use __GNUC__ instead of the undefined __GNUC_MAJOR__
Emilio G. Cota [Tue, 14 Oct 2014 02:31:25 +0000 (22:31 -0400)] 
compiler: use __GNUC__ instead of the undefined __GNUC_MAJOR__

gcc defines the major number with __GNUC__, not __GNUC_MAJOR__:
  https://gcc.gnu.org/onlinedocs/cpp/Common-Predefined-Macros.html

Signed-off-by: Emilio G. Cota <cota@braap.org>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: lfstack reversed empty/non-empty return value
Mathieu Desnoyers [Wed, 22 Oct 2014 11:55:05 +0000 (07:55 -0400)] 
Fix: lfstack reversed empty/non-empty return value

The return value of lfstack push operation is logically reversed
compared to the documentation, and compared to wfstack and wfcqueue.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agolfstack: fix: add missing __cds_lfs_init
Mathieu Desnoyers [Wed, 22 Oct 2014 10:53:58 +0000 (06:53 -0400)] 
lfstack: fix: add missing __cds_lfs_init

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agowfstack: add missing union parameters
Mathieu Desnoyers [Sat, 18 Oct 2014 14:36:36 +0000 (16:36 +0200)] 
wfstack: add missing union parameters

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: preserve example files' timestamps when copying
Mathieu Desnoyers [Thu, 16 Oct 2014 13:50:58 +0000 (15:50 +0200)] 
Fix: preserve example files' timestamps when copying

This fixes an issue where examples were always being rebuilt
when performing an out of tree build since the examples were
being copied to the build directory with a timestamp more
recent than the already-built example objects.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agowfstack: implement mutex-free wfstack with transparent union
Eric Wong [Mon, 1 Sep 2014 21:25:06 +0000 (21:25 +0000)] 
wfstack: implement mutex-free wfstack with transparent union

This allows users more freedom to use alternative synchronization
mechanisms.

Changes since v1:
- Fix typos in cds_wfs_stack_ptr_t documentation.
  Thanks to Mathieu for spotting.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Lai Jiangshan <laijs@cn.fujitsu.com>
Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agowfcqueue: Implement mutex-free wfcqueue head with transparent union
Mathieu Desnoyers [Fri, 1 Aug 2014 01:03:59 +0000 (21:03 -0400)] 
wfcqueue: Implement mutex-free wfcqueue head with transparent union

Tested-by: Eric Wong <normalperson@yhbt.net>
CC: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
CC: "Lai Jiangshan" <laijs@cn.fujitsu.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
This page took 0.043794 seconds and 4 git commands to generate.