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 Add ioctl(2) calls to uftdi(4) to access bitbang, MPSSE, CPU_FIFO, and 2014-04-05 16:08:13 +00:00
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 Change type of the DMA address so that on PAE platforms we get can 2014-06-02 07:08:34 +00:00
usb_cdc.h
usb_compat_linux.c
usb_compat_linux.h
usb_controller.h
usb_core.c
usb_core.h - Add softc pointer argument to FIFO functions as an optimisation. 2014-05-18 09:13:29 +00:00
usb_debug.c Pull in r267961 and r267973 again. Fix for issues reported will follow. 2014-06-28 03:56:17 +00:00
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 Pull in r267961 and r267973 again. Fix for issues reported will follow. 2014-06-28 03:56:17 +00:00
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 Resolve a deadlock setting the USB configuration index from userspace 2014-06-08 20:10:29 +00:00
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 Add a second Huawei SCSI eject command as USB mode switch config files 2014-08-05 09:35:25 +00:00
usb_parse.c
usb_pci.h
usb_pf.c Fix for NULL pointer. 2014-05-09 14:28:11 +00:00
usb_pf.h
usb_process.c Pull in r267961 and r267973 again. Fix for issues reported will follow. 2014-06-28 03:56:17 +00:00
usb_process.h Try to resolve a possible deadlock when detaching USB devices which 2014-03-20 13:53:24 +00:00
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 Resolve a deadlock setting the USB configuration index from userspace 2014-06-08 20:10:29 +00:00
usbhid.h