kernel/sched/core.c:2771:20: warning: unused function 'rq_has_pinned_tasks'

From: kernel test robot
Date: Sat Jul 03 2021 - 10:32:40 EST


Hi Peter,

FYI, the error/warning still remains.

tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 4b820e167bf6f410ace479d8df5b15a574000e75
commit: a7c81556ec4d341dfdbf2cc478ead89d73e474a7 sched: Fix migrate_disable() vs rt/dl balancing
date: 8 months ago
config: mips-randconfig-r015-20210702 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 9eb613b2de3163686b1a4bd1160f15ac56a4b083)
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
# install mips cross compiling tool for clang build
# apt-get install binutils-mips-linux-gnu
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=a7c81556ec4d341dfdbf2cc478ead89d73e474a7
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout a7c81556ec4d341dfdbf2cc478ead89d73e474a7
# save the attached .config to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross O=build_dir ARCH=mips SHELL=/bin/bash kernel/locking/ kernel/sched/ kernel/time/ mm/

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

All warnings (new ones prefixed by >>):

kernel/sched/core.c:2711:6: warning: no previous prototype for function 'sched_set_stop_task'
void sched_set_stop_task(int cpu, struct task_struct
^
kernel/sched/core.c:2711:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
void sched_set_stop_task(int cpu, struct task_struct
^
static
kernel/sched/core.c:4109:13: warning: variable 'rq' set but not used
struct rq
^
>> kernel/sched/core.c:2771:20: warning: unused function 'rq_has_pinned_tasks'
static inline bool rq_has_pinned_tasks(struct rq
^
kernel/sched/core.c:4559:20: warning: unused function 'sched_tick_stop'
static inline void sched_tick_stop(int cpu) { }
^
kernel/sched/core.c:7224:20: warning: unused function 'balance_hotplug_wait'
static inline void balance_hotplug_wait(void)
^
fatal error: error in backend: Nested variants found in inline asm string: '.if ( 0x00 ) != -1)) 0x00 ) != -1)) : ($( static struct ftrace_branch_data __attribute__((__aligned__(4))) __attribute__((__section__("_ftrace_branch"))) __if_trace = $( .func = __func__, .file = "arch/mips/include/asm/barrier.h", .line = 21, $); 0x00 ) != -1)) : $))) ) && ( (1 << 0) ); .set push; .set mips64r2; .rept 1; sync 0x00; .endr; .set pop; .else; ; .endif'
clang-13: error: clang frontend command failed with exit code 70 (use -v to see invocation)
clang version 13.0.0 (git://gitmirror/llvm_project cb5de7c813f976dd458bd2a7f40702ba648bf650)
Target: mips-unknown-linux-gnu
Thread model: posix
InstalledDir: /opt/cross/clang-cb5de7c813/bin
clang-13: note: diagnostic msg:
Makefile arch block certs crypto drivers fs include init ipc kernel lib mm scripts security sound source usr virt


vim +/rq_has_pinned_tasks +2771 kernel/sched/core.c

09a40af5240de0 kernel/sched.c Mike Galbraith 2010-04-15 2710
f5832c1998af2c kernel/sched/core.c Nicolas Pitre 2017-05-29 @2711 void sched_set_stop_task(int cpu, struct task_struct *stop)
f5832c1998af2c kernel/sched/core.c Nicolas Pitre 2017-05-29 2712 {
ded467dc83ac71 kernel/sched/core.c Peter Zijlstra 2020-10-01 2713 static struct lock_class_key stop_pi_lock;
f5832c1998af2c kernel/sched/core.c Nicolas Pitre 2017-05-29 2714 struct sched_param param = { .sched_priority = MAX_RT_PRIO - 1 };
f5832c1998af2c kernel/sched/core.c Nicolas Pitre 2017-05-29 2715 struct task_struct *old_stop = cpu_rq(cpu)->stop;
f5832c1998af2c kernel/sched/core.c Nicolas Pitre 2017-05-29 2716
f5832c1998af2c kernel/sched/core.c Nicolas Pitre 2017-05-29 2717 if (stop) {
f5832c1998af2c kernel/sched/core.c Nicolas Pitre 2017-05-29 2718 /*
f5832c1998af2c kernel/sched/core.c Nicolas Pitre 2017-05-29 2719 * Make it appear like a SCHED_FIFO task, its something
f5832c1998af2c kernel/sched/core.c Nicolas Pitre 2017-05-29 2720 * userspace knows about and won't get confused about.
f5832c1998af2c kernel/sched/core.c Nicolas Pitre 2017-05-29 2721 *
f5832c1998af2c kernel/sched/core.c Nicolas Pitre 2017-05-29 2722 * Also, it will make PI more or less work without too
f5832c1998af2c kernel/sched/core.c Nicolas Pitre 2017-05-29 2723 * much confusion -- but then, stop work should not
f5832c1998af2c kernel/sched/core.c Nicolas Pitre 2017-05-29 2724 * rely on PI working anyway.
f5832c1998af2c kernel/sched/core.c Nicolas Pitre 2017-05-29 2725 */
f5832c1998af2c kernel/sched/core.c Nicolas Pitre 2017-05-29 2726 sched_setscheduler_nocheck(stop, SCHED_FIFO, &param);
f5832c1998af2c kernel/sched/core.c Nicolas Pitre 2017-05-29 2727
f5832c1998af2c kernel/sched/core.c Nicolas Pitre 2017-05-29 2728 stop->sched_class = &stop_sched_class;
ded467dc83ac71 kernel/sched/core.c Peter Zijlstra 2020-10-01 2729
ded467dc83ac71 kernel/sched/core.c Peter Zijlstra 2020-10-01 2730 /*
ded467dc83ac71 kernel/sched/core.c Peter Zijlstra 2020-10-01 2731 * The PI code calls rt_mutex_setprio() with ->pi_lock held to
ded467dc83ac71 kernel/sched/core.c Peter Zijlstra 2020-10-01 2732 * adjust the effective priority of a task. As a result,
ded467dc83ac71 kernel/sched/core.c Peter Zijlstra 2020-10-01 2733 * rt_mutex_setprio() can trigger (RT) balancing operations,
ded467dc83ac71 kernel/sched/core.c Peter Zijlstra 2020-10-01 2734 * which can then trigger wakeups of the stop thread to push
ded467dc83ac71 kernel/sched/core.c Peter Zijlstra 2020-10-01 2735 * around the current task.
ded467dc83ac71 kernel/sched/core.c Peter Zijlstra 2020-10-01 2736 *
ded467dc83ac71 kernel/sched/core.c Peter Zijlstra 2020-10-01 2737 * The stop task itself will never be part of the PI-chain, it
ded467dc83ac71 kernel/sched/core.c Peter Zijlstra 2020-10-01 2738 * never blocks, therefore that ->pi_lock recursion is safe.
ded467dc83ac71 kernel/sched/core.c Peter Zijlstra 2020-10-01 2739 * Tell lockdep about this by placing the stop->pi_lock in its
ded467dc83ac71 kernel/sched/core.c Peter Zijlstra 2020-10-01 2740 * own class.
ded467dc83ac71 kernel/sched/core.c Peter Zijlstra 2020-10-01 2741 */
ded467dc83ac71 kernel/sched/core.c Peter Zijlstra 2020-10-01 2742 lockdep_set_class(&stop->pi_lock, &stop_pi_lock);
f5832c1998af2c kernel/sched/core.c Nicolas Pitre 2017-05-29 2743 }
f5832c1998af2c kernel/sched/core.c Nicolas Pitre 2017-05-29 2744
f5832c1998af2c kernel/sched/core.c Nicolas Pitre 2017-05-29 2745 cpu_rq(cpu)->stop = stop;
f5832c1998af2c kernel/sched/core.c Nicolas Pitre 2017-05-29 2746
f5832c1998af2c kernel/sched/core.c Nicolas Pitre 2017-05-29 2747 if (old_stop) {
f5832c1998af2c kernel/sched/core.c Nicolas Pitre 2017-05-29 2748 /*
f5832c1998af2c kernel/sched/core.c Nicolas Pitre 2017-05-29 2749 * Reset it back to a normal scheduling class so that
f5832c1998af2c kernel/sched/core.c Nicolas Pitre 2017-05-29 2750 * it can die in pieces.
f5832c1998af2c kernel/sched/core.c Nicolas Pitre 2017-05-29 2751 */
f5832c1998af2c kernel/sched/core.c Nicolas Pitre 2017-05-29 2752 old_stop->sched_class = &rt_sched_class;
f5832c1998af2c kernel/sched/core.c Nicolas Pitre 2017-05-29 2753 }
f5832c1998af2c kernel/sched/core.c Nicolas Pitre 2017-05-29 2754 }
f5832c1998af2c kernel/sched/core.c Nicolas Pitre 2017-05-29 2755
25834c73f93af7 kernel/sched/core.c Peter Zijlstra 2015-05-15 2756 #else
25834c73f93af7 kernel/sched/core.c Peter Zijlstra 2015-05-15 2757
25834c73f93af7 kernel/sched/core.c Peter Zijlstra 2015-05-15 2758 static inline int __set_cpus_allowed_ptr(struct task_struct *p,
9cfc3e18adb036 kernel/sched/core.c Peter Zijlstra 2020-09-16 2759 const struct cpumask *new_mask,
9cfc3e18adb036 kernel/sched/core.c Peter Zijlstra 2020-09-16 2760 u32 flags)
25834c73f93af7 kernel/sched/core.c Peter Zijlstra 2015-05-15 2761 {
25834c73f93af7 kernel/sched/core.c Peter Zijlstra 2015-05-15 2762 return set_cpus_allowed_ptr(p, new_mask);
25834c73f93af7 kernel/sched/core.c Peter Zijlstra 2015-05-15 2763 }
25834c73f93af7 kernel/sched/core.c Peter Zijlstra 2015-05-15 2764
5cc389bcee088b kernel/sched/core.c Peter Zijlstra 2015-06-11 2765 #endif /* CONFIG_SMP */
970b13bacba14a kernel/sched.c Peter Zijlstra 2009-11-25 2766
af449901b84c98 kernel/sched/core.c Peter Zijlstra 2020-09-17 2767 #if !defined(CONFIG_SMP) || !defined(CONFIG_PREEMPT_RT)
af449901b84c98 kernel/sched/core.c Peter Zijlstra 2020-09-17 2768
af449901b84c98 kernel/sched/core.c Peter Zijlstra 2020-09-17 2769 static inline void migrate_disable_switch(struct rq *rq, struct task_struct *p) { }
af449901b84c98 kernel/sched/core.c Peter Zijlstra 2020-09-17 2770
3015ef4b98f53f kernel/sched/core.c Thomas Gleixner 2020-08-26 @2771 static inline bool rq_has_pinned_tasks(struct rq *rq)
3015ef4b98f53f kernel/sched/core.c Thomas Gleixner 2020-08-26 2772 {
3015ef4b98f53f kernel/sched/core.c Thomas Gleixner 2020-08-26 2773 return false;
3015ef4b98f53f kernel/sched/core.c Thomas Gleixner 2020-08-26 2774 }
3015ef4b98f53f kernel/sched/core.c Thomas Gleixner 2020-08-26 2775

:::::: The code at line 2771 was first introduced by commit
:::::: 3015ef4b98f53fe7eba4f5f82f562c0e074d213c sched/core: Make migrate disable and CPU hotplug cooperative

:::::: TO: Thomas Gleixner <tglx@xxxxxxxxxxxxx>
:::::: CC: Peter Zijlstra <peterz@xxxxxxxxxxxxx>

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

Attachment: .config.gz
Description: application/gzip