Re: [patch] delay panic during startup of kernel

From: Andi Kleen
Date: Mon Oct 26 2009 - 04:41:19 EST


Michael Sundius <msundius@xxxxxxxxx> writes:

> We've been, from time to time, running into various problems early on
> the initialization of the kernel, encountering situations where we really
> should panic, but we can't because its too early to do so.
> (see * if you care to know why this is a problem for us). Anyhow, I've
> created this patch to have a little better way of orderly finishing the
> bring-up to the point where we can panic safely. Any comments?

It's (nearly) never too early to panic. The main problem is that you sometimes
cannot see it and sometimes panic requires some state (but that's usually
a bug in panic to be fixed)

I also don't think it makes much sense to continue just to panic later.
Such a continue path is likely untested and buggy.

Some time ago I had patches to do a early_panic() using early_printk,
but didn't end up submitting them because the caller I intended them
for disappeared.

Basically early_panic() is just

void early_panic(char *fmt, ...)
{
char buf[256];
va_list ap;
va_start(ap, fmt);
vsnprintf(buf, sizeof buf, fmt, ap);
early_printk("PANIC : %s\n", buf);
va_end(ap);
for (;;)
safe_hlt();
}


However it might be better to fix panic to do that automatically.

-Andi


--
ak@xxxxxxxxxxxxxxx -- Speaking for myself only.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/