mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@osdl.org>
To: Dave Jones <davej@redhat.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: tickle nmi watchdog whilst doing serial writes.
Date: Sat, 14 May 2005 00:07:23 -0700	[thread overview]
Message-ID: <20050514000723.73bd6e5a.akpm@osdl.org> (raw)
In-Reply-To: <20050514065753.GA28213@redhat.com>

Dave Jones <davej@redhat.com> wrote:
>
> On Fri, May 13, 2005 at 11:43:31PM -0700, Andrew Morton wrote:
>  > Dave Jones <davej@redhat.com> wrote:
>  > >
>  > > This was fun. I inserted a music CD with some obnoxious copy-protection
>  > >  on it into the drive, and lots of SCSI errors went zipping over to
>  > >  the serial console. Unfortunatly, the box was also compiling a kernel,
>  > >  playing oggs, and doing a number of other things at the same time,
>  > >  so this happened..
>  > > 
>  > >  NMI Watchdog detected LOCKUP on CPU2CPU 2
>  > 
>  > OK..  But calling touch_nmi_watchdog() at 1MHz seems a bit excessive, and
>  > might perturb the finely-tuned timing in there.
>  > 
>  > How's about this?
> 
> Umm..  Despite it being past my bedtime, I'm pretty sure I'm
> missing something here...
> 
>  > +		while (!(serial_in(up, UART_MSR) & UART_MSR_CTS) && --tmout)
>  >  			udelay(1);
> 
> I don't see how this is any better than the current code.
> We're doing 1000000 udelays. Whilst we're doing that,
> the nmi watchdog goes bonkers.
>  
>  > +		if (tmout < 1000000)
>  > +			touch_nmi_watchdog();
> 
> So by the time we do this, its already triggered.

But the NMI watchdog won't expire after one second - normally it's set to
fixe seconds.

> How about..
> 
> --- linux-2.6.11/drivers/serial/8250.c~	2005-05-14 02:49:02.000000000 -0400
> +++ linux-2.6.11/drivers/serial/8250.c	2005-05-14 02:54:30.000000000 -0400
> @@ -40,6 +40,7 @@
>  #include <linux/serial_core.h>
>  #include <linux/serial.h>
>  #include <linux/serial_8250.h>
> +#include <linux/nmi.h>
>  
>  #include <asm/io.h>
>  #include <asm/irq.h>
> @@ -2099,8 +2100,15 @@ static inline void wait_for_xmitr(struct
>  	if (up->port.flags & UPF_CONS_FLOW) {
>  		tmout = 1000000;
>  		while (--tmout &&
> -		       ((serial_in(up, UART_MSR) & UART_MSR_CTS) == 0))
> +		       ((serial_in(up, UART_MSR) & UART_MSR_CTS) == 0)) {
> +			int cnt=0;
>  			udelay(1);
> +			cnt++;
> +			if (cnt==100) {
> +				touch_nmi_watchdog();
> +				cnt=0;
> +			}
> +		}

<obwhitespacewhine> spose so.

--- 25/drivers/serial/8250.c~tickle-nmi-watchdog-whilst-doing-serial-writes	2005-05-14 00:03:09.000000000 -0700
+++ 25-akpm/drivers/serial/8250.c	2005-05-14 00:06:53.000000000 -0700
@@ -40,6 +40,7 @@
 #include <linux/serial_core.h>
 #include <linux/serial.h>
 #include <linux/serial_8250.h>
+#include <linux/nmi.h>
 
 #include <asm/io.h>
 #include <asm/irq.h>
@@ -2098,9 +2099,11 @@ static inline void wait_for_xmitr(struct
 	/* Wait up to 1s for flow control if necessary */
 	if (up->port.flags & UPF_CONS_FLOW) {
 		tmout = 1000000;
-		while (--tmout &&
-		       ((serial_in(up, UART_MSR) & UART_MSR_CTS) == 0))
+		while (!(serial_in(up, UART_MSR) & UART_MSR_CTS) && --tmout) {
 			udelay(1);
+			if ((tmout % 1000) == 0)
+				touch_nmi_watchdog();
+		}
 	}
 }
 
_


  reply	other threads:[~2005-05-14  7:08 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-05-13 18:48 Dave Jones
2005-05-13 19:14 ` Arjan van de Ven
2005-05-13 19:23   ` Dave Jones
2005-05-13 19:37   ` Russell King
2005-05-14  6:43 ` Andrew Morton
2005-05-14  6:57   ` Dave Jones
2005-05-14  7:07     ` Andrew Morton [this message]
2005-05-14 10:31       ` Ed Tomlinson
2005-05-14 10:53         ` Alexander Nyberg
2005-05-15 11:40           ` Andi Kleen
2005-05-14 10:53         ` Ed Tomlinson
2005-05-15 11:38 ` Andi Kleen
2005-05-15 12:07   ` Russell King
2005-05-15 12:20     ` Andi Kleen
2005-05-15 14:01       ` Russell King
2005-05-15 14:03         ` Andi Kleen
2005-05-19  0:24       ` George Anzinger
2005-05-19  7:33         ` Russell King
2005-05-23 20:20           ` Bill Davidsen

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=20050514000723.73bd6e5a.akpm@osdl.org \
    --to=akpm@osdl.org \
    --cc=davej@redhat.com \
    --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

all inboxes | Powered by JetHome®