<feed xmlns='http://www.w3.org/2005/Atom'>
<title>src-test2/sys/dev/usb/usb_dev.c, branch release/11.0.0</title>
<subtitle>FreeBSD source tree</subtitle>
<id>https://cgit-dev.freebsd.org/src-test2/atom?h=release%2F11.0.0</id>
<link rel='self' href='https://cgit-dev.freebsd.org/src-test2/atom?h=release%2F11.0.0'/>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src-test2/'/>
<updated>2016-05-25T07:48:36Z</updated>
<entry>
<title>Check for signals when locking the USB enumeration thread from</title>
<updated>2016-05-25T07:48:36Z</updated>
<author>
<name>Hans Petter Selasky</name>
<email>hselasky@FreeBSD.org</email>
</author>
<published>2016-05-25T07:48:36Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src-test2/commit/?id=10aab8b6113f60e567b723bb9128c010760a2fff'/>
<id>urn:sha1:10aab8b6113f60e567b723bb9128c010760a2fff</id>
<content type='text'>
userspace, so that USB applications can be killed if an enumeration
thread should be stuck for various reasons.

MFC after:	1 week
</content>
</entry>
<entry>
<title>dev/usb: minor spelling fixes in comments.</title>
<updated>2016-05-02T17:44:03Z</updated>
<author>
<name>Pedro F. Giffuni</name>
<email>pfg@FreeBSD.org</email>
</author>
<published>2016-05-02T17:44:03Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src-test2/commit/?id=207332450ebe1df184818ab11115dcd7b95a5bc5'/>
<id>urn:sha1:207332450ebe1df184818ab11115dcd7b95a5bc5</id>
<content type='text'>
No functional change.

Reviewed by:	hselasky
</content>
</entry>
<entry>
<title>Don't wait forever for USB data to be flushed.</title>
<updated>2015-06-05T06:06:07Z</updated>
<author>
<name>Hans Petter Selasky</name>
<email>hselasky@FreeBSD.org</email>
</author>
<published>2015-06-05T06:06:07Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src-test2/commit/?id=b6630e5024b180c37f33419dd5c84ec8435d69dd'/>
<id>urn:sha1:b6630e5024b180c37f33419dd5c84ec8435d69dd</id>
<content type='text'>
MFC after:	1 week
</content>
</entry>
<entry>
<title>Resolve a special case deadlock: When two or more threads are</title>
<updated>2015-01-13T16:37:43Z</updated>
<author>
<name>Hans Petter Selasky</name>
<email>hselasky@FreeBSD.org</email>
</author>
<published>2015-01-13T16:37:43Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src-test2/commit/?id=b78e84d1325b0d2aee4cc018e93d21c02a673572'/>
<id>urn:sha1:b78e84d1325b0d2aee4cc018e93d21c02a673572</id>
<content type='text'>
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
</content>
</entry>
<entry>
<title>When we fail to get a USB reference we should just return, because</title>
<updated>2014-10-03T16:09:46Z</updated>
<author>
<name>Hans Petter Selasky</name>
<email>hselasky@FreeBSD.org</email>
</author>
<published>2014-10-03T16:09:46Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src-test2/commit/?id=b06d477b3c860a9118ccf232d52eea8d279ab48c'/>
<id>urn:sha1:b06d477b3c860a9118ccf232d52eea8d279ab48c</id>
<content type='text'>
there are no more references held.

MFC after:	3 days
</content>
</entry>
<entry>
<title>Pull in r267961 and r267973 again. Fix for issues reported will follow.</title>
<updated>2014-06-28T03:56:17Z</updated>
<author>
<name>Hans Petter Selasky</name>
<email>hselasky@FreeBSD.org</email>
</author>
<published>2014-06-28T03:56:17Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src-test2/commit/?id=af3b2549c4ba2ef00a7cbb4cb6836598bf0aefbe'/>
<id>urn:sha1:af3b2549c4ba2ef00a7cbb4cb6836598bf0aefbe</id>
<content type='text'>
</content>
</entry>
<entry>
<title>Revert r267961, r267973:</title>
<updated>2014-06-27T22:05:21Z</updated>
<author>
<name>Glen Barber</name>
<email>gjb@FreeBSD.org</email>
</author>
<published>2014-06-27T22:05:21Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src-test2/commit/?id=37a107a407cdb47ee0f4c4337e369e9973b34076'/>
<id>urn:sha1:37a107a407cdb47ee0f4c4337e369e9973b34076</id>
<content type='text'>
These changes prevent sysctl(8) from returning proper output,
such as:

 1) no output from sysctl(8)
 2) erroneously returning ENOMEM with tools like truss(1)
    or uname(1)
 truss: can not get etype: Cannot allocate memory
