Skip to content

Commit a649d25

Browse files
committed
rcu: Add lockdep_assert_irqs_disabled() to rcu_sched_clock_irq() and callees
This commit adds a number of lockdep_assert_irqs_disabled() calls to rcu_sched_clock_irq() and a number of the functions that it calls. The point of this is to help track down a situation where lockdep appears to be insisting that interrupts are enabled within these functions, which should only ever be invoked from the scheduling-clock interrupt handler. Link: https://lore.kernel.org/lkml/20201111133813.GA81547@elver.google.com/ Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
1 parent c5586e3 commit a649d25

3 files changed

Lines changed: 13 additions & 0 deletions

File tree

‎kernel/rcu/tree.c‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2553,6 +2553,7 @@ static void rcu_do_batch(struct rcu_data *rdp)
25532553
void rcu_sched_clock_irq(int user)
25542554
{
25552555
trace_rcu_utilization(TPS("Start scheduler-tick"));
2556+
lockdep_assert_irqs_disabled();
25562557
raw_cpu_inc(rcu_data.ticks_this_gp);
25572558
/* The load-acquire pairs with the store-release setting to true. */
25582559
if (smp_load_acquire(this_cpu_ptr(&rcu_data.rcu_urgent_qs))) {
@@ -2566,6 +2567,7 @@ void rcu_sched_clock_irq(int user)
25662567
rcu_flavor_sched_clock_irq(user);
25672568
if (rcu_pending(user))
25682569
invoke_rcu_core();
2570+
lockdep_assert_irqs_disabled();
25692571

25702572
trace_rcu_utilization(TPS("End scheduler-tick"));
25712573
}
@@ -3690,6 +3692,8 @@ static int rcu_pending(int user)
36903692
struct rcu_data *rdp = this_cpu_ptr(&rcu_data);
36913693
struct rcu_node *rnp = rdp->mynode;
36923694

3695+
lockdep_assert_irqs_disabled();
3696+
36933697
/* Check for CPU stalls, if enabled. */
36943698
check_cpu_stall(rdp);
36953699

‎kernel/rcu/tree_plugin.h‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -682,6 +682,7 @@ static void rcu_flavor_sched_clock_irq(int user)
682682
{
683683
struct task_struct *t = current;
684684

685+
lockdep_assert_irqs_disabled();
685686
if (user || rcu_is_cpu_rrupt_from_idle()) {
686687
rcu_note_voluntary_context_switch(current);
687688
}

‎kernel/rcu/tree_stall.h‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,7 @@ static int rcu_print_task_stall(struct rcu_node *rnp, unsigned long flags)
260260
struct task_struct *t;
261261
struct task_struct *ts[8];
262262

263+
lockdep_assert_irqs_disabled();
263264
if (!rcu_preempt_blocked_readers_cgp(rnp))
264265
return 0;
265266
pr_err("\tTasks blocked on level-%d rcu_node (CPUs %d-%d):",
@@ -284,6 +285,7 @@ static int rcu_print_task_stall(struct rcu_node *rnp, unsigned long flags)
284285
".q"[rscr.rs.b.need_qs],
285286
".e"[rscr.rs.b.exp_hint],
286287
".l"[rscr.on_blkd_list]);
288+
lockdep_assert_irqs_disabled();
287289
put_task_struct(t);
288290
ndetected++;
289291
}
@@ -472,6 +474,8 @@ static void print_other_cpu_stall(unsigned long gp_seq, unsigned long gps)
472474
struct rcu_node *rnp;
473475
long totqlen = 0;
474476

477+
lockdep_assert_irqs_disabled();
478+
475479
/* Kick and suppress, if so configured. */
476480
rcu_stall_kick_kthreads();
477481
if (rcu_stall_is_suppressed())
@@ -493,6 +497,7 @@ static void print_other_cpu_stall(unsigned long gp_seq, unsigned long gps)
493497
}
494498
}
495499
ndetected += rcu_print_task_stall(rnp, flags); // Releases rnp->lock.
500+
lockdep_assert_irqs_disabled();
496501
}
497502

498503
for_each_possible_cpu(cpu)
@@ -538,6 +543,8 @@ static void print_cpu_stall(unsigned long gps)
538543
struct rcu_node *rnp = rcu_get_root();
539544
long totqlen = 0;
540545

546+
lockdep_assert_irqs_disabled();
547+
541548
/* Kick and suppress, if so configured. */
542549
rcu_stall_kick_kthreads();
543550
if (rcu_stall_is_suppressed())
@@ -592,6 +599,7 @@ static void check_cpu_stall(struct rcu_data *rdp)
592599
unsigned long js;
593600
struct rcu_node *rnp;
594601

602+
lockdep_assert_irqs_disabled();
595603
if ((rcu_stall_is_suppressed() && !READ_ONCE(rcu_kick_kthreads)) ||
596604
!rcu_gp_in_progress())
597605
return;

0 commit comments

Comments
 (0)