From owner-freebsd-current@freebsd.org Tue Jul 7 23:52:57 2015 Return-Path: Delivered-To: freebsd-current@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8E2FE9967E4 for ; Tue, 7 Jul 2015 23:52:57 +0000 (UTC) (envelope-from rysto32@gmail.com) Received: from mail-ie0-x235.google.com (mail-ie0-x235.google.com [IPv6:2607:f8b0:4001:c03::235]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5F2D61E10 for ; Tue, 7 Jul 2015 23:52:57 +0000 (UTC) (envelope-from rysto32@gmail.com) Received: by ieru20 with SMTP id u20so1826559ier.0 for ; Tue, 07 Jul 2015 16:52:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=M+tpzVdh1yxu31GLxffnUIAbmd3YPXCh4X8j+qaOTtU=; b=UnQwb3v9iw6oJk733H00TnKBpRjvxUzRpTe6+poiUKJ/7twHx1TC3sf+y32giPbjDy C6+uMmWz1DIUfdDKyoTrT1n77yY0ORvUK3AZliCacT3wmtPE0H8YCRyzSNUYz1aePGxK 3gCBwSUY7uj+h1i9p26s8eYXIMVlXUYorC3MjcPHuLGy1q4tGaU6Ohr5+niaEYOmNNv3 YSsDHne4a2NtigJcD53c1YxG//WgQSr+ui9RdVLgeQ9ooHQrmGx/eubOonhmGxtQQwju DbyFc7wCKt3gtCpUN2iK/sCt01s6nXlxAAfml3L0TWCppOekmSuVpiZPEPDJ8WN+HjCN seiA== MIME-Version: 1.0 X-Received: by 10.107.149.14 with SMTP id x14mr10767003iod.87.1436313176646; Tue, 07 Jul 2015 16:52:56 -0700 (PDT) Received: by 10.107.145.68 with HTTP; Tue, 7 Jul 2015 16:52:56 -0700 (PDT) In-Reply-To: <20150702070828.GH2080@kib.kiev.ua> References: <20150701213241.GG2080@kib.kiev.ua> <20150702070828.GH2080@kib.kiev.ua> Date: Tue, 7 Jul 2015 19:52:56 -0400 Message-ID: Subject: Re: How should a driver shutdown a taskqueue on detach? From: Ryan Stone To: Konstantin Belousov Cc: Jack Vogel , FreeBSD Current Content-Type: text/plain; charset=UTF-8 X-Content-Filtered-By: Mailman/MimeDel 2.1.20 X-BeenThere: freebsd-current@freebsd.org X-Mailman-Version: 2.1.20 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: Tue, 07 Jul 2015 23:52:57 -0000 On Thu, Jul 2, 2015 at 3:08 AM, Konstantin Belousov wrote: > Having taskqueue_enqueue() which could silently (?) not enqueue the given > task is huge and IMO risky change to the KPI. If doing it, I think > that there should be a new function to enqueue, which is allowed to > fail, unlike taskqueue_enqueue(). > > BTW, the man page for taskqueue(9) is wrong, taskqueue_enqueue(9) > always succeed now and always returns 0 (ignoring the ushort overflow). > That's fair, but I feel that a new enqueue function would be rather intrusive for existing drivers. Maybe we should attach this from a different angle. How about a taskqueue_quiesce() function, which must be called on a blocked taskqueue (by taskqueue_block() ). taskqueue_quiesce() would block until the taskqueue's thread has stopped running. Then I can do: taskqueue_block() taskqueue_quiesce() taskqueue_cancel() //... taskqueue_free()