From: "Randy.Dunlap" <rdunlap@xenotime.net>
To: Dave Jones <davej@redhat.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: oops pauser. / boot_delayer
Date: Wed, 4 Jan 2006 22:10:23 -0800 [thread overview]
Message-ID: <20060104221023.10249eb3.rdunlap@xenotime.net> (raw)
In-Reply-To: <20060105045212.GA15789@redhat.com>
On Wed, 4 Jan 2006 23:52:12 -0500 Dave Jones wrote:
> In my quest to get better debug data from users in Fedora bug reports,
> I came up with this patch. A majority of users don't have serial
> consoles, so when an oops scrolls off the top of the screen,
> and locks up, they usually end up reporting a 2nd (or later) oops
> that isn't particularly helpful (or worse, some inconsequential
> info like 'sleeping whilst atomic' warnings)
>
> With this patch, if we oops, there's a pause for a two minutes..
> which hopefully gives people enough time to grab a digital camera
> to take a screenshot of the oops.
>
> It has an on-screen timer so the user knows what's going on,
> (and that it's going to come back to life [maybe] after the oops).
>
> The one case this doesn't catch is the problem of oopses whilst
> in X. Previously a non-fatal oops would stall X momentarily,
> and then things continue. Now those cases will lock up completely
> for two minutes. Future patches could add some additional feedback
> during this 'stall' such as the blinky keyboard leds, or periodic speaker beeps.
That's nice. Here's another patch^w hack.
This one delays each printk() during boot by a variable time
(from kernel command line), while system_state == SYSTEM_BOOTING.
Caveat: it's not terribly SMP safe or SMP nice.
Any ideas for improvements (esp. in the SMP area) are appreciated.
---
From: Randy Dunlap <rdunlap@xenotime.net>
Optionally add a boot delay after each kernel printk() call,
crudely measured in milliseconds, with a maximum delay of
10 seconds per printk.
Enable CONFIG_BOOT_DELAY=y and then add (e.g.):
"lpj=loops_per_jiffy boot_delay=100"
to the kernel command line.
Signed-off-by: Randy Dunlap <rdunlap@xenotime.net>
---
init/calibrate.c | 2 +-
init/main.c | 25 +++++++++++++++++++++++++
kernel/printk.c | 33 +++++++++++++++++++++++++++++++++
lib/Kconfig.debug | 18 ++++++++++++++++++
4 files changed, 77 insertions(+), 1 deletion(-)
--- linux-2615-work.orig/init/main.c
+++ linux-2615-work/init/main.c
@@ -557,6 +557,31 @@ static int __init initcall_debug_setup(c
}
__setup("initcall_debug", initcall_debug_setup);
+#ifdef CONFIG_BOOT_DELAY
+
+unsigned int boot_delay = 0; /* msecs delay after each printk during bootup */
+extern long preset_lpj;
+unsigned long long printk_delay_msec = 0; /* per msec, based on boot_delay */
+
+static int __init boot_delay_setup(char *str)
+{
+ unsigned long lpj = preset_lpj ? preset_lpj : 1000000; /* some guess */
+ unsigned long long loops_per_msec = lpj / 1000 * CONFIG_HZ;
+
+ get_option(&str, &boot_delay);
+ if (boot_delay > 10 * 1000)
+ boot_delay = 0;
+
+ printk_delay_msec = loops_per_msec;
+ printk("boot_delay: %u, preset_lpj: %ld, lpj: %lu, CONFIG_HZ: %d, printk_delay_msec: %llu\n",
+ boot_delay, preset_lpj, lpj, CONFIG_HZ, printk_delay_msec);
+
+ return 1;
+}
+__setup("boot_delay=", boot_delay_setup);
+
+#endif
+
struct task_struct *child_reaper = &init_task;
extern initcall_t __initcall_start[], __initcall_end[];
--- linux-2615-work.orig/init/calibrate.c
+++ linux-2615-work/init/calibrate.c
@@ -10,7 +10,7 @@
#include <asm/timex.h>
-static unsigned long preset_lpj;
+unsigned long preset_lpj;
static int __init lpj_setup(char *str)
{
preset_lpj = simple_strtoul(str,NULL,0);
--- linux-2615-work.orig/kernel/printk.c
+++ linux-2615-work/kernel/printk.c
@@ -23,6 +23,7 @@
#include <linux/smp_lock.h>
#include <linux/console.h>
#include <linux/init.h>
+#include <linux/jiffies.h>
#include <linux/module.h>
#include <linux/interrupt.h> /* For in_interrupt() */
#include <linux/config.h>
@@ -201,6 +202,33 @@ out:
__setup("log_buf_len=", log_buf_len_setup);
+#ifdef CONFIG_BOOT_DELAY
+
+extern unsigned int boot_delay; /* msecs to delay after each printk during bootup */
+extern long preset_lpj;
+extern unsigned long long printk_delay_msec;
+
+static void boot_delay_msec(int millisecs)
+{
+ unsigned long long k = printk_delay_msec * millisecs;
+ unsigned long timeout;
+
+ timeout = jiffies + msecs_to_jiffies(millisecs);
+ while (k) {
+ k--;
+ rep_nop();
+ /*
+ * use (volatile) jiffies to prevent
+ * compiler reduction; loop termination via jiffies
+ * is secondary and may or may not happen.
+ */
+ if (time_after(jiffies, timeout))
+ break;
+ }
+}
+
+#endif
+
/*
* Commands to do_syslog:
*
@@ -520,6 +548,11 @@ asmlinkage int printk(const char *fmt, .
r = vprintk(fmt, args);
va_end(args);
+#ifdef CONFIG_BOOT_DELAY
+ if (boot_delay && system_state == SYSTEM_BOOTING)
+ boot_delay_msec(boot_delay);
+#endif
+
return r;
}
--- linux-2615-work.orig/lib/Kconfig.debug
+++ linux-2615-work/lib/Kconfig.debug
@@ -186,6 +186,24 @@ config FRAME_POINTER
some architectures or if you use external debuggers.
If you don't debug the kernel, you can say N.
+config BOOT_DELAY
+ bool "Delay each boot message by N milliseconds"
+ depends on DEBUG_KERNEL
+ help
+ This build option allows you to read kernel boot messages
+ by inserting a short delay after each one. The delay is
+ specified in milliseconds on the kernel command line,
+ using "boot_delay=N".
+
+ It is likely that you would also need to use "lpj=M" to preset
+ the "loops per jiffie" value.
+ See a previous boot log for the "lpj" value to use for your
+ system, and then set "lpj=M" before setting "boot_delay=N".
+ NOTE: Using this option may adversely affect SMP systems.
+ I.e., processors other than the first one may not boot up.
+ BOOT_DELAY also may cause DETECT_SOFTLOCKUP to detect
+ what it believes to be lockup conditions.
+
config RCU_TORTURE_TEST
tristate "torture tests for RCU"
depends on DEBUG_KERNEL
next prev parent reply other threads:[~2006-01-05 6:10 UTC|newest]
Thread overview: 72+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-01-05 4:52 oops pauser Dave Jones
2006-01-05 6:10 ` Randy.Dunlap [this message]
2006-01-05 7:30 ` oops pauser. / boot_delayer Bernd Eckenfels
2006-01-05 8:07 ` Jan Engelhardt
2006-01-06 1:28 ` David Lang
2006-01-06 5:36 ` Dave Jones
2006-01-06 7:00 ` David Lang
2006-01-08 13:21 ` Pavel Machek
2006-01-08 19:30 ` Josef Sipek
2006-01-08 23:08 ` Pavel Machek
2006-01-08 23:39 ` Josef Sipek
2006-01-06 7:36 ` Jan Engelhardt
2006-01-06 8:33 ` David Lang
2006-01-05 9:25 ` Grant Coady
2006-01-05 15:31 ` Mark Lord
2006-01-05 15:38 ` Avishay Traeger
2006-01-05 19:15 ` Mark Lord
2006-01-05 11:11 ` Dave Jones
2006-01-07 21:44 ` Kurtis D. Rader
2006-01-07 21:48 ` Arjan van de Ven
2006-01-07 22:00 ` Kurtis D. Rader
2006-01-08 23:29 ` David Lang
2006-01-07 22:27 ` Bernd Eckenfels
2006-01-05 8:15 ` oops pauser Jan Engelhardt
2006-01-05 10:33 ` Dave Jones
2006-01-05 11:05 ` Jan Engelhardt
2006-01-05 12:05 ` Keith Owens
2006-01-05 15:17 ` Jesper Juhl
2006-01-05 13:46 ` Kurt Wall
2006-01-06 1:24 ` David Lang
2006-01-06 1:41 ` Josef Sipek
2006-01-08 13:38 ` Ville Herva
2006-01-08 13:53 ` Randy.Dunlap
2006-01-08 19:35 ` Jan Engelhardt
2006-01-09 1:43 ` Randy.Dunlap
2006-01-08 19:40 ` Grant Coady
2006-01-09 1:45 ` Randy.Dunlap
2006-01-09 16:15 ` Jan Engelhardt
2006-01-09 16:25 ` Ville Herva
2006-01-09 16:39 ` Randy.Dunlap
2006-01-05 13:37 ` Alan Cox
2006-01-05 20:52 ` Dave Jones
2006-01-06 13:31 ` Alan Cox
2006-01-06 20:33 ` Dave Jones
2006-01-06 15:22 ` Pavel Machek
2006-01-06 19:06 ` Jan Engelhardt
2006-01-06 22:34 ` Pavel Machek
2006-01-06 22:48 ` Dave Jones
2006-01-05 13:58 ` Avishay Traeger
2006-01-05 20:54 ` Dave Jones
2006-01-06 0:19 ` Josef Sipek
2006-01-06 1:12 ` Bernd Eckenfels
2006-01-06 1:35 ` Josef Sipek
2006-01-06 2:21 ` Bernd Eckenfels
2006-01-05 14:39 ` Kyle McMartin
2006-01-09 18:43 ` Console debugging wishlist was: " Andi Kleen
2006-01-10 20:25 ` Jan Engelhardt
2006-01-10 20:29 ` Josef Sipek
2006-01-10 20:44 ` Jan Engelhardt
2006-01-10 22:54 ` Josef Sipek
2006-01-10 20:46 ` Andi Kleen
2006-01-10 20:45 ` Andi Kleen
2006-01-10 21:06 ` Jan Engelhardt
2006-01-10 21:18 ` Andi Kleen
2006-01-10 21:30 ` Jan Engelhardt
2006-01-11 12:24 ` Antonino A. Daplas
2006-01-11 12:31 ` Andi Kleen
2006-01-11 13:05 ` Antonino A. Daplas
2006-01-11 13:17 ` Andi Kleen
2006-01-11 13:43 ` Antonino A. Daplas
2006-01-11 13:51 ` Andi Kleen
2006-01-11 18:34 ` Jan Engelhardt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20060104221023.10249eb3.rdunlap@xenotime.net \
--to=rdunlap@xenotime.net \
--cc=davej@redhat.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).