freebsd-nq/sys/dev/usb
Hans Petter Selasky b78e84d132 Resolve a special case deadlock: When two or more threads are
simultaneously detaching kernel drivers on the same USB device we can
get stuck in the "usb_wait_pending_ref_locked()" function because the
conditions needed for allowing detach are not met. The "destroy_dev()"
function waits for all system calls involving the given character
device to return. Character device system calls may lock the USB
enumeration lock, which is also held when "destroy_dev()" is
called. This can sometimes lead to a deadlock not noticed by
WITNESS. The current solution is to ensure the calling thread is the
only one holding the USB enumeration lock and prevent other threads
from getting refs while a USB device detach is ongoing. This turned
out not to be sufficient. To solve this deadlock we could use
"destroy_dev_sched()" to schedule the device destruction in the
background, but then we don't know when it is safe to free() the
private data of the character device. Instead a callback function is
executed by the USB explore process to kill off any leftover USB
character devices synchronously after the USB device explore code is
finished and the USB enumeration lock is no longer locked. This makes
porting easier and also ensures us that character devices must
eventually go away after a USB device detach.

While at it ensure that "flag_iserror" is only written when "priv_mtx"
is locked, which is protecting it.

MFC after:	5 days
2015-01-13 16:37:43 +00:00
..
controller Resolve a special case deadlock: When two or more threads are 2015-01-13 16:37:43 +00:00
gadget Make a bunch of USB debug SYSCTLs tunable, so that their value(s) can 2015-01-05 15:04:17 +00:00
input Make a bunch of USB debug SYSCTLs tunable, so that their value(s) can 2015-01-05 15:04:17 +00:00
misc In order to reduce use of M_EXT outside of the mbuf allocator and 2015-01-06 12:59:37 +00:00
net Make a bunch of USB debug SYSCTLs tunable, so that their value(s) can 2015-01-05 15:04:17 +00:00
quirk Add more quirks. 2014-12-26 10:53:22 +00:00
serial Add support for USB device side mode to the USB modem driver. 2015-01-09 18:40:12 +00:00
storage Make a bunch of USB debug SYSCTLs tunable, so that their value(s) can 2015-01-05 15:04:17 +00:00
template Add usb template SERIALNET allowing us to have both USB CDC Ethernet 2015-01-13 14:03:56 +00:00
wlan Make a bunch of USB debug SYSCTLs tunable, so that their value(s) can 2015-01-05 15:04:17 +00:00
ufm_ioctl.h
uftdiio.h
uled_ioctl.h The USB LED driver for the Dream Cheeky WebMail Notifier. 2014-09-05 11:25:58 +00:00
usb_bus.h Resolve a special case deadlock: When two or more threads are 2015-01-13 16:37:43 +00:00
usb_busdma.c
usb_busdma.h
usb_cdc.h
usb_compat_linux.c
usb_compat_linux.h
usb_controller.h
usb_core.c Provide one global language string descriptor for 2013-01-30 15:46:26 +00:00
usb_core.h
usb_debug.c
usb_debug.h
usb_dev.c Resolve a special case deadlock: When two or more threads are 2015-01-13 16:37:43 +00:00
usb_dev.h
usb_device.c Resolve a special case deadlock: When two or more threads are 2015-01-13 16:37:43 +00:00
usb_device.h Resolve a special case deadlock: When two or more threads are 2015-01-13 16:37:43 +00:00
usb_dynamic.c
usb_dynamic.h
usb_endian.h
usb_error.c
usb_freebsd_loader.h Increase the maximum number of dynamic USB quirks. USB memory stick 2015-01-12 06:34:23 +00:00
usb_freebsd.h Increase the maximum number of dynamic USB quirks. USB memory stick 2015-01-12 06:34:23 +00:00
usb_generic.c
usb_generic.h
usb_handle_request.c
usb_hid.c
usb_hub.c Make a bunch of USB debug SYSCTLs tunable, so that their value(s) can 2015-01-05 15:04:17 +00:00
usb_hub.h
usb_if.m
usb_ioctl.h Add usb template SERIALNET allowing us to have both USB CDC Ethernet 2015-01-13 14:03:56 +00:00
usb_lookup.c
usb_mbuf.c
usb_mbuf.h
usb_msctest.c Increase the maximum number of dynamic USB quirks. USB memory stick 2015-01-12 06:34:23 +00:00
usb_msctest.h
usb_parse.c
usb_pci.h
usb_pf.c
usb_pf.h
usb_process.c
usb_process.h
usb_request.c Make a bunch of USB debug SYSCTLs tunable, so that their value(s) can 2015-01-05 15:04:17 +00:00
usb_request.h
usb_transfer.c Add 64-bit DMA support in the XHCI controller driver. 2015-01-05 20:22:18 +00:00
usb_transfer.h
usb_util.c
usb_util.h
usb.h Actually change the USB_PORT_ROOT_RESET_DELAY definition as stated in 2014-10-22 07:50:19 +00:00
usbdevs Add more USB devices. 2014-12-26 10:57:39 +00:00
usbdi_util.h
usbdi.h
usbhid.h