diff options
| author | Andrew Morton <akpm@digeo.com> | 2002-12-29 21:41:16 -0800 |
|---|---|---|
| committer | Linus Torvalds <torvalds@home.transmeta.com> | 2002-12-29 21:41:16 -0800 |
| commit | a93e679a7d1ca9cd662520a79830fec88a9654ca (patch) | |
| tree | 10c9c2e91bc3f89c0f5594a004a7c2c9c16d1301 /include/linux/smp.h | |
| parent | 8b0cc2d4e2705dc8793bd7c0e0f7b3504c49ecc6 (diff) | |
[PATCH] don't call console drivers on non-online CPUs
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.
Diffstat (limited to 'include/linux/smp.h')
| -rw-r--r-- | include/linux/smp.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/include/linux/smp.h b/include/linux/smp.h index 7a1e22b170c2..8243c6bec130 100644 --- a/include/linux/smp.h +++ b/include/linux/smp.h @@ -78,6 +78,13 @@ extern int register_cpu_notifier(struct notifier_block *nb); extern void unregister_cpu_notifier(struct notifier_block *nb); int cpu_up(unsigned int cpu); + +/* + * Mark the boot cpu "online" so that it can call console drivers in + * printk() and can access its per-cpu storage. + */ +void smp_prepare_boot_cpu(void); + #else /* !SMP */ /* @@ -94,7 +101,8 @@ static inline void smp_send_reschedule_all(void) { } #define cpu_online(cpu) ({ BUG_ON((cpu) != 0); 1; }) #define num_online_cpus() 1 #define num_booting_cpus() 1 -#define cpu_possible(cpu) ({ BUG_ON((cpu) != 0); 1; }) +#define cpu_possible(cpu) ({ BUG_ON((cpu) != 0); 1; }) +#define smp_prepare_boot_cpu() do {} while (0) struct notifier_block; |
