From owner-svn-src-all@FreeBSD.ORG Sat Apr 24 00:53:42 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 701B91065676; Sat, 24 Apr 2010 00:53:42 +0000 (UTC) (envelope-from attilio@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 44F928FC18; Sat, 24 Apr 2010 00:53:42 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o3O0rgUK065846; Sat, 24 Apr 2010 00:53:42 GMT (envelope-from attilio@svn.freebsd.org) Received: (from attilio@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o3O0rgVg065844; Sat, 24 Apr 2010 00:53:42 GMT (envelope-from attilio@svn.freebsd.org) Message-Id: <201004240053.o3O0rgVg065844@svn.freebsd.org> From: Attilio Rao Date: Sat, 24 Apr 2010 00:53:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r207138 - stable/8/sys/kern X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 24 Apr 2010 00:53:42 -0000 Author: attilio Date: Sat Apr 24 00:53:41 2010 New Revision: 207138 URL: http://svn.freebsd.org/changeset/base/207138 Log: MFC r206482, r206879: - Introduce a blessed list for sxlocks that prevents the deadlkres to panic on those ones. Populate this list with getblk and so_snd_sx and so_rcv_sx. - Fix ticks counter wrap-up Sponsored by: Sandvine Incorporated Modified: stable/8/sys/kern/kern_clock.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) stable/8/sys/geom/sched/ (props changed) Modified: stable/8/sys/kern/kern_clock.c ============================================================================== --- stable/8/sys/kern/kern_clock.c Sat Apr 24 00:49:19 2010 (r207137) +++ stable/8/sys/kern/kern_clock.c Sat Apr 24 00:53:41 2010 (r207138) @@ -162,6 +162,12 @@ SYSCTL_PROC(_kern, OID_AUTO, cp_times, C 0,0, sysctl_kern_cp_times, "LU", "per-CPU time statistics"); #ifdef DEADLKRES +static const char *blessed[] = { + "getblk", + "so_snd_sx", + "so_rcv_sx", + NULL +}; static int slptime_threshold = 1800; static int blktime_threshold = 900; static int sleepfreq = 3; @@ -172,7 +178,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 +211,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 +232,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 +256,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",