</content>
</entry>
<entry>
<title>Extend the meaning of the CTLFLAG_TUN flag to automatically check if</title>
<updated>2014-06-27T16:33:43Z</updated>
<author>
<name>Hans Petter Selasky</name>
<email>hselasky@FreeBSD.org</email>
</author>
<published>2014-06-27T16:33:43Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src-test2/commit/?id=3da1cf1e88f8448bb10c5f778ab56ff65c7a6938'/>
<id>urn:sha1:3da1cf1e88f8448bb10c5f778ab56ff65c7a6938</id>
<content type='text'>
there is an environment variable which shall initialize the SYSCTL
during early boot. This works for all SYSCTL types both statically and
dynamically created ones, except for the SYSCTL NODE type and SYSCTLs
which belong to VNETs. A new flag, CTLFLAG_NOFETCH, has been added to
be used in the case a tunable sysctl has a custom initialisation
function allowing the sysctl to still be marked as a tunable. The
kernel SYSCTL API is mostly the same, with a few exceptions for some
special operations like iterating childrens of a static/extern SYSCTL
node. This operation should probably be made into a factored out
common macro, hence some device drivers use this. The reason for
changing the SYSCTL API was the need for a SYSCTL parent OID pointer
and not only the SYSCTL parent OID list pointer in order to quickly
generate the sysctl path. The motivation behind this patch is to avoid
parameter loading cludges inside the OFED driver subsystem. Instead of
adding special code to the OFED driver subsystem to post-load tunables
into dynamically created sysctls, we generalize this in the kernel.

Other changes:
- Corrected a possibly incorrect sysctl name from "hw.cbb.intr_mask"
to "hw.pcic.intr_mask".
- Removed redundant TUNABLE statements throughout the kernel.
- Some minor code rewrites in connection to removing not needed
TUNABLE statements.
- Added a missing SYSCTL_DECL().
- Wrapped two very long lines.
- Avoid malloc()/free() inside sysctl string handling, in case it is
called to initialize a sysctl from a tunable, hence malloc()/free() is
not ready when sysctls from the sysctl dataset are registered.
- Bumped FreeBSD version to indicate SYSCTL API change.

MFC after:	2 weeks
Sponsored by:	Mellanox Technologies
</content>
</entry>
<entry>
<title>Resolve a deadlock setting the USB configuration index from userspace</title>
<updated>2014-06-08T20:10:29Z</updated>
<author>
<name>Hans Petter Selasky</name>
<email>hselasky@FreeBSD.org</email>
</author>
<published>2014-06-08T20:10:29Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src-test2/commit/?id=d64e9217c40746d8e4f8172457226b9abfe11be5'/>
<id>urn:sha1:d64e9217c40746d8e4f8172457226b9abfe11be5</id>
<content type='text'>
on USB HUBs by moving the code into the USB explore threads. The
deadlock happens because child devices of the USB HUB don't have the
expected reference count when called from outside the explore
thread. Only the HUB device itself, which the IOCTL interface locks,
gets the correct reference count.

MFC after:	3 days
</content>
</entry>
<entry>
<title>Try to resolve a possible deadlock when detaching USB devices which</title>
<updated>2014-03-20T13:53:24Z</updated>
<author>
<name>Hans Petter Selasky</name>
<email>hselasky@FreeBSD.org</email>
</author>
<published>2014-03-20T13:53:24Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src-test2/commit/?id=d008478e28f4465b491fc0e2aeeafe820661718b'/>
<id>urn:sha1:d008478e28f4465b491fc0e2aeeafe820661718b</id>
<content type='text'>
create character devices. The deadlock can happen if an application is
issuing IOCTLs which require USB refcounting, at the same time the USB
device is detaching.

There is already a counter in place in the USB device structure to
detect this situation, but it was not always checked ahead of invoking
functions that might destroy character devices, like detach, set
configuration, set alternate interface or detach active kernel driver.

Reported by:	Daniel O'Connor &lt;doconnor@gsoft.com.au&gt;
MFC after:	1 week
</content>
</entry>
</feed>
