From: Jiri Slaby <jslaby@suse.cz>
To: Tony Luck <tony.luck@intel.com>
Cc: gregkh@suse.de, linux-kernel@vger.kernel.org,
jirislaby@gmail.com, Dave Young <hidave.darkstar@gmail.com>,
Dave Jones <davej@redhat.com>,
Ben Hutchings <ben@decadent.org.uk>,
Dmitriy Matrosov <sgf.dma@gmail.com>,
Alan Cox <alan@lxorguk.ukuu.org.uk>, stable <stable@kernel.org>
Subject: Re: [PATCH 2/5] TTY: ldisc, move wait idle to caller
Date: Fri, 02 Dec 2011 09:21:12 +0100 [thread overview]
Message-ID: <4ED88A78.8010706@suse.cz> (raw)
In-Reply-To: <CA+8MBbJ4Tu86jSbaBRjDKfowwVE12jY3efK7QMm74e7i8aq4Hg@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 853 bytes --]
On 12/02/2011 12:01 AM, Tony Luck wrote:
> One of my systems (HP rx2620 - ia64) has started hanging during shutdown.
> Last messages on the serial console are:
>
> Shutting down service (localfs) network . . . . . . . . . done
> Shutting down D-Bus daemon done
> Running /etc/ini
>
> and there it hangs forever in mid word (totally repeatable stops at "ini" every
> time).
>
> git bisect blames:
>
> commit 300420722e0734a4254f3b634e0f82664495d210
> Author: Jiri Slaby <jslaby@suse.cz>
> Date: Wed Nov 16 16:27:08 2011 +0100
>
> TTY: ldisc, move wait idle to caller
>
> [Though the following commit "TTY: ldisc, wait for ldisc infinitely in hangup"
> sounds like it fits the symptoms]
>
> Ideas?
Thanks. What distro and init do you use? Does the attached patch help?
--
js
suse labs
[-- Attachment #2: 0001-TTY-ldisc-don-t-wait-with-ldisc_mutex.patch --]
[-- Type: text/x-patch, Size: 1954 bytes --]
>From 6f778e80388f8b1ad65f0c8bfbc874704d77b3eb Mon Sep 17 00:00:00 2001
From: Jiri Slaby <jslaby@suse.cz>
Date: Fri, 2 Dec 2011 09:19:05 +0100
Subject: [PATCH 1/1] TTY: ldisc, don't wait with ldisc_mutex
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
drivers/tty/tty_ldisc.c | 16 +++++++++++++---
1 files changed, 13 insertions(+), 3 deletions(-)
diff --git a/drivers/tty/tty_ldisc.c b/drivers/tty/tty_ldisc.c
index 24b95db..c93e113 100644
--- a/drivers/tty/tty_ldisc.c
+++ b/drivers/tty/tty_ldisc.c
@@ -527,6 +527,14 @@ static void tty_ldisc_flush_works(struct tty_struct *tty)
flush_work_sync(&tty->buf.work);
}
+static bool tty_ldisc_is_idle(struct tty_struct *tty)
+{
+ bool idle;
+ mutex_lock(&tty->ldisc_mutex);
+ idle = !tty->ldisc || atomic_read(&tty->ldisc->users) == 1;
+ mutex_unlock(&tty->ldisc_mutex);
+ return idle;
+}
/**
* tty_ldisc_wait_idle - wait for the ldisc to become idle
* @tty: tty to wait for
@@ -534,12 +542,14 @@ static void tty_ldisc_flush_works(struct tty_struct *tty)
*
* Wait for the line discipline to become idle. The discipline must
* have been halted for this to guarantee it remains idle.
+ *
+ * Locking: neither BTM, nor tty->ldisc_mutex must be held
*/
static int tty_ldisc_wait_idle(struct tty_struct *tty, long timeout)
{
long ret;
- ret = wait_event_timeout(tty_ldisc_idle,
- atomic_read(&tty->ldisc->users) == 1, timeout);
+ ret = wait_event_timeout(tty_ldisc_idle, tty_ldisc_is_idle(tty),
+ timeout);
return ret > 0 ? 0 : -EBUSY;
}
@@ -830,6 +840,7 @@ retry:
if (atomic_read(&tty->ldisc->users) != 1) {
char cur_n[TASK_COMM_LEN], tty_n[64];
long timeout = 3 * HZ;
+ mutex_unlock(&tty->ldisc_mutex);
tty_unlock();
while (tty_ldisc_wait_idle(tty, timeout) == -EBUSY) {
@@ -839,7 +850,6 @@ retry:
__func__, get_task_comm(cur_n, current),
tty_name(tty, tty_n));
}
- mutex_unlock(&tty->ldisc_mutex);
goto retry;
}
--
1.7.7.3
next prev parent reply other threads:[~2011-12-02 8:21 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-11-16 15:27 [PATCH 1/5] TTY: ldisc, allow waiting for ldisc arbitrarily long Jiri Slaby
2011-11-16 15:27 ` [PATCH 2/5] TTY: ldisc, move wait idle to caller Jiri Slaby
2011-12-01 23:01 ` Tony Luck
2011-12-02 0:40 ` Tony Luck
2011-12-02 8:21 ` Jiri Slaby [this message]
2011-12-02 18:24 ` Tony Luck
2011-11-16 15:27 ` [PATCH 3/5] TTY: ldisc, wait for ldisc infinitely in hangup Jiri Slaby
2011-11-16 15:27 ` [PATCH 4/5] TTY: ldisc, remove some unneeded includes Jiri Slaby
2011-11-16 15:27 ` [PATCH 5/5] TTY: pty, cleanup the pty counting Jiri Slaby
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=4ED88A78.8010706@suse.cz \
--to=jslaby@suse.cz \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=ben@decadent.org.uk \
--cc=davej@redhat.com \
--cc=gregkh@suse.de \
--cc=hidave.darkstar@gmail.com \
--cc=jirislaby@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=sgf.dma@gmail.com \
--cc=stable@kernel.org \
--cc=tony.luck@intel.com \
/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
Powered by JetHome