--- - branch: MAIN date: Fri Jan 14 22:25:49 UTC 2022 files: - new: '1.21' old: '1.20' path: src/sys/dev/i2c/ihidev.c pathrev: src/sys/dev/i2c/ihidev.c@1.21 type: modified - new: '1.6' old: '1.5' path: src/sys/dev/i2c/ihidev.h pathrev: src/sys/dev/i2c/ihidev.h@1.6 type: modified id: 20220114T222549Z.74bf18f9110c9a3fcc42a60187aacd36b0a01061 log: | 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. module: src subject: 'CVS commit: src/sys/dev/i2c' unixtime: '1642199149' user: riastradh