From: kernel test robot <lkp@intel.com>
To: kbuild-all@lists.01.org
Subject: [zen:5.14/prjc 1/221] kernel/sched/alt_core.c:1409:6: warning: no previous prototype for 'sched_set_stop_task'
Date: Tue, 28 Sep 2021 01:55:09 +0800 [thread overview]
Message-ID: <202109280107.BerKXEBh-lkp@intel.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 30228 bytes --]
tree: https://github.com/zen-kernel/zen-kernel 5.14/prjc
head: a74cb46b3e41b71e5eb452467ef2000188afe8d7
commit: f746b5817d3274fa4f458f87f6b452e7304b1d64 [1/221] Project C v5.7.5-r2
config: parisc-randconfig-r013-20210927 (attached as .config)
compiler: hppa-linux-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://github.com/zen-kernel/zen-kernel/commit/f746b5817d3274fa4f458f87f6b452e7304b1d64
git remote add zen https://github.com/zen-kernel/zen-kernel
git fetch --no-tags zen 5.14/prjc
git checkout f746b5817d3274fa4f458f87f6b452e7304b1d64
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross ARCH=parisc
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
All warnings (new ones prefixed by >>):
In file included from kernel/sched/alt_core.c:191:
kernel/sched/alt_core.c: In function 'dequeue_task':
kernel/sched/bmq_imp.h:52:9: error: implicit declaration of function 'sched_info_dequeued'; did you mean 'sched_info_dequeue'? [-Werror=implicit-function-declaration]
52 | sched_info_dequeued(rq, p); \
| ^~~~~~~~~~~~~~~~~~~
kernel/sched/alt_core.c:444:9: note: in expansion of macro '__SCHED_DEQUEUE_TASK'
444 | __SCHED_DEQUEUE_TASK(p, rq, flags, update_sched_rq_watermark(rq));
| ^~~~~~~~~~~~~~~~~~~~
kernel/sched/alt_core.c: In function 'enqueue_task':
kernel/sched/bmq_imp.h:61:9: error: implicit declaration of function 'sched_info_queued'; did you mean 'sched_info_enqueue'? [-Werror=implicit-function-declaration]
61 | sched_info_queued(rq, p); \
| ^~~~~~~~~~~~~~~~~
kernel/sched/alt_core.c:461:9: note: in expansion of macro '__SCHED_ENQUEUE_TASK'
461 | __SCHED_ENQUEUE_TASK(p, rq, flags);
| ^~~~~~~~~~~~~~~~~~~~
kernel/sched/alt_core.c: At top level:
kernel/sched/alt_core.c:652:6: warning: no previous prototype for 'resched_curr' [-Wmissing-prototypes]
652 | void resched_curr(struct rq *rq)
| ^~~~~~~~~~~~
kernel/sched/alt_core.c:675:6: warning: no previous prototype for 'resched_cpu' [-Wmissing-prototypes]
675 | void resched_cpu(int cpu)
| ^~~~~~~~~~~
kernel/sched/alt_core.c: In function 'activate_task':
kernel/sched/alt_core.c:955:13: error: implicit declaration of function 'task_contributes_to_load' [-Werror=implicit-function-declaration]
955 | if (task_contributes_to_load(p))
| ^~~~~~~~~~~~~~~~~~~~~~~~
kernel/sched/alt_core.c: At top level:
kernel/sched/alt_core.c:1188:15: error: conflicting types for 'wait_task_inactive'; have 'long unsigned int(struct task_struct *, long int)'
1188 | unsigned long wait_task_inactive(struct task_struct *p, long match_state)
| ^~~~~~~~~~~~~~~~~~
In file included from kernel/sched/alt_sched.h:4,
from kernel/sched/sched.h:6,
from kernel/sched/alt_core.c:14:
include/linux/sched.h:1869:22: note: previous declaration of 'wait_task_inactive' with type 'long unsigned int(struct task_struct *, unsigned int)'
1869 | extern unsigned long wait_task_inactive(struct task_struct *, unsigned int match_state);
| ^~~~~~~~~~~~~~~~~~
In file included from include/linux/kernel.h:11,
from arch/parisc/include/asm/bug.h:5,
from include/linux/bug.h:5,
from include/linux/thread_info.h:13,
from include/asm-generic/current.h:5,
from ./arch/parisc/include/generated/asm/current.h:1,
from include/linux/sched.h:12,
from kernel/sched/alt_sched.h:4,
from kernel/sched/sched.h:6,
from kernel/sched/alt_core.c:14:
kernel/sched/alt_core.c: In function 'wait_task_inactive':
kernel/sched/alt_core.c:1211:56: error: 'struct task_struct' has no member named 'state'; did you mean '__state'?
1211 | if (match_state && unlikely(p->state != match_state))
| ^~~~~
include/linux/compiler.h:33:55: note: in definition of macro '__branch_check__'
33 | ______r = __builtin_expect(!!(x), expect); \
| ^
kernel/sched/alt_core.c:1211:44: note: in expansion of macro 'unlikely'
1211 | if (match_state && unlikely(p->state != match_state))
| ^~~~~~~~
kernel/sched/alt_core.c:1211:56: error: 'struct task_struct' has no member named 'state'; did you mean '__state'?
1211 | if (match_state && unlikely(p->state != match_state))
| ^~~~~
include/linux/compiler.h:35:54: note: in definition of macro '__branch_check__'
35 | expect, is_constant); \
| ^~~~~~~~~~~
kernel/sched/alt_core.c:1211:44: note: in expansion of macro 'unlikely'
1211 | if (match_state && unlikely(p->state != match_state))
| ^~~~~~~~
kernel/sched/alt_core.c:1226:40: error: 'struct task_struct' has no member named 'state'; did you mean '__state'?
1226 | if (!match_state || p->state == match_state)
| ^~~~~
| __state
kernel/sched/alt_core.c: At top level:
>> kernel/sched/alt_core.c:1409:6: warning: no previous prototype for 'sched_set_stop_task' [-Wmissing-prototypes]
1409 | void sched_set_stop_task(int cpu, struct task_struct *stop)
| ^~~~~~~~~~~~~~~~~~~
kernel/sched/alt_core.c: In function '__set_cpus_allowed_ptr':
kernel/sched/alt_core.c:1501:35: error: 'struct task_struct' has no member named 'state'; did you mean '__state'?
1501 | if (task_running(p) || p->state == TASK_WAKING) {
| ^~~~~
| __state
kernel/sched/alt_core.c: In function 'ttwu_do_wakeup':
kernel/sched/alt_core.c:1578:12: error: 'struct task_struct' has no member named 'state'; did you mean '__state'?
1578 | p->state = TASK_RUNNING;
| ^~~~~
| __state
kernel/sched/alt_core.c: At top level:
kernel/sched/alt_core.c:1611:6: error: redefinition of 'scheduler_ipi'
1611 | void scheduler_ipi(void)
| ^~~~~~~~~~~~~
In file included from kernel/sched/alt_sched.h:4,
from kernel/sched/sched.h:6,
from kernel/sched/alt_core.c:14:
include/linux/sched.h:1860:29: note: previous definition of 'scheduler_ipi' with type 'void(void)'
1860 | static __always_inline void scheduler_ipi(void)
| ^~~~~~~~~~~~~
kernel/sched/alt_core.c: In function 'try_to_wake_up':
kernel/sched/alt_core.c:1793:26: error: 'struct task_struct' has no member named 'state'; did you mean '__state'?
1793 | if (!(p->state & state))
| ^~~~~
| __state
kernel/sched/alt_core.c:1799:20: error: 'struct task_struct' has no member named 'state'; did you mean '__state'?
1799 | p->state = TASK_RUNNING;
| ^~~~~
| __state
kernel/sched/alt_core.c:1812:18: error: 'struct task_struct' has no member named 'state'; did you mean '__state'?
1812 | if (!(p->state & state))
| ^~~~~
| __state
kernel/sched/alt_core.c:1879:12: error: 'struct task_struct' has no member named 'state'; did you mean '__state'?
1879 | p->state = TASK_WAKING;
| ^~~~~
| __state
kernel/sched/alt_core.c: In function 'sched_fork':
kernel/sched/alt_core.c:1973:12: error: 'struct task_struct' has no member named 'state'; did you mean '__state'?
1973 | p->state = TASK_NEW;
| ^~~~~
| __state
kernel/sched/alt_core.c: In function 'wake_up_new_task':
kernel/sched/alt_core.c:2136:12: error: 'struct task_struct' has no member named 'state'; did you mean '__state'?
2136 | p->state = TASK_RUNNING;
| ^~~~~
| __state
kernel/sched/alt_core.c: In function 'finish_task_switch':
kernel/sched/alt_core.c:2384:28: error: 'struct task_struct' has no member named 'state'; did you mean '__state'?
2384 | prev_state = prev->state;
| ^~~~~
| __state
kernel/sched/alt_core.c: In function 'schedule_tail':
kernel/sched/alt_core.c:2433:20: warning: variable 'rq' set but not used [-Wunused-but-set-variable]
2433 | struct rq *rq;
| ^~
kernel/sched/alt_core.c: At top level:
kernel/sched/alt_core.c:2518:15: error: conflicting types for 'nr_running'; have 'long unsigned int(void)'
2518 | unsigned long nr_running(void)
| ^~~~~~~~~~
In file included from kernel/sched/alt_sched.h:16,
from kernel/sched/sched.h:6,
from kernel/sched/alt_core.c:14:
include/linux/sched/stat.h:20:21: note: previous declaration of 'nr_running' with type 'unsigned int(void)'
20 | extern unsigned int nr_running(void);
| ^~~~~~~~~~
kernel/sched/alt_core.c:2565:15: error: conflicting types for 'nr_iowait_cpu'; have 'long unsigned int(int)'
2565 | unsigned long nr_iowait_cpu(int cpu)
| ^~~~~~~~~~~~~
In file included from kernel/sched/alt_sched.h:16,
from kernel/sched/sched.h:6,
from kernel/sched/alt_core.c:14:
include/linux/sched/stat.h:23:21: note: previous declaration of 'nr_iowait_cpu' with type 'unsigned int(int)'
23 | extern unsigned int nr_iowait_cpu(int cpu);
| ^~~~~~~~~~~~~
kernel/sched/alt_core.c:2600:15: error: conflicting types for 'nr_iowait'; have 'long unsigned int(void)'
2600 | unsigned long nr_iowait(void)
| ^~~~~~~~~
In file included from kernel/sched/alt_sched.h:16,
from kernel/sched/sched.h:6,
from kernel/sched/alt_core.c:14:
include/linux/sched/stat.h:22:21: note: previous declaration of 'nr_iowait' with type 'unsigned int(void)'
22 | extern unsigned int nr_iowait(void);
| ^~~~~~~~~
kernel/sched/alt_core.c:2706:6: error: conflicting types for 'arch_set_thermal_pressure'; have 'void(struct cpumask *, long unsigned int)'
2706 | void arch_set_thermal_pressure(struct cpumask *cpus,
| ^~~~~~~~~~~~~~~~~~~~~~~~~
In file included from kernel/sched/alt_sched.h:19,
from kernel/sched/sched.h:6,
from kernel/sched/alt_core.c:14:
include/linux/sched/topology.h:264:6: note: previous definition of 'arch_set_thermal_pressure' with type 'void(const struct cpumask *, long unsigned int)'
264 | void arch_set_thermal_pressure(const struct cpumask *cpus,
| ^~~~~~~~~~~~~~~~~~~~~~~~~
kernel/sched/alt_core.c: In function 'scheduler_tick':
kernel/sched/alt_core.c:2753:9: error: implicit declaration of function 'psi_task_tick'; did you mean 'put_task_stack'? [-Werror=implicit-function-declaration]
2753 | psi_task_tick(rq);
| ^~~~~~~~~~~~~
| put_task_stack
--
from kernel/sched/alt_sched.h:24,
from kernel/sched/sched.h:6,
from kernel/sched/alt_core.c:14:
include/linux/kallsyms.h:177:20: note: declared here
177 | static inline void print_ip_sym(const char *loglvl, unsigned long ip)
| ^~~~~~~~~~~~
kernel/sched/alt_core.c: In function '__schedule':
kernel/sched/alt_core.c:3357:31: error: 'struct task_struct' has no member named 'state'; did you mean '__state'?
3357 | if (!preempt && prev->state) {
| ^~~~~
| __state
kernel/sched/alt_core.c:3358:48: error: 'struct task_struct' has no member named 'state'; did you mean '__state'?
3358 | if (signal_pending_state(prev->state, prev)) {
| ^~~~~
| __state
kernel/sched/alt_core.c:3359:31: error: 'struct task_struct' has no member named 'state'; did you mean '__state'?
3359 | prev->state = TASK_RUNNING;
| ^~~~~
| __state
kernel/sched/alt_core.c: In function 'sched_submit_work':
kernel/sched/alt_core.c:3438:19: error: 'struct task_struct' has no member named 'state'; did you mean '__state'?
3438 | if (!tsk->state)
| ^~~~~
| __state
In file included from arch/parisc/include/asm/bug.h:93,
from include/linux/bug.h:5,
from include/linux/thread_info.h:13,
from include/asm-generic/current.h:5,
from ./arch/parisc/include/generated/asm/current.h:1,
from include/linux/sched.h:12,
from kernel/sched/alt_sched.h:4,
from kernel/sched/sched.h:6,
from kernel/sched/alt_core.c:14:
kernel/sched/alt_core.c: In function 'schedule_idle':
kernel/sched/alt_core.c:3512:31: error: 'struct task_struct' has no member named 'state'; did you mean '__state'?
3512 | WARN_ON_ONCE(current->state);
| ^~~~~
include/asm-generic/bug.h:104:32: note: in definition of macro 'WARN_ON_ONCE'
104 | int __ret_warn_on = !!(condition); \
| ^~~~~~~~~
kernel/sched/alt_core.c: In function '__sched_setscheduler':
kernel/sched/alt_core.c:4031:46: error: 'MAX_USER_RT_PRIO' undeclared (first use in this function); did you mean 'MAX_RT_PRIO'?
4031 | (p->mm && attr->sched_priority > MAX_USER_RT_PRIO - 1) ||
| ^~~~~~~~~~~~~~~~
| MAX_RT_PRIO
kernel/sched/alt_core.c:4031:46: note: each undeclared identifier is reported only once for each function it appears in
kernel/sched/alt_core.c: At top level:
kernel/sched/alt_core.c:4749:13: error: redefinition of '_cond_resched'
4749 | int __sched _cond_resched(void)
| ^~~~~~~~~~~~~
In file included from kernel/sched/alt_sched.h:4,
from kernel/sched/sched.h:6,
from kernel/sched/alt_core.c:14:
include/linux/sched.h:1948:19: note: previous definition of '_cond_resched' with type 'int(void)'
1948 | static inline int _cond_resched(void)
| ^~~~~~~~~~~~~
kernel/sched/alt_core.c: In function '__do_sys_sched_get_priority_max':
kernel/sched/alt_core.c:4902:23: error: 'MAX_USER_RT_PRIO' undeclared (first use in this function); did you mean 'MAX_RT_PRIO'?
4902 | ret = MAX_USER_RT_PRIO-1;
| ^~~~~~~~~~~~~~~~
| MAX_RT_PRIO
kernel/sched/alt_core.c: In function 'sched_show_task':
kernel/sched/alt_core.c:5010:16: error: 'struct task_struct' has no member named 'state'; did you mean '__state'?
5010 | if (p->state == TASK_RUNNING)
| ^~~~~
| __state
kernel/sched/alt_core.c:5025:9: error: too few arguments to function 'show_stack'
5025 | show_stack(p, NULL);
| ^~~~~~~~~~
In file included from kernel/sched/alt_sched.h:9,
from kernel/sched/sched.h:6,
from kernel/sched/alt_core.c:14:
include/linux/sched/debug.h:33:13: note: declared here
33 | extern void show_stack(struct task_struct *task, unsigned long *sp,
| ^~~~~~~~~~
kernel/sched/alt_core.c: In function 'state_filter_match':
kernel/sched/alt_core.c:5038:18: error: 'struct task_struct' has no member named 'state'; did you mean '__state'?
5038 | if (!(p->state & state_filter))
| ^~~~~
| __state
kernel/sched/alt_core.c:5045:56: error: 'struct task_struct' has no member named 'state'; did you mean '__state'?
5045 | if (state_filter == TASK_UNINTERRUPTIBLE && p->state == TASK_IDLE)
| ^~~~~
| __state
kernel/sched/alt_core.c: At top level:
kernel/sched/alt_core.c:5052:6: error: conflicting types for 'show_state_filter'; have 'void(long unsigned int)'
5052 | void show_state_filter(unsigned long state_filter)
| ^~~~~~~~~~~~~~~~~
In file included from kernel/sched/alt_sched.h:9,
from kernel/sched/sched.h:6,
from kernel/sched/alt_core.c:14:
include/linux/sched/debug.h:17:13: note: previous declaration of 'show_state_filter' with type 'void(unsigned int)'
17 | extern void show_state_filter(unsigned int state_filter);
| ^~~~~~~~~~~~~~~~~
kernel/sched/alt_core.c: In function 'init_idle':
kernel/sched/alt_core.c:5118:15: error: 'struct task_struct' has no member named 'state'; did you mean '__state'?
5118 | idle->state = TASK_RUNNING;
| ^~~~~
| __state
kernel/sched/alt_core.c: At top level:
>> kernel/sched/alt_core.c:5191:6: warning: no previous prototype for 'idle_task_exit' [-Wmissing-prototypes]
5191 | void idle_task_exit(void)
| ^~~~~~~~~~~~~~
>> kernel/sched/alt_core.c:5340:5: warning: no previous prototype for 'sched_cpu_activate' [-Wmissing-prototypes]
5340 | int sched_cpu_activate(unsigned int cpu)
| ^~~~~~~~~~~~~~~~~~
>> kernel/sched/alt_core.c:5373:5: warning: no previous prototype for 'sched_cpu_deactivate' [-Wmissing-prototypes]
5373 | int sched_cpu_deactivate(unsigned int cpu)
| ^~~~~~~~~~~~~~~~~~~~
>> kernel/sched/alt_core.c:5416:5: warning: no previous prototype for 'sched_cpu_starting' [-Wmissing-prototypes]
5416 | int sched_cpu_starting(unsigned int cpu)
| ^~~~~~~~~~~~~~~~~~
>> kernel/sched/alt_core.c:5424:5: warning: no previous prototype for 'sched_cpu_dying' [-Wmissing-prototypes]
5424 | int sched_cpu_dying(unsigned int cpu)
| ^~~~~~~~~~~~~~~
kernel/sched/alt_core.c: In function 'select_fallback_rq':
kernel/sched/alt_core.c:1357:28: warning: this statement may fall through [-Wimplicit-fallthrough=]
1357 | if (IS_ENABLED(CONFIG_CPUSETS)) {
| ^
kernel/sched/alt_core.c:1363:17: note: here
1363 | case possible:
| ^~~~
At top level:
kernel/sched/alt_core.c:142:18: warning: 'sched_sg_idle_mask' defined but not used [-Wunused-variable]
142 | static cpumask_t sched_sg_idle_mask ____cacheline_aligned_in_smp;
| ^~~~~~~~~~~~~~~~~~
cc1: some warnings being treated as errors
vim +/sched_set_stop_task +1409 kernel/sched/alt_core.c
1170
1171 #ifdef CONFIG_SMP
1172 /*
1173 * wait_task_inactive - wait for a thread to unschedule.
1174 *
1175 * If @match_state is nonzero, it's the @p->state value just checked and
1176 * not expected to change. If it changes, i.e. @p might have woken up,
1177 * then return zero. When we succeed in waiting for @p to be off its CPU,
1178 * we return a positive number (its total switch count). If a second call
1179 * a short while later returns the same number, the caller can be sure that
1180 * @p has remained unscheduled the whole time.
1181 *
1182 * The caller must ensure that the task *will* unschedule sometime soon,
1183 * else this function might spin for a *long* time. This function can't
1184 * be called with interrupts off, or it may introduce deadlock with
1185 * smp_call_function() if an IPI is sent by the same process we are
1186 * waiting to become inactive.
1187 */
1188 unsigned long wait_task_inactive(struct task_struct *p, long match_state)
1189 {
1190 unsigned long flags;
1191 bool running, on_rq;
1192 unsigned long ncsw;
1193 struct rq *rq;
1194 raw_spinlock_t *lock;
1195
1196 for (;;) {
1197 rq = task_rq(p);
1198
1199 /*
1200 * If the task is actively running on another CPU
1201 * still, just relax and busy-wait without holding
1202 * any locks.
1203 *
1204 * NOTE! Since we don't hold any locks, it's not
1205 * even sure that "rq" stays as the right runqueue!
1206 * But we don't care, since this will return false
1207 * if the runqueue has changed and p is actually now
1208 * running somewhere else!
1209 */
1210 while (task_running(p) && p == rq->curr) {
> 1211 if (match_state && unlikely(p->state != match_state))
1212 return 0;
1213 cpu_relax();
1214 }
1215
1216 /*
1217 * Ok, time to look more closely! We need the rq
1218 * lock now, to be *sure*. If we're wrong, we'll
1219 * just go back and repeat.
1220 */
1221 task_access_lock_irqsave(p, &lock, &flags);
1222 trace_sched_wait_task(p);
1223 running = task_running(p);
1224 on_rq = p->on_rq;
1225 ncsw = 0;
1226 if (!match_state || p->state == match_state)
1227 ncsw = p->nvcsw | LONG_MIN; /* sets MSB */
1228 task_access_unlock_irqrestore(p, lock, &flags);
1229
1230 /*
1231 * If it changed from the expected state, bail out now.
1232 */
1233 if (unlikely(!ncsw))
1234 break;
1235
1236 /*
1237 * Was it really running after all now that we
1238 * checked with the proper locks actually held?
1239 *
1240 * Oops. Go back and try again..
1241 */
1242 if (unlikely(running)) {
1243 cpu_relax();
1244 continue;
1245 }
1246
1247 /*
1248 * It's not enough that it's not actively running,
1249 * it must be off the runqueue _entirely_, and not
1250 * preempted!
1251 *
1252 * So if it was still runnable (but just not actively
1253 * running right now), it's preempted, and we should
1254 * yield - it could be a while.
1255 */
1256 if (unlikely(on_rq)) {
1257 ktime_t to = NSEC_PER_SEC / HZ;
1258
1259 set_current_state(TASK_UNINTERRUPTIBLE);
1260 schedule_hrtimeout(&to, HRTIMER_MODE_REL);
1261 continue;
1262 }
1263
1264 /*
1265 * Ahh, all good. It wasn't running, and it wasn't
1266 * runnable, which means that it will never become
1267 * running in the future either. We're all done!
1268 */
1269 break;
1270 }
1271
1272 return ncsw;
1273 }
1274
1275 /***
1276 * kick_process - kick a running thread to enter/exit the kernel
1277 * @p: the to-be-kicked thread
1278 *
1279 * Cause a process which is running on another CPU to enter
1280 * kernel-mode, without any delay. (to get signals handled.)
1281 *
1282 * NOTE: this function doesn't have to take the runqueue lock,
1283 * because all it wants to ensure is that the remote task enters
1284 * the kernel. If the IPI races and the task has been migrated
1285 * to another CPU then no harm is done and the purpose has been
1286 * achieved as well.
1287 */
1288 void kick_process(struct task_struct *p)
1289 {
1290 int cpu;
1291
1292 preempt_disable();
1293 cpu = task_cpu(p);
1294 if ((cpu != smp_processor_id()) && task_curr(p))
1295 smp_send_reschedule(cpu);
1296 preempt_enable();
1297 }
1298 EXPORT_SYMBOL_GPL(kick_process);
1299
1300 /*
1301 * ->cpus_ptr is protected by both rq->lock and p->pi_lock
1302 *
1303 * A few notes on cpu_active vs cpu_online:
1304 *
1305 * - cpu_active must be a subset of cpu_online
1306 *
1307 * - on CPU-up we allow per-CPU kthreads on the online && !active CPU,
1308 * see __set_cpus_allowed_ptr(). At this point the newly online
1309 * CPU isn't yet part of the sched domains, and balancing will not
1310 * see it.
1311 *
1312 * - on cpu-down we clear cpu_active() to mask the sched domains and
1313 * avoid the load balancer to place new tasks on the to be removed
1314 * CPU. Existing tasks will remain running there and will be taken
1315 * off.
1316 *
1317 * This means that fallback selection must not select !active CPUs.
1318 * And can assume that any active CPU must be online. Conversely
1319 * select_task_rq() below may allow selection of !active CPUs in order
1320 * to satisfy the above rules.
1321 */
1322 static int select_fallback_rq(int cpu, struct task_struct *p)
1323 {
1324 int nid = cpu_to_node(cpu);
1325 const struct cpumask *nodemask = NULL;
1326 enum { cpuset, possible, fail } state = cpuset;
1327 int dest_cpu;
1328
1329 /*
1330 * If the node that the CPU is on has been offlined, cpu_to_node()
1331 * will return -1. There is no CPU on the node, and we should
1332 * select the CPU on the other node.
1333 */
1334 if (nid != -1) {
1335 nodemask = cpumask_of_node(nid);
1336
1337 /* Look for allowed, online CPU in same node. */
1338 for_each_cpu(dest_cpu, nodemask) {
1339 if (!cpu_active(dest_cpu))
1340 continue;
1341 if (cpumask_test_cpu(dest_cpu, p->cpus_ptr))
1342 return dest_cpu;
1343 }
1344 }
1345
1346 for (;;) {
1347 /* Any allowed, online CPU? */
1348 for_each_cpu(dest_cpu, p->cpus_ptr) {
1349 if (!is_cpu_allowed(p, dest_cpu))
1350 continue;
1351 goto out;
1352 }
1353
1354 /* No more Mr. Nice Guy. */
1355 switch (state) {
1356 case cpuset:
1357 if (IS_ENABLED(CONFIG_CPUSETS)) {
1358 cpuset_cpus_allowed_fallback(p);
1359 state = possible;
1360 break;
1361 }
1362 /* Fall-through */
1363 case possible:
1364 do_set_cpus_allowed(p, cpu_possible_mask);
1365 state = fail;
1366 break;
1367
1368 case fail:
1369 BUG();
1370 break;
1371 }
1372 }
1373
1374 out:
1375 if (state != cpuset) {
1376 /*
1377 * Don't tell them about moving exiting tasks or
1378 * kernel threads (both mm NULL), since they never
1379 * leave kernel.
1380 */
1381 if (p->mm && printk_ratelimit()) {
1382 printk_deferred("process %d (%s) no longer affine to cpu%d\n",
1383 task_pid_nr(p), p->comm, cpu);
1384 }
1385 }
1386
1387 return dest_cpu;
1388 }
1389
1390 static inline int select_task_rq(struct task_struct *p)
1391 {
1392 cpumask_t chk_mask, tmp;
1393
1394 if (unlikely(!cpumask_and(&chk_mask, p->cpus_ptr, cpu_online_mask)))
1395 return select_fallback_rq(task_cpu(p), p);
1396
1397 if (
1398 #ifdef CONFIG_SCHED_SMT
1399 cpumask_and(&tmp, &chk_mask, &sched_sg_idle_mask) ||
1400 #endif
1401 cpumask_and(&tmp, &chk_mask, &sched_rq_watermark[IDLE_WM]) ||
1402 cpumask_and(&tmp, &chk_mask,
1403 &sched_rq_watermark[task_sched_prio(p) + 1]))
1404 return best_mask_cpu(task_cpu(p), &tmp);
1405
1406 return best_mask_cpu(task_cpu(p), &chk_mask);
1407 }
1408
> 1409 void sched_set_stop_task(int cpu, struct task_struct *stop)
1410 {
1411 struct sched_param stop_param = { .sched_priority = STOP_PRIO };
1412 struct sched_param start_param = { .sched_priority = 0 };
1413 struct task_struct *old_stop = cpu_rq(cpu)->stop;
1414
1415 if (stop) {
1416 /*
1417 * Make it appear like a SCHED_FIFO task, its something
1418 * userspace knows about and won't get confused about.
1419 *
1420 * Also, it will make PI more or less work without too
1421 * much confusion -- but then, stop work should not
1422 * rely on PI working anyway.
1423 */
1424 sched_setscheduler_nocheck(stop, SCHED_FIFO, &stop_param);
1425 }
1426
1427 cpu_rq(cpu)->stop = stop;
1428
1429 if (old_stop) {
1430 /*
1431 * Reset it back to a normal scheduling policy so that
1432 * it can die in pieces.
1433 */
1434 sched_setscheduler_nocheck(old_stop, SCHED_NORMAL, &start_param);
1435 }
1436 }
1437
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
[-- Attachment #2: config.gz --]
[-- Type: application/gzip, Size: 36943 bytes --]
reply other threads:[~2021-09-27 17:55 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202109280107.BerKXEBh-lkp@intel.com \
--to=lkp@intel.com \
--cc=kbuild-all@lists.01.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.