From owner-svn-src-projects@FreeBSD.ORG Mon Jul 30 18:04:42 2012 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id 817C11065676; Mon, 30 Jul 2012 18:04:42 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from bigwig.baldwin.cx (bigknife-pt.tunnel.tserv9.chi1.ipv6.he.net [IPv6:2001:470:1f10:75::2]) by mx1.freebsd.org (Postfix) with ESMTP id 5250B8FC1D; Mon, 30 Jul 2012 18:04:42 +0000 (UTC) Received: from jhbbsd.localnet (unknown [209.249.190.124]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 9985BB98C; Mon, 30 Jul 2012 14:04:41 -0400 (EDT) From: John Baldwin To: Konstantin Belousov Date: Mon, 30 Jul 2012 11:49:43 -0400 User-Agent: KMail/1.13.5 (FreeBSD/8.2-CBSD-20110714-p17; KDE/4.5.5; amd64; ; ) References: <201207301350.q6UDobCI099069@svn.freebsd.org> <20120730143943.GY2676@deviant.kiev.zoral.com.ua> In-Reply-To: <20120730143943.GY2676@deviant.kiev.zoral.com.ua> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-15" Content-Transfer-Encoding: 7bit Message-Id: <201207301149.43458.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.7 (bigwig.baldwin.cx); Mon, 30 Jul 2012 14:04:41 -0400 (EDT) Cc: Attilio Rao , Davide Italiano , src-committers@freebsd.org, svn-src-projects@freebsd.org Subject: Re: svn commit: r238907 - projects/calloutng/sys/kern X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Jul 2012 18:04:42 -0000 On Monday, July 30, 2012 10:39:43 am Konstantin Belousov wrote: > On Mon, Jul 30, 2012 at 03:24:26PM +0100, Attilio Rao wrote: > > On 7/30/12, Davide Italiano wrote: > > > On Mon, Jul 30, 2012 at 4:02 PM, Attilio Rao wrote: > > > Thanks for the comment, Attilio. > > > Yes, it's exactly what you thought. If direct flag is equal to one > > > you're sure you're processing a callout which runs directly from > > > hardware interrupt context. In this case, the running thread cannot > > > sleep and it's likely you have TDP_NOSLEEPING flags set, failing the > > > KASSERT() in THREAD_NO_SLEEPING() and leading to panic if kernel is > > > compiled with INVARIANTS. > > > In case you're running from SWI context (direct equals to zero) code > > > remains the same as before. > > > I think what I'm doing works due the assumption thread running never > > > sleeps. Do you suggest some other way to handle this? > > > > Possibly the quicker way to do this is to have a way to deal with the > > TDP_NOSLEEPING flag in recursed way, thus implement the same logic as > > VFS_LOCK_GIANT() does, for example. > > You will need to change the few callers of THREAD_NO_SLEEPING(), but > > the patch should be no longer than 10/15 lines. > > There are already curthread_pflags_set/restore KPI designed exactly to handle > nested private thread flags. > > Also, I wonder, should you assert somehow that direct dispatch cannot block > as well ? Hmm, I have a nested TDP_NOSLEEPING already (need it to fix an issue in rmlocks). It uses a count though as the flag is set during rm_rlock() and released during rm_runlock(). I don't think it could use a set/restore KPI as there is no good place to store the state. -- John Baldwin