From owner-svn-src-head@freebsd.org Thu Sep 17 17:27:29 2015 Return-Path: Delivered-To: svn-src-head@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 A00189CF2A5; Thu, 17 Sep 2015 17:27:29 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: from mail-io0-x22d.google.com (mail-io0-x22d.google.com [IPv6:2607:f8b0:4001:c06::22d]) (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 6B2AA1D00; Thu, 17 Sep 2015 17:27:29 +0000 (UTC) (envelope-from adrian.chadd@gmail.com) Received: by iofh134 with SMTP id h134so29868621iof.0; Thu, 17 Sep 2015 10:27:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; bh=WpHOEG4pxmSGCuM5q0oWcp0NrFT4Do3LiQDy6ExZaWI=; b=ek84KGyjVi1vSPGdJlwnKj1ZNs9HDl8Iwvy6G0P6Nv+qhyEX11sEs0gaJwlz4X5x5W aOSB7xW5wy1dsas2yx7m6jeGZARN8oEY1jO8q4xcS8ed4glLcFxp6lN7Xt3wppXJqFFq S7AtUzNVggjaQsCWU8RYWJIcEQs2L3UgBo/eKY3WWOb6rQyVZrSLzsWgR4wyd3S4UbXT mZ/0PIXWMY4g2c04WKP90+uh3c9ci5oLJBLsMTDj07A3cYoDdrohFAxF4bgpS3XP9L6Q gfzX1wkQstVCrpFvMy0WDoHRWoD+zDuBB1Ur14YhAmF7Hm6sDYDn9epC/G3FYKq9tUb6 l2sw== MIME-Version: 1.0 X-Received: by 10.107.35.78 with SMTP id j75mr7905905ioj.123.1442510848775; Thu, 17 Sep 2015 10:27:28 -0700 (PDT) Sender: adrian.chadd@gmail.com Received: by 10.36.28.208 with HTTP; Thu, 17 Sep 2015 10:27:28 -0700 (PDT) In-Reply-To: <55FA7196.40004@selasky.org> References: <201509170301.t8H31KdP042687@repo.freebsd.org> <55FA6C62.6010705@selasky.org> <55FA6EA2.8050809@selasky.org> <55FA7196.40004@selasky.org> Date: Thu, 17 Sep 2015 10:27:28 -0700 X-Google-Sender-Auth: aBkzIFB-Beo1_pTWu2cHU8YB0CY Message-ID: Subject: Re: svn commit: r287892 - head/sys/dev/usb/wlan From: Adrian Chadd To: Hans Petter Selasky Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Content-Type: text/plain; charset=UTF-8 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 17 Sep 2015 17:27:29 -0000 On 17 September 2015 at 00:53, Hans Petter Selasky wrote: > Hi Adrian, > > On 09/17/15 09:43, Adrian Chadd wrote: >> >> .. I'm likely going to do exactly that as part of "making" if_rsu do >> 11n and behave correctly. Right now it does neither. > > > Thank you for helping out with the USB WLAN drivers. Yes, USB requests sleep > and don't spin until they're done. > >> >> But this is a pretty big design pattern flaw; all of the wifi drivers >> use the usb library like this and .. well, unless you look under the >> hood, you don't really realise that serialiser lock is being dropped >> for you... :( > > > Right. If you need any help test, code or review, let me know. > > Not dropping the mutex inside USB sleeping functions would force all USB > drivers to use SX locks or lower in the locking hierherachy, for > synchronization, which would not be so good. Well, that's a big design warning alert. Same as NICs that do UNLOCK;input;LOCK and chunks of the wifi stack I inherited which do the same thing - you suddenly can't guarantee consistency in any way. So, we need some way to serialise management accesses and TX/RX accesses and we need to use that design pattern for all drivers. Right now it's "use mutex to serialize hardware state" which people then break with unlock;stackwork;lock or unlock;sleep;lock. I can't point to a specific USB device that does it correctly (and most PCI wifi drivers don't do it either. Sigh.) -adrian