public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jiri Slaby <jslaby@suse.cz>
To: gregkh@suse.de
Cc: alan@linux.intel.com, arnd@arndb.de,
	Linux kernel mailing list <linux-kernel@vger.kernel.org>
Subject: Re: patch "TTY: remove tty_locked" added to tty tree
Date: Tue, 23 Aug 2011 20:33:38 +0200	[thread overview]
Message-ID: <4E53F282.10908@suse.cz> (raw)
In-Reply-To: <13141210141189@kroah.org>

[-- Attachment #1: Type: text/plain, Size: 780 bytes --]

On 08/23/2011 07:36 PM, gregkh@suse.de wrote:
> diff --git a/include/linux/tty.h b/include/linux/tty.h
> index 44bc0c5..6d5eceb 100644
> --- a/include/linux/tty.h
> +++ b/include/linux/tty.h
> @@ -600,8 +600,6 @@ extern long vt_compat_ioctl(struct tty_struct *tty,
>  /* functions for preparation of BKL removal */
>  extern void __lockfunc tty_lock(void) __acquires(tty_lock);
>  extern void __lockfunc tty_unlock(void) __releases(tty_lock);
> -extern struct task_struct *__big_tty_mutex_owner;
> -#define tty_locked()		(current == __big_tty_mutex_owner)

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.

thanks,
-- 
js
suse labs

[-- Attachment #2: 0001-TTY-fix-stalls-on-BTM-when-waiting-until-sent.patch --]
[-- Type: text/x-patch, Size: 1375 bytes --]

>From a7c35daffe26129072aceb5d285924017820b56d Mon Sep 17 00:00:00 2001
From: Jiri Slaby <jslaby@suse.cz>
Date: Fri, 19 Aug 2011 22:16:51 +0200
Subject: [PATCH] TTY: fix stalls on BTM when waiting until sent

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Cc: Andreas Bombe <aeb@debian.org>
---
 drivers/tty/tty_ioctl.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/tty/tty_ioctl.c b/drivers/tty/tty_ioctl.c
index 53f2442..3837175 100644
--- a/drivers/tty/tty_ioctl.c
+++ b/drivers/tty/tty_ioctl.c
@@ -146,6 +146,7 @@ EXPORT_SYMBOL(tty_unthrottle);
 
 void tty_wait_until_sent(struct tty_struct *tty, long timeout)
 {
+	int retval;
 #ifdef TTY_DEBUG_WAIT_UNTIL_SENT
 	char buf[64];
 
@@ -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);
+	if (retval >= 0) {
 		if (tty->ops->wait_until_sent)
 			tty->ops->wait_until_sent(tty, timeout);
 	}
-- 
1.7.6


       reply	other threads:[~2011-08-23 18:33 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <13141210141189@kroah.org>
2011-08-23 18:33 ` Jiri Slaby [this message]
2011-08-23 18:46   ` patch "TTY: remove tty_locked" added to tty tree Arnd Bergmann
2011-08-23 18:54     ` Jiri Slaby
2011-08-24  8:46       ` Arnd Bergmann
2011-08-24  9:31         ` Jiri Slaby
2011-08-24 11:20           ` Arnd Bergmann
2011-08-24 11:47             ` Jiri Slaby
2011-08-24 14:35               ` Arnd Bergmann
2011-08-24 21:27                 ` Jiri Slaby
2011-08-24 21:42                   ` Greg KH
2011-08-24 21:48                     ` Jiri Slaby
2011-08-24 21:54                       ` Greg KH
2011-08-25 13:12                   ` [PATCH 1/5] TTY: serial, use ASYNCB_CLOSING in uart_close Jiri Slaby
2011-08-25 13:12                     ` [PATCH 2/5] TTY: serial, move locking " Jiri Slaby
2011-08-25 13:12                     ` [PATCH 3/5] TTY: define tty_wait_until_sent_from_close Jiri Slaby
2011-08-25 13:12                     ` [PATCH 4/5] TTY: use tty_wait_until_sent_from_close in tty_port_close_start Jiri Slaby
2011-08-25 13:12                     ` [PATCH 5/5] TTY: use tty_wait_until_sent_from_close in other drivers Jiri Slaby
2011-08-25 15:15                     ` [PATCH 1/5] TTY: serial, use ASYNCB_CLOSING in uart_close Arnd Bergmann
2011-08-24 15:53             ` patch "TTY: remove tty_locked" added to tty tree Alan Cox

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4E53F282.10908@suse.cz \
    --to=jslaby@suse.cz \
    --cc=alan@linux.intel.com \
    --cc=arnd@arndb.de \
    --cc=gregkh@suse.de \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox