Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 17 Sep 2015 10:27:28 -0700
From:      Adrian Chadd <adrian@freebsd.org>
To:        Hans Petter Selasky <hps@selasky.org>
Cc:        "src-committers@freebsd.org" <src-committers@freebsd.org>,  "svn-src-all@freebsd.org" <svn-src-all@freebsd.org>,  "svn-src-head@freebsd.org" <svn-src-head@freebsd.org>
Subject:   Re: svn commit: r287892 - head/sys/dev/usb/wlan
Message-ID:  <CAJ-Vmok9wz0nef73Ww3kUZYk1PBQ0RZp4d6vrJ5UtmK-7_znyA@mail.gmail.com>
In-Reply-To: <55FA7196.40004@selasky.org>
References:  <201509170301.t8H31KdP042687@repo.freebsd.org> <55FA6C62.6010705@selasky.org> <55FA6EA2.8050809@selasky.org> <CAJ-Vmo=P%2BzsOnM9uvzgcTjUB6TvONU5zLaOMCXMmrHZ2jOrJNQ@mail.gmail.com> <55FA7196.40004@selasky.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On 17 September 2015 at 00:53, Hans Petter Selasky <hps@selasky.org> 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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAJ-Vmok9wz0nef73Ww3kUZYk1PBQ0RZp4d6vrJ5UtmK-7_znyA>