urcu.git
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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
8 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 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>
9 years agolfstack: Implement mutex-free stack head with transparent union (v2)
Mathieu Desnoyers [Fri, 1 Aug 2014 00:01:57 +0000 (20:01 -0400)] 
lfstack: Implement mutex-free stack head with transparent union (v2)

Changes since v1:
- implement __cds_lfs_init().

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>
9 years agorculfhash: remove duplicated code
Eric Wong [Tue, 24 Jun 2014 01:20:32 +0000 (01:20 +0000)] 
rculfhash: remove duplicated code

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agorculfhash: handle pthread_create failures
Eric Wong [Tue, 24 Jun 2014 01:20:31 +0000 (01:20 +0000)] 
rculfhash: handle pthread_create failures

Like calloc, pthread_create may fail with EAGAIN due to a lack
of resources.  Account for that and gracefully continue.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agorculfhash: fall back to single-threaded resize on calloc failure
Eric Wong [Tue, 24 Jun 2014 01:20:30 +0000 (01:20 +0000)] 
rculfhash: fall back to single-threaded resize on calloc failure

Having a calloc fail on my server should not be fatal.

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agox86: drop extra semi-colon in caa_cpu_relax
Eric Wong [Thu, 31 Jul 2014 00:21:51 +0000 (00:21 +0000)] 
x86: drop extra semi-colon in caa_cpu_relax

This fixes compilation in braceless if/else constructs:

if (expr)
caa_cpu_relax();
else
...

Signed-off-by: Eric Wong <normalperson@yhbt.net>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoCleanup: tests: cast console write return value as void
Mathieu Desnoyers [Tue, 13 May 2014 13:27:36 +0000 (09:27 -0400)] 
Cleanup: tests: cast console write return value as void

Fixes #791

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoModernize doc using Markdown
Philippe Proulx [Mon, 5 May 2014 18:59:11 +0000 (14:59 -0400)] 
Modernize doc using Markdown

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: update automake following README to README.md change
Mathieu Desnoyers [Mon, 5 May 2014 17:56:35 +0000 (13:56 -0400)] 
Fix: update automake following README to README.md change

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoModernize README using Markdown
Philippe Proulx [Mon, 5 May 2014 17:03:20 +0000 (13:03 -0400)] 
Modernize README using Markdown

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: incorrect parenthesis in cds_hlist_for_each_entry_safe_2
Mathieu Desnoyers [Tue, 29 Apr 2014 20:01:57 +0000 (22:01 +0200)] 
Fix: incorrect parenthesis in cds_hlist_for_each_entry_safe_2

commit db903109f0031c831e8fdc95cb7197996e53f46d introduced a regression
in cds_hlist_for_each_entry_safe_2(): incorrect parenthesis assign "e"
to 1, rather than assign "e" to the next pointer, and evaluating the
expression to 1 (comma expression).

Reported-by: Daniel Thibault <Daniel.Thibault@drdc-rddc.gc.ca>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
9 years agoFix: Use after free in rcu_barrier()
Keir Fraser [Sat, 19 Apr 2014 19:59:01 +0000 (15:59 -0400)] 
Fix: Use after free in rcu_barrier()

Do not free the rcu_barrier() completion struct until all threads are
done with it.

It cannot reside on the waiter's stack as rcu_barrier() may return
before the call_rcu handlers have finished checking whether it needs a
futex wakeup. Instead we dynamically allocate the structure and
determine its lifetime with a reference count.

Signed-off-by: Keir Fraser <keir@cohodata.com>
[ Edit by Mathieu Desnoyers: use urcu/ref.h. Cleanup: use
  uatomic_sub_return() rather than uatomic_add_return() with negative
  value. ]
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: rcu_barrier(): uninitialized futex field
Mathieu Desnoyers [Fri, 18 Apr 2014 16:01:04 +0000 (12:01 -0400)] 
Fix: rcu_barrier(): uninitialized futex field

