From owner-freebsd-arch@FreeBSD.ORG Thu Nov 4 21:23:04 2010 Return-Path: Delivered-To: freebsd-arch@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 4AF90106564A; Thu, 4 Nov 2010 21:23:04 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from cyrus.watson.org (cyrus.watson.org [65.122.17.42]) by mx1.freebsd.org (Postfix) with ESMTP id 14DB98FC13; Thu, 4 Nov 2010 21:23:04 +0000 (UTC) Received: from bigwig.baldwin.cx (66.111.2.69.static.nyinternet.net [66.111.2.69]) by cyrus.watson.org (Postfix) with ESMTPSA id AC24446B0D; Thu, 4 Nov 2010 17:23:03 -0400 (EDT) Received: from jhbbsd.localnet (smtp.hudson-trading.com [209.249.190.9]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 9BAD38A009; Thu, 4 Nov 2010 17:23:02 -0400 (EDT) From: John Baldwin To: freebsd-arch@freebsd.org Date: Thu, 4 Nov 2010 17:22:46 -0400 User-Agent: KMail/1.13.5 (FreeBSD/7.3-CBSD-20100819; KDE/4.4.5; amd64; ; ) References: <201011012054.59551.hselasky@c2i.net> <201011042115.16187.hselasky@c2i.net> In-Reply-To: <201011042115.16187.hselasky@c2i.net> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201011041722.46673.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.6 (bigwig.baldwin.cx); Thu, 04 Nov 2010 17:23:02 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.96.3 at bigwig.baldwin.cx X-Virus-Status: Clean X-Spam-Status: No, score=-1.9 required=4.2 tests=BAYES_00 autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on bigwig.baldwin.cx Cc: Matthew Fleming , freebsd-usb@freebsd.org, Weongyo Jeong , freebsd-current@freebsd.org, Andrew Thompson , Hans Petter Selasky Subject: Re: [RFC] Outline of USB process integration in the kernel taskqueue system X-BeenThere: freebsd-arch@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussion related to FreeBSD architecture List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Nov 2010 21:23:04 -0000 On Thursday, November 04, 2010 4:15:16 pm Hans Petter Selasky wrote: > On Thursday 04 November 2010 21:11:38 Matthew Fleming wrote: > > On Thu, Nov 4, 2010 at 12:11 PM, Hans Petter Selasky > wrote: > > > On Thursday 04 November 2010 20:01:57 Matthew Fleming wrote: > > >> On Thu, Nov 4, 2010 at 11:41 AM, Hans Petter Selasky > > > > > > wrote: > > >> > On Thursday 04 November 2010 15:29:51 John Baldwin wrote: > > >> >> (and there is in Jeff's OFED branch) > > >> > > > >> > Is there a link to this branch? I would certainly have a look at his > > >> > work and re-base my patch. > > >> > > >> It's on svn.freebsd.org: > > >> > > >> http://svn.freebsd.org/viewvc/base/projects/ofed/head/sys/kern/subr_task > > >> que ue.c?view=log > > >> http://svn.freebsd.org/viewvc/base?view=revision&revision=209422 > > >> > > >> For the purpose of speed, I'm not opposed to breaking the KBI by using > > >> a doubly-linked TAILQ, but I don't think the difference will matter > > >> all that often (perhaps I'm wrong and some taskqueues have dozens of > > >> pending tasks?) > > >> > > >> Thanks, > > >> matthew > > > > > > At first look I see that I need a non-blocking version of: > > > > > > taskqueue_cancel( > > > > > > At the point in the code where these functions are called I cannot block. > > > Is this impossible to implement? > > > > It depends on whether the queue uses a MTX_SPIN or MTX_DEF. It is not > > possible to determine whether a task is running without taking the > > taskqueue lock. And it is certainly impossible to dequeue a task > > without the lock that was used to enqueue it. > > > > However, a variant that dequeued if the task was still pending, and > > returned failure otherwise (rather than sleeping) is definitely > > possible. > > I think that if a task is currently executing, then there should be a drain > method for that. I.E. two methods: One to stop and one to cancel/drain. Can > you implement this? I agree, this would also be consistent with the callout_*() API if you had both "stop()" and "drain()" methods. -- John Baldwin