HomeFreeBSD

evdev: Make open(2) and close(3) handlers sleepable.

Description

evdev: Make open(2) and close(3) handlers sleepable.

At the beginning of evdev there was a LOR between hardware driver's and
evdev client list locks as they were taken in different order at
driver's interrupt and evdev open()/close() handlers.

The LOR was fixed with introduction of evdev_register_mtx() function
which allowed to use a hardware driver's lock as evdev client list lock.
While this works good with PS/2 and USB, this does not work with I2C.
Unlike PS/2 and USB, I2C open()/close() handlers do unbound sleeps
while waiting for I2C bus to release and while performing IO.
This change uses epoch(9) for traversing evdev client list in interrupt
handler to avoid the LOR thus making possible to convert evdev client
list lock to sleepable sx.

While here add brief locking protocol description.

Reviewed by: markj
Differential revision: https://reviews.freebsd.org/D27865

Details

Provenance
wulfAuthored on Apr 21 2020, 10:26 AM
Reviewer
markj
Differential Revision
D27865: evdev: Make open(2) and close(3) handlers sleepable.
Parents
R10:5af73ad51b8c: evdev: Remove useless "initial value" parameter from evdev_support_abs()
Branches
Unknown
Tags
Unknown