All of lore.kernel.org
 help / color / mirror / Atom feed
* [tip:sched/core] [sched/fair]  c9d93a73ce: WARNING:suspicious_RCU_usage
@ 2026-05-23 13:27 kernel test robot
  2026-05-25  1:53 ` Chen, Yu C
  0 siblings, 1 reply; 4+ messages in thread
From: kernel test robot @ 2026-05-23 13:27 UTC (permalink / raw)
  To: Andrea Righi
  Cc: oe-lkp, lkp, linux-kernel, x86, Peter Zijlstra, K Prateek Nayak,
	Vincent Guittot, aubrey.li, yu.c.chen, oliver.sang



Hello,

kernel test robot noticed "WARNING:suspicious_RCU_usage" on:

commit: c9d93a73ce871ca32caf9308562501290b64b955 ("sched/fair: Drop redundant RCU read lock in NOHZ kick path")
https://git.kernel.org/cgit/linux/kernel/git/tip/tip.git sched/core


in testcase: rcutorture
version: 
with following parameters:

	runtime: 300s
	test: cpuhotplug
	torture_type: tasks-rude



config: x86_64-randconfig-001-20260521
compiler: clang-20
test machine: qemu-system-x86_64 -enable-kvm -cpu SandyBridge -smp 2 -m 32G

(please refer to attached dmesg/kmsg for entire log/backtrace)


If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <oliver.sang@intel.com>
| Closes: https://lore.kernel.org/oe-lkp/202605232131.cfcd45a2-lkp@intel.com



[  102.159951][   T23]
[  102.160730][   T23] =============================
[  102.162072][   T23] WARNING: suspicious RCU usage
[  102.163398][   T23] 7.1.0-rc2-00011-gc9d93a73ce87 #1 Not tainted
[  102.165064][   T23] -----------------------------
[  102.167687][   T23] kernel/sched/fair.c:12793 suspicious rcu_dereference_check() usage!
[  102.169994][   T23]
[  102.169994][   T23] other info that might help us debug this:
[  102.169994][   T23]
[  102.169994][   T23] other info that might help us debug this:
[  102.169994][   T23]
[  102.169994][   T23] other info that might help us debug this:
[  102.169994][   T23]
[  102.175418][   T23]
[  102.175418][   T23] rcu_scheduler_active = 2, debug_locks = 1
[  102.175418][   T23]
[  102.175418][   T23] rcu_scheduler_active = 2, debug_locks = 1
[  102.175418][   T23]
[  102.175418][   T23] rcu_scheduler_active = 2, debug_locks = 1
[  102.180431][   T23] 2 locks held by cpuhp/1/23:
[  102.182158][   T23]  #0: ffffffff872eadf0 (cpu_hotplug_lock){++++}-{0:0}, at: cpuhp_thread_fun (cpu.c:545 cpu.c:1085)
[  102.184843][   T23]  #1: ffffffff872eaf20 (cpuhp_state-down){+.+.}-{0:0}, at: cpuhp_thread_fun (cpu.c:545 cpu.c:1085)
[  102.187589][   T23]
[  102.187589][   T23] stack backtrace:
[  102.187589][   T23]
[  102.187589][   T23] stack backtrace:
[  102.187589][   T23]
[  102.187589][   T23] stack backtrace:
[  102.189233][   T23] CPU: 1 UID: 0 PID: 23 Comm: cpuhp/1 Not tainted 7.1.0-rc2-00011-gc9d93a73ce87 #1 PREEMPT
[  102.189241][   T23] Call Trace:
[  102.189245][   T23]  <TASK>
[  102.189251][   T23]  __dump_stack (dump_stack.c:94)
[  102.189260][   T23]  dump_stack_lvl (dump_stack.c:120)
[  102.189266][   T23]  dump_stack (dump_stack.c:129)
[  102.189270][   T23]  lockdep_rcu_suspicious (locking/lockdep.c:6876)
[  102.189279][   T23]  set_cpu_sd_state_busy (sched/fair.c:12793)
[  102.189286][   T23]  nohz_balance_exit_idle (sched/fair.c:12812)
[  102.189293][   T23]  sched_cpu_deactivate (sched/core.c:8677)
[  102.189300][   T23]  ? trace_cpuhp_enter (trace/events/cpuhp.h:10)
[  102.189305][   T23]  ? balance_push_set (sched/sched.h:?)
[  102.189312][   T23]  cpuhp_invoke_callback (cpu.c:194)
[  102.189315][   T23]  ? lock_acquire (locking/lockdep.c:5868)
[  102.189321][   T23]  ? cpuhp_thread_fun (cpu.c:545 cpu.c:1085)
[  102.189326][   T23]  ? lock_acquire (locking/lockdep.c:5868)
[  102.189337][   T23]  cpuhp_thread_fun (cpu.c:1109)
[  102.189341][   T23]  ? cpuhp_thread_fun (cpu.c:545 cpu.c:1085)
[  102.189350][   T23]  ? cpuhp_should_run (cpu.c:?)
[  102.189354][   T23]  smpboot_thread_fn (smpboot.c:160)
[  102.189364][   T23]  ? smpboot_thread_fn (smpboot.c:?)
[  102.189373][   T23]  kthread (kthread.c:436)
[  102.189379][   T23]  ? smpboot_unregister_percpu_thread (smpboot.c:321)
[  102.189385][   T23]  ? kthread_unuse_mm (kthread.c:?)
[  102.189392][   T23]  ret_from_fork (x86/kernel/process.c:158)
[  102.189397][   T23]  ? kthread_unuse_mm (kthread.c:?)
[  102.189402][   T23]  ret_from_fork_asm (x86/entry/entry_64.S:245)
[  102.189416][   T23]  </TASK>


The kernel config and materials to reproduce are available at:
https://download.01.org/0day-ci/archive/20260523/202605232131.cfcd45a2-lkp@intel.com



-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [tip:sched/core] [sched/fair] c9d93a73ce: WARNING:suspicious_RCU_usage
  2026-05-23 13:27 [tip:sched/core] [sched/fair] c9d93a73ce: WARNING:suspicious_RCU_usage kernel test robot
@ 2026-05-25  1:53 ` Chen, Yu C
  2026-05-25  4:24   ` Andrea Righi
  0 siblings, 1 reply; 4+ messages in thread
From: Chen, Yu C @ 2026-05-25  1:53 UTC (permalink / raw)
  To: kernel test robot, Andrea Righi
  Cc: oe-lkp, lkp, linux-kernel, x86, Peter Zijlstra, K Prateek Nayak,
	Vincent Guittot, aubrey.li

On 5/23/2026 9:27 PM, kernel test robot wrote:

> 
> [  102.159951][   T23]
> [  102.160730][   T23] =============================
> [  102.162072][   T23] WARNING: suspicious RCU usage
> [  102.163398][   T23] 7.1.0-rc2-00011-gc9d93a73ce87 #1 Not tainted
> [  102.165064][   T23] -----------------------------
> [  102.167687][   T23] kernel/sched/fair.c:12793 suspicious rcu_dereference_check() usage!
> [  102.169994][   T23]

sched_cpu_deactivate() does not hold RCU read lock, nor are 
preemption/IRQs/BH disabled,
how about this:
  static void set_cpu_sd_state_busy(int cpu)
  {
         struct sched_domain *sd;
-       sd = rcu_dereference_all(per_cpu(sd_llc, cpu));
+       sd = rcu_dereference_all_check(per_cpu(sd_llc, cpu),
+                                      lockdep_is_cpus_held());

         /*
          * sd->nohz_idle only pairs with nr_busy_cpus on sd->shared; if 
this
@@ -12815,7 +12817,8 @@ void nohz_balance_exit_idle(struct rq *rq)
  static void set_cpu_sd_state_idle(int cpu)
  {
         struct sched_domain *sd;
-       sd = rcu_dereference_all(per_cpu(sd_llc, cpu));
+       sd = rcu_dereference_all_check(per_cpu(sd_llc, cpu),
+                                      lockdep_is_cpus_held());

         /* See set_cpu_sd_state_busy(): nohz_idle is only used with 
sd->shared. */
         if (!sd || !sd->shared || sd->nohz_idle)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [tip:sched/core] [sched/fair] c9d93a73ce: WARNING:suspicious_RCU_usage
  2026-05-25  1:53 ` Chen, Yu C
@ 2026-05-25  4:24   ` Andrea Righi
  2026-05-25  8:08     ` Chen, Yu C
  0 siblings, 1 reply; 4+ messages in thread
From: Andrea Righi @ 2026-05-25  4:24 UTC (permalink / raw)
  To: Chen, Yu C
  Cc: kernel test robot, oe-lkp, lkp, linux-kernel, x86, Peter Zijlstra,
	K Prateek Nayak, Vincent Guittot, aubrey.li

Hello,

On Mon, May 25, 2026 at 09:53:22AM +0800, Chen, Yu C wrote:
> On 5/23/2026 9:27 PM, kernel test robot wrote:
> 
> > 
> > [  102.159951][   T23]
> > [  102.160730][   T23] =============================
> > [  102.162072][   T23] WARNING: suspicious RCU usage
> > [  102.163398][   T23] 7.1.0-rc2-00011-gc9d93a73ce87 #1 Not tainted
> > [  102.165064][   T23] -----------------------------
> > [  102.167687][   T23] kernel/sched/fair.c:12793 suspicious rcu_dereference_check() usage!
> > [  102.169994][   T23]

This should be fixed by
https://lore.kernel.org/all/20260522092523.2046095-1-arighi@nvidia.com/

Thanks,
-Andrea

> 
> sched_cpu_deactivate() does not hold RCU read lock, nor are
> preemption/IRQs/BH disabled,
> how about this:
>  static void set_cpu_sd_state_busy(int cpu)
>  {
>         struct sched_domain *sd;
> -       sd = rcu_dereference_all(per_cpu(sd_llc, cpu));
> +       sd = rcu_dereference_all_check(per_cpu(sd_llc, cpu),
> +                                      lockdep_is_cpus_held());
> 
>         /*
>          * sd->nohz_idle only pairs with nr_busy_cpus on sd->shared; if this
> @@ -12815,7 +12817,8 @@ void nohz_balance_exit_idle(struct rq *rq)
>  static void set_cpu_sd_state_idle(int cpu)
>  {
>         struct sched_domain *sd;
> -       sd = rcu_dereference_all(per_cpu(sd_llc, cpu));
> +       sd = rcu_dereference_all_check(per_cpu(sd_llc, cpu),
> +                                      lockdep_is_cpus_held());
> 
>         /* See set_cpu_sd_state_busy(): nohz_idle is only used with
> sd->shared. */
>         if (!sd || !sd->shared || sd->nohz_idle)

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [tip:sched/core] [sched/fair] c9d93a73ce: WARNING:suspicious_RCU_usage
  2026-05-25  4:24   ` Andrea Righi
@ 2026-05-25  8:08     ` Chen, Yu C
  0 siblings, 0 replies; 4+ messages in thread
From: Chen, Yu C @ 2026-05-25  8:08 UTC (permalink / raw)
  To: Andrea Righi
  Cc: kernel test robot, oe-lkp, lkp, linux-kernel, x86, Peter Zijlstra,
	K Prateek Nayak, Vincent Guittot, aubrey.li

On 5/25/2026 12:24 PM, Andrea Righi wrote:
> Hello,
> 
> On Mon, May 25, 2026 at 09:53:22AM +0800, Chen, Yu C wrote:
>> On 5/23/2026 9:27 PM, kernel test robot wrote:
>>
>>>
>>> [  102.159951][   T23]
>>> [  102.160730][   T23] =============================
>>> [  102.162072][   T23] WARNING: suspicious RCU usage
>>> [  102.163398][   T23] 7.1.0-rc2-00011-gc9d93a73ce87 #1 Not tainted
>>> [  102.165064][   T23] -----------------------------
>>> [  102.167687][   T23] kernel/sched/fair.c:12793 suspicious rcu_dereference_check() usage!
>>> [  102.169994][   T23]
> 
> This should be fixed by
> https://lore.kernel.org/all/20260522092523.2046095-1-arighi@nvidia.com/
> 

Got it, thanks for the fix!

thanks,
Chenyu

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2026-05-25  8:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-23 13:27 [tip:sched/core] [sched/fair] c9d93a73ce: WARNING:suspicious_RCU_usage kernel test robot
2026-05-25  1:53 ` Chen, Yu C
2026-05-25  4:24   ` Andrea Righi
2026-05-25  8:08     ` Chen, Yu C

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.