Re: [PATCH] 2.4.16 kernel/printk.c (per processorinitializationcheck)

David Mosberger (davidm@hpl.hp.com)
Sat, 8 Dec 2001 17:14:40 -0800


>>>>> On Sun, 9 Dec 2001 01:15:25 +0000 (GMT), Alan Cox <alan@lxorguk.ukuu.org.uk> said:

Alan> And break the ability for non broken setups to debug SMP boot
Alan> up. Lets do the job properly.

Then use Andrew's patch (attached below).

--david

--- linux-2.4.17-pre4/include/asm-ia64/system.h Thu Nov 22 23:02:59 2001
+++ linux-akpm/include/asm-ia64/system.h Wed Dec 5 23:09:15 2001
@@ -405,6 +405,10 @@ extern void ia64_load_extra (struct task
ia64_psr(ia64_task_regs(prev))->dfh = 1; \
__switch_to(prev,next,last); \
} while (0)
+
+/* Return true if this CPU can call the console drivers in printk() */
+#define arch_consoles_callable() (cpu_online_map & (1UL << smp_processor_id()))
+
#else
# define switch_to(prev,next,last) do { \
ia64_psr(ia64_task_regs(next))->dfh = (ia64_get_fpu_owner() != (next)); \
--- linux-2.4.17-pre4/kernel/printk.c Thu Nov 22 23:02:59 2001
+++ linux-akpm/kernel/printk.c Wed Dec 5 23:03:54 2001
@@ -38,6 +38,10 @@

#define LOG_BUF_MASK (LOG_BUF_LEN-1)

+#ifndef arch_consoles_callable
+#define arch_consoles_callable() (1)
+#endif
+
/* printk's without a loglevel use this.. */
#define DEFAULT_MESSAGE_LOGLEVEL 4 /* KERN_WARNING */

@@ -438,6 +442,14 @@ asmlinkage int printk(const char *fmt, .
log_level_unknown = 1;
}

+ if (!arch_consoles_callable()) {
+ /*
+ * On some architectures, the consoles are not usable
+ * on secondary CPUs early in the boot process.
+ */
+ spin_unlock_irqrestore(&logbuf_lock, flags);
+ goto out;
+ }
if (!down_trylock(&console_sem)) {
/*
* We own the drivers. We can drop the spinlock and let
@@ -454,6 +466,7 @@ asmlinkage int printk(const char *fmt, .
*/
spin_unlock_irqrestore(&logbuf_lock, flags);
}
+out:
return printed_len;
}
EXPORT_SYMBOL(printk);
-
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/