All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch] i386: halt the CPU on serious errors
@ 2006-06-20  4:55 Chuck Ebbert
  2006-06-20  5:09 ` Dave Jones
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Chuck Ebbert @ 2006-06-20  4:55 UTC (permalink / raw)
  To: linux-kernel; +Cc: Andreas Mohr, Andrew Morton

Halt the CPU when serious errors are encountered and we
deliberately go into an infinite loop.

Suggested by Andreas Mohr.

Signed-off-by: Chuck Ebbert <76306.1226@compuserve.com>

--- 2.6.17-32.orig/arch/i386/kernel/crash.c
+++ 2.6.17-32/arch/i386/kernel/crash.c
@@ -113,8 +113,8 @@ static int crash_nmi_callback(struct pt_
 	disable_local_APIC();
 	atomic_dec(&waiting_for_crash_ipi);
 	/* Assume hlt works */
-	halt();
-	for(;;);
+	for (;;)
+		halt();
 
 	return 1;
 }
--- 2.6.17-32.orig/arch/i386/kernel/doublefault.c
+++ 2.6.17-32/arch/i386/kernel/doublefault.c
@@ -44,7 +44,8 @@ static void doublefault_fn(void)
 		}
 	}
 
-	for (;;) /* nothing */;
+	for (;;)
+		halt();
 }
 
 struct tss_struct doublefault_tss __cacheline_aligned = {
-- 
Chuck
 "You can't read a newspaper if you can't read."  --George W. Bush

^ permalink raw reply	[flat|nested] 7+ messages in thread
* Re: [patch] i386: halt the CPU on serious errors
@ 2006-06-21  9:17 Chuck Ebbert
  0 siblings, 0 replies; 7+ messages in thread
From: Chuck Ebbert @ 2006-06-21  9:17 UTC (permalink / raw)
  To: Dave Jones; +Cc: Andrew Morton, Andreas Mohr, linux-kernel

In-Reply-To: <20060620050910.GA6091@redhat.com>

On Tue, 20 Jun 2006 01:09:10 -0400, Dave Jones wrote:

> > --- 2.6.17-32.orig/arch/i386/kernel/crash.c
> > +++ 2.6.17-32/arch/i386/kernel/crash.c
> > @@ -113,8 +113,8 @@ static int crash_nmi_callback(struct pt_
> >     disable_local_APIC();
> >     atomic_dec(&waiting_for_crash_ipi);
> >     /* Assume hlt works */
> > -   halt();
> > -   for(;;);
> > +   for (;;)
> > +           halt();
> >  
> >     return 1;
>
> But we should never get past that first halt(), as interrupts are disabled.

Yeah, but why not do it anyway?  I'll change the comment.

> > --- 2.6.17-32.orig/arch/i386/kernel/doublefault.c
> > +++ 2.6.17-32/arch/i386/kernel/doublefault.c
> > @@ -44,7 +44,8 @@ static void doublefault_fn(void)
> >             }
> >     }
> >  
> > -   for (;;) /* nothing */;
> > +   for (;;)
> > +           halt();
> >  }
>
> This one would probably be better off as a cpu_relax()

OK.

-- 
Chuck
 "You can't read a newspaper if you can't read."  --George W. Bush

^ permalink raw reply	[flat|nested] 7+ messages in thread
* Re: [patch] i386: halt the CPU on serious errors
@ 2006-06-21  9:17 Chuck Ebbert
  0 siblings, 0 replies; 7+ messages in thread
From: Chuck Ebbert @ 2006-06-21  9:17 UTC (permalink / raw)
  To: Andreas Mohr; +Cc: Andrew Morton, linux-kernel

In-Reply-To: <20060620075015.GB3030@rhlx01.fht-esslingen.de>

On Tue, 20 Jun 2006 09:50:15 +0200, Andreas Mohr wrote:

> Thanks for the very fast patch, but:
> 
> >       /* Assume hlt works */
> > -     halt();
> > -     for(;;);
> > +     for (;;)
> > +             halt();
> 
> The comment above seems to hint at this code in arch/i386/kernel/smp.c/
> stop_this_cpu() which does proper hlt checks:
> 
>         if (cpu_data[smp_processor_id()].hlt_works_ok)
>                 for(;;) halt();
>         for (;;);
> 
> So I'm unsure what happens if hlt is not supported properly. Maybe
> there's an invalid opcode exception in a loop then.

  Some ancient CPUs never wake up on interrupt after a halt.  See
include/asm-i386/bugs.h::check_hlt().

-- 
Chuck
 "You can't read a newspaper if you can't read."  --George W. Bush

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

end of thread, other threads:[~2006-06-21  9:26 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-06-20  4:55 [patch] i386: halt the CPU on serious errors Chuck Ebbert
2006-06-20  5:09 ` Dave Jones
2006-06-20  7:50 ` Andreas Mohr
2006-06-21  9:20 ` Andi Kleen
2006-06-21  9:26 ` Arjan van de Ven
  -- strict thread matches above, loose matches on Subject: below --
2006-06-21  9:17 Chuck Ebbert
2006-06-21  9:17 Chuck Ebbert

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.