From owner-freebsd-hackers@FreeBSD.ORG Thu Aug 7 07:22:42 2003 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 482D337B404 for ; Thu, 7 Aug 2003 07:22:42 -0700 (PDT) Received: from mail.speakeasy.net (mail11.speakeasy.net [216.254.0.211]) by mx1.FreeBSD.org (Postfix) with ESMTP id C23B643FAF for ; Thu, 7 Aug 2003 07:22:40 -0700 (PDT) (envelope-from jhb@FreeBSD.org) Received: (qmail 30173 invoked from network); 7 Aug 2003 14:22:40 -0000 Received: from unknown (HELO server.baldwin.cx) ([216.27.160.63]) (envelope-sender )encrypted SMTP for ; 7 Aug 2003 14:22:40 -0000 Received: from laptop.baldwin.cx (gw1.twc.weather.com [216.133.140.1]) by server.baldwin.cx (8.12.9/8.12.9) with ESMTP id h77EMc9s031103; Thu, 7 Aug 2003 10:22:38 -0400 (EDT) (envelope-from jhb@FreeBSD.org) Message-ID: X-Mailer: XFMail 1.5.4 on FreeBSD X-Priority: 3 (Normal) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 8bit MIME-Version: 1.0 In-Reply-To: Date: Thu, 07 Aug 2003 10:23:00 -0400 (EDT) From: John Baldwin To: Ted Unangst cc: freebsd-hackers@freebsd.org Subject: RE: possible deadlocks? X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Aug 2003 14:22:42 -0000 On 06-Aug-2003 Ted Unangst wrote: > My advisor Dawson Engler has written a deadlock detector, and we'd like > some verification. They look like bugs, unless there is some other reason > why two call chains cannot happen at the same time. > > deadlock between ktrace_mtx and sema_mtx. is it possible to call > sema_timewait on ktrace_sema? call chain below. > > thread 1: > _sema_timedwait(sema, ...) > mtx_lock(&sema->sema_mtx) /* gets this lock */ > cv_timewait() > ktrcsw() > ktr_getrequest() > mtx_lock(&ktrace_mtx) /* waits for thread 2 */ > > thread 2: > ktr_submitrequest > mtx_lock(&ktrace_mtx) /* gets this lock */ > _sema_post(&ktrace_sema) > mtx_lock(&sema->sema_mtx) /* waits for thread 1 */ Yes, the lock isn't needed around the post anyways. Fixed. -- John Baldwin <>< http://www.FreeBSD.org/~jhb/ "Power Users Use the Power to Serve!" - http://www.FreeBSD.org/