From owner-freebsd-arch@FreeBSD.ORG Fri Nov 5 19:07:56 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 1B43A106566B; Fri, 5 Nov 2010 19:07:56 +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 DB0298FC16; Fri, 5 Nov 2010 19:07:55 +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 88C0F46B4C; Fri, 5 Nov 2010 15:07:55 -0400 (EDT) Received: from jhbbsd.localnet (smtp.hudson-trading.com [209.249.190.9]) by bigwig.baldwin.cx (Postfix) with ESMTPSA id 80B0E8A01D; Fri, 5 Nov 2010 15:07:54 -0400 (EDT) From: John Baldwin To: freebsd-arch@freebsd.org Date: Fri, 5 Nov 2010 15:06:12 -0400 User-Agent: KMail/1.13.5 (FreeBSD/7.3-CBSD-20100819; KDE/4.4.5; amd64; ; ) References: <201011012054.59551.hselasky@c2i.net> <201011052000.37188.hselasky@c2i.net> In-Reply-To: <201011052000.37188.hselasky@c2i.net> MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Message-Id: <201011051506.12643.jhb@freebsd.org> X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.6 (bigwig.baldwin.cx); Fri, 05 Nov 2010 15:07:54 -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 , Andrew Thompson , Weongyo Jeong , freebsd-current@freebsd.org, freebsd-usb@freebsd.org, 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: Fri, 05 Nov 2010 19:07:56 -0000 On Friday, November 05, 2010 3:00:37 pm Hans Petter Selasky wrote: > On Friday 05 November 2010 19:48:05 Matthew Fleming wrote: > > On Fri, Nov 5, 2010 at 11:45 AM, Hans Petter Selasky > wrote: > > > On Friday 05 November 2010 19:39:45 Matthew Fleming wrote: > > >> True, but no taskqueue(9) code can handle that. Only the caller can > > >> prevent a task from becoming enqueued again. The same issue exists > > >> with taskqueue_drain(). > > > > > > I find that strange, because that means if I queue a task again while it > > > is running, then I doesn't get run? Are you really sure? > > > > If a task is currently running when enqueued, the task struct will be > > re-enqueued to the taskqueue. When that task comes up as the head of > > the queue, it will be run again. > > Right, and the taskqueue_cancel has to cancel in that state to, but it doesn't > because it only checks pending if !running() :-) ?? You can't close that race in taskqueue_cancel(). You have to manage that race yourself in your task handler. For the callout(9) API we are only able to close that race if you use callout_init_mtx() so that the code managing the callout wheel can make use of your lock to resolve the races. If you use callout_init() you have to explicitly manage these races in your callout handler. -- John Baldwin