Mathieu Desnoyers [Wed, 9 Jan 2013 18:31:41 +0000 (13:31 -0500)]
Version 0.6.9
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Tue, 8 May 2012 21:07:03 +0000 (17:07 -0400)]
API cleanup: use "uatomic_*" in cmm_smp_mb__ API
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Tue, 8 May 2012 20:47:28 +0000 (16:47 -0400)]
uatomic: add memory barrier API for and/or/add/sub/inc/sub
Implement:
cmm_smp_mb__before_and, cmm_smp_mb__after_and
cmm_smp_mb__before_or, cmm_smp_mb__after_or
cmm_smp_mb__before_add, cmm_smp_mb__after_add
cmm_smp_mb__before_sub, cmm_smp_mb__after_sub
cmm_smp_mb__before_inc, cmm_smp_mb__after_inc
cmm_smp_mb__before_dec, cmm_smp_mb__after_dec
For generic and x86.
These currently translate into simple compiler barriers on all
architectures, but the and/or/add/sub/inc/dec uatomics do not provide
memory ordering guarantees (only uatomic_add_return, uatomic_sub_return,
uatomic_xchg, and uatomic_cmpxchg provides full memory barrier
guarantees before and after the atomic operations).
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Mon, 26 Mar 2012 15:27:01 +0000 (11:27 -0400)]
Fix uatomic sign cast
Passing an unsigned int to uatomic_sub does not honor sign extend to
long, as we should be allowed by assume.
Fix this by introducing caa_cast_long_keep_sign(), which casts either to
long or unsigned long depending on the signedness of the argument
received. It is used in uatomic_sub before applying the "-" operator,
since this operator needs to operate on the "long" type size (since sign
extension might not be performed if the argument received is unsigned).
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Wed, 26 Dec 2012 17:18:06 +0000 (12:18 -0500)]
Discourage use of pthread_atfork() for call_rcu handlers
Discourage use of glibc pthread_atfork() for call_rcu handlers due to
its inappropriate assumptions about single-threadedness while pthread
atfork handlers are executing. This results in hangs within the glibc
memory allocator.
Reviewed-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Wed, 19 Dec 2012 00:31:21 +0000 (19:31 -0500)]
Fix call_rcu fork handling
Fix call_rcu fork handling by putting all call_rcu threads in a
quiescent state before fork (paused state), and unpausing them when the
parent returns from fork.
On the child, everything will run fine as long as we don't issue fork()
from a call_rcu callback.
Side-note: pthread_atfork is not appropriate when using with multithread
and malloc/free. The glibc malloc implementation sadly expects that all
malloc/free are executed from the context of a single thread while
pthread atfork handlers are running, which leads to interesting hang in
glibc.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Tue, 18 Dec 2012 04:43:14 +0000 (23:43 -0500)]
test: fork handling
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Thu, 11 Oct 2012 16:03:35 +0000 (12:03 -0400)]
Version 0.6.8
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Thu, 11 Oct 2012 15:56:42 +0000 (11:56 -0400)]
Fix: call_rcu list corruption on teardown
* Mathieu Desnoyers <mathieu.desnoyers@efficios.com> wrote:
> * Lai Jiangshan (laijs@cn.fujitsu.com) wrote:
> > test code:
> > ./tests/test_urcu_lfs 100 10 10
> >
> > bug produce rate > 60%
> >
> > {{{
> > I didn't see any bug when "./tests/test_urcu_lfs 10 10 10" Or
> +"./tests/test_urcu_lfs 100 100 10"
> > But I just test it about 5 times
> > }}}
> >
> > 4cores*1threads: Intel(R) Core(TM) i5 CPU 760
> > RCU_MB (no time to test for other rcu type)
> > test commit:
768fba83676f49eb73fd1d8ad452016a84c5ec2a
> >
> > I didn't see any bug when "./tests/test_urcu_mb 10 100 10"
> >
> > Sorry, I tried, but I failed to find out the root cause currently.
>
> I think I managed to narrow down the issue:
>
> 1) the master branch does not reproduce it, but commit
>
768fba83676f49eb73fd1d8ad452016a84c5ec2a repdroduces it about 50% of the
> time.
>
> 2) the main change between
768fba83676f49eb73fd1d8ad452016a84c5ec2a and
> current master (
f94061a3df4c9eab9ac869a19e4228de54771fcb) is call_rcu
> moving to wfcqueue.
>
> 3) the bug always arise, for me, at the end of the 10 seconds.
> However, it might be simply due to the fact that most of the memory
> get freed at the end of program execution.
>
> 4) I've been able to get a backtrace, and it looks like we have some
> call_rcu callback-invokation threads still working while
> call_rcu_data_free() is invoked. In the backtrace, call_rcu_data_free()
> is nicely waiting for the next thread to stop, and during that time,
> two callback-invokation threads are invoking callbacks (and one of
> them triggers the segfault).
>
> So I expect that commit
>
> commit
5161f31e09ce33dd79afad8d08a2372fbf1c4fbe
> Author: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
> Date: Tue Sep 25 10:50:49 2012 -0500
>
> call_rcu: use wfcqueue, eliminate false-sharing
>
> Eliminate false-sharing between call_rcu (enqueuer) and worker threads
> on the queue head and tail.
>
> Acked-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
> Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
>
> Could have managed to fix the issue, or change the timing enough that it
> does not reproduces. I'll continue investigating.
The bug was in call rcu. It is not required for master, because we fixed
it while moving to wfcqueue. We were erroneously writing to the head
field of the default call_rcu_data rather than tail.
The conditions to reproduce this bug:
1) setup per-cpu callback-invokation threads,
2) use call_rcu
3) call call_rcu_data_free() while there are still some pending
callbacks that have not yet been executed by the callback-invokation
threads,
4) we then get corruption due to the "default" callback invokation
that walks through a corrupted queue.
This bug is fixed by commit
5161f31e09ce33dd79afad8d08a2372fbf1c4fbe in
the 0.7.x series. Commit
0b8ab7df078a6d8e1439b1db5849638892e1cc83 in the
0.7.x series explains the real motivation for moving call_rcu from
wfqueue to wfcqueue.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Tue, 13 Dec 2011 02:35:45 +0000 (21:35 -0500)]
Version 0.6.7
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Thu, 8 Dec 2011 21:16:46 +0000 (16:16 -0500)]
Add compat file for test urcu wfs
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Thu, 8 Dec 2011 21:14:21 +0000 (16:14 -0500)]
Add missing compat file for wfq test
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Thu, 8 Dec 2011 13:28:01 +0000 (08:28 -0500)]
urcu-bp: no need for weak attribute
We should do this within the user (e.g. liblttng-ust), not within the
urcu-bp library.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Mon, 5 Dec 2011 23:41:29 +0000 (18:41 -0500)]
hlist.h: Add missing stddef.h include for NULL
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Mon, 5 Dec 2011 20:49:57 +0000 (15:49 -0500)]
call_rcu: Add missing call_rcu_before_fork and call_rcu_after_fork_parent declarations
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Thu, 1 Dec 2011 15:40:31 +0000 (10:40 -0500)]
Describe autotools/libtool/automake version dependency
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Thu, 1 Dec 2011 15:18:12 +0000 (10:18 -0500)]
Remove m4_ifdef for AC_PROG_LIBTOOL (deprecated)
This trick does not seem to work anyway.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Wed, 30 Nov 2011 14:03:10 +0000 (09:03 -0500)]
Support older autotools
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Tue, 29 Nov 2011 20:30:26 +0000 (15:30 -0500)]
Apply autoupdate to configure.ac
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Mon, 28 Nov 2011 19:28:29 +0000 (14:28 -0500)]
Fix build for amd64 environment (for FreeBSD 8.2)
Signed-off-by: David Goulet <dgoulet@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Sun, 27 Nov 2011 08:58:52 +0000 (08:58 +0000)]
Add missing rcu_dereference_sym_bp
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Sun, 27 Nov 2011 00:41:09 +0000 (00:41 +0000)]
urcu-bp: allow weak linking
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Alexandre Montplaisir [Tue, 22 Nov 2011 17:02:29 +0000 (18:02 +0100)]
Install test scripts in the dist tarball
Fix for http://lttng.org/issue/250
Allows running `make check' when installing from the tarball
Signed-off-by: Alexandre Montplaisir <alexandre.montplaisir@gmail.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Thu, 3 Nov 2011 16:49:07 +0000 (12:49 -0400)]
Version 0.6.6
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Wed, 14 Sep 2011 17:36:12 +0000 (13:36 -0400)]
qsbr vs call_rcu : remove exit assertion
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Tue, 1 Nov 2011 23:58:52 +0000 (19:58 -0400)]
Rename likely/unlikely to caa_likely/caa_unlikely
This fixes namespace conflicts.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Sat, 15 Oct 2011 14:08:46 +0000 (09:08 -0500)]
Reinsert missing test_urcu_*.c files (missing in rename)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Lai Jiangshan [Fri, 14 Oct 2011 13:46:30 +0000 (08:46 -0500)]
rename test_qsbr to test_urcu_qsbr
[ edit by Mathieu Desnoyers: update runtests*.sh scripts accordingly ]
Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Wed, 5 Oct 2011 02:01:50 +0000 (22:01 -0400)]
urcu-pointer: fix rcu_set_pointer unset return value
The problem only affected non-_LGPL_SOURCE configs.
Reported-by: Stephen Hemminger <shemminger@vyatta.com>
Fix-proposed-by: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Sun, 2 Oct 2011 16:53:44 +0000 (12:53 -0400)]
Enhance API.txt documentation, add to Makefile as EXTRA_DIST
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Thu, 29 Sep 2011 22:15:42 +0000 (18:15 -0400)]
Version 0.6.5
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Thu, 29 Sep 2011 21:40:01 +0000 (17:40 -0400)]
call_rcu: Document call_rcu requirements
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Thu, 29 Sep 2011 21:17:05 +0000 (17:17 -0400)]
call_rcu: fix error handling of malloc error
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Thu, 29 Sep 2011 21:13:48 +0000 (17:13 -0400)]
urcu call_rcu: Use RCU read-side protection for per-cpu call_rcu data
A concurrent get_cpu_call_rcu_data(), called by get_call_rcu_data(),
could dereference this pointer without holding any mutex. So this
situation would happen if we have a concurrent call_rcu() executing
while we do the create_all_cpu_call_rcu_data().
I think we would need to put a rcu_dereference() around
per_cpu_call_rcu_data read within get_cpu_call_rcu_data() too.
per_cpu_call_rcu_data should be done with rcu_set_pointer.
Also, a rcu read-side critical section would be required around any
usage of per_cpu_call_rcu_data, and the action of tearing down the
per-cpu data would require to wait for a quiescent state. So we would
basically require that the call_rcu users need to be registered as
RCU reader threads.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Lai Jiangshan [Thu, 29 Sep 2011 19:56:43 +0000 (15:56 -0400)]
urcu,call_rcu: Cleanup call_rcu_data pointers before use in child
[ Edit by Mathieu Desnoyers: create maxcpus_reset to handle cases where
maxcpus is 0 and -1, depending on the configuration. ]
Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Lai Jiangshan [Thu, 29 Sep 2011 17:55:11 +0000 (13:55 -0400)]
urcu,call_rcu: avoid create call_rcu_data for child when unneed
Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Reviewed-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Lai Jiangshan [Thu, 29 Sep 2011 17:47:13 +0000 (13:47 -0400)]
urcu,defer_rcu: Make defer_rcu encoding more compact for marker
When the function changes (and the function is aligned), and only the
data is the marker, we can get away with using only 2 pointers rather
than 3.
[ Edit by Mathieu Desnoyers: patch cleanup, changelog updates ]
Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Thu, 29 Sep 2011 17:28:04 +0000 (13:28 -0400)]
urcu_defer: Use cancellation flag instead of pthread_cancel()
- Provides better control over cancellation point location.
- Set the futex to 0 before exiting the defer thread.
This patch combines and enhances patches from Lai Jiangshan:
urcu,defer_rcu: fix missing respond to a cancellation request
urcu,defer_rcu: Avoid thread exit unexpected
Reported-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Lai Jiangshan [Thu, 29 Sep 2011 17:04:12 +0000 (13:04 -0400)]
urcu,call_rcu: protects call_rcu_data_list when remove node
Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Wed, 28 Sep 2011 20:03:13 +0000 (16:03 -0400)]
Create default call rcu data upon per-cpu call-rcu teardown
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Thu, 22 Sep 2011 15:00:14 +0000 (11:00 -0400)]
powerpc: use __NO_LWSYNC__ check to use appropriate lwsync/sync opcode
We already used it in uatomic code, move it to arch ppc.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Paolo Bonzini [Thu, 22 Sep 2011 09:12:44 +0000 (05:12 -0400)]
cmm: provide lightweight smp_rmb/smp_wmb on PPC
lwsync orders loads in cacheable memory with respect to other loads,
and stores in cacheable memory with respect to other stores. Use it
to implement smp_rmb/smp_wmb.
The heavy-weight sync is still used for the "full" rmb/wmb operations,
as well as for smp_mb.
[ Edit by Mathieu Desnoyers: rephrased the comments around the memory
barriers. ]
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Thu, 22 Sep 2011 00:25:20 +0000 (20:25 -0400)]
atomic: provide seq_cst semantics on powerpc
We provide sequential consistency semantic over all architectures for
cmpxchg and add_return family of primitives, but the powerpc
implementation does not match that.
Change the isync after the atomic primitives to sync, and explain the
scheme.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Lai Jiangshan [Thu, 15 Sep 2011 15:24:03 +0000 (11:24 -0400)]
avoid leaking crdp for failed path
[ Comment: now that set_cpu_call_rcu_data() is not racy and detects
overwrites, we can effectively trust its return value and free the
crdp if already set. ]
Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Lai Jiangshan [Thu, 15 Sep 2011 15:22:03 +0000 (11:22 -0400)]
Return -EEXIST when the old cpu call_rcu_data has not been removed
To make it matches the comments.
It is the caller's responsibility to use
set_cpu_call_rcu_data(cpu, NULL) to remove the CPU's
call_rcu_data structure and dispose it.
Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Lai Jiangshan [Thu, 15 Sep 2011 15:20:29 +0000 (11:20 -0400)]
protect writing to per_cpu_call_rcu_data[*]
Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Lai Jiangshan [Thu, 15 Sep 2011 15:19:12 +0000 (11:19 -0400)]
wake up default call_rcu thread after we move the leftover callbacks
Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Lai Jiangshan [Thu, 15 Sep 2011 15:17:41 +0000 (11:17 -0400)]
avoid memory leak in call_rcu_data_free()
Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Lai Jiangshan [Thu, 15 Sep 2011 15:14:43 +0000 (11:14 -0400)]
urcu call_rcu: fix use after free()
call_rcu_after_fork_child() needs to use cds_list_for_each_entry_safe to
safely iterate on the list as its item is being freed.
Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Lai Jiangshan [Thu, 15 Sep 2011 15:10:31 +0000 (11:10 -0400)]
use get_cpu_call_rcu_data() for get_call_rcu_data()
[ Impact: refactor duplicated code ]
Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Lai Jiangshan [Thu, 15 Sep 2011 15:01:38 +0000 (11:01 -0400)]
init maxcpus before use
[ Edit:
Covers the per-cpu call_rcu data setup (not all_cpus helper, which is
why we did not trigger it in our tests. ]
Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Lai Jiangshan [Thu, 15 Sep 2011 14:56:56 +0000 (10:56 -0400)]
call_rcu implementation: add missing static
Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Thu, 15 Sep 2011 14:04:30 +0000 (10:04 -0400)]
Document QSBR interaction with mutexes
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Tue, 13 Sep 2011 21:00:08 +0000 (17:00 -0400)]
urcu-pointer: implement URCU_FORCE_CAST for C++ compatibility of urcu-pointer.h
We need to be careful with those, so we do not break aliasing. Our
use-case is to cast back and forth between the same type and a void *
(or void **) type when we pass pointers to C functions. As we cast back
to the same type when the pointer is returned from the function,
aliasing should still work.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Paolo Bonzini [Tue, 13 Sep 2011 17:49:28 +0000 (13:49 -0400)]
urcu-qsbr: use rcu_thread_offline/rcu_thread_online instead of inlining them
* Mathieu Desnoyers wrote:
> Just to let you know that I pushed two updates into urcu: one fixes a
> grace period hang caused by a missing wakeup in the synchronize_rcu
> QSBR code. This appears to hit us due to the more fine-grained wakeup
> code brought by Paolo. The wakeup was really missing from the
> synchronize_rcu code (so Paolo's code just triggered an existing
> problem). I thought it would be good to let you know the effect: grace
> periods are delayed forever. This problem never appeared in a release
> (I caught it before).
Good catch. Why not use rcu_thread_offline/online in synchronize_rcu,
instead of touching rcu_reader.ctr directly? I had this in my QEMU
branch but hadn't posted yet because it was meant as a cleanup only.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Sun, 11 Sep 2011 06:45:59 +0000 (23:45 -0700)]
Pair all_cpu call_rcu create with free
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Sun, 11 Sep 2011 05:02:58 +0000 (22:02 -0700)]
call_rcu: register work threads as rcu readers
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Sun, 11 Sep 2011 06:03:09 +0000 (23:03 -0700)]
QSBR: add missing wakeups in synchronize_rcu code
synchronize_rcu go into offline mode during grace period. It duplicates
the rcu_thread_online/offline code, and therefore adding the required
wake_up_gp() is required there too.
Failure to do so leads to grace period hangs.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Paolo Bonzini [Sat, 10 Sep 2011 19:29:56 +0000 (12:29 -0700)]
cmm: do not generate code for smp_rmb/smp_wmb on x86_64
We can assume, on x86, that no accesses to write-combining memory occur,
and also that there are no non-temporal load/stores (people would
presumably write those with assembly or intrinsics and put appropriate
lfence/sfence manually). In this case rmb and wmb are no-ops on x86.
according to the updated x86 memory models:
INTEL CORPORATION. Intel 64 Architecture Memory Ordering White Paper,
2007.
http://developer.intel.com/products/processor/manuals/318147.pdf
ADVANCED MICRO DEVICES. AMD x86-64 Architecture Programmer’s Manual
Volume 2: System Programming, 2007.
Paul E. McKenney. Memory Ordering in Modern Microprocessors
www.rdrop.com/users/paulmck/scalability/paper/ordering.2007.09.19a.pdf
x86 does not reorder loads vs loads, and stores vs stores when using
normal memory accesses, with the notable exceptions of Pentium Pro
(reorders reads) and WinChip (reorders writes). Therefore, it is safe
not to emit fence instructions for x86_64 cmm_smp_rmb()/cmm_smp_wmb(),
but we leave the memory fences in place for x86_32 for those two
special-cases.
Define cmm_smp_rmb and cmm_smp_wmb to be the "common" operations that
do not require fence instruction, while leaving cmm_rmb and cmm_wmb in
place for more sophisticated uses.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Paolo Bonzini [Sat, 10 Sep 2011 19:26:19 +0000 (12:26 -0700)]
cmm: let per-arch files provide cmm_smp_* barriers
x86 instructions lfence and sfence are rarely needed, thus we want
the cmm_smp_rmb/cmm_smp_wmb macros to be simple compiler barriers.
So, let the per-arch files override the default definitions in
arch/generic.h.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Tulio Magno Quites Machado Filho [Fri, 9 Sep 2011 05:37:11 +0000 (22:37 -0700)]
Optimize caa_get_cycles() for PowerPC64
Make caa_get_cycles() read from the Time Base register with only 1
instruction.
[ Edit by Mathieu Desnoyers: coding style update ]
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Signed-off-by: Tulio Magno Quites Machado Filho <tuliom@linux.vnet.ibm.com>
Mathieu Desnoyers [Mon, 5 Sep 2011 01:25:21 +0000 (21:25 -0400)]
lfq/lfs tests: use call_rcu
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Mon, 5 Sep 2011 00:11:01 +0000 (20:11 -0400)]
Revert "Add cds_list_empty"
This reverts commit
4b7cab77f3c1c03f021cb0f7e8d150eed3f948e9.
(did duplicate cds_list_empty)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Mon, 5 Sep 2011 00:07:41 +0000 (20:07 -0400)]
Add cds_list_empty
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Sun, 4 Sep 2011 23:48:20 +0000 (19:48 -0400)]
list: Add cds_list_first_entry
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Sat, 3 Sep 2011 14:07:41 +0000 (10:07 -0400)]
rculfstack/queue: define _LGPL_SOURCE around static header include
... so the urcu-pointer header takes the LGPL version of rcu_dereference
and friends.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Sat, 3 Sep 2011 13:49:07 +0000 (09:49 -0400)]
Revert "Create per RCU flavor CDS libraries"
This reverts commit
d4b99c015229978810319cfd42e1c9763772fad8.
Minor change (not visible to end-users): this commit introduces a
liburcu-common.so to hold wfqueue, wfstack and futex fall-back code.
This .so is used by all URCU flavors, as well as liburcu-cds.so.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Sat, 3 Sep 2011 13:15:14 +0000 (09:15 -0400)]
Revert "CDS API: removal of rcu_read lock/unlock dep, removal of call_rcu argument from init"
This reverts commit
7618919ae496bda84a2efa4f2ad0abe569892a9e.
Rationale:
I thought about it some more, and had discussions with various people,
and there are a few reasons to go for a scheme where rcu read lock
should be taken by the caller, and to pass call_rcu as a parameter to
the data structure init function:
A) The advantage, as Paul E. McKenney pointed out, is that one single .so
is enough to support all RCU flavors. Very convenient for external data
structure containers.
B) It clearly documents where rcu read-side locks are needed, so the user
keep control and in-depth understanding of their read-side locks.
C) When multiple API functions that require RCU read-side lock to be
held (sometimes even the same lock) throughout a sequence of API
calls, we have no choice but to let the caller hold the read-side
lock.
D) Due to support of multiple nesting of rcu read-side lock, any
"improvement" we could get by releasing the read-side lock in
retry loops would vanish in the cases where we are called within
nested C.S..
E) If a library uses synchronize_rcu, this should be clearly documented,
and even frowned upon, because this involves important limitations on
the design of the caller, and important performance hit. There are
usually ways to reach the same result through use of call_rcu, which
should really be used thoroughout these libraries.
F) It clearly documents when a data structure needs to use call_rcu
internally.
G) Some very early benchmark results show that there is indeed not
much performance gain to achieve by inlining call_rcu, even if it is
a version with a cache for the "call_rcu structure" lookup
(per-cpu/per-thread/global). So passing it as a parameter to
the data structure init function should be fine, even in cases
where it is called very often.
H) For use-cases where applications would like to use more than one
RCU flavor concurrently (which is now supported), leaving management
of RCU read-side C.S. to the reader allows the application to take
more than one RCU read-side lock across API calls. It also lets the
application specify its own call_rcu function that could handle more
than one RCU flavor.
So for all these reasons, I reverting back to the API we have in our
last release (0.6.4).
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Sat, 3 Sep 2011 12:37:22 +0000 (08:37 -0400)]
Add __rcu annotation (unimplemented)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Thu, 1 Sep 2011 20:11:14 +0000 (16:11 -0400)]
Fix incorrect fsf address in header files
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Thu, 1 Sep 2011 13:31:55 +0000 (09:31 -0400)]
wfstack: push returns prior stack emptiness state
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Thu, 1 Sep 2011 13:28:30 +0000 (09:28 -0400)]
Make lf stack push return if the stack was empty
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Tue, 23 Aug 2011 21:22:00 +0000 (17:22 -0400)]
Document caa_container_of
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Sat, 20 Aug 2011 17:50:08 +0000 (13:50 -0400)]
urcu-bp: do not call munmap for NULL registry at exit
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Thu, 18 Aug 2011 17:41:11 +0000 (13:41 -0400)]
urcu libraries can directly use the _LGPL_SOURCE wfqueue
No need to link dynamically with the data structure object.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Thu, 18 Aug 2011 16:13:44 +0000 (12:13 -0400)]
rculfstack: document "push"
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Wed, 17 Aug 2011 21:58:30 +0000 (17:58 -0400)]
Add runall.sh to tarball
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Wed, 17 Aug 2011 21:57:19 +0000 (17:57 -0400)]
Fix build order of liburcu-cds-common
Caused make install to fail.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Wed, 17 Aug 2011 21:54:33 +0000 (17:54 -0400)]
CDS API: removal of rcu_read lock/unlock dep, removal of call_rcu argument from init
* API change * for all liburcu-cds* flavors.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Wed, 17 Aug 2011 21:54:07 +0000 (17:54 -0400)]
Fix missing check for SYS_membarrier in map header
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Wed, 17 Aug 2011 20:42:20 +0000 (16:42 -0400)]
Create per RCU flavor CDS libraries
Introduce per-flavor concurrent data structure libraries for data
structures depending on RCU:
liburcu-cds: memb flavor (default), matches -lurcu
liburcu-cds-qsbr: qsbr flavor, matches -lurcu-qsbr
liburcu-cds-mb: mb flavor, matches -lurcu-mb
liburcu-cds-signal, matches -lurcu-signal
liburcu-cds-bp, matches -lurcu-bp
liburcu-cds-common: Data structures not depending on RCU for
synchronization.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Wed, 17 Aug 2011 10:07:35 +0000 (06:07 -0400)]
Merge branch 'master' into lfqueue-dev
Paolo Bonzini [Wed, 17 Aug 2011 09:42:51 +0000 (05:42 -0400)]
urcu-qsbr: avoid useless futex wakeups and burning CPU for long grace periods
I noticed that urcu makes exactly _one_ attempt at using futexes
to avoid busy looping on synchronize_rcu. The attached patch instead
switches from busy waiting to futexes after RCU_QS_ACTIVE_ATTEMPTS.
To limit the amount of system calls, reading threads remember whether
they already had a quiescent state in this grace period; if so they were
already removed from the list, and can avoid signaling the futex.
Performance measured with rcutorture (nreaders: 10, nupdaters: 1,
duration: 10, median of nine runs):
RCU_QS_ACTIVE_ATTEMPTS == 100, no patch n_updates = 292
RCU_QS_ACTIVE_ATTEMPTS == 1, no patch n_updates = 290
RCU_QS_ACTIVE_ATTEMPTS == 100, with patch n_updates = 408
RCU_QS_ACTIVE_ATTEMPTS == 1, with patch n_updates = 404
(the first two cases are obviously the same; the only change is
when the futex is used, but over many calls there is no difference).
This patch matches the update to the Promela model.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Paolo Bonzini [Wed, 17 Aug 2011 09:33:58 +0000 (05:33 -0400)]
api: reimplement BUILD_BUG_ON in compiler.h
Even though it's just two lines of code, I'm reimplementing it
cleanly out of paranoia.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Paolo Bonzini [Wed, 17 Aug 2011 09:31:21 +0000 (05:31 -0400)]
test api cleanup: remove unused primitives
[ Mathieu: the rationale for this is that we can always add back that
code if every needed. Removing leftover GPLv2 test code is an
incentive to create the appropriate library-wide LGPL/MIT-style
abstractions.]
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Wed, 17 Aug 2011 09:28:33 +0000 (05:28 -0400)]
Merge branch 'master' into lfqueue-dev
Paolo Bonzini [Tue, 9 Aug 2011 20:49:27 +0000 (16:49 -0400)]
put thread offline while waiting for the init flag
Otherwise, the call_rcu thread might end up in a synchronize_rcu that
never ends.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Paolo Bonzini [Tue, 9 Aug 2011 20:44:20 +0000 (16:44 -0400)]
urcu: move private definitions to .c file
The reader does not and should not know about RCU_QS_ACTIVE_ATTEMPTS
and KICK_READER_LOOPS. Move the definition to urcu.c.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Paolo Bonzini [Tue, 9 Aug 2011 20:43:21 +0000 (16:43 -0400)]
urcu-bp: move private definitions to .c file
The reader does not and should not know about RCU_QS_ACTIVE_ATTEMPTS.
Move the definition to urcu-bp.c.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Paolo Bonzini [Tue, 9 Aug 2011 20:42:53 +0000 (16:42 -0400)]
urcu-qsbr: move private definitions to .c file
The reader does not and should not know about RCU_QS_ACTIVE_ATTEMPTS.
Move the definition to urcu-qsbr.c. Also remove KICK_READER_LOOPS.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Paolo Bonzini [Tue, 9 Aug 2011 20:40:29 +0000 (16:40 -0400)]
rcutorture: fix rcutorture-qsbr
rcutorture-qsbr is not marking quiescent states, so it will always
have just one update in the whole test. Fix it.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Paolo Bonzini [Tue, 9 Aug 2011 12:37:14 +0000 (08:37 -0400)]
wfqueue: fix type-incorrect assignment
The "old_tail = q->tail, q->tail = node" assignment in wfqueue
is not type safe; q->tail is a pointer to pointer to node and the
correct value to assign is &node->next. While the arithmetic is
the same, it is better to be tidy.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mathieu Desnoyers [Tue, 16 Aug 2011 11:11:16 +0000 (07:11 -0400)]
Fix tests Makefile EXTRA_DIST to use api.h
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Duncan Sands [Tue, 16 Aug 2011 11:10:01 +0000 (07:10 -0400)]
Fix choice of default flavour in urcu/map/urcu.h
Hi, I noticed in the 0.64 release (and git too) that if a flavour is not
specified explicitly then RCU_MB is chosen in urcu/map/urcu.h, while the
docs say and the Makefile expects RCU_MEMBARRIER. Note that the header
file urcu/static/urcu.h has similar logic but uses RCU_MEMBARRIER for
the default.
Before this patch:
$ nm *.a | grep rcu_init
00000000000003c0 T rcu_init_mb
00000000000003c0 T rcu_init_mb
0000000000000000 T rcu_init_sig
After this patch:
$ nm *.a | grep rcu_init
00000000000003c0 T rcu_init_memb
00000000000003c0 T rcu_init_mb
0000000000000000 T rcu_init_sig
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Paolo Bonzini [Tue, 16 Aug 2011 10:52:54 +0000 (06:52 -0400)]
api: remove list/hlist
Remove the parts that actually caused compilation to fail.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Paolo Bonzini [Tue, 16 Aug 2011 10:51:55 +0000 (06:51 -0400)]
api: remove arch-specific files
No change since they were a subset of api_gcc.h. api_gcc.h is
renamed to api.h, and configure need not create a symlink anymore.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Paolo Bonzini [Tue, 16 Aug 2011 10:41:06 +0000 (06:41 -0400)]
api: make api_gcc.h a superset of the other headers
After this patch the only differences are:
- for_each_tid is now defined in api_x86.h
- HAVE_CPU_SET_T and HAVE_SCHED_SETAFFINITY are now defined in api_ppc.h
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Paolo Bonzini [Fri, 12 Aug 2011 22:23:59 +0000 (18:23 -0400)]
tests api: remove atomics
The code is #if 0'd already, remove it.
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Paolo Bonzini [Tue, 9 Aug 2011 20:49:27 +0000 (16:49 -0400)]
put thread offline while waiting for the init flag
Otherwise, the call_rcu thread might end up in a synchronize_rcu that
never ends.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Paolo Bonzini [Tue, 9 Aug 2011 20:44:20 +0000 (16:44 -0400)]
urcu: move private definitions to .c file
The reader does not and should not know about RCU_QS_ACTIVE_ATTEMPTS
and KICK_READER_LOOPS. Move the definition to urcu.c.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
This page took 0.044734 seconds and 4 git commands to generate.