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>
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)