Revert "qsbr urcu: make it safe to call rcu_sychronize from a registered thread."
[urcu.git] / README
CommitLineData
7ac06cef 1Userspace RCU Implementation
c97ae6eb 2by Mathieu Desnoyers and Paul E. McKenney
6991f61a 3
c97ae6eb
PMF
4BUILDING
5--------
6991f61a 6
c97ae6eb
PMF
7 make
8 make install
9
aa8c36e0 10
c97ae6eb
PMF
11QUICK START GUIDE
12-----------------
aa8c36e0 13
c97ae6eb
PMF
14Initialization
15
16 Each thread that has reader critical sections (that uses
17 rcu_read_lock()/rcu_read_unlock() must first register to the URCU
18 library. This is done by calling rcu_register_thread().
19
20Reading
21
22 Reader critical sections must be protected by locating them between
23 calls to rcu_read_lock() and rcu_read_unlock(). Inside that lock,
24 rcu_dereference() may be called to read an RCU protected pointer.
25
26Writing
27
28 rcu_assign_pointer() and rcu_xchg_pointer() may be called anywhere.
9fb223da
MD
29 After, synchronize_rcu() must be called. When it returns, the old
30 values are not in usage anymore.
c97ae6eb 31
dd052bd3
PMF
32Being careful with signals
33
7ac06cef 34 The urcu library uses signals internally. The signal handler is
dd052bd3
PMF
35 registered with the SA_RESTART flag. However, these signals may cause
36 some non-restartable system calls to fail with errno = EINTR. Care
37 should be taken to restart system calls manually if they fail with this
38 error. A list of non-restartable system calls may be found in
b4ce1526 39 signal(7). To ensure the Userspace RCU library does not use signals,
7ac06cef 40 see "Usage of liburcu-mb" below.
c97ae6eb 41
7ac06cef
MD
42 Read-side critical sections can are allowed in a signal handler with
43 liburcu and liburcu-mb. Be careful, however, to disable these signals
44 between thread creation and calls to rcu_register_thread(), because a
45 signal handler nesting on an unregistered thread would not be allowed to
46 call rcu_read_lock().
cee02f0a 47
7ac06cef 48Usage of liburcu
c97ae6eb 49
7ac06cef
MD
50 This is the preferred version of the library, both in terms of speed and
51 flexibility. Define _LGPL_SOURCE if your code is LGPL or GPL (otherwise
52 function calls will be generated instead of inlines). Use the urcu.h
53 header. Link the application with "-lurcu".
54
55Usage of liburcu-mb
56
57 Compile code with "-DCONFIG_URCU_AVOID_SIGNALS" and link with
58 "-lurcu-mb" to use a version of the urcu library which does not need to
59 reserve a signal number. CONFIG_URCU_AVOID_SIGNALS uses full SMP
60 barriers for readers. This eliminates the need for signals but results
61 in slower reads.
62
63Usage of liburcu-qsbr
64
65 The QSBR flavor of RCU needs to have each reader thread executing
66 rcu_quiescent_state() periodically to progress. rcu_thread_online() and
67 rcu_thread_offline() can be used to mark long periods for which the
68 threads are not active. Link with "-lurcu-qsbr" and use urcu-qsbr.h.
c97ae6eb 69
cee02f0a
MD
70Usage of DEBUG_RCU
71
72 DEBUG_RCU is used to add internal debugging self-checks to the
73 RCU library. This define adds a performance penality when enabled.
fb6e510b
MD
74 Can be enabled by uncommenting the corresponding line in
75 Makefile.build.inc.
c97ae6eb
PMF
76
77Usage of DEBUG_YIELD
78
79 DEBUG_YIELD is used to add random delays in the code for testing
80 purposes.
7ac06cef
MD
81
82
This page took 0.0252 seconds and 4 git commands to generate.