summaryrefslogtreecommitdiff
path: root/include/linux/debug_locks.h
diff options
context:
space:
mode:
authorIan Abbott <abbotti@mev.co.uk>2025-12-05 16:13:32 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2026-01-16 18:33:08 +0300
commitd63cf1eea10c904c1b31b22ff3e118033ec7edfb (patch)
treed2adb9fbf16c2417db0dc0612badbc78dd382e34 /include/linux/debug_locks.h
parent45edeece5abe146b1188ef9af3cde0609997493b (diff)
downloadlinux-d63cf1eea10c904c1b31b22ff3e118033ec7edfb.tar.xz
comedi: don't use mutex for COMEDI_BUFINFO ioctl
The main mutex in a comedi device can get held for quite a while when processing comedi instructions, so for performance reasons, the "read", "write", and "poll" file operations do not use it; they use the `attach_lock` rwsemaphore to protect against the comedi device becoming detached at an inopportune moment. As an alternative to using the "read" and "write" operations, user-space can mmap the data buffer and use the `COMEDI_BUFINFO` ioctl to manage data transfer through the buffer. However, the "ioctl" file handler currently locks the main mutex for all ioctl commands. Make the handling of the `COMEDI_BUFINFO` an exception, using the `attach_lock` rwsemaphore during normal operation. However, before it calls `do_become_nonbusy()` at the end of acquisition, it does need to lock the main mutex, but it needs to unlock the `attach_lock` rwsemaphore first to avoid deadlock. After locking the main mutex, it needs to check that it is still in a suitable state to become non-busy, because things may have changed while unlocked. Signed-off-by: Ian Abbott <abbotti@mev.co.uk> Link: https://patch.msgid.link/20251205131332.16672-1-abbotti@mev.co.uk Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include/linux/debug_locks.h')
0 files changed, 0 insertions, 0 deletions