This uninitialized futex field can lead to rcu_barrier() hang. This
issue has been found with Valgrind.

Fixes #787

Reported-by: Keir Fraser <keir@cohodata.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agocall_rcu threads should clear their PAUSED flag when they unpause
Keir Fraser [Mon, 7 Apr 2014 13:28:52 +0000 (14:28 +0100)] 
call_rcu threads should clear their PAUSED flag when they unpause

And call_rcu_after_fork_parent should spin-wait on this.

Otherwise a second fork in the parent will see the PAUSED flags
already set and call_rcu_before_fork will not correctly wait for the
call_rcu threads to quiesce on this second occasion.

Fixes #786

Signed-off-by: Keir Fraser <keir@cohodata.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agotest_urcu_fork: test many fork, with 3 children deep
Mathieu Desnoyers [Thu, 17 Apr 2014 12:32:22 +0000 (08:32 -0400)] 
test_urcu_fork: test many fork, with 3 children deep

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoUpdate list of supported architectures in README
Mathieu Desnoyers [Thu, 17 Apr 2014 11:58:22 +0000 (07:58 -0400)] 
Update list of supported architectures in README

Add ARM 64, Tilera, and hppa/PA-RISC.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoAdd support for hppa/PA-RISC architecture
Helge Deller [Thu, 17 Apr 2014 11:04:05 +0000 (07:04 -0400)] 
Add support for hppa/PA-RISC architecture

Add the missing architecture specific functions to provide support for
the hppa/PA-RISC architecture:
- the processor internal time stamp counter (Control Register CR16) is
  used to get high-performance/low-latency cycle counts
- gcc provides the necessary built-in atomic functions on hppa (which in
  turn uses the light-weigth atomic locking syscall-interface of the
  Linux kernel)

Signed-off-by: Helge Deller <deller@gmx.de>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoUse autoconf AM_MAINTAINER_MODE
Lars Persson [Wed, 12 Mar 2014 09:36:04 +0000 (10:36 +0100)] 
Use autoconf AM_MAINTAINER_MODE

Give distribution maintainers the option to skip rebuilding
autoconf and automake generated files. The default behaviour
is still to have the rebuild rules enabled.

Signed-off-by: Lars Persson <larper@axis.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoUse gcc atomics on aarch64/powerpc64le
Dimitri John Ledkov [Wed, 12 Mar 2014 12:17:51 +0000 (08:17 -0400)] 
Use gcc atomics on aarch64/powerpc64le

Currently there are two fairly recent architectures, which at the
moment can only be compiled with "gcc atomics" code path.
The two new architectures are (GNU Types):
* aarch64-linux-gnu (aka ARMv8, ARM64, AARCH64, etc)
* powerpc64le-linux-gnu

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: move wait loop increment before first conditional block
Mathieu Desnoyers [Sat, 1 Mar 2014 21:22:52 +0000 (16:22 -0500)] 
Fix: move wait loop increment before first conditional block

The fix "Fix: high cpu usage in synchronize_rcu with long RCU read-side
C.S." has an imperfection in urcu.c and urcu-qsbr.c: when incrementing
the wait loop counter for the last time, the first conditional branch is
not taken, but the following conditionals are, and they assume the first
conditional has been taken.

Within urcu.c (urcu-mb, urcu-membarrier and urcu-signal), and
urcu-qsbr.c, this will simply skip the first wait_gp() call, without any
noticeable ill side-effect.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: high cpu usage in synchronize_rcu with long RCU read-side C.S.
Mathieu Desnoyers [Sat, 1 Mar 2014 16:33:25 +0000 (11:33 -0500)] 
Fix: high cpu usage in synchronize_rcu with long RCU read-side C.S.

We noticed that with this kind of scenario:
- application using urcu-mb, urcu-membarrier, urcu-signal, or urcu-bp,
- long RCU read-side critical sections, caused by e.g. long network I/O
  system calls,
- other short lived RCU critical sections running in other threads,
- very frequent invocation of call_rcu to enqueue callbacks,
lead to abnormally high CPU usage within synchronize_rcu() in the
call_rcu worker threads.

Inspection of the code gives us the answer: in urcu.c, we expect that if
we need to wait on a futex (wait_gp()), we expect to be able to end the
grace period within the next loop, having been notified by a
rcu_read_unlock(). However, this is not always the case: we can very
well be awakened by a rcu_read_unlock() executed on a thread running
short-lived RCU read-side critical sections, while the long-running RCU
read-side C.S. is still active. We end up in a situation where we
busy-wait for a very long time, because the counter is !=
RCU_QS_ACTIVE_ATTEMPTS until a 32-bit overflow happens (or more likely,
until we complete the grace period). We need to change the wait_loops ==
RCU_QS_ACTIVE_ATTEMPTS check into an inequality to use wait_gp() for
every attempts beyond RCU_QS_ACTIVE_ATTEMPTS loops.

urcu-bp.c also has this issue. Moreover, it uses usleep() rather than
poll() when dealing with long-running RCU read-side critical sections.
Turn the usleep 1000us (1ms) into a poll of 10ms. One of the advantage
of using poll() rather than usleep() is that it does not interact with
SIGALRM.

urcu-qsbr.c already checks for wait_loops >= RCU_QS_ACTIVE_ATTEMPTS, so
it is not affected by this issue.

Looking into these loops, however, shows that overflow of the loop
counter, although unlikely, would bring us back to a situation of high
cpu usage (a negative value well below RCU_QS_ACTIVE_ATTEMPTS).
Therefore, change the counter behavior so it stops incrementing when it
reaches RCU_QS_ACTIVE_ATTEMPTS, to eliminate overflow.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: out of tree build: doc/examples
Mathieu Desnoyers [Tue, 4 Feb 2014 19:46:31 +0000 (14:46 -0500)] 
Fix: out of tree build: doc/examples

Fixes #704

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: out of tree build tests/common
Mathieu Desnoyers [Tue, 4 Feb 2014 19:44:29 +0000 (14:44 -0500)] 
Fix: out of tree build tests/common

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agotests/unit: use lib rather than source
Mathieu Desnoyers [Wed, 15 Jan 2014 14:22:04 +0000 (09:22 -0500)] 
tests/unit: use lib rather than source

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoautomake: Rename INCLUDES to AM_CPPFLAGS (new name)
Mathieu Desnoyers [Wed, 15 Jan 2014 14:19:23 +0000 (09:19 -0500)] 
automake: Rename INCLUDES to AM_CPPFLAGS (new name)

Fixes this warning:

Makefile.am:3: warning: 'INCLUDES' is the old name for 'AM_CPPFLAGS' (or '*_CPPFLAGS')

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agotests regressions: use lib rather than recompile from source
Mathieu Desnoyers [Wed, 15 Jan 2014 14:18:17 +0000 (09:18 -0500)] 
tests regressions: use lib rather than recompile from source

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agotests: use common lib rather than recompile compat sources
Mathieu Desnoyers [Wed, 15 Jan 2014 14:09:00 +0000 (09:09 -0500)] 
tests: use common lib rather than recompile compat sources

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agourcu tests: use lib rather than compile from source
Mathieu Desnoyers [Wed, 15 Jan 2014 14:05:59 +0000 (09:05 -0500)] 
urcu tests: use lib rather than compile from source

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agourcu mb tests: use lib rather than recompile from source
Mathieu Desnoyers [Wed, 15 Jan 2014 14:01:56 +0000 (09:01 -0500)] 
urcu mb tests: use lib rather than recompile from source

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agourcu signal tests: use library rather than recompile source
Mathieu Desnoyers [Wed, 15 Jan 2014 13:59:41 +0000 (08:59 -0500)] 
urcu signal tests: use library rather than recompile source

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agotests: move yield debug to common test library
Mathieu Desnoyers [Wed, 15 Jan 2014 13:56:31 +0000 (08:56 -0500)] 
tests: move yield debug to common test library

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agotests urcu bp: use lib rather than recompile source
Mathieu Desnoyers [Tue, 14 Jan 2014 17:24:29 +0000 (12:24 -0500)] 
tests urcu bp: use lib rather than recompile source

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agotest_urcu_defer: link on urcu lib rather than recompile source
Mathieu Desnoyers [Tue, 14 Jan 2014 17:22:17 +0000 (12:22 -0500)] 
test_urcu_defer: link on urcu lib rather than recompile source

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agotests/benchmark: use urcu qsbr lib rather than recompile from source
Mathieu Desnoyers [Tue, 14 Jan 2014 17:19:24 +0000 (12:19 -0500)] 
tests/benchmark: use urcu qsbr lib rather than recompile from source

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoPass the CC variable to the example Makefiles
Jérémie Galarneau [Fri, 10 Jan 2014 21:39:05 +0000 (16:39 -0500)] 
Pass the CC variable to the example Makefiles

