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

Steven Rostedt
2005-08-01T21:18:51Z

On Mon, 2005-08-01 at 22:52 +0200, Ingo Molnar wrote:
> * 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?

Thanks Ingo.

If Daniel was trying to detect soft lock ups of lower priority tasks
(tasks that block all tasks lower than itself), I've added a counter to
Daniels patch to keep from showing this for the one time case. This
doesn't spit anything out for me anymore. But I guess this could detect
a higher priority task blocking lower ones, as long as higher tasks
don't run often (thus reseting the count).

-- Steve

Index: linux_realtime_ernie/kernel/softlockup.c
===================================================================
--- linux_realtime_ernie/kernel/softlockup.c (revision 266)
+++ linux_realtime_ernie/kernel/softlockup.c (working copy)
@@ -22,6 +22,7 @@
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 DEFINE_PER_CPU(unsigned long, task_counter);

static int did_panic = 0;
static int softlock_panic(struct notifier_block *this, unsigned long event,
@@ -61,18 +62,21 @@
if (per_cpu(prev_task, this_cpu) != current ||
!rt_task(current)) {
per_cpu(prev_task, this_cpu) = current;
+ per_cpu(task_counter, this_cpu) = 0;
}
- else if (printk_ratelimit()) {
+ else if ((++per_cpu(task_counter, this_cpu) > 10) && 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);
+ printk("curr=%s:%d\n",current->comm,current->pid);
+
dump_stack();
#if defined(__i386__) && defined(CONFIG_SMP)
nmi_show_all_regs();
#endif
spin_unlock(&print_lock);
-
+ per_cpu(task_counter, this_cpu) = 0;
}

wake_up_process(per_cpu(watchdog_task, this_cpu));
@@ -97,6 +101,7 @@
nmi_show_all_regs();
#endif
spin_unlock(&print_lock);
+ per_cpu(task_counter, this_cpu) = 0;
}
}