linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Paul Fulghum <paulkf@microgate.com>
To: Olaf Hering <olh@suse.de>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] new tty buffering locking fix
Date: Tue, 07 Feb 2006 10:21:42 -0600	[thread overview]
Message-ID: <1139329302.3019.14.camel@amdx2.microgate.com> (raw)
In-Reply-To: <20060207123450.GA854@suse.de>

On Tue, 2006-02-07 at 13:34 +0100, Olaf Hering wrote:
> > [PATCH] new tty buffering locking fix

> This patch breaks the hvc console, no input is accepted, even with
> init=/bin/sash? Any idea what this driver needs to do now?
> I wonder if it worked ok on -mm.

I think this is happening:

1. hvc calls tty_buffer_request_room, claiming a
   tty buffer for use by the driver

2. hvc adds data to the tty buffer

3. hvc calls tty_schedule_flip or tty_flip_buffer_push,
   which releases the buffer for processing

4. *before* the buffer can be processed, hvc again calls
   tty_buffer_request_room, reclaiming the same buffer
   which still has free room

5. hvc does not have more data to input, so it does
   not call tty_schedule_flip or tty_flip_buffer_push

Now the tty buffer contains some data but can't be processed
because it is still marked as in use by the driver.

Try the below patches (for testing only, I'm not suggesting
these as a final fix yet) and let me know if it fixes it.

Thanks,
Paul


--- linux-2.6.16-rc2/drivers/char/hvc_console.c	2006-02-06 13:50:39.000000000 -0600
+++ b/drivers/char/hvc_console.c	2006-02-07 10:10:18.000000000 -0600
@@ -613,6 +613,7 @@ static int hvc_poll(struct hvc_struct *h
 				tty_hangup(tty);
 				spin_lock_irqsave(&hp->lock, flags);
 			}
+			tty_schedule_flip(tty);
 			break;
 		}
 		for (i = 0; i < n; ++i) {
@@ -633,8 +634,7 @@ static int hvc_poll(struct hvc_struct *h
 			tty_insert_flip_char(tty, buf[i], 0);
 		}
 
-		if (count)
-			tty_schedule_flip(tty);
+		tty_schedule_flip(tty);
 
 		/*
 		 * Account for the total amount read in one loop, and if above
--- linux-2.6.16-rc2/drivers/char/hvcs.c	2006-02-06 13:50:39.000000000 -0600
+++ b/drivers/char/hvcs.c	2006-02-07 10:09:57.000000000 -0600
@@ -469,8 +469,7 @@ static int hvcs_io(struct hvcs_struct *h
 
 	spin_unlock_irqrestore(&hvcsd->lock, flags);
 	/* This is synch because tty->low_latency == 1 */
-	if(got)
-		tty_flip_buffer_push(tty);
+	tty_flip_buffer_push(tty);
 
 	if (!got) {
 		/* Do this _after_ the flip_buffer_push */



  reply	other threads:[~2006-02-07 16:21 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <200602032312.k13NCbWb012991@hera.kernel.org>
2006-02-07 12:34 ` [PATCH] new tty buffering locking fix Olaf Hering
2006-02-07 16:21   ` Paul Fulghum [this message]
2006-02-07 17:11     ` Olaf Hering
2006-02-07 18:47       ` Paul Fulghum
2006-02-07 21:27       ` Paul Fulghum
2006-02-08  1:14         ` Alan Cox
2006-02-08  2:41           ` Paul Fulghum
2006-02-08  2:56             ` Paul Fulghum
2006-02-08 22:05           ` Paul Fulghum
2006-02-08 22:39             ` Olaf Hering
2006-01-26 20:33 Paul Fulghum

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=1139329302.3019.14.camel@amdx2.microgate.com \
    --to=paulkf@microgate.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=olh@suse.de \
    /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;
as well as URLs for NNTP newsgroup(s).