Page MenuHomeFreeBSD

Various book-keeping cleanup changes for newbus locking
AbandonedPublic

Authored by imp on Jan 27 2020, 11:37 PM.
Tags
None
Referenced Files
Unknown Object (File)
Jan 12 2024, 12:59 AM
Unknown Object (File)
Dec 27 2023, 11:28 PM
Unknown Object (File)
Oct 24 2023, 9:34 AM
Unknown Object (File)
Oct 12 2023, 12:53 AM
Unknown Object (File)
Jul 13 2023, 4:05 AM
Unknown Object (File)
May 19 2023, 5:44 AM
Unknown Object (File)
Jan 18 2023, 1:03 AM

Details

Reviewers
scottl
shurd
jhb
Group Reviewers
iflib
Summary

These changes are mosly to make actual locking better, except the
device_busy/unbusy which is real change (there's 3 changes here that are
separate in my git tree, but mixed together for this preview-review)

Make device_busy/unbusy work w/o Giant held

The vast majority of the busy/unbusy users in the tree don't acquire Giant
before calling device_busy/unbusy. However, if multiple threads are opening a
file, say, that causes the device to busy/unbusy, then we can race to the root
marking things busy. Create a new device_busy_locked and device_unbusy_locked
that are the current implemntations of device_busy and device_unbusy. Make
device_busy and unbusy acquire Giant before calling the _locked versrions. Since
we never sleep in the busy/unbusy path, Giant's single threaded semantics
suffice to keep this safe.

Push Giant lock down inside of mii_attach

Several drivers do a deferred attach of the mii bus and takeout and drop Giant
to do that. This is undesirable, so push the giant use down into mii where we
can more easily change it.

Diff Detail

Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 28961
Build 26943: arc lint + arc unit

Event Timeline

sys/compat/linuxkpi/common/src/linux_usb.c
1184–1188

this looks odd... both the original code and my changes.

I think device_tree_lock() and device_tree_unlock() are better names than newbus_xxx().

sys/dev/usb/net/if_axe.c
907

These changes look good!

This has been committed in part, and the rest needs more thought. Closing