• Andrew Morton's avatar
    [PATCH] don't call console drivers on non-online CPUs · a93e679a
    Andrew Morton authored
    George Anzinger identified the following problem: when a secondary CPU is
    coming up, it calls printk() before it is "online".  It calls the console
    drivers before its per-cpu storage has been prepared.  And the vga console
    driver does a mod_timer().  This CPU's timers have not yet been initialised;
    it is not clear why this doesn't oops - George thinks it is because virtual
    address zero is still accessible at that time.
    
    I believe the right way to fix this is to change printk so that a not-online
    CPU will not call the console drivers.  Because printk should always be
    callable.  If the CPU is not online the message is buffered, so the next
    caller to printk who is online will actually display it.
    
    ia64 has been doing exactly this for ages, so we can remove the
    arch_consoles_callable() hook and just open-code the cpu_online() test in
    printk.
    
    
    
    That fixes things up for the secondary CPUs.  But this change causes a
    problem for the boot CPU: it is being marked online very late in boot, so the
    printk buffer is being displayed much later than we would like.
    
    I believe that the solution to this is to mark the boot CPU online much
    earlier.  So in this patch we call the new arch-provided function
    smp_prepare_boot_cpu() immediately after the boot CPU's per-cpu areas are set
    up.  Its mandate is to (at least) mark the boot CPU "online".
    
    The change has been reviewed by davem and rth.  No comments were received
    from the other arch maintainers.
    a93e679a
smpboot.c 13.5 KB