]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
selftests: cpu-hotplug: fix case where CPUs offline > CPUs present
authorColin Ian King <colin.king@canonical.com>
Thu, 10 Jan 2019 12:38:02 +0000 (12:38 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 13 Mar 2019 21:04:02 +0000 (14:04 -0700)
commit59f746bcc39601e185271bb8bec81f0a4e76d58a
tree9acf3b0dfd9769d833e55495c5c78ef2b31b8a05
parentecfdb9b32cdf8e84c8a568f2551f234b242ce8fc
selftests: cpu-hotplug: fix case where CPUs offline > CPUs present

[ Upstream commit 2b531b6137834a55857a337ac17510d6436b6fbb ]

The cpu-hotplug test assumes that we can offline the maximum CPU as
described by /sys/devices/system/cpu/offline.  However, in the case
where the number of CPUs exceeds like kernel configuration then
the offline count can be greater than the present count and we end
up trying to test the offlining of a CPU that is not available to
offline.  Fix this by testing the maximum present CPU instead.

Also, the test currently offlines the CPU and does not online it,
so fix this by onlining the CPU after the test.

Fixes: d89dffa976bc ("fault-injection: add selftests for cpu and memory hotplug")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
Signed-off-by: Shuah Khan <shuah@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
tools/testing/selftests/cpu-hotplug/cpu-on-off-test.sh