public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Joe Peterson <joe@skyrush.com>
To: Elias Oltmanns <eo@nebensachen.de>
Cc: "Török Edwin" <edwintorok@gmail.com>,
	"Alan Cox" <alan@lxorguk.ukuu.org.uk>,
	"Linux Kernel" <linux-kernel@vger.kernel.org>
Subject: Re: Ctrl+C doesn't interrupt process waiting for I/O
Date: Fri, 04 Jul 2008 14:10:43 -0600	[thread overview]
Message-ID: <486E83C3.1040509@skyrush.com> (raw)
In-Reply-To: <87fxqurqpz.fsf@denkblock.local>

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

Elias Oltmanns wrote:
>> I have encountered the following situation several times, but I've been
>> unable to come up with a way to reproduce this until now:
>>  - some process is keeping the disk busy (some cron job for example:
>> updatedb, chkrootkit, ...)
>>  - other processes that want to do I/O have to wait (this is normal)
>>  - I have a (I/O bound) process running in my terminal, and I want to
>> interrupt it with Ctrl+C
>>  - I type Ctrl+C several times, and the process is not interrupted for
>> several seconds (10-30 secs)
>>  - if I type Ctrl+Z, and use kill %1 the process dies faster than
>> waiting for it to react to Ctrl+C
> 
> The following patch to 2.6.26-rc8 fixes the issue for me. Perhaps we
> really want to do something else, but since I'm not all that familiar
> with the standard behaviour on other Unices and since the comment
> describing the changed order of function calls in the original commit
> didn't give the reason for that change, I leave that to more
> knowledgeable people.

I have tried to reproduce the original poster's issue on
2.6.26-rc8-git3 without success.  In around 100 attempts (restarting the
disk activity process over each time it completed), it always broke out
after one ^C - one time took an extra second or two.  Note that I did
not run latencytop (did not have it compiled in my kernel) - if that is
required for the test, let me know, but I assume it is just for
gathering info when the issue occurs.

Can you please try something for me?  For one, apply the attached patch,
which removes what seems to be a redundant flush (since both calls end
up calling the same n_tty routine).  This made no difference for me, but
I am curious if it might help you.

If you still see the problem, please try typing "stty noflsh" and try
again.  This disables the flush step, which may be affecting you.
Again, this did not make a difference for me.

It will really help me to know the results of these steps for you.

As far as moving the flush after the signal, I have tried this (in the
patch I posted earlier), and it ends up causing various anomalies in
output, so I do not think that is the right solution.

						-Joe


[-- Attachment #2: gentoo-sources-2.6.26-remove-redundant-flush.patch --]
[-- Type: text/x-patch, Size: 627 bytes --]

--- linux/drivers/char/n_tty.c.orig	2008-07-04 09:45:37.000000000 -0600
+++ linux/drivers/char/n_tty.c	2008-07-04 11:25:38.000000000 -0600
@@ -589,10 +589,8 @@
 {
 	if (tty->pgrp)
 		kill_pgrp(tty->pgrp, sig, 1);
-	if (flush || !L_NOFLSH(tty)) {
+	if (flush || !L_NOFLSH(tty))
 		n_tty_flush_buffer(tty);
-		tty_driver_flush_buffer(tty);
-	}
 }
 
 /**
@@ -765,10 +763,8 @@
 			 * the order to be:
 			 * 1) flush, 2) echo, 3) signal
 			 */
-			if (!L_NOFLSH(tty)) {
+			if (!L_NOFLSH(tty))
 				n_tty_flush_buffer(tty);
-				tty_driver_flush_buffer(tty);
-			}
 			if (L_ECHO(tty))
 				echo_char(c, tty);
 			if (tty->pgrp)


  parent reply	other threads:[~2008-07-04 20:10 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-28 10:38 Ctrl+C doesn't interrupt process waiting for I/O Török Edwin
2008-06-29  2:44 ` Jeremy Fitzhardinge
2008-06-29  2:45   ` Jeremy Fitzhardinge
2008-06-29  3:42   ` Avi Kivity
2008-06-29  5:13     ` Jeremy Fitzhardinge
2008-06-29  5:39       ` Avi Kivity
2008-06-29  6:25         ` Jeremy Fitzhardinge
2008-06-29  7:45           ` Török Edwin
2008-06-29 23:57           ` Bill Davidsen
2008-06-29 12:37         ` Alan Cox
2008-06-30 17:35       ` J. Bruce Fields
2008-06-29  7:09   ` Török Edwin
2008-06-29  7:23   ` David Newall
2008-06-29 12:10   ` Andi Kleen
2008-06-29 16:02     ` Jeremy Fitzhardinge
2008-06-30 10:30       ` Helge Hafting
2008-07-01  7:47 ` Elias Oltmanns
2008-07-01  8:02   ` Elias Oltmanns
2008-07-01  8:28     ` Török Edwin
2008-07-01  9:59       ` Elias Oltmanns
2008-07-01 12:07       ` Joe Peterson
2008-07-01  8:50   ` David Newall
2008-07-01  9:01     ` Török Edwin
2008-07-01  9:12       ` David Newall
2008-07-01 14:12   ` Joe Peterson
2008-07-01 14:48     ` Elias Oltmanns
2008-07-01 16:27       ` Joe Peterson
2008-07-02 21:26   ` Joe Peterson
2008-07-04 20:10   ` Joe Peterson [this message]
2008-07-04 20:23     ` Alan Cox
2008-07-04 21:17       ` Joe Peterson
2008-07-11 14:47         ` Alan Cox
2008-07-12  0:44           ` Joe Peterson
2008-07-12 10:37             ` Alan Cox
2008-07-04 21:21       ` Andi Kleen
2008-07-04 21:14         ` Alan Cox
2008-07-04 21:36           ` Andi Kleen
2008-07-04 21:44             ` Alan Cox
2008-07-04 22:09               ` Andi Kleen
2008-07-05 10:34                 ` Alan Cox
2008-07-05 11:00                   ` Andi Kleen
2008-07-05 11:34                     ` Alan Cox
2008-07-05 12:49                     ` Elias Oltmanns
2008-07-05 14:01                       ` Andi Kleen
2008-07-05 19:58                       ` Joe Peterson
2008-07-06  8:28                         ` Elias Oltmanns
  -- strict thread matches above, loose matches on Subject: below --
2008-07-03  0:59 Matthew Wilcox

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=486E83C3.1040509@skyrush.com \
    --to=joe@skyrush.com \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=edwintorok@gmail.com \
    --cc=eo@nebensachen.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