From owner-freebsd-usb@FreeBSD.ORG Thu Nov 4 20:11:40 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 2F3E31065672; Thu, 4 Nov 2010 20:11:40 +0000 (UTC) (envelope-from mdf356@gmail.com) Received: from mail-yx0-f182.google.com (mail-yx0-f182.google.com [209.85.213.182]) by mx1.freebsd.org (Postfix) with ESMTP id A01588FC12; Thu, 4 Nov 2010 20:11:39 +0000 (UTC) Received: by yxl31 with SMTP id 31so1808006yxl.13 for ; Thu, 04 Nov 2010 13:11:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:received:in-reply-to :references:date:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=aMZNkIF9iVlGQqt1uYJpveDEPXRqgwgMV3juNw8lHVc=; b=bof83p7zSh8loU1jljLWlrzmnWbnZmGOVQTEWULbxFIBZ/7FTxByFe8Xp3bUpTggGj Dp+B/iyA5JsczjE4qBLn/CWoPzryt+RYwl49SoDVZoZJR7nQrmcdvxp9ahubeuWiD0Ad hHj2TI7ACzkVnAjaa/ZL8G6u5EVq9stEzeNWc= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; b=v36Ozpxmqlcl2vlCGYLLjRFENZR9EXPndpzn6FqP4TfXZ6kOEqPP5fnyT4ghyQ+ATQ mMa/e1drhQIi4LKuTwmigwjn6ZciO1RzZF38R6vhSZFJHFpM4SmUIqWva1qOwKMCMX7+ 59Yjgqdo49ABDSECfC//RUCJfANWoegPUlF6I= MIME-Version: 1.0 Received: by 10.42.97.67 with SMTP id m3mr731997icn.343.1288901498679; Thu, 04 Nov 2010 13:11:38 -0700 (PDT) Received: by 10.231.159.198 with HTTP; Thu, 4 Nov 2010 13:11:38 -0700 (PDT) In-Reply-To: <201011042011.44705.hselasky@c2i.net> References: <201011012054.59551.hselasky@c2i.net> <201011041941.09662.hselasky@c2i.net> <201011042011.44705.hselasky@c2i.net> Date: Thu, 4 Nov 2010 13:11:38 -0700 Message-ID: From: Matthew Fleming To: Hans Petter Selasky Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable 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:11:40 -0000 On Thu, Nov 4, 2010 at 12:11 PM, Hans Petter Selasky wro= te: > 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: >> >> =A0(and there is in Jeff's OFED branch) >> > >> > Is there a link to this branch? I would certainly have a look at his w= ork >> > 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=3Dlog >> http://svn.freebsd.org/viewvc/base?view=3Drevision&revision=3D209422 >> >> 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. Thanks, matthew