Cross-compilation fails when using the --host configure option
since the cross-compiler is not invoked by the hand-made Makefiles
in doc/examples.

The CC variable must be passed explicitly to ensure the host's
default compiler is not invoked.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: urcu-bp interaction with threads vs constructors/destructors
Mathieu Desnoyers [Sun, 8 Dec 2013 15:31:04 +0000 (10:31 -0500)] 
Fix: urcu-bp interaction with threads vs constructors/destructors

Add a reference counter for threads using urcu-bp, thus ensuring that
even if the urcu destructor is executed before each thread using RCU
read-side critical sections exit, those threads will not see a corrupted
thread list.

Also, don't use URCU_TLS() within urcu_bp_thread_exit_notifier(). It
appears that this is racy (although this was probably due to the issue
fixed by reference counting). Anyway, play safe, and pass the rcu_key
received as parameter instead.

Those issues only reproduce when threads are still active when the
urcu-bp destructor is called.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agox86 barrier for Xeon Phi: use rsp on x86-64
Mathieu Desnoyers [Sat, 7 Dec 2013 06:00:53 +0000 (07:00 +0100)] 
x86 barrier for Xeon Phi: use rsp on x86-64

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoSet RCU_HAVE_FENCE to false on Intel Xeon Phi
Simon Marchi [Fri, 6 Dec 2013 21:17:55 +0000 (16:17 -0500)] 
Set RCU_HAVE_FENCE to false on Intel Xeon Phi

It currently fails to compile, because the Phi does not have fence
instructions.

It will use lock prefixed instructions for all memory barriers, which
is overkill for this platform, but at least it will work.

Signed-off-by: Simon Marchi <simon.marchi@polymtl.ca>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix undefined NULL pointer arithmetic in hlist
Mathieu Desnoyers [Tue, 3 Dec 2013 16:31:16 +0000 (17:31 +0100)] 
Fix undefined NULL pointer arithmetic in hlist

Clang 3.3 with -O2 optimisations is especially picky about arithmetic on
NULL pointers. This undefined behavior is turned into optimized out NULL
checks by clang 3.3. Fix the undefined behavior by checking against the
pointer directly, without going back and forth around NULL with
pointer arithmetic.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoCleanup: Check for pthread in Libc
Charles Briere [Mon, 2 Dec 2013 02:00:50 +0000 (18:00 -0800)] 
Cleanup: Check for pthread in Libc

Some libc like Googles's Bionic for Android include pThread. Instead of
checking for Android as in commit
58a052effb2305655ff1b7233c78ab24fc25257e this patch checks for pthread
in libc as proposed by Thomas Petazzoni.

Reported-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Charles Briere <charlesbriere.flatzo@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoCleanup: Android: Do not redefine gettid
Charles Briere [Mon, 2 Dec 2013 02:00:49 +0000 (18:00 -0800)] 
Cleanup: Android: Do not redefine gettid

