From owner-freebsd-usb@FreeBSD.ORG Thu Nov 4 20:14:09 2010 Return-Path: Delivered-To: freebsd-usb@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 706F8106566B; Thu, 4 Nov 2010 20:14:09 +0000 (UTC) (envelope-from hselasky@c2i.net) Received: from swip.net (mailfe01.swip.net [212.247.154.1]) by mx1.freebsd.org (Postfix) with ESMTP id 5ADBA8FC08; Thu, 4 Nov 2010 20:14:07 +0000 (UTC) X-Cloudmark-Score: 0.000000 [] X-Cloudmark-Analysis: v=1.1 cv=omSrwDgyMf70S47Fr5SNr0rQzcmIOo0IafWlB/wSLLo= c=1 sm=1 a=FberXtVRn-wA:10 a=8nJEP1OIZ-IA:10 a=CL8lFSKtTFcA:10 a=i9M/sDlu2rpZ9XS819oYzg==:17 a=8kQB0OdkAAAA:8 a=6I5d2MoRAAAA:8 a=0QwtpmV1rXepT5CfuEUA:9 a=eS946g9CBUxHvd1zr24A:7 a=CZwjQWI-HvlaZHoSd6vtHMF60NkA:4 a=wPNLvfGTeEIA:10 a=9aOQ2cSd83gA:10 a=i9M/sDlu2rpZ9XS819oYzg==:117 Received: from [188.126.198.129] (account mc467741@c2i.net HELO laptop002.hselasky.homeunix.org) by mailfe01.swip.net (CommuniGate Pro SMTP 5.2.19) with ESMTPA id 45433961; Thu, 04 Nov 2010 21:14:06 +0100 From: Hans Petter Selasky To: Matthew Fleming Date: Thu, 4 Nov 2010 21:15:16 +0100 User-Agent: KMail/1.13.5 (FreeBSD/8.1-STABLE; KDE/4.4.5; amd64; ; ) References: <201011012054.59551.hselasky@c2i.net> <201011042011.44705.hselasky@c2i.net> In-Reply-To: X-Face: +~\`s("[*|O,="7?X@L.elg*F"OA\I/3%^p8g?ab%RN'( =?iso-8859-1?q?=3B=5FIjlA=3A=0A=09hGE=2E=2EEw?=, =?iso-8859-1?q?XAQ*o=23=5C/M=7ESC=3DS1-f9=7BEzRfT=27=7CHhll5Q=5Dha5Bt-s=7Co?= =?iso-8859-1?q?TlKMusi=3A1e=5BwJl=7Dkd=7DGR=0A=09Z0adGx-x=5F0zGbZj=27e?=(Y[(UNle~)8CQWXW@:DX+9)_YlB[tIccCPN$7/L' MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201011042115.16187.hselasky@c2i.net> Cc: freebsd-arch@freebsd.org, freebsd-current@freebsd.org, freebsd-usb@freebsd.org, Weongyo Jeong Subject: Re: [RFC] Outline of USB process integration in the kernel taskqueue system X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 04 Nov 2010 20:14:09 -0000 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? --HPS