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

From: j-nomura@ce.jp.nec.com
Date: Thu Dec 06 2001 - 00:01:02 EST


Hi,
excuse me for not prompt response. I've been off-line for 2 days.

> > The reason I put it in release_console_sem() is that release_console_sem()
> > can be called from other functions than printk(), e.g. console_unblank().
> > I agree with you that it is clearer but I think it is not sufficient.
>
> I really doubt if any of those paths could be called before
> even the MMU is set up.

I didn't have any intention to say that console_unblank() is called so early.

OK. Here is revised patch which checks if cpu initialization is done
just before down_trylock(). This works for me.

diff -u -r1.1.1.8 printk.c
--- kernel/printk.c 2001/11/27 04:41:49 1.1.1.8
+++ kernel/printk.c 2001/12/06 04:54:50
@@ -438,7 +438,13 @@
                         log_level_unknown = 1;
         }
 
- if (!down_trylock(&console_sem)) {
+ if (!(cpu_online_map & 1UL << smp_processor_id())) {
+ /*
+ * The cpu has not been initialized completely
+ * enough to call console drivers.
+ */
+ spin_unlock_irqrestore(&logbuf_lock, flags);
+ } else if (!down_trylock(&console_sem)) {
                 /*
                  * We own the drivers. We can drop the spinlock and let
                  * release_console_sem() print the text

Best regards.

--
NOMURA, Jun'ichi <j-nomura@ce.jp.nec.com, nomura@hpc.bs1.fc.nec.co.jp>
HPC Operating System Group, 1st Computers Software Division,
Computers Software Operations Unit, NEC Solutions.
-
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 Dec 07 2001 - 21:00:32 EST