hc
2024-01-05 071106ecf68c401173c58808b1cf5f68cc50d390
kernel/include/linux/rcupdate.h
....@@ -54,11 +54,6 @@
5454 * types of kernel builds, the rcu_read_lock() nesting depth is unknowable.
5555 */
5656 #define rcu_preempt_depth() (current->rcu_read_lock_nesting)
57
-#ifndef CONFIG_PREEMPT_RT
58
-#define sched_rcu_preempt_depth() rcu_preempt_depth()
59
-#else
60
-static inline int sched_rcu_preempt_depth(void) { return 0; }
61
-#endif
6257
6358 #else /* #ifdef CONFIG_PREEMPT_RCU */
6459
....@@ -84,13 +79,11 @@
8479 return 0;
8580 }
8681
87
-#define sched_rcu_preempt_depth() rcu_preempt_depth()
88
-
8982 #endif /* #else #ifdef CONFIG_PREEMPT_RCU */
9083
9184 /* Internal to kernel */
9285 void rcu_init(void);
93
-extern int rcu_scheduler_active __read_mostly;
86
+extern int rcu_scheduler_active;
9487 void rcu_sched_clock_irq(int user);
9588 void rcu_report_dead(unsigned int cpu);
9689 void rcutree_migrate_callbacks(int cpu);
....@@ -196,6 +189,7 @@
196189
197190 #define rcu_note_voluntary_context_switch(t) rcu_tasks_qs(t, false)
198191 void exit_tasks_rcu_start(void);
192
+void exit_tasks_rcu_stop(void);
199193 void exit_tasks_rcu_finish(void);
200194 #else /* #ifdef CONFIG_TASKS_RCU_GENERIC */
201195 #define rcu_tasks_qs(t, preempt) do { } while (0)
....@@ -203,6 +197,7 @@
203197 #define call_rcu_tasks call_rcu
204198 #define synchronize_rcu_tasks synchronize_rcu
205199 static inline void exit_tasks_rcu_start(void) { }
200
+static inline void exit_tasks_rcu_stop(void) { }
206201 static inline void exit_tasks_rcu_finish(void) { }
207202 #endif /* #else #ifdef CONFIG_TASKS_RCU_GENERIC */
208203
....@@ -313,11 +308,18 @@
313308 * RCU_LOCKDEP_WARN - emit lockdep splat if specified condition is met
314309 * @c: condition to check
315310 * @s: informative message
311
+ *
312
+ * This checks debug_lockdep_rcu_enabled() before checking (c) to
313
+ * prevent early boot splats due to lockdep not yet being initialized,
314
+ * and rechecks it after checking (c) to prevent false-positive splats
315
+ * due to races with lockdep being disabled. See commit 3066820034b5dd
316
+ * ("rcu: Reject RCU_LOCKDEP_WARN() false positives") for more detail.
316317 */
317318 #define RCU_LOCKDEP_WARN(c, s) \
318319 do { \
319320 static bool __section(".data.unlikely") __warned; \
320
- if ((c) && debug_lockdep_rcu_enabled() && !__warned) { \
321
+ if (debug_lockdep_rcu_enabled() && (c) && \
322
+ debug_lockdep_rcu_enabled() && !__warned) { \
321323 __warned = true; \
322324 lockdep_rcu_suspicious(__FILE__, __LINE__, s); \
323325 } \
....@@ -336,8 +338,7 @@
336338 #define rcu_sleep_check() \
337339 do { \
338340 rcu_preempt_sleep_check(); \
339
- if (!IS_ENABLED(CONFIG_PREEMPT_RT)) \
340
- RCU_LOCKDEP_WARN(lock_is_held(&rcu_bh_lock_map), \
341
+ RCU_LOCKDEP_WARN(lock_is_held(&rcu_bh_lock_map), \
341342 "Illegal context switch in RCU-bh read-side critical section"); \
342343 RCU_LOCKDEP_WARN(lock_is_held(&rcu_sched_lock_map), \
343344 "Illegal context switch in RCU-sched read-side critical section"); \