Page MenuHomeFreeBSD

hidbus: stop interrupts before finalizing child deactivation
Needs ReviewPublic

Authored by kevans on Sun, Jul 12, 7:48 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sat, Jul 18, 10:07 PM
Unknown Object (File)
Sat, Jul 18, 9:42 PM
Unknown Object (File)
Sat, Jul 18, 6:35 PM
Unknown Object (File)
Sat, Jul 18, 6:32 PM
Unknown Object (File)
Sat, Jul 18, 9:50 AM
Unknown Object (File)
Fri, Jul 17, 11:45 PM
Unknown Object (File)
Fri, Jul 17, 8:40 PM
Unknown Object (File)
Fri, Jul 17, 3:03 AM
Subscribers

Details

Reviewers
wulf
aokblast
Summary

In the case of usbhid, the parent will drain any transfers that are
pending, which could lead to just a little bit of data being plumbed
through. Stop interrupts *before* we mark the child as inactive so that
anything that was inflight makes it through.

This primarily helps a little with debugging, so that we can tell if
data was dropped as a result of hid_intr_stop().

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 74754
Build 71637: arc lint + arc unit

Event Timeline

sys/dev/hid/hidbus.c
639

I can't understand. If it is the last bit. We should clear the bit then do foreach check? Or it will never deactive?

sys/dev/hid/hidbus.c
639

Clearing the bit up-front means hidbus_intr won't drain any last minute response to the device driver thaat hid_intr_stop (doing a usbd_transfer_drain) triggers. The device driver will either be discarding them anyways (e.g., u2f(4), hidraw(4)) or it's harmless; in either case, it's useful for debugging to be able to observe the response at that level even if it wll be ignored.

sys/dev/hid/hidbus.c
639

Ok. I think you want to trigger the hidbus_intr in the last minutes and let the decision pass to the underlying driver. But would it actually work? ivar->actiave = false set after the active |= tlc->active, it measn active would never equals to 0 if we don't deactive twice in the same node.