[frederic-dynticks:rcu/rt-test 8/8] kernel/rcu/tree.c:2457:20: error: unused variable 'offloaded'

From: kernel test robot
Date: Tue Sep 28 2021 - 21:11:42 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/frederic/linux-dynticks.git rcu/rt-test
head: 6a4c736f3c9ae1378d57d5f54766f7c21b94689b
commit: 6a4c736f3c9ae1378d57d5f54766f7c21b94689b [8/8] rcu/nocb: Don't invoke local rcu core on callback overload from nocb kthread
config: arc-allyesconfig (attached as .config)
compiler: arceb-elf-gcc (GCC) 11.2.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://git.kernel.org/pub/scm/linux/kernel/git/frederic/linux-dynticks.git/commit/?id=6a4c736f3c9ae1378d57d5f54766f7c21b94689b
git remote add frederic-dynticks https://git.kernel.org/pub/scm/linux/kernel/git/frederic/linux-dynticks.git
git fetch --no-tags frederic-dynticks rcu/rt-test
git checkout 6a4c736f3c9ae1378d57d5f54766f7c21b94689b
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=arc

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All errors (new ones prefixed by >>):

kernel/rcu/tree.c: In function 'rcu_do_batch':
>> kernel/rcu/tree.c:2457:20: error: unused variable 'offloaded' [-Werror=unused-variable]
2457 | const bool offloaded = rcu_rdp_is_offloaded(rdp);
| ^~~~~~~~~
In file included from include/linux/perf_event.h:25,
from include/linux/trace_events.h:10,
from kernel/rcu/tree.c:49:
At top level:
arch/arc/include/asm/perf_event.h:126:27: error: 'arc_pmu_cache_map' defined but not used [-Werror=unused-const-variable=]
126 | static const unsigned int arc_pmu_cache_map[C(MAX)][C(OP_MAX)][C(RESULT_MAX)] = {
| ^~~~~~~~~~~~~~~~~
arch/arc/include/asm/perf_event.h:91:27: error: 'arc_pmu_ev_hw_map' defined but not used [-Werror=unused-const-variable=]
91 | static const char * const arc_pmu_ev_hw_map[] = {
| ^~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors


vim +/offloaded +2457 kernel/rcu/tree.c

64db4cfff99c04 kernel/rcutree.c Paul E. McKenney 2008-12-18 2447
64db4cfff99c04 kernel/rcutree.c Paul E. McKenney 2008-12-18 2448 /*
64db4cfff99c04 kernel/rcutree.c Paul E. McKenney 2008-12-18 2449 * Invoke any RCU callbacks that have made it to the end of their grace
a616aec9aa140e kernel/rcu/tree.c Ingo Molnar 2021-03-22 2450 * period. Throttle as specified by rdp->blimit.
64db4cfff99c04 kernel/rcutree.c Paul E. McKenney 2008-12-18 2451 */
5bb5d09cc4f868 kernel/rcu/tree.c Paul E. McKenney 2018-07-03 2452 static void rcu_do_batch(struct rcu_data *rdp)
64db4cfff99c04 kernel/rcutree.c Paul E. McKenney 2008-12-18 2453 {
b5374b2df0ac1c kernel/rcu/tree.c Paul E. McKenney 2020-06-23 2454 int div;
b4e6039e8af8c2 kernel/rcu/tree.c Joel Fernandes (Google 2020-11-18 2455) bool __maybe_unused empty;
64db4cfff99c04 kernel/rcutree.c Paul E. McKenney 2008-12-18 2456 unsigned long flags;
3820b513a2e33d kernel/rcu/tree.c Frederic Weisbecker 2020-11-12 @2457 const bool offloaded = rcu_rdp_is_offloaded(rdp);
15fecf89e46a96 kernel/rcu/tree.c Paul E. McKenney 2017-02-08 2458 struct rcu_head *rhp;
15fecf89e46a96 kernel/rcu/tree.c Paul E. McKenney 2017-02-08 2459 struct rcu_cblist rcl = RCU_CBLIST_INITIALIZER(rcl);
6bc335828056f3 kernel/rcu/tree.c Joel Fernandes (Google 2020-11-03 2460) long bl, count = 0;
cfcdef5e30469f kernel/rcu/tree.c Eric Dumazet 2019-07-24 2461 long pending, tlimit = 0;
64db4cfff99c04 kernel/rcutree.c Paul E. McKenney 2008-12-18 2462
64db4cfff99c04 kernel/rcutree.c Paul E. McKenney 2008-12-18 2463 /* If no callbacks are ready, just return. */
15fecf89e46a96 kernel/rcu/tree.c Paul E. McKenney 2017-02-08 2464 if (!rcu_segcblist_ready_cbs(&rdp->cblist)) {
3c779dfef2c452 kernel/rcu/tree.c Paul E. McKenney 2018-07-05 2465 trace_rcu_batch_start(rcu_state.name,
15fecf89e46a96 kernel/rcu/tree.c Paul E. McKenney 2017-02-08 2466 rcu_segcblist_n_cbs(&rdp->cblist), 0);
3c779dfef2c452 kernel/rcu/tree.c Paul E. McKenney 2018-07-05 2467 trace_rcu_batch_end(rcu_state.name, 0,
15fecf89e46a96 kernel/rcu/tree.c Paul E. McKenney 2017-02-08 2468 !rcu_segcblist_empty(&rdp->cblist),
4968c300e1fa53 kernel/rcutree.c Paul E. McKenney 2011-12-07 2469 need_resched(), is_idle_task(current),
4968c300e1fa53 kernel/rcutree.c Paul E. McKenney 2011-12-07 2470 rcu_is_callbacks_kthread());
64db4cfff99c04 kernel/rcutree.c Paul E. McKenney 2008-12-18 2471 return;
29c00b4a1d9e27 kernel/rcutree.c Paul E. McKenney 2011-06-17 2472 }
64db4cfff99c04 kernel/rcutree.c Paul E. McKenney 2008-12-18 2473
64db4cfff99c04 kernel/rcutree.c Paul E. McKenney 2008-12-18 2474 /*
64db4cfff99c04 kernel/rcutree.c Paul E. McKenney 2008-12-18 2475 * Extract the list of ready callbacks, disabling to prevent
15fecf89e46a96 kernel/rcu/tree.c Paul E. McKenney 2017-02-08 2476 * races with call_rcu() from interrupt handlers. Leave the
15fecf89e46a96 kernel/rcu/tree.c Paul E. McKenney 2017-02-08 2477 * callback counts, as rcu_barrier() needs to be conservative.
64db4cfff99c04 kernel/rcutree.c Paul E. McKenney 2008-12-18 2478 */
306badf8ea025e kernel/rcu/tree.c Frederic Weisbecker 2021-09-27 2479 rcu_nocb_lock_irqsave(rdp, flags);
8146c4e2e2c197 kernel/rcutree.c Paul E. McKenney 2012-01-10 2480 WARN_ON_ONCE(cpu_is_offline(smp_processor_id()));
cfcdef5e30469f kernel/rcu/tree.c Eric Dumazet 2019-07-24 2481 pending = rcu_segcblist_n_cbs(&rdp->cblist);
b5374b2df0ac1c kernel/rcu/tree.c Paul E. McKenney 2020-06-23 2482 div = READ_ONCE(rcu_divisor);
b5374b2df0ac1c kernel/rcu/tree.c Paul E. McKenney 2020-06-23 2483 div = div < 0 ? 7 : div > sizeof(long) * 8 - 2 ? sizeof(long) * 8 - 2 : div;
b5374b2df0ac1c kernel/rcu/tree.c Paul E. McKenney 2020-06-23 2484 bl = max(rdp->blimit, pending >> div);
a2b354b9950bb8 kernel/rcu/tree.c Paul E. McKenney 2020-06-23 2485 if (unlikely(bl > 100)) {
a2b354b9950bb8 kernel/rcu/tree.c Paul E. McKenney 2020-06-23 2486 long rrn = READ_ONCE(rcu_resched_ns);
a2b354b9950bb8 kernel/rcu/tree.c Paul E. McKenney 2020-06-23 2487
a2b354b9950bb8 kernel/rcu/tree.c Paul E. McKenney 2020-06-23 2488 rrn = rrn < NSEC_PER_MSEC ? NSEC_PER_MSEC : rrn > NSEC_PER_SEC ? NSEC_PER_SEC : rrn;
a2b354b9950bb8 kernel/rcu/tree.c Paul E. McKenney 2020-06-23 2489 tlimit = local_clock() + rrn;
a2b354b9950bb8 kernel/rcu/tree.c Paul E. McKenney 2020-06-23 2490 }
3c779dfef2c452 kernel/rcu/tree.c Paul E. McKenney 2018-07-05 2491 trace_rcu_batch_start(rcu_state.name,
15fecf89e46a96 kernel/rcu/tree.c Paul E. McKenney 2017-02-08 2492 rcu_segcblist_n_cbs(&rdp->cblist), bl);
15fecf89e46a96 kernel/rcu/tree.c Paul E. McKenney 2017-02-08 2493 rcu_segcblist_extract_done_cbs(&rdp->cblist, &rcl);
78f6bae72b0d41 kernel/rcu/tree.c Frederic Weisbecker 2021-09-27 2494 if (rcu_rdp_is_offloaded(rdp))
7f36ef82e5cf0b kernel/rcu/tree.c Paul E. McKenney 2019-05-28 2495 rdp->qlen_last_fqs_check = rcu_segcblist_n_cbs(&rdp->cblist);
3afe7fa535491e kernel/rcu/tree.c Joel Fernandes (Google 2020-11-14 2496)
3afe7fa535491e kernel/rcu/tree.c Joel Fernandes (Google 2020-11-14 2497) trace_rcu_segcb_stats(&rdp->cblist, TPS("SegCbDequeued"));
5d6742b37727e1 kernel/rcu/tree.c Paul E. McKenney 2019-05-15 2498 rcu_nocb_unlock_irqrestore(rdp, flags);
64db4cfff99c04 kernel/rcutree.c Paul E. McKenney 2008-12-18 2499
64db4cfff99c04 kernel/rcutree.c Paul E. McKenney 2008-12-18 2500 /* Invoke callbacks. */
6a949b7af82db7 kernel/rcu/tree.c Paul E. McKenney 2019-07-28 2501 tick_dep_set_task(current, TICK_DEP_BIT_RCU);
15fecf89e46a96 kernel/rcu/tree.c Paul E. McKenney 2017-02-08 2502 rhp = rcu_cblist_dequeue(&rcl);
3afe7fa535491e kernel/rcu/tree.c Joel Fernandes (Google 2020-11-14 2503)
15fecf89e46a96 kernel/rcu/tree.c Paul E. McKenney 2017-02-08 2504 for (; rhp; rhp = rcu_cblist_dequeue(&rcl)) {
77a40f97030b27 kernel/rcu/tree.c Joel Fernandes (Google 2019-08-30 2505) rcu_callback_t f;
77a40f97030b27 kernel/rcu/tree.c Joel Fernandes (Google 2019-08-30 2506)
6bc335828056f3 kernel/rcu/tree.c Joel Fernandes (Google 2020-11-03 2507) count++;
15fecf89e46a96 kernel/rcu/tree.c Paul E. McKenney 2017-02-08 2508 debug_rcu_head_unqueue(rhp);
77a40f97030b27 kernel/rcu/tree.c Joel Fernandes (Google 2019-08-30 2509)
77a40f97030b27 kernel/rcu/tree.c Joel Fernandes (Google 2019-08-30 2510) rcu_lock_acquire(&rcu_callback_map);
77a40f97030b27 kernel/rcu/tree.c Joel Fernandes (Google 2019-08-30 2511) trace_rcu_invoke_callback(rcu_state.name, rhp);
77a40f97030b27 kernel/rcu/tree.c Joel Fernandes (Google 2019-08-30 2512)
77a40f97030b27 kernel/rcu/tree.c Joel Fernandes (Google 2019-08-30 2513) f = rhp->func;
77a40f97030b27 kernel/rcu/tree.c Joel Fernandes (Google 2019-08-30 2514) WRITE_ONCE(rhp->func, (rcu_callback_t)0L);
77a40f97030b27 kernel/rcu/tree.c Joel Fernandes (Google 2019-08-30 2515) f(rhp);
77a40f97030b27 kernel/rcu/tree.c Joel Fernandes (Google 2019-08-30 2516)
77a40f97030b27 kernel/rcu/tree.c Joel Fernandes (Google 2019-08-30 2517) rcu_lock_release(&rcu_callback_map);
77a40f97030b27 kernel/rcu/tree.c Joel Fernandes (Google 2019-08-30 2518)
15fecf89e46a96 kernel/rcu/tree.c Paul E. McKenney 2017-02-08 2519 /*
15fecf89e46a96 kernel/rcu/tree.c Paul E. McKenney 2017-02-08 2520 * Stop only if limit reached and CPU has something to do.
15fecf89e46a96 kernel/rcu/tree.c Paul E. McKenney 2017-02-08 2521 */
1dd2a3d133f29b kernel/rcu/tree.c Frederic Weisbecker 2021-09-27 2522 if (count >= bl && in_serving_softirq() &&
1dd2a3d133f29b kernel/rcu/tree.c Frederic Weisbecker 2021-09-27 2523 (need_resched() || !is_idle_task(current)))
64db4cfff99c04 kernel/rcutree.c Paul E. McKenney 2008-12-18 2524 break;
cfcdef5e30469f kernel/rcu/tree.c Eric Dumazet 2019-07-24 2525 if (unlikely(tlimit)) {
cfcdef5e30469f kernel/rcu/tree.c Eric Dumazet 2019-07-24 2526 /* only call local_clock() every 32 callbacks */
6bc335828056f3 kernel/rcu/tree.c Joel Fernandes (Google 2020-11-03 2527) if (likely((count & 31) || local_clock() < tlimit))
cfcdef5e30469f kernel/rcu/tree.c Eric Dumazet 2019-07-24 2528 continue;
cfcdef5e30469f kernel/rcu/tree.c Eric Dumazet 2019-07-24 2529 /* Exceeded the time limit, so leave. */
cfcdef5e30469f kernel/rcu/tree.c Eric Dumazet 2019-07-24 2530 break;
cfcdef5e30469f kernel/rcu/tree.c Eric Dumazet 2019-07-24 2531 }
e3abe959fbd57a kernel/rcu/tree.c Frederic Weisbecker 2020-11-13 2532 if (!in_serving_softirq()) {
5d6742b37727e1 kernel/rcu/tree.c Paul E. McKenney 2019-05-15 2533 local_bh_enable();
5d6742b37727e1 kernel/rcu/tree.c Paul E. McKenney 2019-05-15 2534 lockdep_assert_irqs_enabled();
5d6742b37727e1 kernel/rcu/tree.c Paul E. McKenney 2019-05-15 2535 cond_resched_tasks_rcu_qs();
5d6742b37727e1 kernel/rcu/tree.c Paul E. McKenney 2019-05-15 2536 lockdep_assert_irqs_enabled();
5d6742b37727e1 kernel/rcu/tree.c Paul E. McKenney 2019-05-15 2537 local_bh_disable();
5d6742b37727e1 kernel/rcu/tree.c Paul E. McKenney 2019-05-15 2538 }
64db4cfff99c04 kernel/rcutree.c Paul E. McKenney 2008-12-18 2539 }
64db4cfff99c04 kernel/rcutree.c Paul E. McKenney 2008-12-18 2540
306badf8ea025e kernel/rcu/tree.c Frederic Weisbecker 2021-09-27 2541 rcu_nocb_lock_irqsave(rdp, flags);
e816d56fad57ba kernel/rcu/tree.c Paul E. McKenney 2020-05-01 2542 rdp->n_cbs_invoked += count;
3c779dfef2c452 kernel/rcu/tree.c Paul E. McKenney 2018-07-05 2543 trace_rcu_batch_end(rcu_state.name, count, !!rcl.head, need_resched(),
8ef0f37efb7863 kernel/rcu/tree.c Paul E. McKenney 2017-05-02 2544 is_idle_task(current), rcu_is_callbacks_kthread());
64db4cfff99c04 kernel/rcutree.c Paul E. McKenney 2008-12-18 2545
15fecf89e46a96 kernel/rcu/tree.c Paul E. McKenney 2017-02-08 2546 /* Update counts and requeue any remaining callbacks. */
15fecf89e46a96 kernel/rcu/tree.c Paul E. McKenney 2017-02-08 2547 rcu_segcblist_insert_done_cbs(&rdp->cblist, &rcl);
6bc335828056f3 kernel/rcu/tree.c Joel Fernandes (Google 2020-11-03 2548) rcu_segcblist_add_len(&rdp->cblist, -count);
64db4cfff99c04 kernel/rcutree.c Paul E. McKenney 2008-12-18 2549
64db4cfff99c04 kernel/rcutree.c Paul E. McKenney 2008-12-18 2550 /* Reinstate batch limit if we have worked down the excess. */
15fecf89e46a96 kernel/rcu/tree.c Paul E. McKenney 2017-02-08 2551 count = rcu_segcblist_n_cbs(&rdp->cblist);
d5a9a8c3bc8068 kernel/rcu/tree.c Paul E. McKenney 2019-04-10 2552 if (rdp->blimit >= DEFAULT_MAX_RCU_BLIMIT && count <= qlowmark)
64db4cfff99c04 kernel/rcutree.c Paul E. McKenney 2008-12-18 2553 rdp->blimit = blimit;
64db4cfff99c04 kernel/rcutree.c Paul E. McKenney 2008-12-18 2554
37c72e56f6b234 kernel/rcutree.c Paul E. McKenney 2009-10-14 2555 /* Reset ->qlen_last_fqs_check trigger if enough CBs have drained. */
15fecf89e46a96 kernel/rcu/tree.c Paul E. McKenney 2017-02-08 2556 if (count == 0 && rdp->qlen_last_fqs_check != 0) {
37c72e56f6b234 kernel/rcutree.c Paul E. McKenney 2009-10-14 2557 rdp->qlen_last_fqs_check = 0;
2431774f04d105 kernel/rcu/tree.c Paul E. McKenney 2021-07-20 2558 rdp->n_force_qs_snap = READ_ONCE(rcu_state.n_force_qs);
15fecf89e46a96 kernel/rcu/tree.c Paul E. McKenney 2017-02-08 2559 } else if (count < rdp->qlen_last_fqs_check - qhimark)
15fecf89e46a96 kernel/rcu/tree.c Paul E. McKenney 2017-02-08 2560 rdp->qlen_last_fqs_check = count;
efd88b02bb9e6b kernel/rcu/tree.c Paul E. McKenney 2017-10-19 2561
efd88b02bb9e6b kernel/rcu/tree.c Paul E. McKenney 2017-10-19 2562 /*
efd88b02bb9e6b kernel/rcu/tree.c Paul E. McKenney 2017-10-19 2563 * The following usually indicates a double call_rcu(). To track
efd88b02bb9e6b kernel/rcu/tree.c Paul E. McKenney 2017-10-19 2564 * this down, try building with CONFIG_DEBUG_OBJECTS_RCU_HEAD=y.
efd88b02bb9e6b kernel/rcu/tree.c Paul E. McKenney 2017-10-19 2565 */
b4e6039e8af8c2 kernel/rcu/tree.c Joel Fernandes (Google 2020-11-18 2566) empty = rcu_segcblist_empty(&rdp->cblist);
b4e6039e8af8c2 kernel/rcu/tree.c Joel Fernandes (Google 2020-11-18 2567) WARN_ON_ONCE(count == 0 && !empty);
d1b222c6be1f8b kernel/rcu/tree.c Paul E. McKenney 2019-07-02 2568 WARN_ON_ONCE(!IS_ENABLED(CONFIG_RCU_NOCB_CPU) &&
b4e6039e8af8c2 kernel/rcu/tree.c Joel Fernandes (Google 2020-11-18 2569) count != 0 && empty);
b4e6039e8af8c2 kernel/rcu/tree.c Joel Fernandes (Google 2020-11-18 2570) WARN_ON_ONCE(count == 0 && rcu_segcblist_n_segment_cbs(&rdp->cblist) != 0);
b4e6039e8af8c2 kernel/rcu/tree.c Joel Fernandes (Google 2020-11-18 2571) WARN_ON_ONCE(!empty && rcu_segcblist_n_segment_cbs(&rdp->cblist) == 0);
37c72e56f6b234 kernel/rcutree.c Paul E. McKenney 2009-10-14 2572
5d6742b37727e1 kernel/rcu/tree.c Paul E. McKenney 2019-05-15 2573 rcu_nocb_unlock_irqrestore(rdp, flags);
64db4cfff99c04 kernel/rcutree.c Paul E. McKenney 2008-12-18 2574
6a949b7af82db7 kernel/rcu/tree.c Paul E. McKenney 2019-07-28 2575 tick_dep_clear_task(current, TICK_DEP_BIT_RCU);
64db4cfff99c04 kernel/rcutree.c Paul E. McKenney 2008-12-18 2576 }
64db4cfff99c04 kernel/rcutree.c Paul E. McKenney 2008-12-18 2577

:::::: The code at line 2457 was first introduced by commit
:::::: 3820b513a2e33d6dee1caa3b4815f92079cb9890 rcu/nocb: Detect unsafe checks for offloaded rdp

:::::: TO: Frederic Weisbecker <frederic@xxxxxxxxxx>
:::::: CC: Paul E. McKenney <paulmck@xxxxxxxxxx>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip