From owner-freebsd-hackers@FreeBSD.ORG Thu Feb 28 13:17:48 2008 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 525481065683 for ; Thu, 28 Feb 2008 13:17:48 +0000 (UTC) (envelope-from pluknet@gmail.com) Received: from ug-out-1314.google.com (ug-out-1314.google.com [66.249.92.170]) by mx1.freebsd.org (Postfix) with ESMTP id 7CB6A8FC2A for ; Thu, 28 Feb 2008 13:17:47 +0000 (UTC) (envelope-from pluknet@gmail.com) Received: by ug-out-1314.google.com with SMTP id y2so313949uge.37 for ; Thu, 28 Feb 2008 05:17:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=x8AAZH1iwiylNXdfHpXfBQYHWRo88q0t4dVVYsLPv5U=; b=Ouyq91gAJVfc/NUJihNuDY3dUv5Ms6JTJQV4TWReeplNVA37WL7Z2jVZkijklXGnFgR+41LtXLVoos21L2EBuT/YbkADoihPxh5ay6wX635lanYUdJVkjoXQ0xVqKqTgyb3B0QJJ50dGKWpXNa5VO6rzuJxfObfc1ZlyT8VDgPU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=oBQx+fRWjVGcXcfCwftH3FCBcQmjYX0o1TfWjyCi/eVF0qkHiqFa7fMiizLcTAJTc6D+1XN3YZy9M1WsWt9wM70gpzOqI2wMLT3JBP71qsAOYNFef/io3Km8RPDi6kx9D01H1NzJRfzlGsm4VF4oF/m/ZrvX25ahVNWyRU9Ids4= Received: by 10.78.151.3 with SMTP id y3mr8160049hud.62.1204204665498; Thu, 28 Feb 2008 05:17:45 -0800 (PST) Received: by 10.78.46.11 with HTTP; Thu, 28 Feb 2008 05:17:45 -0800 (PST) Message-ID: Date: Thu, 28 Feb 2008 16:17:45 +0300 From: pluknet To: "Yuri Pankov" In-Reply-To: <20080228111222.GE92245@mail.irbisnet.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <20080228111222.GE92245@mail.irbisnet.ru> Cc: freebsd-hackers@freebsd.org Subject: Re: pfind() in ithread handler X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Feb 2008 13:17:48 -0000 On 28/02/2008, Yuri Pankov wrote: > Hi, > > I'm trying to understand the cause of following panic. > > panic: Trying sleep, but thread marked as sleeping prohibited > cpuid = 0 > KDB: stack backtrace: > db_trace_self_wrapper() at db_trace_self_wrapper+0x2a > panic() at panic+0x17d > sleepq_add() at sleepq_add+0x2e1 > _sx_slock_hard() at _sx_slock_hard+0x15d > _sx_slock() at _sx_slock+0xc1 > pfind() at pfind+0x24 > saa_intr() at saa_intr+0x313 > ithread_loop() at ithread_loop+0xda > fork_exit() at fork_exit+0x12a > fork_trampoline() at fork_trampoline+0xe > --- trap 0, rip = 0, rsp = 0xffffffffac3c0d30, rbp = 0 --- > > Can someone enlighten me on what is causing the panic and is it ok to > use pfind() in interrupt handler (I have very limited understanding of > kernel internals)? > > Code in question (taken from saa driver > http://freebsd.ricin.com/ports/distfiles/kbtv-1.92.tbz) can be found at > http://www.pastebin.ca/921830 > > > TIA, > Yuri You cannot sleep in high priority ithread handler, pfind() uses sleepable sx(9) lock. In your case it fail to acquire a shared lock and trying to sleep. Probably you should call pfind() elsewhere. wbr, pluknet