Merge tag 'iommu-updates-v4.21' of git://git.kernel.org/pub/scm/linux/kernel/git...
[linux-2.6-microblaze.git] / kernel / torture.c
index 17d91f5..bbf6d47 100644 (file)
@@ -194,11 +194,23 @@ torture_onoff(void *arg)
        int cpu;
        int maxcpu = -1;
        DEFINE_TORTURE_RANDOM(rand);
+       int ret;
 
        VERBOSE_TOROUT_STRING("torture_onoff task started");
        for_each_online_cpu(cpu)
                maxcpu = cpu;
        WARN_ON(maxcpu < 0);
+       if (!IS_MODULE(CONFIG_TORTURE_TEST))
+               for_each_possible_cpu(cpu) {
+                       if (cpu_online(cpu))
+                               continue;
+                       ret = cpu_up(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");
@@ -233,16 +245,15 @@ stop:
  */
 int torture_onoff_init(long ooholdoff, long oointerval)
 {
-       int ret = 0;
-
 #ifdef CONFIG_HOTPLUG_CPU
        onoff_holdoff = ooholdoff;
        onoff_interval = oointerval;
        if (onoff_interval <= 0)
                return 0;
-       ret = torture_create_kthread(torture_onoff, NULL, onoff_task);
-#endif /* #ifdef CONFIG_HOTPLUG_CPU */
-       return ret;
+       return torture_create_kthread(torture_onoff, NULL, onoff_task);
+#else /* #ifdef CONFIG_HOTPLUG_CPU */
+       return 0;
+#endif /* #else #ifdef CONFIG_HOTPLUG_CPU */
 }
 EXPORT_SYMBOL_GPL(torture_onoff_init);
 
@@ -513,15 +524,13 @@ static int torture_shutdown(void *arg)
  */
 int torture_shutdown_init(int ssecs, void (*cleanup)(void))
 {
-       int ret = 0;
-
        torture_shutdown_hook = cleanup;
        if (ssecs > 0) {
                shutdown_time = ktime_add(ktime_get(), ktime_set(ssecs, 0));
-               ret = torture_create_kthread(torture_shutdown, NULL,
+               return torture_create_kthread(torture_shutdown, NULL,
                                             shutdown_task);
        }
-       return ret;
+       return 0;
 }
 EXPORT_SYMBOL_GPL(torture_shutdown_init);
 
@@ -620,13 +629,10 @@ static int torture_stutter(void *arg)
 /*
  * Initialize and kick off the torture_stutter kthread.
  */
-int torture_stutter_init(int s)
+int torture_stutter_init(const int s)
 {
-       int ret;
-
        stutter = s;
-       ret = torture_create_kthread(torture_stutter, NULL, stutter_task);
-       return ret;
+       return torture_create_kthread(torture_stutter, NULL, stutter_task);
 }
 EXPORT_SYMBOL_GPL(torture_stutter_init);