Skip to contentSkip to conversation

Hardlock with all kernel >= 2.4.7-pre5 - softirq related ?

PATCH Thomas Svedberg 2 participants 3 messages Aug 14, 2001

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

I have experienced hardlocks (everything freezes with small white square box with pointer in upper left corner on screen and only SysRq-b seems to work) without any oops or anything.

I have after some trial and error narrowed it down to the following part of the interdiff between 2.4.7-pre4 and 2.4.7-pre5:
(For config, lspci -vvv, program versions and boot logs see
http://thsv.dnsalias.org/~thsv/lock/config
http://thsv.dnsalias.org/~thsv/lock/lspci-vvv
http://thsv.dnsalias.org/~thsv/lock/versions
http://thsv.dnsalias.org/~thsv/lock/messages
http://thsv.dnsalias.org/~thsv/lock/boot.log )

kernel/ksyms.c +2 -0
@@ -540,0 +541,2 @@
+EXPORT_SYMBOL(raise_softirq);
+EXPORT_SYMBOL(cpu_raise_softirq);
kernel/softirq.c renamed from linux/kernel/softirq.c +130 -37

254 lines not on this page · raw message

kernel/sched.c renamed from linux/kernel/sched.c +2 -9
@@ -543,11 +543,6 @@
 
 	release_kernel_lock(prev, this_cpu);
 
-	/* Do "administrative" work here while we don't hold any locks */
-	if (softirq_pending(this_cpu))
-		goto handle_softirq;
-handle_softirq_back:
-
 	/*
 	 * 'sched_data' is protected by the fact that we can run
 	 * only one process per CPU.
@@ -689,13 +684,11 @@
 	goto repeat_schedule;
 
 still_running:
+	if (!(prev->cpus_allowed & (1UL << this_cpu)))
+		goto still_running_back;
 	c = goodness(prev, this_cpu, prev->active_mm);
 	next = prev;
 	goto still_running_back;
-
-handle_softirq:
-	do_softirq();
-	goto handle_softirq_back;
 
 move_rr_last:
 	if (!prev->counter) {
include/linux/netdevice.h renamed from linux/include/linux/netdevice.h +2 -2
@@ -487,7 +487,7 @@
 		local_irq_save(flags);
 		dev->next_sched = softnet_data[cpu].output_queue;
 		softnet_data[cpu].output_queue = dev;
-		__cpu_raise_softirq(cpu, NET_TX_SOFTIRQ);
+		cpu_raise_softirq(cpu, NET_TX_SOFTIRQ);
 		local_irq_restore(flags);
 	}
 }
@@ -536,7 +536,7 @@
 		local_irq_save(flags);
 		skb->next = softnet_data[cpu].completion_queue;
 		softnet_data[cpu].completion_queue = skb;
-		__cpu_raise_softirq(cpu, NET_TX_SOFTIRQ);
+		cpu_raise_softirq(cpu, NET_TX_SOFTIRQ);
 		local_irq_restore(flags);
 	}
 }
include/linux/irq_cpustat.h renamed from linux/include/linux/irq_cpustat.h +1 -0
@@ -30,6 +30,7 @@
 #define local_irq_count(cpu)	__IRQ_STAT((cpu), __local_irq_count)
 #define local_bh_count(cpu)	__IRQ_STAT((cpu), __local_bh_count)
 #define syscall_count(cpu)	__IRQ_STAT((cpu), __syscall_count)
+#define ksoftirqd_task(cpu)	__IRQ_STAT((cpu), __ksoftirqd_task)
   /* arch dependent irq_stat fields */
 #define nmi_count(cpu)		__IRQ_STAT((cpu), __nmi_count)		/* i386, ia64 */
 
include/linux/interrupt.h renamed from linux/include/linux/interrupt.h +3 -2
@@ -73,8 +73,9 @@
 
 asmlinkage void do_softirq(void);
 extern void open_softirq(int nr, void (*action)(struct softirq_action*), void *data);
-
 extern void softirq_init(void);
+extern void FASTCALL(cpu_raise_softirq(unsigned int cpu, unsigned int nr));
+extern void FASTCALL(raise_softirq(unsigned int nr));
 
 
 
@@ -129,7 +130,7 @@
 extern struct tasklet_head tasklet_hi_vec[NR_CPUS];
 
 #define tasklet_trylock(t) (!test_and_set_bit(TASKLET_STATE_RUN, &(t)->state))
-#define tasklet_unlock(t) clear_bit(TASKLET_STATE_RUN, &(t)->state)
+#define tasklet_unlock(t) do { smp_mb__before_clear_bit(); clear_bit(TASKLET_STATE_RUN, &(t)->state); } while(0)
 #define tasklet_unlock_wait(t) while (test_bit(TASKLET_STATE_RUN, &(t)->state)) { barrier(); }
 
 extern void tasklet_schedule(struct tasklet_struct *t);
include/asm-i386/softirq.h renamed from linux/include/asm-i386/softirq.h +3 -2
@@ -11,8 +11,6 @@
 
 #define local_bh_disable()	cpu_bh_disable(smp_processor_id())
 #define __local_bh_enable()	__cpu_bh_enable(smp_processor_id())
-#define __cpu_raise_softirq(cpu,nr) set_bit((nr), &softirq_pending(cpu));
-#define raise_softirq(nr) __cpu_raise_softirq(smp_processor_id(), (nr))
 
 #define in_softirq() (local_bh_count(smp_processor_id()) != 0)
 
@@ -28,6 +26,7 @@
 do {									\
 	unsigned int *ptr = &local_bh_count(smp_processor_id());	\
 									\
+	barrier();							\
 	if (!--*ptr)							\
 		__asm__ __volatile__ (					\
 			"cmpl $0, -8(%0);"				\
@@ -45,5 +44,7 @@
 		: "r" (ptr), "i" (do_softirq)				\
 		/* no registers clobbered */ );				\
 } while (0)
+
+#define __cpu_raise_softirq(cpu, nr) __set_bit(nr, &softirq_pending(cpu))
 
 #endif	/* __ASM_SOFTIRQ_H */
include/asm-i386/hardirq.h renamed from linux/include/asm-i386/hardirq.h +1 -0
@@ -11,6 +11,7 @@
 	unsigned int __local_irq_count;
 	unsigned int __local_bh_count;
 	unsigned int __syscall_count;
+	struct task_struct * __ksoftirqd_task; /* waitqueue is too large */
 	unsigned int __nmi_count;	/* arch dependent */
 } ____cacheline_aligned irq_cpustat_t;
 

