> But flush_to_ldisc() itself has a real oddity: it uses "tty->buf.lock" to > protect everything, BUT NOT THE ACTUAL CALL TO ->receive_buf()! Indeed or it deadlocks > Anyway, the above explanation "feels right". It would easily explain the > behavior, because if the ->receive_buf() calls get re-ordered, then the > events get re-ordered, and one simple case of that would be to see the key > "release" event before the key "press" event. And you would only see it in X11 because only X11 deals in raw key events. > The sane fix would be to just run ->receive_buf() under the tty->buf.lock, > but I assume we'd have a lot of unhappy ldiscs if we did that (and > possibly irq latency problems too). You bet However there is nothing stopping you stuffing that lot into a per tty mutex solely used for serializing those submissions. It can't really be a mutex for anything else as we call back into the ldisc to send stuff. You aren't allowed to stuff data into the ldisc unless it can sleep so a mutex is fine. I can't help feeling a mutex might be simpler. It would also then fix tiocsti() which is most definitely broken right now and documented as racing. Alan -- To unsubscribe from this list: send the line "unsubscribe kernel-testers" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html