]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
sparc64: fix an issue when trying to bring hotplug cpus online
authorDave Aldridge <david.j.aldridge@oracle.com>
Fri, 24 Mar 2017 12:01:00 +0000 (06:01 -0600)
committerChuck Anderson <chuck.anderson@oracle.com>
Mon, 24 Apr 2017 04:43:25 +0000 (21:43 -0700)
When booting the kernel with maxcpus= on the command line
and then subsequently trying to bring cpus online using:

echo 1 > /sys/devices/system/cpu/cpu[n]/online

messages of the form:

ldom_startcpu_cpuid: sun4v_cpu_start() gives error 6
Processor[n] is stuck

were being reported on the console.

This commit fixes this issue by ensuring that any cpus not
booted during initial kernel boot are explicitly stopped.
This then allows them to be successfully brought online later
if required.

Orabug: 25667277

Signed-off-by: Dave Aldridge <david.j.aldridge@oracle.com>
Reviewed-by: Shannon Nelson <shannon.nelson@oracle.com>
Reviewed-by: Allen Pais <allen.pais@oracle.com>
Signed-off-by: Allen Pais <allen.pais@oracle.com>
arch/sparc/kernel/smp_64.c

index 8b18c56717ba43a61a82adccbef9056294a3903f..6db80e106ab0925f3ab136e548a2e0dc912f6aa7 100644 (file)
@@ -1462,6 +1462,30 @@ void __cpu_die(unsigned int cpu)
 
 void __init smp_cpus_done(unsigned int max_cpus)
 {
+#if defined(CONFIG_SUN_LDOMS) && defined(CONFIG_HOTPLUG_CPU)
+       unsigned long hv_err;
+       int cpu;
+
+       if (num_present_cpus() == num_online_cpus()) {
+               /* All present cpus are online,
+                * nothing to do here
+                */
+               return;
+       }
+
+       /* Stop the cpus currently not online, so that we
+        * can bring them online later if required
+        */
+       for_each_present_cpu(cpu) {
+               if (!cpu_online(cpu) &&
+                       (sun4v_cpu_state(cpu) != HV_CPU_STATE_STOPPED)) {
+                       hv_err = sun4v_cpu_stop(cpu);
+                       if (hv_err)
+                               pr_err("%s: sun4v_cpu_stop() fails err=%lu\n",
+                                       __func__, hv_err);
+               }
+       }
+#endif
 }
 
 void smp_send_reschedule(int cpu)