Skip to content

Commit ea5e5bc

Browse files
paulmckrcugregkh
authored andcommitted
rcu: Add lockdep_assert_irqs_disabled() to rcu_sched_clock_irq() and callees
[ Upstream commit a649d25 ] 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> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 527b56d commit ea5e5bc

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
@@ -2561,6 +2561,7 @@ static void rcu_do_batch(struct rcu_data *rdp)
25612561
void rcu_sched_clock_irq(int user)
25622562
{
25632563
trace_rcu_utilization(TPS("Start scheduler-tick"));
2564+
lockdep_assert_irqs_disabled();
25642565
raw_cpu_inc(rcu_data.ticks_this_gp);
25652566
/* The load-acquire pairs with the store-release setting to true. */
25662567
if (smp_load_acquire(this_cpu_ptr(&rcu_data.rcu_urgent_qs))) {
@@ -2574,6 +2575,7 @@ void rcu_sched_clock_irq(int user)
25742575
rcu_flavor_sched_clock_irq(user);
25752576
if (rcu_pending(user))
25762577
invoke_rcu_core();
2578+
lockdep_assert_irqs_disabled();
25772579

25782580
trace_rcu_utilization(TPS("End scheduler-tick"));
25792581
}
@@ -3730,6 +3732,8 @@ static int rcu_pending(int user)
37303732
struct rcu_data *rdp = this_cpu_ptr(&rcu_data);
37313733
struct rcu_node *rnp = rdp->mynode;
37323734

3735+
lockdep_assert_irqs_disabled();
3736+
37333737
/* Check for CPU stalls, if enabled. */
37343738
check_cpu_stall(rdp);
37353739

‎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
@@ -262,6 +262,7 @@ static int rcu_print_task_stall(struct rcu_node *rnp, unsigned long flags)
262262
struct task_struct *t;
263263
struct task_struct *ts[8];
264264

265+
lockdep_assert_irqs_disabled();
265266
if (!rcu_preempt_blocked_readers_cgp(rnp))
266267
return 0;
267268
pr_err("\tTasks blocked on level-%d rcu_node (CPUs %d-%d):",
@@ -286,6 +287,7 @@ static int rcu_print_task_stall(struct rcu_node *rnp, unsigned long flags)
286287
".q"[rscr.rs.b.need_qs],
287288
".e"[rscr.rs.b.exp_hint],
288289
".l"[rscr.on_blkd_list]);
290+
lockdep_assert_irqs_disabled();
289291
put_task_struct(t);
290292
ndetected++;
291293
}
@@ -474,6 +476,8 @@ static void print_other_cpu_stall(unsigned long gp_seq, unsigned long gps)
474476
struct rcu_node *rnp;
475477
long totqlen = 0;
476478

479+
lockdep_assert_irqs_disabled();
480+
477481
/* Kick and suppress, if so configured. */
478482
rcu_stall_kick_kthreads();
479483
if (rcu_stall_is_suppressed())
@@ -495,6 +499,7 @@ static void print_other_cpu_stall(unsigned long gp_seq, unsigned long gps)
495499
}
496500
}
497501
ndetected += rcu_print_task_stall(rnp, flags); // Releases rnp->lock.
502+
lockdep_assert_irqs_disabled();
498503
}
499504

500505
for_each_possible_cpu(cpu)
@@ -540,6 +545,8 @@ static void print_cpu_stall(unsigned long gps)
540545
struct rcu_node *rnp = rcu_get_root();
541546
long totqlen = 0;
542547

548+
lockdep_assert_irqs_disabled();
549+
543550
/* Kick and suppress, if so configured. */
544551
rcu_stall_kick_kthreads();
545552
if (rcu_stall_is_suppressed())
@@ -594,6 +601,7 @@ static void check_cpu_stall(struct rcu_data *rdp)
594601
unsigned long js;
595602
struct rcu_node *rnp;
596603

604+
lockdep_assert_irqs_disabled();
597605
if ((rcu_stall_is_suppressed() && !READ_ONCE(rcu_kick_kthreads)) ||
598606
!rcu_gp_in_progress())
599607
return;

0 commit comments

Comments
 (0)