freebsd-dev/sys
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
..
amd64 Revert r263475: TDP_DEVMEMIO no longer needed, since amd64 /dev/kmem 2015-01-12 08:58:07 +00:00
arm Rename Exynos UART driver. No functional change. 2015-01-13 15:04:28 +00:00
boot Add new USB template to the USB bootloader module. 2015-01-13 16:06:38 +00:00
bsm IFp4 @1192291: 2014-04-07 20:44:00 +00:00
cam Explain a bit of tricky code dealing with trims and how it prevents 2015-01-13 00:20:35 +00:00
cddl Skip extra bcopy() when scrubbing vdev without redundancy. 2015-01-12 22:38:55 +00:00
compat Regen for r276654 (__getcwd()). 2015-01-04 10:40:23 +00:00
conf Add usb template SERIALNET allowing us to have both USB CDC Ethernet 2015-01-13 14:03:56 +00:00
contrib In order to reduce use of M_EXT outside of the mbuf allocator and 2015-01-06 12:59:37 +00:00
crypto Add some new modes to OpenCrypto. These modes are AES-ICM (can be used 2014-12-12 19:56:36 +00:00
ddb ddb: ANSI-fy function declarations. 2014-10-12 18:01:52 +00:00
dev Resolve a special case deadlock: When two or more threads are 2015-01-13 16:37:43 +00:00
fs Don't use POLLNVAL as a return value from the client side poll 2015-01-13 13:32:18 +00:00
gdb Add support for gdb's memory searching capabilities to our in-kernel gdb 2014-09-05 16:40:47 +00:00
geom Remove old ioctl use and support, once and for all. 2015-01-06 05:28:37 +00:00
gnu reiserfs: Use signed i_nlink 2014-09-25 19:10:32 +00:00
i386 For x86, read MAXPHYADDR, defined in SDM vol 3 4.1.4 Enumeration of Paging 2015-01-12 07:36:25 +00:00
isa Remove vestiges of knowing the ISA bus, which we gave up on around 20 2014-03-19 21:03:04 +00:00
kern Revert r263475: TDP_DEVMEMIO no longer needed, since amd64 /dev/kmem 2015-01-12 08:58:07 +00:00
kgssapi Avoid dynamic syscall overhead for statically compiled modules. 2014-10-26 19:42:44 +00:00
libkern Add some new modes to OpenCrypto. These modes are AES-ICM (can be used 2014-12-12 19:56:36 +00:00
mips Move MALTA_COMMON to std.MALTA (as we have for XLP and SWARM). 2015-01-07 12:12:36 +00:00
modules Add new USB template to the USB template module. 2015-01-13 14:26:05 +00:00
net Restore Ethernet-within-IP Encapsulation support that was broken after 2015-01-10 08:28:50 +00:00
net80211 Switch around the order of static inline to be in line with how it's 2015-01-11 18:43:45 +00:00
netgraph When the node receives NGM_FLOW_COOKIE update the if_link_state, instead 2015-01-12 09:50:42 +00:00
netinet Do not go one layer down to check ifqueue length. First, not all drivers 2015-01-12 18:06:22 +00:00
netinet6 Do not go one layer down to check ifqueue length. First, not all drivers 2015-01-12 14:52:43 +00:00
netipsec In order to reduce use of M_EXT outside of the mbuf allocator and 2015-01-06 12:59:37 +00:00
netnatm
netpfil Do not initialize pfi_unlnkdkifs_mtx and pf_frag_mtx. 2015-01-08 17:49:07 +00:00
netsmb Remove redundant unlock. 2014-04-17 12:22:08 +00:00
nfs Remove the old NFS client and server from head, 2014-12-23 00:47:46 +00:00
nfsclient Remove the old NFS client and server from head, 2014-12-23 00:47:46 +00:00
nfsserver Use M_SIZE() instead of hand-crafted (and mostly correct) NFSMSIZ() macro 2015-01-07 17:22:56 +00:00
nlm Avoid dynamic syscall overhead for statically compiled modules. 2014-10-26 19:42:44 +00:00
ofed Don't mask the IP-address when doing multicast IP over infiniband. 2015-01-09 06:39:07 +00:00
opencrypto Add some new modes to OpenCrypto. These modes are AES-ICM (can be used 2014-12-12 19:56:36 +00:00
pc98 Factor out duplicated code from dumpsys() on each architecture into generic 2015-01-07 01:01:39 +00:00
powerpc Increase default MAXTSIZ to allow execution of larger binaries. 2015-01-10 06:54:10 +00:00
rpc Add facility to stop all userspace processes. The supposed use of the 2014-12-13 16:18:29 +00:00
security Adjust printf format specifiers for dev_t and ino_t in kernel. 2014-12-17 07:27:19 +00:00
sparc64 Factor out duplicated code from dumpsys() on each architecture into generic 2015-01-07 01:01:39 +00:00
sys Revert r263475: TDP_DEVMEMIO no longer needed, since amd64 /dev/kmem 2015-01-12 08:58:07 +00:00
teken mdoc: improvements to SEE ALSO. 2014-12-27 07:07:37 +00:00
tools Allow the make_dtb script to work outside of a "make buildkernel" context 2014-08-30 22:39:15 +00:00
ufs Handle MAKEENTRY cnp flag in the VOP_CREATE(). Curiously, some 2014-12-21 13:29:33 +00:00
vm Revert r263475: TDP_DEVMEMIO no longer needed, since amd64 /dev/kmem 2015-01-12 08:58:07 +00:00
x86 For x86, read MAXPHYADDR, defined in SDM vol 3 4.1.4 Enumeration of Paging 2015-01-12 07:36:25 +00:00
xdr
xen Pacify clang 3.3 by ending the file with a newline. This is common 2015-01-06 21:26:35 +00:00
Makefile Remove "pci" from CSCOPEDIRS. 2014-09-23 06:32:19 +00:00