summaryrefslogtreecommitdiffstats
path: root/sys/kern/kern_clock.c
diff options
context:
space:
mode:
authorattilio <attilio@FreeBSD.org>2010-04-11 16:06:09 +0000
committerattilio <attilio@FreeBSD.org>2010-04-11 16:06:09 +0000
commit02f2ab87a28d7815613d690ceff6e2d7e408cbd6 (patch)
tree7743c8b50a57b7a779d9443d4f4213acc0540c1e /sys/kern/kern_clock.c
parentd7a91dc6bf166a266421facb5e7cc8067695b03b (diff)
downloadFreeBSD-src-02f2ab87a28d7815613d690ceff6e2d7e408cbd6.zip
FreeBSD-src-02f2ab87a28d7815613d690ceff6e2d7e408cbd6.tar.gz
- Introduce a blessed list for sxlocks that prevents the deadlkres to
panic on those ones. [0] - Fix ticks counter wrap-up Sponsored by: Sandvine Incorporated [0] Reported by: jilles [0] Tested by: jilles MFC: 1 week
Diffstat (limited to 'sys/kern/kern_clock.c')
-rw-r--r--sys/kern/kern_clock.c32
1 files changed, 31 insertions, 1 deletions
diff --git a/sys/kern/kern_clock.c b/sys/kern/kern_clock.c
index 2844103..98e276b 100644
--- a/sys/kern/kern_clock.c
+++ b/sys/kern/kern_clock.c
@@ -162,6 +162,11 @@ SYSCTL_PROC(_kern, OID_AUTO, cp_times, CTLTYPE_LONG|CTLFLAG_RD|CTLFLAG_MPSAFE,
0,0, sysctl_kern_cp_times, "LU", "per-CPU time statistics");
#ifdef DEADLKRES
+static const char *blessed[] = {
+ "so_snd_sx",
+ "so_rcv_sx",
+ NULL
+};
static int slptime_threshold = 1800;
static int blktime_threshold = 900;
static int sleepfreq = 3;
@@ -172,7 +177,7 @@ deadlkres(void)
struct proc *p;
struct thread *td;
void *wchan;
- int blkticks, slpticks, slptype, tryl, tticks;
+ int blkticks, i, slpticks, slptype, tryl, tticks;
tryl = 0;
for (;;) {
@@ -205,6 +210,10 @@ deadlkres(void)
* turnstile channel is in good state.
*/
MPASS(td->td_blocked != NULL);
+
+ /* Handle ticks wrap-up. */
+ if (ticks < td->td_blktick)
+ continue;
tticks = ticks - td->td_blktick;
thread_unlock(td);
if (tticks > blkticks) {
@@ -222,6 +231,10 @@ deadlkres(void)
}
} else if (TD_IS_SLEEPING(td)) {
+ /* Handle ticks wrap-up. */
+ if (ticks < td->td_blktick)
+ continue;
+
/*
* Check if the thread is sleeping on a
* lock, otherwise skip the check.
@@ -242,7 +255,24 @@ deadlkres(void)
* thresholds, this thread is
* stuck for too long on a
* sleepqueue.
+ * However, being on a
+ * sleepqueue, we might still
+ * check for the blessed
+ * list.
*/
+ tryl = 0;
+ for (i = 0; blessed[i] != NULL;
+ i++) {
+ if (!strcmp(blessed[i],
+ td->td_wmesg)) {
+ tryl = 1;
+ break;
+ }
+ }
+ if (tryl != 0) {
+ tryl = 0;
+ continue;
+ }
PROC_UNLOCK(p);
sx_sunlock(&allproc_lock);
panic("%s: possible deadlock detected for %p, blocked for %d ticks\n",
OpenPOWER on IntegriCloud