summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul E. McKenney <paulmck@linux.vnet.ibm.com>2018-08-21 18:27:16 -0400
committerPaul E. McKenney <paulmck@linux.ibm.com>2018-12-01 15:45:32 -0500
commit28cf5952f56005325f269ccfe402a880cd741189 (patch)
treeaf1893d5a12f1fb34ffa4d96b7d41fcf0fe9dab2
parent4871848531af1d62f30032bfb872c43b9afe03ad (diff)
torture: Bring any extra CPUs online during kernel startup
Currently, the torture scripts rely on the initrd/init script to bring any extra CPUs online, for example, in the case where the kernel and qemu have different ideas about how many CPUs are present. This works, but is an unnecessary dependency on initrd, which needs to vary depending on the distro. This commit therefore causes torture_onoff() to check for additional CPUs, attempting to bring any found online. Errors are ignored, just as they are by the initrd/init script. Signed-off-by: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
-rw-r--r--kernel/torture.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/kernel/torture.c b/kernel/torture.c
index 17d91f5fba2a..9410d1bf84d6 100644
--- a/kernel/torture.c
+++ b/kernel/torture.c
@@ -194,11 +194,23 @@ torture_onoff(void *arg)
194 int cpu; 194 int cpu;
195 int maxcpu = -1; 195 int maxcpu = -1;
196 DEFINE_TORTURE_RANDOM(rand); 196 DEFINE_TORTURE_RANDOM(rand);
197 int ret;
197 198
198 VERBOSE_TOROUT_STRING("torture_onoff task started"); 199 VERBOSE_TOROUT_STRING("torture_onoff task started");
199 for_each_online_cpu(cpu) 200 for_each_online_cpu(cpu)
200 maxcpu = cpu; 201 maxcpu = cpu;
201 WARN_ON(maxcpu < 0); 202 WARN_ON(maxcpu < 0);
203 if (!IS_MODULE(CONFIG_TORTURE_TEST))
204 for_each_possible_cpu(cpu) {
205 if (cpu_online(cpu))
206 continue;
207 ret = cpu_up(cpu);
208 if (ret && verbose) {
209 pr_alert("%s" TORTURE_FLAG
210 "%s: Initial online %d: errno %d\n",
211 __func__, torture_type, cpu, ret);
212 }
213 }
202 214
203 if (maxcpu == 0) { 215 if (maxcpu == 0) {
204 VERBOSE_TOROUT_STRING("Only one CPU, so CPU-hotplug testing is disabled"); 216 VERBOSE_TOROUT_STRING("Only one CPU, so CPU-hotplug testing is disabled");