public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] 2.4.16 kernel/printk.c (per processor initialization check)
@ 2001-12-03  5:46 j-nomura
  2001-12-03  9:20 ` Andrew Morton
  0 siblings, 1 reply; 25+ messages in thread
From: j-nomura @ 2001-12-03  5:46 UTC (permalink / raw)
  To: linux-kernel; +Cc: j-nomura

Hello,

I experienced system hang on my SMP machine and it turned out to be due to
console write before mmu initialization completes.

To be more specific, even if secondary processors are not in status enough
to do actual console I/O (e.g. mmu is not initialized), call_console_drivers()
tries to do it.
This leads to unpredictable result. For me, for example, it cause machine
check abort and hang up system.

Attached is a patch for it.

--- kernel/printk.c	2001/11/27 04:41:49	1.1.1.8
+++ kernel/printk.c	2001/12/03 05:25:26
@@ -491,20 +491,22 @@
  */
 void release_console_sem(void)
 {
 	unsigned long flags;
 	unsigned long _con_start, _log_end;
 	unsigned long must_wake_klogd = 0;
 
 	for ( ; ; ) {
 		spin_lock_irqsave(&logbuf_lock, flags);
 		must_wake_klogd |= log_start - log_end;
+		if (!(cpu_online_map & 1UL << smp_processor_id()))
+			break;
 		if (con_start == log_end)
 			break;			/* Nothing to print */
 		_con_start = con_start;
 		_log_end = log_end;
 		con_start = log_end;		/* Flush */
 		spin_unlock_irqrestore(&logbuf_lock, flags);
 		call_console_drivers(_con_start, _log_end);
 	}
 	console_may_schedule = 0;
 	up(&console_sem);

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.

^ permalink raw reply	[flat|nested] 25+ messages in thread
* Re: [PATCH] 2.4.16 kernel/printk.c (per processorinitializationcheck)
@ 2001-12-08 17:36 Manfred Spraul
  0 siblings, 0 replies; 25+ messages in thread
From: Manfred Spraul @ 2001-12-08 17:36 UTC (permalink / raw)
  To: Alan Cox; +Cc: linux-kernel

Alan Cox wrote:
> x86_udelay_tsc wont have been set at that point so the main timer is still
> being used.

No. x86_udelay_tsc is initialized by time_init(), and time_init() is called before
smp_init(). The udelay implementation only multiplies with loops_per_jiffy,
therefore there is no oops on i386.

But could oops if the bios disables the TSC instruction - the first printk on
the secondary cpu happens before

     clear_in_cr4(X86_CR4_VME|X86_CR4_PVI|X86_CR4_TSD|X86_CR4_DE)

--
    Manfred


^ permalink raw reply	[flat|nested] 25+ messages in thread

end of thread, other threads:[~2001-12-09  1:24 UTC | newest]

Thread overview: 25+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2001-12-03  5:46 [PATCH] 2.4.16 kernel/printk.c (per processor initialization check) j-nomura
2001-12-03  9:20 ` Andrew Morton
2001-12-03 10:32   ` j-nomura
2001-12-04  1:45     ` [PATCH] 2.4.16 kernel/printk.c (per processor initializationcheck) Andrew Morton
2001-12-06  5:01       ` j-nomura
2001-12-07  3:40         ` [PATCH] 2.4.16 kernel/printk.c (per processorinitializationcheck) Andrew Morton
2001-12-07 18:52           ` Marcelo Tosatti
2001-12-07 20:52             ` William Lee Irwin III
2001-12-07 21:37             ` David Mosberger
2001-12-07 20:47               ` Marcelo Tosatti
2001-12-07 22:17                 ` David Mosberger
2001-12-07 21:09                   ` Marcelo Tosatti
2001-12-08  1:10                     ` David Mosberger
2001-12-08 11:27                       ` Alan Cox
2001-12-08 16:41                         ` David Mosberger
2001-12-08 20:45                           ` Alan Cox
2001-12-09  0:32                             ` David Mosberger
2001-12-09  0:55                               ` Alan Cox
2001-12-09  0:58                                 ` David Mosberger
2001-12-09  1:15                                   ` Alan Cox
2001-12-09  1:14                                     ` David Mosberger
2001-12-09  1:32                                       ` Alan Cox
2001-12-07 22:08               ` Alan Cox
2001-12-07 22:14               ` Christopher Friesen
  -- strict thread matches above, loose matches on Subject: below --
2001-12-08 17:36 Manfred Spraul

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox