Re: Most processes gradually becoming 'D'

Andrea Arcangeli (andrea@e-mind.com)
Mon, 25 Jan 1999 13:00:25 +0100 (CET)


On Mon, 25 Jan 1999, Alan Cox wrote:

> > I was in the process of updating my system when dpkg froze (it went
> > 'D'). From this point on, I was unable to start a new xterm, log into
> > a virtual console, or terminate any running applications to gain
> > control of an xterm.

> Apply the patch Stephen Tweedie posted for the wchan channel then you can
> see where they all hang. Also if Linus doesnt reply to this one I'll forward

You can also apply my semaphore deadlock detector that I just merged in my
ikd-patch.

Be sure to be on the console once you see that some process got stuck in
D. Then write on paper the EIP address and at least the first stack
traces.

Index: sched.c
===================================================================
RCS file: /var/cvs/linux/kernel/sched.c,v
retrieving revision 1.1.1.1.2.37
diff -u -r1.1.1.1.2.37 sched.c
--- sched.c 1999/01/07 11:57:23 1.1.1.1.2.37
+++ sched.c 1999/01/08 10:41:53
@@ -22,6 +22,10 @@
* current-task
*/

+/*
+ * Debug down() code. Copyright (C) 1999 Andrea Arcangeli
+ */
+
#include <linux/mm.h>
#include <linux/kernel_stat.h>
#include <linux/fdreg.h>
@@ -893,12 +897,27 @@
tsk->state = TASK_RUNNING; \
remove_wait_queue(&sem->wait, &wait);

+void generate_oops (struct semaphore *sem)
+{
+ sema_init(sem, 9876);
+ wake_up(&sem->wait);
+}
+
void __down(struct semaphore * sem)
{
DOWN_VAR
+ struct timer_list timer;
+ init_timer (&timer);
+ timer.expires = jiffies + HZ*20;
+ timer.data = (unsigned long) sem;
+ timer.function = (void (*)(unsigned long)) generate_oops;
+ add_timer(&timer);
DOWN_HEAD(TASK_UNINTERRUPTIBLE)
schedule();
+ if (atomic_read(&sem->count) == 9876)
+ *(int *) 0 = 0;
DOWN_TAIL(TASK_UNINTERRUPTIBLE)
+ del_timer(&timer);
}

int __down_interruptible(struct semaphore * sem)

Andrea Arcangeli

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/