When compiling with Android Toolchain, gettid is already defined in
<unistd.h> and therefore doesn't need to be reimplemented. This patch
checks for gettid instead of looking for Android in case other
environements behave the same way.

Signed-off-by: Charles Briere <charlesbriere.flatzo@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix undefined NULL pointer arithmetic
Mathieu Desnoyers [Thu, 28 Nov 2013 17:41:13 +0000 (18:41 +0100)] 
Fix undefined NULL pointer arithmetic

Clang 3.3 with -O2 optimisations is especially picky about arithmetic
on NULL pointers. This undefined behavior is turned into optimized out
NULL checks by clang 3.3. Fix the undefined behavior by checking against
the pointer directly, without going back and forth around NULL with
pointer arithmetic.

Reported-by: Zifei Tong <soariez@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoAndroid: implement rand_r()
Pierre-Luc St-Charles [Wed, 27 Nov 2013 15:48:33 +0000 (07:48 -0800)] 
Android: implement rand_r()

stdlib.h doesn't implement rand_r() on Android.

Signed-off-by: Charles Briere <charlesbriere.flatzo@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoAndroid: do not redefine gettid on Android
Charles Briere [Wed, 27 Nov 2013 15:48:32 +0000 (07:48 -0800)] 
Android: do not redefine gettid on Android

Bionic already defines gettid through <unistd.h>.

Signed-off-by: Charles Briere <charlesbriere.flatzo@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoAndroid: add a compat layer for 'syscall.h'
Pierre-Luc St-Charles [Wed, 27 Nov 2013 15:48:31 +0000 (07:48 -0800)] 
Android: add a compat layer for 'syscall.h'

Path to include syscall.h is different on Android.

Signed-off-by: Charles Briere <charlesbriere.flatzo@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoAndroid: do not link pthread on Android
Charles Briere [Wed, 27 Nov 2013 15:48:30 +0000 (07:48 -0800)] 
Android: do not link pthread on Android

On Android, pthread is already part of libc called Bionic and doesn't
have an external library to link with.

Signed-off-by: Charles Briere <charlesbriere.flatzo@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoAndroid: configure.ac Android check
Charles Briere [Wed, 27 Nov 2013 15:48:29 +0000 (07:48 -0800)] 
Android: configure.ac Android check

Set TARGET_IS_ANDROID to true if target is Android.

Signed-off-by: Charles Briere <charlesbriere.flatzo@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoBlacklist ARM gcc 4.8.0, 4.8.1, 4.8.2
Mathieu Desnoyers [Sun, 24 Nov 2013 08:31:44 +0000 (03:31 -0500)] 
Blacklist ARM gcc 4.8.0, 4.8.1, 4.8.2

It produces clobbered frame accesses, which can lead to stack corruption
when racing with signal handlers nested on stack.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agorculfhash: document max_nr_buckets = 0
Mathieu Desnoyers [Tue, 19 Nov 2013 14:53:54 +0000 (09:53 -0500)] 
rculfhash: document max_nr_buckets = 0

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoLibrary major version number (soname) increment to 3
Mathieu Desnoyers [Fri, 1 Nov 2013 20:00:52 +0000 (16:00 -0400)] 
Library major version number (soname) increment to 3

Due to the urcu/tls-compat.h TLS fallback symbol clash fix, we need to
bump the Userspace RCU soname major version number so we don't have to
keep erroneous usage detection code around.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: tls-compat multi-lib conflict
Mathieu Desnoyers [Fri, 1 Nov 2013 13:42:23 +0000 (09:42 -0400)] 
Fix: tls-compat multi-lib conflict

When configured with the TLS pthread key fallback either:

- explicitly with ./configure --disable-compiler-tls,
- or if compiler TLS is not usable,

(this can be confirmed by looking at the configure output:
Thread Local Storage (TLS): pthread_getspecific().)

There is an issue when using multiple flavors of RCU within the same
program. Unit tests concerned:

