From owner-freebsd-current@FreeBSD.ORG Fri Nov 12 14:18:49 2010 Return-Path: Delivered-To: freebsd-current@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0B489106566C for ; Fri, 12 Nov 2010 14:18:49 +0000 (UTC) (envelope-from mdf356@gmail.com) Received: from mail-gx0-f182.google.com (mail-gx0-f182.google.com [209.85.161.182]) by mx1.freebsd.org (Postfix) with ESMTP id B5B728FC12 for ; Fri, 12 Nov 2010 14:18:48 +0000 (UTC) Received: by gxk9 with SMTP id 9so1936405gxk.13 for ; Fri, 12 Nov 2010 06:18:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:sender:received :in-reply-to:references:date:x-google-sender-auth:message-id:subject :from:to:cc:content-type:content-transfer-encoding; bh=IUqLvQCRT16Dy2hsyEYOff26n99EONvYCjksXkzg3Go=; b=sqVzL8QiISKviomwTFyH0rUDP+dBszouLhEBacHCrxCzBYrGr4U7xVcAwUVRdN8y0X oZJk3ADqN9bVjaNr7GlhRW3UNEIXFPpiuEAtsC1nkjZhHm1qlHDbyZ8ERm7+yd06tr/N h+yP12e3lfx8iAHwK3N6lhwIIvbaIaNeg8OVg= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=I2bjj0G+oSGWPq8+1ui0KrEfj6wWuZXnEBN1qZZ9/6Q/BE97ubhwffHg1YJoStx/t/ 4pdvtHAikQYaxYav1z7X2K8UdxgLc0RrhWGQ5Abro/JBjxuyGSDQiSwT59/PyOFPbSOu oVMJaoqL0XKvJ8C4tDRMw+Idb4y2rsBCgmSeQ= MIME-Version: 1.0 Received: by 10.42.211.131 with SMTP id go3mr1919282icb.393.1289571527024; Fri, 12 Nov 2010 06:18:47 -0800 (PST) Sender: mdf356@gmail.com Received: by 10.231.21.35 with HTTP; Fri, 12 Nov 2010 06:18:46 -0800 (PST) In-Reply-To: <201011120956.04501.hselasky@c2i.net> References: <06D5F9F6F655AD4C92E28B662F7F853E039E389A@seaxch09.desktop.isilon.com> <201011120956.04501.hselasky@c2i.net> Date: Fri, 12 Nov 2010 06:18:46 -0800 X-Google-Sender-Auth: zIFuVX9Ki84cAymiyVzh3-UJdkc Message-ID: From: mdf@FreeBSD.org To: Hans Petter Selasky Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: freebsd-current@freebsd.org Subject: Re: sleep bug in taskqueue(9) 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: Fri, 12 Nov 2010 14:18:49 -0000 On Fri, Nov 12, 2010 at 12:56 AM, Hans Petter Selasky wr= ote: > On Thursday 29 April 2010 01:59:58 Matthew Fleming wrote: >> It looks to me like taskqueue_drain(taskqueue_thread, foo) will not >> correctly detect whether or not a task is currently running. =A0The chec= k >> is against a field in the taskqueue struct, but for the taskqueue_thread >> queue with more than one thread, multiple threads can simultaneously be >> running a task, thus stomping over the tq_running field. >> >> I have not seen any problem with the code as-is in actual use, so this >> is purely an inspection bug. >> >> The following patch should fix the problem. =A0Because it changes the si= ze >> of struct task I'm not sure if it would be suitable for MFC. >> > > 1) The u_char is going to leave a hole in that structure on ARM platforms= for > example. > > 2) The existing taskqueue implementation also has a missing check for the > pending count wrapping to zero. I.E. it should stick at 0xFFFF and not wr= ap to > 0. This commit mail is rather old, and this fix was incorrect, because the task cannot be referenced after it has been run. Some task handlers will free the task as part of the handler. Thanks, matthew