From owner-freebsd-current@FreeBSD.ORG Thu Aug 11 23:07:11 2005 Return-Path: X-Original-To: freebsd-current@FreeBSD.org Delivered-To: freebsd-current@FreeBSD.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 621B216A41F; Thu, 11 Aug 2005 23:07:11 +0000 (GMT) (envelope-from scottl@samsco.org) Received: from pooker.samsco.org (pooker.samsco.org [168.103.85.57]) by mx1.FreeBSD.org (Postfix) with ESMTP id E106A43D48; Thu, 11 Aug 2005 23:07:08 +0000 (GMT) (envelope-from scottl@samsco.org) Received: from [192.168.254.14] (imini.samsco.home [192.168.254.14]) (authenticated bits=0) by pooker.samsco.org (8.13.3/8.13.3) with ESMTP id j7BNJ2r9019158; Thu, 11 Aug 2005 17:19:02 -0600 (MDT) (envelope-from scottl@samsco.org) Message-ID: <42FBDA1A.9000204@samsco.org> Date: Thu, 11 Aug 2005 17:07:06 -0600 From: Scott Long User-Agent: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.7.7) Gecko/20050416 X-Accept-Language: en-us, en MIME-Version: 1.0 To: John Baldwin References: <20050811220017.A72944@hades.admin.frm2> <200508111741.15983.jhb@FreeBSD.org> <200508111803.41851.jhb@FreeBSD.org> In-Reply-To: <200508111803.41851.jhb@FreeBSD.org> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.8 required=3.8 tests=ALL_TRUSTED autolearn=failed version=3.0.2 X-Spam-Checker-Version: SpamAssassin 3.0.2 (2004-11-16) on pooker.samsco.org Cc: freebsd-current@FreeBSD.org, Joerg Pulz Subject: Re: 6.0-BETA2: taskqueue_drain for if_xl.c:2796 X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Discussions about the use of FreeBSD-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 11 Aug 2005 23:07:11 -0000 John Baldwin wrote: > On Thursday 11 August 2005 05:41 pm, John Baldwin wrote: > >>On Thursday 11 August 2005 04:09 pm, Joerg Pulz wrote: >> >>>Hi, >>> >>>with a fresh installed 6.0-BETA2 i get this when xl(4) gets configured at >>>the system startup. >>>System is P3-800MHz SMP. dmesg is attached. >> >>I'm working on fixes for this. Ping me in a day or so for a patch. > > > Ok, I've got a patch. I added a taskqueue_stop() function to bring > taskqueue's a bit closer inline with the callout*() API and use > taskqueue_stop() in xl_stop() as it is ok to be called with locks held and > doesn't block. The xl task handler function now bails if IFF_DRV_RUNNING is > clear, and I added a taskqueue_drain() in detach to make sure we were > finished with the mutex and function before detach finishes. Unfortunately, > the patch is to HEAD, but you can probably get it to work on 6.x by changing > if_drv_flags to if_flags and IFF_DRV_RUNNING to IFF_RUNNING on 6.x. > > http://www.FreeBSD.org/~jhb/patches/xl_locking It looks like taskqueue_stop merely removes a pending task from the queue, it doesn't protect against there being a task already running and/or sleeping. I know that you're looking for the convenience of being able to cancel a taskqueue without having to worry about locks, but ignoring the possibility of an in-progress task is dangerous. It's incovenient, but it's the price of concurrency in the kernel. I've objected to callout_stop for the same reason. Never the less, if you're looking to have a similar API as callout_*, why not follow their model and have _taskqueue_stop_safe() ? Scott