On Wed, Aug 16, 2023 at 11:50:15AM +0200, Oliver Neukum wrote: > On 15.08.23 03:02, Dan Drown wrote: > > Looks like it was put there to protect the iocount changes in the > > surrounding code. Are your concerns around performance or deadlocks? > > the lock is there for that and so that wait_serial_change() > will read consistent counts. > > The latter concerns me. We are calling potentially arbitrary code. That > you intend it for PPS doesn't change that we'll call it for > every line discipline that supports that callback. > Line disciplines are supposed to do something with tty devices, > aren't they? So what methods could they call in turn? > Something that can end in wait_serial_change()? Looking at the callers of tty_register_ldisc, the only one that passes in a dcd_change handler is the pps-ldisc. That's not to say that couldn't change in the future. I could move the call to dcd_change before the read lock is acquired, would that work for you?