[PATCH][2.5] Remove BUG in cpu_up

From: Zwane Mwaikambo (zwane@holomorphy.com)
Date: Tue Nov 12 2002 - 22:42:07 EST


I think a BUG here is a bit on the extreme side, we already have a running
processor (in boot i'd presume its the BSP) so we can afford to limp on.
At runtime a stopped/dead processor which refuses to come back up
shouldn't make the kernel oops.

        Zwane

Index: linux-2.5.47/kernel/cpu.c
===================================================================
RCS file: /build/cvsroot/linux-2.5.47/kernel/cpu.c,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 cpu.c
--- linux-2.5.47/kernel/cpu.c 11 Nov 2002 03:59:33 -0000 1.1.1.1
+++ linux-2.5.47/kernel/cpu.c 13 Nov 2002 03:37:37 -0000
@@ -35,13 +35,11 @@
                 return ret;
 
         if (cpu_online(cpu)) {
- ret = -EINVAL;
+ ret = -EBUSY;
                 goto out;
         }
         ret = notifier_call_chain(&cpu_chain, CPU_UP_PREPARE, hcpu);
         if (ret == NOTIFY_BAD) {
- printk("%s: attempt to bring up CPU %u failed\n",
- __FUNCTION__, cpu);
                 ret = -EINVAL;
                 goto out_notify;
         }
@@ -50,16 +48,22 @@
         ret = __cpu_up(cpu);
         if (ret != 0)
                 goto out_notify;
- if (!cpu_online(cpu))
- BUG();
+
+ if (!cpu_online(cpu)) {
+ ret = -EIO;
+ goto out_notify;
+ }
 
         /* Now call notifier in preparation. */
- printk("CPU %u IS NOW UP!\n", cpu);
+ printk(KERN_INFO "CPU %u IS NOW UP!\n", cpu);
         notifier_call_chain(&cpu_chain, CPU_ONLINE, hcpu);
 
 out_notify:
- if (ret != 0)
+ if (ret != 0) {
+ printk(KERN_WARNING "%s: attempt to bring up CPU %u failed\n",
+ __FUNCTION__, cpu);
                 notifier_call_chain(&cpu_chain, CPU_UP_CANCELED, hcpu);
+ }
 out:
         up(&cpucontrol);
         return ret;

-- 
function.linuxpower.ca

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Fri Nov 15 2002 - 22:00:28 EST