Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/alpha/include On the Alpha, interprocessor interrup...



details:   https://anonhg.NetBSD.org/src/rev/7bc332f9cdd1
branches:  trunk
changeset: 499466:7bc332f9cdd1
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Mon Nov 20 20:17:13 2000 +0000

description:
On the Alpha, interprocessor interrupts come in at the same priority
as normal device interrupts.  Because of this, we won't get IPIs while
servicing such interrupts.  This can lead to the following deadlock
scenario as reported by Bill Sommerfeld:
- Process runs on cpu1, but has FP state on cpu0.
- Process executes FP-using insn, causing an FP trap, which causes
  the kernel lock to be acquired.
- At roughly the same time, cpu0 receives a device interrupt, and attempts
  to acquire the kernel lock, which blocks since cpu1 already has it.
- cpu1 sends cpu0 a SYNCH FPU IPI, and waits for cpu0 to release its
  FP state.
- Since cpu0 cannot notice the IPI until it has processed the device
  interrupt, which it cannot do because it cannot acquire the kernel
  lock, we have deadlock.

Solve the problem by adding a spinlock interlock release hook which
checks for pending IPIs and processes them.

Idea from Bill Sommerfeld.

diffstat:

 sys/arch/alpha/include/lock.h |  19 ++++++++++++++++++-
 1 files changed, 18 insertions(+), 1 deletions(-)

diffs (31 lines):

diff -r abc851371fe4 -r 7bc332f9cdd1 sys/arch/alpha/include/lock.h
--- a/sys/arch/alpha/include/lock.h     Mon Nov 20 20:07:36 2000 +0000
+++ b/sys/arch/alpha/include/lock.h     Mon Nov 20 20:17:13 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lock.h,v 1.10 2000/08/14 20:28:28 thorpej Exp $ */
+/* $NetBSD: lock.h,v 1.11 2000/11/20 20:17:13 thorpej Exp $ */
 
 /*-
  * Copyright (c) 1998, 1999, 2000 The NetBSD Foundation, Inc.
@@ -130,4 +130,21 @@
                : "=m" (*alp));
 }
 
+/*
+ * On the Alpha, interprocessor interrupts come in at device priority
+ * level.  This can cause some problems while waiting for r/w spinlocks
+ * from a high'ish priority level: IPIs that come in will not be processed.
+ * This can lead to deadlock.
+ *
+ * This hook allows IPIs to be processed when a spinlock's interlock
+ * is released.
+ */
+#define        SPINLOCK_INTERLOCK_RELEASE_HOOK                                 \
+do {                                                                   \
+       struct cpu_info *__ci = curcpu();                               \
+                                                                       \
+       if (__ci->ci_ipis != 0)                                         \
+               alpha_ipi_process(__ci);                                \
+} while (0)
+
 #endif /* _ALPHA_LOCK_H_ */



Home | Main Index | Thread Index | Old Index