diff options
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/rcupdate.c | 32 | ||||
| -rw-r--r-- | kernel/rcutiny.c | 45 | ||||
| -rw-r--r-- | kernel/rcutiny_plugin.h | 203 | ||||
| -rw-r--r-- | kernel/rcutorture.c | 26 | ||||
| -rw-r--r-- | kernel/rcutree.c | 672 | ||||
| -rw-r--r-- | kernel/rcutree.h | 116 | ||||
| -rw-r--r-- | kernel/rcutree_plugin.h | 595 | ||||
| -rw-r--r-- | kernel/rcutree_trace.c | 192 | ||||
| -rw-r--r-- | kernel/softirq.c | 2 |
9 files changed, 1438 insertions, 445 deletions
diff --git a/kernel/rcupdate.c b/kernel/rcupdate.c index f3240e987928..7784bd216b6a 100644 --- a/kernel/rcupdate.c +++ b/kernel/rcupdate.c | |||
| @@ -142,10 +142,17 @@ static int rcuhead_fixup_init(void *addr, enum debug_obj_state state) | |||
| 142 | * Ensure that queued callbacks are all executed. | 142 | * Ensure that queued callbacks are all executed. |
| 143 | * If we detect that we are nested in a RCU read-side critical | 143 | * If we detect that we are nested in a RCU read-side critical |
| 144 | * section, we should simply fail, otherwise we would deadlock. | 144 | * section, we should simply fail, otherwise we would deadlock. |
| 145 | * In !PREEMPT configurations, there is no way to tell if we are | ||
| 146 | * in a RCU read-side critical section or not, so we never | ||
| 147 | * attempt any fixup and just print a warning. | ||
| 145 | */ | 148 | */ |
| 149 | #ifndef CONFIG_PREEMPT | ||
| 150 | WARN_ON_ONCE(1); | ||
| 151 | return 0; | ||
| 152 | #endif | ||
| 146 | if (rcu_preempt_depth() != 0 || preempt_count() != 0 || | 153 | if (rcu_preempt_depth() != 0 || preempt_count() != 0 || |
| 147 | irqs_disabled()) { | 154 | irqs_disabled()) { |
| 148 | WARN_ON(1); | 155 | WARN_ON_ONCE(1); |
| 149 | return 0; | 156 | return 0; |
| 150 | } | 157 | } |
| 151 | rcu_barrier(); | 158 | rcu_barrier(); |
| @@ -184,10 +191,17 @@ static int rcuhead_fixup_activate(void *addr, enum debug_obj_state state) | |||
| 184 | * Ensure that queued callbacks are all executed. | 191 | * Ensure that queued callbacks are all executed. |
| 185 | * If we detect that we are nested in a RCU read-side critical | 192 | * If we detect that we are nested in a RCU read-side critical |
| 186 | * section, we should simply fail, otherwise we would deadlock. | 193 | * section, we should simply fail, otherwise we would deadlock. |
| 194 | * In !PREEMPT configurations, there is no way to tell if we are | ||
| 195 | * in a RCU read-side critical section or not, so we never | ||
| 196 | * attempt any fixup and just print a warning. | ||
| 187 | */ | 197 | */ |
| 198 | #ifndef CONFIG_PREEMPT | ||
| 199 | WARN_ON_ONCE(1); | ||
| 200 | return 0; | ||
| 201 | #endif | ||
| 188 | if (rcu_preempt_depth() != 0 || preempt_count() != 0 || | 202 | if (rcu_preempt_depth() != 0 || preempt_count() != 0 || |
| 189 | irqs_disabled()) { | 203 | irqs_disabled()) { |
| 190 | WARN_ON(1); | 204 | WARN_ON_ONCE(1); |
| 191 | return 0; | 205 | return 0; |
| 192 | } | 206 | } |
| 193 | rcu_barrier(); | 207 | rcu_barrier(); |
| @@ -214,15 +228,17 @@ static int rcuhead_fixup_free(void *addr, enum debug_obj_state state) | |||
| 214 | * Ensure that queued callbacks are all executed. | 228 | * Ensure that queued callbacks are all executed. |
| 215 | * If we detect that we are nested in a RCU read-side critical | 229 | * If we detect that we are nested in a RCU read-side critical |
| 216 | * section, we should simply fail, otherwise we would deadlock. | 230 | * section, we should simply fail, otherwise we would deadlock. |
| 217 | * Note that the machinery to reliably determine whether | 231 | * In !PREEMPT configurations, there is no way to tell if we are |
| 218 | * or not we are in an RCU read-side critical section | 232 | * in a RCU read-side critical section or not, so we never |
| 219 | * exists only in the preemptible RCU implementations | 233 | * attempt any fixup and just print a warning. |
| 220 | * (TINY_PREEMPT_RCU and TREE_PREEMPT_RCU), which is why | ||
| 221 | * DEBUG_OBJECTS_RCU_HEAD is disallowed if !PREEMPT. | ||
| 222 | */ | 234 | */ |
| 235 | #ifndef CONFIG_PREEMPT | ||
| 236 | WARN_ON_ONCE(1); | ||
| 237 | return 0; | ||
| 238 | #endif | ||
| 223 | if (rcu_preempt_depth() != 0 || preempt_count() != 0 || | 239 | if (rcu_preempt_depth() != 0 || preempt_count() != 0 || |
| 224 | irqs_disabled()) { | 240 | irqs_disabled()) { |
| 225 | WARN_ON(1); | 241 | WARN_ON_ONCE(1); |
| 226 | return 0; | 242 | return 0; |
| 227 | } | 243 | } |
| 228 | rcu_barrier(); | 244 | rcu_barrier(); |
diff --git a/kernel/rcutiny.c b/kernel/rcutiny.c index 0c343b9a46d5..421abfd3641d 100644 --- a/kernel/rcutiny.c +++ b/kernel/rcutiny.c | |||
| @@ -40,10 +40,10 @@ | |||
| 40 | static struct task_struct *rcu_kthread_task; | 40 | static struct task_struct *rcu_kthread_task; |
| 41 | static DECLARE_WAIT_QUEUE_HEAD(rcu_kthread_wq); | 41 | static DECLARE_WAIT_QUEUE_HEAD(rcu_kthread_wq); |
| 42 | static unsigned long have_rcu_kthread_work; | 42 | static unsigned long have_rcu_kthread_work; |
| 43 | static void invoke_rcu_kthread(void); | ||
| 44 | 43 | ||
| 45 | /* Forward declarations for rcutiny_plugin.h. */ | 44 | /* Forward declarations for rcutiny_plugin.h. */ |
| 46 | struct rcu_ctrlblk; | 45 | struct rcu_ctrlblk; |
| 46 | static void invoke_rcu_kthread(void); | ||
| 47 | static void rcu_process_callbacks(struct rcu_ctrlblk *rcp); | 47 | static void rcu_process_callbacks(struct rcu_ctrlblk *rcp); |
| 48 | static int rcu_kthread(void *arg); | 48 | static int rcu_kthread(void *arg); |
| 49 | static void __call_rcu(struct rcu_head *head, | 49 | static void __call_rcu(struct rcu_head *head, |
| @@ -79,36 +79,45 @@ void rcu_exit_nohz(void) | |||
| 79 | #endif /* #ifdef CONFIG_NO_HZ */ | 79 | #endif /* #ifdef CONFIG_NO_HZ */ |
| 80 | 80 | ||
| 81 | /* | 81 | /* |
| 82 | * Helper function for rcu_qsctr_inc() and rcu_bh_qsctr_inc(). | 82 | * Helper function for rcu_sched_qs() and rcu_bh_qs(). |
| 83 | * Also disable irqs to avoid confusion due to interrupt handlers | 83 | * Also irqs are disabled to avoid confusion due to interrupt handlers |
| 84 | * invoking call_rcu(). | 84 | * invoking call_rcu(). |
| 85 | */ | 85 | */ |
| 86 | static int rcu_qsctr_help(struct rcu_ctrlblk *rcp) | 86 | static int rcu_qsctr_help(struct rcu_ctrlblk *rcp) |
| 87 | { | 87 | { |
| 88 | unsigned long flags; | ||
| 89 | |||
| 90 | local_irq_save(flags); | ||
| 91 | if (rcp->rcucblist != NULL && | 88 | if (rcp->rcucblist != NULL && |
| 92 | rcp->donetail != rcp->curtail) { | 89 | rcp->donetail != rcp->curtail) { |
| 93 | rcp->donetail = rcp->curtail; | 90 | rcp->donetail = rcp->curtail; |
| 94 | local_irq_restore(flags); | ||
| 95 | return 1; | 91 | return 1; |
| 96 | } | 92 | } |
| 97 | local_irq_restore(flags); | ||
| 98 | 93 | ||
| 99 | return 0; | 94 | return 0; |
| 100 | } | 95 | } |
| 101 | 96 | ||
| 102 | /* | 97 | /* |
| 98 | * Wake up rcu_kthread() to process callbacks now eligible for invocation | ||
| 99 | * or to boost readers. | ||
| 100 | */ | ||
| 101 | static void invoke_rcu_kthread(void) | ||
| 102 | { | ||
| 103 | have_rcu_kthread_work = 1; | ||
| 104 | wake_up(&rcu_kthread_wq); | ||
| 105 | } | ||
| 106 | |||
| 107 | /* | ||
| 103 | * Record an rcu quiescent state. And an rcu_bh quiescent state while we | 108 | * Record an rcu quiescent state. And an rcu_bh quiescent state while we |
| 104 | * are at it, given that any rcu quiescent state is also an rcu_bh | 109 | * are at it, given that any rcu quiescent state is also an rcu_bh |
| 105 | * quiescent state. Use "+" instead of "||" to defeat short circuiting. | 110 | * quiescent state. Use "+" instead of "||" to defeat short circuiting. |
| 106 | */ | 111 | */ |
| 107 | void rcu_sched_qs(int cpu) | 112 | void rcu_sched_qs(int cpu) |
| 108 | { | 113 | { |
| 114 | unsigned long flags; | ||
| 115 | |||
| 116 | local_irq_save(flags); | ||
| 109 | if (rcu_qsctr_help(&rcu_sched_ctrlblk) + | 117 | if (rcu_qsctr_help(&rcu_sched_ctrlblk) + |
| 110 | rcu_qsctr_help(&rcu_bh_ctrlblk)) | 118 | rcu_qsctr_help(&rcu_bh_ctrlblk)) |
| 111 | invoke_rcu_kthread(); | 119 | invoke_rcu_kthread(); |
| 120 | local_irq_restore(flags); | ||
| 112 | } | 121 | } |
| 113 | 122 | ||
| 114 | /* | 123 | /* |
| @@ -116,8 +125,12 @@ void rcu_sched_qs(int cpu) | |||
| 116 | */ | 125 | */ |
| 117 | void rcu_bh_qs(int cpu) | 126 | void rcu_bh_qs(int cpu) |
| 118 | { | 127 | { |
| 128 | unsigned long flags; | ||
| 129 | |||
| 130 | local_irq_save(flags); | ||
| 119 | if (rcu_qsctr_help(&rcu_bh_ctrlblk)) | 131 | if (rcu_qsctr_help(&rcu_bh_ctrlblk)) |
| 120 | invoke_rcu_kthread(); | 132 | invoke_rcu_kthread(); |
| 133 | local_irq_restore(flags); | ||
| 121 | } | 134 | } |
| 122 | 135 | ||
| 123 | /* | 136 | /* |
| @@ -167,7 +180,7 @@ static void rcu_process_callbacks(struct rcu_ctrlblk *rcp) | |||
| 167 | prefetch(next); | 180 | prefetch(next); |
| 168 | debug_rcu_head_unqueue(list); | 181 | debug_rcu_head_unqueue(list); |
| 169 | local_bh_disable(); | 182 | local_bh_disable(); |
| 170 | list->func(list); | 183 | __rcu_reclaim(list); |
| 171 | local_bh_enable(); | 184 | local_bh_enable(); |
| 172 | list = next; | 185 | list = next; |
| 173 | RCU_TRACE(cb_count++); | 186 | RCU_TRACE(cb_count++); |
| @@ -208,20 +221,6 @@ static int rcu_kthread(void *arg) | |||
| 208 | } | 221 | } |
| 209 | 222 | ||
| 210 | /* | 223 | /* |
| 211 | * Wake up rcu_kthread() to process callbacks now eligible for invocation | ||
