* [linux-stable-rc:linux-4.19.y 5631/5633] kernel/cgroup/cgroup.c:2237:2: error: implicit declaration of function 'get_online_cpus'
@ 2023-03-15 16:27 kernel test robot
0 siblings, 0 replies; only message in thread
From: kernel test robot @ 2023-03-15 16:27 UTC (permalink / raw)
To: Tejun Heo; +Cc: llvm, oe-kbuild-all, Greg Kroah-Hartman, Cai Xinchen
tree: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git linux-4.19.y
head: cb91edfa52f0b1a9fca6342d158744cd1d673a57
commit: b37fb75964cc116d7c3a776df22fbe90724503b8 [5631/5633] cgroup: Fix threadgroup_rwsem <-> cpus_read_lock() deadlock
config: mips-randconfig-r013-20230312 (https://download.01.org/0day-ci/archive/20230316/202303160030.RoNHau1K-lkp@intel.com/config)
compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project 67409911353323ca5edf2049ef0df54132fa1ca7)
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-mipsel-linux-gnu
# https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git/commit/?id=b37fb75964cc116d7c3a776df22fbe90724503b8
git remote add linux-stable-rc https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable-rc.git
git fetch --no-tags linux-stable-rc linux-4.19.y
git checkout b37fb75964cc116d7c3a776df22fbe90724503b8
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=mips olddefconfig
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=mips SHELL=/bin/bash kernel/cgroup/
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@intel.com>
| Link: https://lore.kernel.org/oe-kbuild-all/202303160030.RoNHau1K-lkp@intel.com/
All errors (new ones prefixed by >>):
>> kernel/cgroup/cgroup.c:2237:2: error: implicit declaration of function 'get_online_cpus' [-Werror,-Wimplicit-function-declaration]
get_online_cpus();
^
kernel/cgroup/cgroup.c:2237:2: note: did you mean 'get_online_mems'?
include/linux/memory_hotplug.h:258:20: note: 'get_online_mems' declared here
static inline void get_online_mems(void) {}
^
>> kernel/cgroup/cgroup.c:2248:2: error: implicit declaration of function 'put_online_cpus' [-Werror,-Wimplicit-function-declaration]
put_online_cpus();
^
kernel/cgroup/cgroup.c:2248:2: note: did you mean 'put_online_mems'?
include/linux/memory_hotplug.h:259:20: note: 'put_online_mems' declared here
static inline void put_online_mems(void) {}
^
2 errors generated.
vim +/get_online_cpus +2237 kernel/cgroup/cgroup.c
2211
2212 /**
2213 * cgroup_attach_lock - Lock for ->attach()
2214 * @lock_threadgroup: whether to down_write cgroup_threadgroup_rwsem
2215 *
2216 * cgroup migration sometimes needs to stabilize threadgroups against forks and
2217 * exits by write-locking cgroup_threadgroup_rwsem. However, some ->attach()
2218 * implementations (e.g. cpuset), also need to disable CPU hotplug.
2219 * Unfortunately, letting ->attach() operations acquire cpus_read_lock() can
2220 * lead to deadlocks.
2221 *
2222 * Bringing up a CPU may involve creating and destroying tasks which requires
2223 * read-locking threadgroup_rwsem, so threadgroup_rwsem nests inside
2224 * cpus_read_lock(). If we call an ->attach() which acquires the cpus lock while
2225 * write-locking threadgroup_rwsem, the locking order is reversed and we end up
2226 * waiting for an on-going CPU hotplug operation which in turn is waiting for
2227 * the threadgroup_rwsem to be released to create new tasks. For more details:
2228 *
2229 * http://lkml.kernel.org/r/20220711174629.uehfmqegcwn2lqzu@wubuntu
2230 *
2231 * Resolve the situation by always acquiring cpus_read_lock() before optionally
2232 * write-locking cgroup_threadgroup_rwsem. This allows ->attach() to assume that
2233 * CPU hotplug is disabled on entry.
2234 */
2235 static void cgroup_attach_lock(void)
2236 {
> 2237 get_online_cpus();
2238 percpu_down_write(&cgroup_threadgroup_rwsem);
2239 }
2240
2241 /**
2242 * cgroup_attach_unlock - Undo cgroup_attach_lock()
2243 * @lock_threadgroup: whether to up_write cgroup_threadgroup_rwsem
2244 */
2245 static void cgroup_attach_unlock(void)
2246 {
2247 percpu_up_write(&cgroup_threadgroup_rwsem);
> 2248 put_online_cpus();
2249 }
2250
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-03-15 16:29 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-15 16:27 [linux-stable-rc:linux-4.19.y 5631/5633] kernel/cgroup/cgroup.c:2237:2: error: implicit declaration of function 'get_online_cpus' kernel test robot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).