opnsense-src/sys/dev/usb/controller
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
..
at91dci.c Make a bunch of USB debug SYSCTLs tunable, so that their value(s) can 2015-01-05 15:04:17 +00:00
at91dci.h - Implement fast interrupt handler to save CPU usage. 2014-08-05 18:48:12 +00:00
at91dci_atmelarm.c Add 64-bit DMA support in the XHCI controller driver. 2015-01-05 20:22:18 +00:00
at91dci_fdt.c Add 64-bit DMA support in the XHCI controller driver. 2015-01-05 20:22:18 +00:00
atmegadci.c Make a bunch of USB debug SYSCTLs tunable, so that their value(s) can 2015-01-05 15:04:17 +00:00
atmegadci.h Implement better support for USB controller suspend and resume. 2011-12-14 00:28:54 +00:00
atmegadci_atmelarm.c Add 64-bit DMA support in the XHCI controller driver. 2015-01-05 20:22:18 +00:00
avr32dci.c Make a bunch of USB debug SYSCTLs tunable, so that their value(s) can 2015-01-05 15:04:17 +00:00
avr32dci.h Implement better support for USB controller suspend and resume. 2011-12-14 00:28:54 +00:00
dwc_otg.c Pull in r267961 and r267973 again. Fix for issues reported will follow. 2014-06-28 03:56:17 +00:00
dwc_otg.h Some further DWC OTG improvements for full speed and low speed devices: 2014-06-07 07:23:17 +00:00
dwc_otg_fdt.c Add 64-bit DMA support in the XHCI controller driver. 2015-01-05 20:22:18 +00:00
dwc_otgreg.h Multiple DWC OTG host mode related fixes and improvements: 2014-05-09 14:23:06 +00:00
ehci.c Remove unused defines. 2014-08-05 08:24:41 +00:00
ehci.h Fix undefined behavior: (1 << 31) is not defined as 1 is an int and this 2013-11-30 22:17:27 +00:00
ehci_fsl.c Add 64-bit DMA support in the XHCI controller driver. 2015-01-05 20:22:18 +00:00
ehci_imx.c Add 64-bit DMA support in the XHCI controller driver. 2015-01-05 20:22:18 +00:00
ehci_ixp4xx.c Add 64-bit DMA support in the XHCI controller driver. 2015-01-05 20:22:18 +00:00
ehci_mv.c Add 64-bit DMA support in the XHCI controller driver. 2015-01-05 20:22:18 +00:00
ehci_pci.c Add 64-bit DMA support in the XHCI controller driver. 2015-01-05 20:22:18 +00:00
ehcireg.h The EHCI_CAPLENGTH and EHCI_HCIVERSION registers are actually sub-registers 2010-10-25 15:51:43 +00:00
musb_otg.c Fix handling of an error case when the MUSB driver is operating in USB 2015-01-08 00:11:11 +00:00
musb_otg.h - Verify that we don't load more data into a FIFO than it is 2014-06-05 18:23:51 +00:00
musb_otg_atmelarm.c Add 64-bit DMA support in the XHCI controller driver. 2015-01-05 20:22:18 +00:00
ohci.c Pull in r267961 and r267973 again. Fix for issues reported will follow. 2014-06-28 03:56:17 +00:00
ohci.h Implement better support for USB controller suspend and resume. 2011-12-14 00:28:54 +00:00
ohci_atmelarm.c Add 64-bit DMA support in the XHCI controller driver. 2015-01-05 20:22:18 +00:00
ohci_fdt.c Add 64-bit DMA support in the XHCI controller driver. 2015-01-05 20:22:18 +00:00
ohci_pci.c Add 64-bit DMA support in the XHCI controller driver. 2015-01-05 20:22:18 +00:00
ohci_s3c24x0.c Add 64-bit DMA support in the XHCI controller driver. 2015-01-05 20:22:18 +00:00
ohcireg.h The NetBSD Foundation has granted permission to remove clause 3 and 4 from 2010-03-03 10:18:03 +00:00
saf1761_otg.c Make a bunch of USB debug SYSCTLs tunable, so that their value(s) can 2015-01-05 15:04:17 +00:00
saf1761_otg.h Workaround for possible bug in the SAF1761 chip. Wait 125us before 2014-12-03 21:48:30 +00:00
saf1761_otg_boot.c Add 64-bit DMA support in the XHCI controller driver. 2015-01-05 20:22:18 +00:00
saf1761_otg_fdt.c Add 64-bit DMA support in the XHCI controller driver. 2015-01-05 20:22:18 +00:00
saf1761_otg_reg.h Use correct length mask for split transactions. The hardware would 2014-11-22 08:47:04 +00:00
uhci.c Pull in r267961 and r267973 again. Fix for issues reported will follow. 2014-06-28 03:56:17 +00:00
uhci.h Implement better support for USB controller suspend and resume. 2011-12-14 00:28:54 +00:00
uhci_pci.c Add 64-bit DMA support in the XHCI controller driver. 2015-01-05 20:22:18 +00:00
uhcireg.h The NetBSD Foundation has granted permission to remove clause 3 and 4 from 2010-03-03 10:18:03 +00:00
usb_controller.c Resolve a special case deadlock: When two or more threads are 2015-01-13 16:37:43 +00:00
uss820dci.c Make a bunch of USB debug SYSCTLs tunable, so that their value(s) can 2015-01-05 15:04:17 +00:00
uss820dci.h - Implement fast interrupt handler to save CPU usage. 2014-08-05 06:33:59 +00:00
uss820dci_atmelarm.c Add 64-bit DMA support in the XHCI controller driver. 2015-01-05 20:22:18 +00:00
xhci.c Add 64-bit DMA support in the XHCI controller driver. 2015-01-05 20:22:18 +00:00
xhci.h Fix misleading comment. 2015-01-08 00:12:54 +00:00
xhci_pci.c Add 64-bit DMA support in the XHCI controller driver. 2015-01-05 20:22:18 +00:00
xhcireg.h Improve support for Intel Lynx Point USB 3.0 controllers by masking 2014-07-07 05:17:16 +00:00