/ Thomas
.......................................................................
Thomas Svedberg
Department of Mathematics
Chalmers University of Technology

Address: S-412 96 Göteborg, SWEDEN
E-mail : [email protected], [email protected]
Phone : +46 31 772 5368
Fax : +46 31 772 3595
.......................................................................

#1 lore raw
Quoted 1 line · Thomas Svedberg

I have experienced hardlocks (everything freezes with small white square

exact kernel version? Please make sure you can reproduce on 2.4.9-pre3, thanks.

Andrea

#2 lore raw

Den 14 Aug 2001 21:46:41 +0200 skrev Andrea Arcangeli:

Quoted 5 lines · Thomas Svedberg
Quoted 1 line

I have experienced hardlocks (everything freezes with small white square

exact kernel version? Please make sure you can reproduce on 2.4.9-pre3, thanks.

I have had crashes with 2.4.7, 2.4.8, and all -pre i tried from 2.4.7-pre5 and onward as well as with the few recent -ac I tried.

The diff I included earlier was the part of the difference from 2.4.7-pre4 to -pre5 that I narrowed down the lockup to.

I will try 2.4.9-pre tomorrow and see what happens (but recent kernels have taken longer (about 24h) to lock up than older (<1h), so a positive success will take some time.

/ Thomas
.......................................................................
Thomas Svedberg
Department of Mathematics
Chalmers University of Technology

Address: S-412 96 Göteborg, SWEDEN
E-mail : [email protected], [email protected]
Phone : +46 31 772 5368
Fax : +46 31 772 3595
.......................................................................