tests/unit/test_urcu_multiflavor
tests/unit/test_urcu_multiflavor_dynlink

Vladimir Nikulichev noticed crashes when using this setup. The problem
can be pinpointed to a missing macro expansion in urcu/tls-compat.h:

looking at the output of

nm tests/unit/.libs/test_urcu_multiflavor :

                 U __tls_access_rcu_reader

this seems to be the issue. We're missing macro expansion in
tls-compat.h. With this commit, it becomes:

                 U __tls_access_rcu_reader_bp
                 U __tls_access_rcu_reader_mb
                 U __tls_access_rcu_reader_memb
                 U __tls_access_rcu_reader_sig

Please note that this affects an unusual configuration of userspace RCU
(with TLS pthread key fallback), needed for some BSD that don't support
compiler TLS. Strictly speaking, this requires bumping the URCU library
soname version major number, because it breaks the ABI presented to
applications on those unusual configurations.

A following commit will handle the ABI migration: for stable releases
(stable-0.7 and stable-0.8 branches), the ABI is kept compatible, and
bogus usage are detected. For the upcoming stable-0.9, the soname will
simply be bumped.

Reported-by: Vladimir Nikulichev <nvs@tbricks.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoUse cross compiler for doc examples
Cristiana Voicu [Thu, 31 Oct 2013 08:10:44 +0000 (10:10 +0200)] 
Use cross compiler for doc examples

Signed-off-by: Cristiana Voicu <cristiana.voicu@intel.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoAdd lttng-dev mailing list to readme
Mathieu Desnoyers [Tue, 22 Oct 2013 05:11:51 +0000 (06:11 +0100)] 
Add lttng-dev mailing list to readme

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agowfcqueue: remove misleading comment
Mathieu Desnoyers [Sun, 13 Oct 2013 01:42:25 +0000 (21:42 -0400)] 
wfcqueue: remove misleading comment

The splice blocking operation can indeed busy-wait.

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agogcc warning fixes: -Wsign-compare and -Wextra
Mathieu Desnoyers [Tue, 8 Oct 2013 21:22:42 +0000 (17:22 -0400)] 
gcc warning fixes: -Wsign-compare and -Wextra

When compiling code using the rcu_xchg_pointer() family of functions,
with the following define:

 #define URCU_INLINE_SMALL_FUNCTIONS

prior to including urcu headers, when compiling with gcc with
-Wsign-compare and -Wextra, gcc warns about:

urcu-xchg.c: In function ‘reload’:
urcu-xchg.c:19:1: warning: ordered comparison of pointer with integer zero [-Wextra]
urcu-xchg.c:19:1: warning: signed and unsigned type in conditional expression [-Wsign-compare]

For the "ordered comparison of pointer with integer zero" warning, fix
this by comparing (type) -1 against (type) 0 instead of just 0, so if
"type" is a pointer type, this pointer type will be applied to the right
operand too, thus fixing the warning.

For the "signed and unsigned type in conditional expression" warning, we
need caa_cast_long_keep_sign() to always evaluate to the same type
signedness. In order to do so, when we need to sign-extend the value,
cast it to unsigned long after first casting it to long.

Reported-by: Stephen Hemminger <stephen@networkplumber.org>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
10 years agoFix: urcu-qsbr: reversed logic on RCU_DEBUG
Mathieu Desnoyers [Tue, 8 Oct 2013 13:23:10 +0000 (09:23 -0400)] 
Fix: urcu-qsbr: reversed logic on RCU_DEBUG

* Dmitri Shubin <sbn@tbricks.com> wrote:
> Shouldn't the condition in line 94 actually be
>
>      94  #if (!defined(BUILD_QSBR_LIB) && !defined(RCU_DEBUG))
>
> So when RCU_DEBUG is _not_ defined we get static inlines for
> rcu_read_{,un}lock() ?

Indeed!

Reported-by: Dmitri Shubin <sbn@tbricks.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
This page took 0.04268 seconds and 4 git commands to generate.