Skip to content

Commit

Permalink
torture: Replace cpu_up/down() with add/remove_cpu()
Browse files Browse the repository at this point in the history
The core device API performs extra housekeeping bits that are missing
from directly calling cpu_up/down().

See commit a6717c0 ("powerpc/rtas: use device model APIs and
serialization during LPM") for an example description of what might go
wrong.

This also prepares to make cpu_up/down() a private interface of the CPU
subsystem.

Signed-off-by: Qais Yousef <qais.yousef@arm.com>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Acked-by: "Paul E. McKenney" <paulmck@kernel.org>
Link: https://lkml.kernel.org/r/20200323135110.30522-16-qais.yousef@arm.com
  • Loading branch information
Qais Yousef authored and Thomas Gleixner committed Mar 25, 2020
1 parent 20fb502 commit 457bc8e
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions kernel/torture.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ bool torture_offline(int cpu, long *n_offl_attempts, long *n_offl_successes,
torture_type, cpu);
starttime = jiffies;
(*n_offl_attempts)++;
ret = cpu_down(cpu);
ret = remove_cpu(cpu);
if (ret) {
if (verbose)
pr_alert("%s" TORTURE_FLAG
Expand Down Expand Up @@ -148,7 +148,7 @@ bool torture_online(int cpu, long *n_onl_attempts, long *n_onl_successes,
torture_type, cpu);
starttime = jiffies;
(*n_onl_attempts)++;
ret = cpu_up(cpu);
ret = add_cpu(cpu);
if (ret) {
if (verbose)
pr_alert("%s" TORTURE_FLAG
Expand Down Expand Up @@ -192,17 +192,18 @@ torture_onoff(void *arg)
for_each_online_cpu(cpu)
maxcpu = cpu;
WARN_ON(maxcpu < 0);
if (!IS_MODULE(CONFIG_TORTURE_TEST))
if (!IS_MODULE(CONFIG_TORTURE_TEST)) {
for_each_possible_cpu(cpu) {
if (cpu_online(cpu))
continue;
ret = cpu_up(cpu);
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) {
VERBOSE_TOROUT_STRING("Only one CPU, so CPU-hotplug testing is disabled");
Expand Down

0 comments on commit 457bc8e

Please sign in to comment.