* [tglx-devel:highmem 8/25] kernel/sched/core.c:2151 __set_cpus_allowed_ptr() warn: inconsistent returns 'p->pi_lock'.
@ 2020-09-23 23:58 kernel test robot
0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2020-09-23 23:58 UTC (permalink / raw)
To: kbuild
[-- Attachment #1: Type: text/plain, Size: 8676 bytes --]
CC: kbuild-all(a)lists.01.org
TO: Peter Zijlstra <peterz@infradead.org>
CC: Thomas Gleixner <tglx@linutronix.de>
tree: https://git.kernel.org/pub/scm/linux/kernel/git/tglx/devel.git highmem
head: ba27dfb9cfbeda37c0d760646828d1b9bc5d2f0c
commit: fe6247dfb29bbdd23a8a16350fea406d026a9530 [8/25] sched: Fix migrate_disable() vs set_cpus_allowed_ptr()
:::::: branch date: 10 hours ago
:::::: commit date: 10 hours ago
config: x86_64-randconfig-m001-20200923 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
smatch warnings:
kernel/sched/core.c:2151 __set_cpus_allowed_ptr() warn: inconsistent returns 'p->pi_lock'.
kernel/sched/core.c:2151 __set_cpus_allowed_ptr() warn: inconsistent returns 'rf.flags'.
kernel/sched/core.c:2151 __set_cpus_allowed_ptr() warn: inconsistent returns 'rq->lock'.
# https://git.kernel.org/pub/scm/linux/kernel/git/tglx/devel.git/commit/?id=fe6247dfb29bbdd23a8a16350fea406d026a9530
git remote add tglx-devel https://git.kernel.org/pub/scm/linux/kernel/git/tglx/devel.git
git fetch --no-tags tglx-devel highmem
git checkout fe6247dfb29bbdd23a8a16350fea406d026a9530
vim +2151 kernel/sched/core.c
fe6247dfb29bbd Peter Zijlstra 2020-09-21 2072
5cc389bcee088b Peter Zijlstra 2015-06-11 2073 /*
5cc389bcee088b Peter Zijlstra 2015-06-11 2074 * Change a given task's CPU affinity. Migrate the thread to a
5cc389bcee088b Peter Zijlstra 2015-06-11 2075 * proper CPU and schedule it away if the CPU it's executing on
5cc389bcee088b Peter Zijlstra 2015-06-11 2076 * is removed from the allowed bitmask.
5cc389bcee088b Peter Zijlstra 2015-06-11 2077 *
5cc389bcee088b Peter Zijlstra 2015-06-11 2078 * NOTE: the caller must have a valid reference to the task, the
5cc389bcee088b Peter Zijlstra 2015-06-11 2079 * task must not exit() & deallocate itself prematurely. The
5cc389bcee088b Peter Zijlstra 2015-06-11 2080 * call is not atomic; no spinlocks may be held.
5cc389bcee088b Peter Zijlstra 2015-06-11 2081 */
25834c73f93af7 Peter Zijlstra 2015-05-15 2082 static int __set_cpus_allowed_ptr(struct task_struct *p,
f2b6aeb17504cd Peter Zijlstra 2020-09-21 2083 const struct cpumask *new_mask,
f2b6aeb17504cd Peter Zijlstra 2020-09-21 2084 u32 flags)
5cc389bcee088b Peter Zijlstra 2015-06-11 2085 {
e9d867a67fd03c Peter Zijlstra (Intel 2016-03-10 2086) const struct cpumask *cpu_valid_mask = cpu_active_mask;
5cc389bcee088b Peter Zijlstra 2015-06-11 2087 unsigned int dest_cpu;
eb58075149b7f0 Peter Zijlstra 2015-07-31 2088 struct rq_flags rf;
eb58075149b7f0 Peter Zijlstra 2015-07-31 2089 struct rq *rq;
5cc389bcee088b Peter Zijlstra 2015-06-11 2090 int ret = 0;
5cc389bcee088b Peter Zijlstra 2015-06-11 2091
eb58075149b7f0 Peter Zijlstra 2015-07-31 2092 rq = task_rq_lock(p, &rf);
a499c3ead88ccf Wanpeng Li 2017-02-21 2093 update_rq_clock(rq);
5cc389bcee088b Peter Zijlstra 2015-06-11 2094
e53b52dbd7b6cb Peter Zijlstra 2020-09-21 2095 if (p->flags & PF_KTHREAD || is_migration_disabled(p)) {
e9d867a67fd03c Peter Zijlstra (Intel 2016-03-10 2096) /*
e53b52dbd7b6cb Peter Zijlstra 2020-09-21 2097 * Kernel threads are allowed on online && !active CPUs.
e53b52dbd7b6cb Peter Zijlstra 2020-09-21 2098 *
e53b52dbd7b6cb Peter Zijlstra 2020-09-21 2099 * Specifically, migration_disabled() tasks must not fail the
e53b52dbd7b6cb Peter Zijlstra 2020-09-21 2100 * cpumask_and_and_distribute() pick below, esp. so on
e53b52dbd7b6cb Peter Zijlstra 2020-09-21 2101 * SCA_MIGRATE_ENABLE, otherwise we'll not call
e53b52dbd7b6cb Peter Zijlstra 2020-09-21 2102 * set_cpus_allowed_common() and actually reset p->cpus_ptr.
e9d867a67fd03c Peter Zijlstra (Intel 2016-03-10 2103) */
e9d867a67fd03c Peter Zijlstra (Intel 2016-03-10 2104) cpu_valid_mask = cpu_online_mask;
e9d867a67fd03c Peter Zijlstra (Intel 2016-03-10 2105) }
e9d867a67fd03c Peter Zijlstra (Intel 2016-03-10 2106)
25834c73f93af7 Peter Zijlstra 2015-05-15 2107 /*
25834c73f93af7 Peter Zijlstra 2015-05-15 2108 * Must re-check here, to close a race against __kthread_bind(),
25834c73f93af7 Peter Zijlstra 2015-05-15 2109 * sched_setaffinity() is not guaranteed to observe the flag.
25834c73f93af7 Peter Zijlstra 2015-05-15 2110 */
f2b6aeb17504cd Peter Zijlstra 2020-09-21 2111 if ((flags & SCA_CHECK) && (p->flags & PF_NO_SETAFFINITY)) {
25834c73f93af7 Peter Zijlstra 2015-05-15 2112 ret = -EINVAL;
25834c73f93af7 Peter Zijlstra 2015-05-15 2113 goto out;
25834c73f93af7 Peter Zijlstra 2015-05-15 2114 }
25834c73f93af7 Peter Zijlstra 2015-05-15 2115
e53b52dbd7b6cb Peter Zijlstra 2020-09-21 2116 if (!(flags & SCA_MIGRATE_ENABLE) && cpumask_equal(&p->cpus_mask, new_mask))
5cc389bcee088b Peter Zijlstra 2015-06-11 2117 goto out;
5cc389bcee088b Peter Zijlstra 2015-06-11 2118
46a87b3851f0d6 Paul Turner 2020-03-10 2119 /*
46a87b3851f0d6 Paul Turner 2020-03-10 2120 * Picking a ~random cpu helps in cases where we are changing affinity
46a87b3851f0d6 Paul Turner 2020-03-10 2121 * for groups of tasks (ie. cpuset), so that load balancing is not
46a87b3851f0d6 Paul Turner 2020-03-10 2122 * immediately required to distribute the tasks within their new mask.
46a87b3851f0d6 Paul Turner 2020-03-10 2123 */
46a87b3851f0d6 Paul Turner 2020-03-10 2124 dest_cpu = cpumask_any_and_distribute(cpu_valid_mask, new_mask);
714e501e16cd47 KeMeng Shi 2019-09-16 2125 if (dest_cpu >= nr_cpu_ids) {
5cc389bcee088b Peter Zijlstra 2015-06-11 2126 ret = -EINVAL;
5cc389bcee088b Peter Zijlstra 2015-06-11 2127 goto out;
5cc389bcee088b Peter Zijlstra 2015-06-11 2128 }
5cc389bcee088b Peter Zijlstra 2015-06-11 2129
f2b6aeb17504cd Peter Zijlstra 2020-09-21 2130 __do_set_cpus_allowed(p, new_mask, flags);
5cc389bcee088b Peter Zijlstra 2015-06-11 2131
e9d867a67fd03c Peter Zijlstra (Intel 2016-03-10 2132) if (p->flags & PF_KTHREAD) {
e9d867a67fd03c Peter Zijlstra (Intel 2016-03-10 2133) /*
e9d867a67fd03c Peter Zijlstra (Intel 2016-03-10 2134) * For kernel threads that do indeed end up on online &&
d1ccc66df8bfe3 Ingo Molnar 2017-02-01 2135 * !active we want to ensure they are strict per-CPU threads.
e9d867a67fd03c Peter Zijlstra (Intel 2016-03-10 2136) */
e9d867a67fd03c Peter Zijlstra (Intel 2016-03-10 2137) WARN_ON(cpumask_intersects(new_mask, cpu_online_mask) &&
e9d867a67fd03c Peter Zijlstra (Intel 2016-03-10 2138) !cpumask_intersects(new_mask, cpu_active_mask) &&
e9d867a67fd03c Peter Zijlstra (Intel 2016-03-10 2139) p->nr_cpus_allowed != 1);
e9d867a67fd03c Peter Zijlstra (Intel 2016-03-10 2140) }
e9d867a67fd03c Peter Zijlstra (Intel 2016-03-10 2141)
5cc389bcee088b Peter Zijlstra 2015-06-11 2142 /* Can the task run on the task's current CPU? If so, we're done */
5cc389bcee088b Peter Zijlstra 2015-06-11 2143 if (cpumask_test_cpu(task_cpu(p), new_mask))
5cc389bcee088b Peter Zijlstra 2015-06-11 2144 goto out;
5cc389bcee088b Peter Zijlstra 2015-06-11 2145
fe6247dfb29bbd Peter Zijlstra 2020-09-21 2146 return move_task(rq, &rf, p, dest_cpu, flags);
fe6247dfb29bbd Peter Zijlstra 2020-09-21 2147
5cc389bcee088b Peter Zijlstra 2015-06-11 2148 out:
eb58075149b7f0 Peter Zijlstra 2015-07-31 2149 task_rq_unlock(rq, p, &rf);
5cc389bcee088b Peter Zijlstra 2015-06-11 2150
5cc389bcee088b Peter Zijlstra 2015-06-11 @2151 return ret;
5cc389bcee088b Peter Zijlstra 2015-06-11 2152 }
25834c73f93af7 Peter Zijlstra 2015-05-15 2153
:::::: The code at line 2151 was first introduced by commit
:::::: 5cc389bcee088b72c8c34a01d596412cab4f3f78 sched: Move code around
:::::: TO: Peter Zijlstra <peterz@infradead.org>
:::::: CC: Thomas Gleixner <tglx@linutronix.de>
---
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: 31282 bytes --]
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-09-23 23:58 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-23 23:58 [tglx-devel:highmem 8/25] kernel/sched/core.c:2151 __set_cpus_allowed_ptr() warn: inconsistent returns 'p->pi_lock' kernel test robot
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.