]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/commitdiff
torture: Don't try to offline the last CPU
authorPaul E. McKenney <paulmck@linux.ibm.com>
Wed, 23 Jan 2019 03:23:00 +0000 (19:23 -0800)
committerPaul E. McKenney <paulmck@linux.ibm.com>
Tue, 26 Mar 2019 21:42:53 +0000 (14:42 -0700)
If there is only one online CPU, it doesn't make sense to try to offline
it, as any such attempt is guaranteed to fail.  This commit therefore
check for this condition and refuses to attempt the nonsensical.

Reported-by: Su Yue <suy.fnst@cn.fujitsu.com>
Signed-off-by: Paul E. McKenney <paulmck@linux.ibm.com>
Tested-By: Su Yue <suy.fnst@cn.fujitsu.com>
kernel/torture.c

index 8faa1a9aaeb978a5aeaf218a7096c3073683e08c..17b2be9bde12aa22a010788a2143eeedddc3a6c3 100644 (file)
@@ -88,6 +88,8 @@ bool torture_offline(int cpu, long *n_offl_attempts, long *n_offl_successes,
 
        if (!cpu_online(cpu) || !cpu_is_hotpluggable(cpu))
                return false;
+       if (num_online_cpus() <= 1)
+               return false;  /* Can't offline the last CPU. */
 
        if (verbose > 1)
                pr_alert("%s" TORTURE_FLAG