Re: [patch] Real-Time Preemption, -RT-2.6.13-rc4-V0.7.52-01

Ingo Molnar
2005-08-01T20:56:02Z

* Steven Rostedt <rostedt@goodmis.org> wrote:

> Ingo,
>
> What's with the "BUG: possible soft lockup detected on CPU..."? I'm
> getting a bunch of them from the IDE interrupt. It's not locking up,
> but it does things that probably do take some time. Is this really
> necessary? Here's an example dump:

doh - it's Daniel not Cc:-ing lkml when sending me patches, so people
dont know what's going on ...

here's the patch below. Could you try to revert it?

Ingo

On Sun, 2005-07-31 at 20:27 +0200, Ingo Molnar wrote:
> looks good, but i'd suggest to use printk_ratelimit(). (and the use of
> u16 can be a performance hit on x86 due to potential 16-bit prefixes -
> the best thing to use is an 'int' on pretty much every arch. with
> printk_ratelimit() this flag go away anyway.)

Ok, here's with your suggestions.

Index: linux-2.6.12/kernel/softlockup.c
===================================================================
--- linux-2.6.12.orig/kernel/softlockup.c 2005-07-31 15:31:09.000000000 +0000
+++ linux-2.6.12/kernel/softlockup.c 2005-07-31 18:43:35.000000000 +0000
@@ -9,6 +9,7 @@

#include <linux/mm.h>
#include <linux/cpu.h>
+#include <linux/sched.h>
#include <linux/init.h>
#include <linux/delay.h>
#include <linux/kthread.h>
@@ -19,6 +20,7 @@ static DEFINE_RAW_SPINLOCK(print_lock);
static DEFINE_PER_CPU(unsigned long, timeout) = INITIAL_JIFFIES;
static DEFINE_PER_CPU(unsigned long, timestamp) = INITIAL_JIFFIES;
static DEFINE_PER_CPU(unsigned long, print_timestamp) = INITIAL_JIFFIES;
+static DEFINE_PER_CPU(struct task_struct *, prev_task);
static DEFINE_PER_CPU(struct task_struct *, watchdog_task);

static int did_panic = 0;
@@ -56,6 +58,23 @@ void softlockup_tick(void)
if (!per_cpu(watchdog_task, this_cpu))
return;

+ if (per_cpu(prev_task, this_cpu) != current ||
+ !rt_task(current)) {
+ per_cpu(prev_task, this_cpu) = current;
+ }
+ else if (printk_ratelimit()) {
+
+ spin_lock(&print_lock);
+ printk(KERN_ERR "BUG: possible soft lockup detected on CPU#%u! %lu-%lu(%lu)\n",
+ this_cpu, jiffies, timestamp, timeout);
+ dump_stack();
+#if defined(__i386__) && defined(CONFIG_SMP)
+ nmi_show_all_regs();
+#endif
+ spin_unlock(&print_lock);
+
+ }
+
wake_up_process(per_cpu(watchdog_task, this_cpu));
per_cpu(timeout, this_cpu) = jiffies + msecs_to_jiffies(1000);
}
@@ -71,7 +90,7 @@ void softlockup_tick(void)
per_cpu(print_timestamp, this_cpu) = timestamp;

spin_lock(&print_lock);
- printk(KERN_ERR "BUG: soft lockup detected on CPU#%d! %ld-%ld(%ld)\n",
+ printk(KERN_ERR "BUG: soft lockup detected on CPU#%u! %lu-%lu(%lu)\n",
this_cpu, jiffies, timestamp, timeout);
dump_stack();
#if defined(__i386__) && defined(CONFIG_SMP)