Now
MAIN commitmail json YAML
ihidev(4): Fix locking and interrupt handler.
- Can't run iic_exec in softint because it does cv_wait, at least on
some i2c controllers -- defer to workqueue instead.
- Fix violations of locking rules:
. Do not take a lock at higher IPL than it is defined at!
. Do not sleep under a lock!
. Definitely do not sleep under a spin lock!
In this case, sc_intr_lock was defined at IPL_VM but used at IPL_TTY,
and i2c transactions -- possibly causing sleep for cv_wait -- were
issued under it.
But in this case, the interrupt handler needs only a single bit to
mark whether the work is pending, so just use atomic_swap for that.
- Use an adaptive lock (IPL_NONE) for i2c transactions.
- Detach children, and do so before freeing anything.
- Can't run iic_exec in softint because it does cv_wait, at least on
some i2c controllers -- defer to workqueue instead.
- Fix violations of locking rules:
. Do not take a lock at higher IPL than it is defined at!
. Do not sleep under a lock!
. Definitely do not sleep under a spin lock!
In this case, sc_intr_lock was defined at IPL_VM but used at IPL_TTY,
and i2c transactions -- possibly causing sleep for cv_wait -- were
issued under it.
But in this case, the interrupt handler needs only a single bit to
mark whether the work is pending, so just use atomic_swap for that.
- Use an adaptive lock (IPL_NONE) for i2c transactions.
- Detach children, and do so before freeing anything.