Re: overlaping printk

From: Andrew Morton
Date: Thu May 20 2004 - 18:11:46 EST


Ingo Molnar <mingo@xxxxxxx> wrote:
>
> i've attached a new patch that does what Andi suggested too -
> timestamping of the oopses. This way we will zap no sooner than 10
> seconds after the first oops.

I think that will do the wrong thing between 23 and 47 days uptime because
time_after() will return an incorrect answer.

How's this look?




- Bump the timeout to 30 seconds - 9600 baud is slow.

- Handle jiffy wraps: change the logic so that we only skip the lockbust if
the current time is within 30 seconds of the previous lockbusting attempt.



---

25-akpm/kernel/printk.c | 11 ++++++-----
1 files changed, 6 insertions(+), 5 deletions(-)

diff -puN kernel/printk.c~mangled-printk-oops-output-fix-tweaks kernel/printk.c
--- 25/kernel/printk.c~mangled-printk-oops-output-fix-tweaks Thu May 20 16:01:53 2004
+++ 25-akpm/kernel/printk.c Thu May 20 16:10:32 2004
@@ -55,9 +55,6 @@ EXPORT_SYMBOL(console_printk);

int oops_in_progress;

-/* zap spinlocks only once: */
-unsigned long oops_timestamp;
-
/*
* console_sem protects the console_drivers list, and also
* provides serialisation for access to the entire console
@@ -479,10 +476,14 @@ static void emit_log_char(char c)
* every 10 seconds, to leave time for slow consoles to print a
* full oops.
*/
-static inline void zap_locks(void)
+static void zap_locks(void)
{
- if (!time_after(jiffies, oops_timestamp + 10*HZ))
+ static unsigned long oops_timestamp;
+
+ if (time_after_eq(jiffies, oops_timestamp) &&
+ !time_after(jiffies, oops_timestamp + 30*HZ))
return;
+
oops_timestamp = jiffies;

/* If a crash is occurring, make sure we can't deadlock */

_

-
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/