From owner-freebsd-usb@FreeBSD.ORG Thu Oct 10 07:46:48 2013 Return-Path: Delivered-To: freebsd-usb@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 75E28A3D for ; Thu, 10 Oct 2013 07:46:48 +0000 (UTC) (envelope-from hps@bitfrost.no) Received: from mta.bitpro.no (mta.bitpro.no [92.42.64.202]) by mx1.freebsd.org (Postfix) with ESMTP id 047E7270A for ; Thu, 10 Oct 2013 07:46:47 +0000 (UTC) Received: from mail.lockless.no (mail.lockless.no [46.29.221.38]) by mta.bitpro.no (Postfix) with ESMTP id 99F887A1CC; Thu, 10 Oct 2013 09:46:45 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by mail.lockless.no (Postfix) with ESMTP id 069F98F5E0B; Thu, 10 Oct 2013 09:47:09 +0200 (CEST) X-Virus-Scanned: by amavisd-new-2.6.4 (20090625) (Debian) at lockless.no Received: from mail.lockless.no ([127.0.0.1]) by localhost (mail.lockless.no [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id EHrEJAOwufzG; Thu, 10 Oct 2013 09:47:08 +0200 (CEST) Received: from laptop015.home.selasky.org (cm-176.74.213.204.customer.telag.net [176.74.213.204]) by mail.lockless.no (Postfix) with ESMTPSA id 240798F5DEC; Thu, 10 Oct 2013 09:47:08 +0200 (CEST) Message-ID: <52565BB1.8070506@bitfrost.no> Date: Thu, 10 Oct 2013 09:48:01 +0200 From: Hans Petter Selasky Organization: Bitfrost A/S User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:17.0) Gecko/20130522 Thunderbird/17.0.6 MIME-Version: 1.0 To: Daniel O'Connor Subject: Re: USB config SX lock deadlock References: <9783900F-08A1-41FB-81B8-3C9809B82521@gsoft.com.au> <52553000.2010003@bitfrost.no> <52554855.6030404@bitfrost.no> <52564953.8080707@bitfrost.no> <7610BC59-ED91-4807-B145-7F7DD2C725E9@gsoft.com.au> In-Reply-To: <7610BC59-ED91-4807-B145-7F7DD2C725E9@gsoft.com.au> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: freebsd-usb@freebsd.org X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 10 Oct 2013 07:46:48 -0000 On 10/10/13 09:38, Daniel O'Connor wrote: > > On 10/10/2013, at 16:59, Hans Petter Selasky wrote: >>> It might under some circumstances but not directly. >>> >>> It has 3 sub interfaces, if there is an error on one the the DAQ program will call abort() which would result in FDs being closed. >>> >>> However that sub interface does not use read/poll only ioctl. >>> >> How do these IOCTLs work? > > They get turned into UT_READ_VENDOR_DEVICE requests in the driver. > >> Do you wakeup any sleepers at "surprise" detach? Hi, If you use synchronous USB control requests, then those should always error out. > The usb_fifo_* code handles all wakeups so I am not sure. The usb_fifo code only will only do refcounting. If you do USB control requests, you should use the f_ioctl_post, callback, because the f_ioctl callback does not protect against attach and detach or the enumeration thread running. err = (f->methods->f_ioctl) (f, cmd, addr, fflags); DPRINTFN(2, "f_ioctl cmd 0x%lx = %d\n", cmd, err); if (err != ENOIOCTL) goto done; if (usb_usb_ref_device(cpd, &refs)) { err = ENXIO; goto done; } err = (f->methods->f_ioctl_post) (f, cmd, addr, fflags); DPRINTFN(2, "f_ioctl_post cmd 0x%lx = %d\n", cmd, err); --HPS