torture: Clean up after torture-test CPU hotplugging
This commit puts all CPUs back online at the end of a torture test, and also unconditionally puts them online at the beginning of the test, rather than just in the case of built-in tests. This allows torture tests to behave in a predictable manner, whether built-in or based on modules. Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
This commit is contained in:
parent
edf7b84178
commit
0b962c8fe0
@ -291,6 +291,26 @@ bool torture_online(int cpu, long *n_onl_attempts, long *n_onl_successes,
|
|||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(torture_online);
|
EXPORT_SYMBOL_GPL(torture_online);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Get everything online at the beginning and ends of tests.
|
||||||
|
*/
|
||||||
|
static void torture_online_all(char *phase)
|
||||||
|
{
|
||||||
|
int cpu;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
for_each_possible_cpu(cpu) {
|
||||||
|
if (cpu_online(cpu))
|
||||||
|
continue;
|
||||||
|
ret = add_cpu(cpu);
|
||||||
|
if (ret && verbose) {
|
||||||
|
pr_alert("%s" TORTURE_FLAG
|
||||||
|
"%s: %s online %d: errno %d\n",
|
||||||
|
__func__, phase, torture_type, cpu, ret);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Execute random CPU-hotplug operations at the interval specified
|
* Execute random CPU-hotplug operations at the interval specified
|
||||||
* by the onoff_interval.
|
* by the onoff_interval.
|
||||||
@ -301,25 +321,12 @@ torture_onoff(void *arg)
|
|||||||
int cpu;
|
int cpu;
|
||||||
int maxcpu = -1;
|
int maxcpu = -1;
|
||||||
DEFINE_TORTURE_RANDOM(rand);
|
DEFINE_TORTURE_RANDOM(rand);
|
||||||
int ret;
|
|
||||||
|
|
||||||
VERBOSE_TOROUT_STRING("torture_onoff task started");
|
VERBOSE_TOROUT_STRING("torture_onoff task started");
|
||||||
for_each_online_cpu(cpu)
|
for_each_online_cpu(cpu)
|
||||||
maxcpu = cpu;
|
maxcpu = cpu;
|
||||||
WARN_ON(maxcpu < 0);
|
WARN_ON(maxcpu < 0);
|
||||||
if (!IS_MODULE(CONFIG_TORTURE_TEST)) {
|
torture_online_all("Initial");
|
||||||
for_each_possible_cpu(cpu) {
|
|
||||||
if (cpu_online(cpu))
|
|
||||||
continue;
|
|
||||||
ret = add_cpu(cpu);
|
|
||||||
if (ret && verbose) {
|
|
||||||
pr_alert("%s" TORTURE_FLAG
|
|
||||||
"%s: Initial online %d: errno %d\n",
|
|
||||||
__func__, torture_type, cpu, ret);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (maxcpu == 0) {
|
if (maxcpu == 0) {
|
||||||
VERBOSE_TOROUT_STRING("Only one CPU, so CPU-hotplug testing is disabled");
|
VERBOSE_TOROUT_STRING("Only one CPU, so CPU-hotplug testing is disabled");
|
||||||
goto stop;
|
goto stop;
|
||||||
@ -347,6 +354,7 @@ torture_onoff(void *arg)
|
|||||||
|
|
||||||
stop:
|
stop:
|
||||||
torture_kthread_stopping("torture_onoff");
|
torture_kthread_stopping("torture_onoff");
|
||||||
|
torture_online_all("Final");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user