Re: patch "TTY: remove tty_locked" added to tty tree

From: Arnd Bergmann
Date: Tue Aug 23 2011 - 14:47:18 EST


On Tuesday 23 August 2011 20:33:38 Jiri Slaby wrote:

> It looks like I need tty_locked to fix system stalls in
> tty_wait_until_sent in the end. Like with the patch attached. But if
> someone finds another way to fix this in short-term, it would be great.
>
>
> @@ -153,8 +154,14 @@ void tty_wait_until_sent(struct tty_struct *tty, long timeout)
> #endif
> if (!timeout)
> timeout = MAX_SCHEDULE_TIMEOUT;
> - if (wait_event_interruptible_timeout(tty->write_wait,
> - !tty_chars_in_buffer(tty), timeout) >= 0) {
> +
> + if (tty_locked()) /* e.g. uart (holds) vs. tty_ioctl (does not) */
> + retval = wait_event_interruptible_timeout_tty(tty->write_wait,
> + !tty_chars_in_buffer(tty), timeout);
> + else
> + retval = wait_event_interruptible_timeout(tty->write_wait,
> + !tty_chars_in_buffer(tty), timeout);
>
>

According to http://kernelnewbies.org/BigKernelLock, I concluded back then
that tty_wait_until_sent would always be called without BTM held. Has that
changed recently, or did I miss a caller that holds the BTM?

The only caller that used to call it with BKL was tty_set_ldisc, and that
got changed to release the BTM before calling it. If there is another
caller, can it do the same?

Arnd
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/