All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: Aaron Durbin <adurbin@google.com>
Cc: linux-kernel@vger.kernel.org, ak@suse.de, Robin Holt <holt@sgi.com>
Subject: Re: [PATCH] x86_64: Avoid NMI Watchdog and/or long wait in setup_APIC_timer
Date: Thu, 9 Aug 2007 13:30:11 -0700	[thread overview]
Message-ID: <20070809133011.2d03c04a.akpm@linux-foundation.org> (raw)
In-Reply-To: <20070808231719.GA7101@google.com>

On Wed, 8 Aug 2007 16:17:19 -0700
Aaron Durbin <adurbin@google.com> wrote:

> In setup_APIC_timer with the HPET in use, a condition can arise while
> waiting for the next irq slice to expire on the HPET which will either
> cause an NMI watchdog to fire or a 3 minute busy loop if the NMI
> watchdog is disabled.
> 
> The HPET comparator and the counter keep incrementing during its normal
> operation. When a comparison event fires the comparator will increment
> by the designated period. If the HPET trigger occurs right after
> the 'int trigger = hpet_readl(HPET_T0_CMP);' line, we will will spin
> for up to 3 minutes (with a clock of 25MHz) waiting for the HPET
> counter to wrap around. However, when the NMI watchdog is enabled the
> NMI watchdog will detect a lockup and reboot the machine. This
> scenario can be exasperated by the presence of an SMI which will
> increase the window of opportunity for the condition to occur.
> 
> The fix is to wait for the compartor to change which signals the
> end of the tick slice.
> 
> ---
> 
> The last patch had a typo in the diff which really would cause the
> problem state above. Sorry.
> 
> diff --git a/arch/x86_64/kernel/apic.c b/arch/x86_64/kernel/apic.c
> index 900ff38..06797e2 100644
> --- a/arch/x86_64/kernel/apic.c
> +++ b/arch/x86_64/kernel/apic.c
> @@ -791,10 +791,12 @@ static void setup_APIC_timer(unsigned in
>  
>  	/* wait for irq slice */
>  	if (hpet_address && hpet_use_timer) {
> +		/*
> +		 * Wait for the comparator value to change which signals that
> +		 * the tick slice has expired.
> +		 */
>  		int trigger = hpet_readl(HPET_T0_CMP);
> -		while (hpet_readl(HPET_COUNTER) >= trigger)
> -			/* do nothing */ ;
> -		while (hpet_readl(HPET_COUNTER) <  trigger)
> +		while (trigger == hpet_readl(HPET_T0_CMP))
>  			/* do nothing */ ;
>  	} else {
>  		int c1, c2;

but, but.  Didn't this get fixed by
ftp://ftp.kernel.org/pub/linux/kernel/people/akpm/patches/2.6/2.6.23-rc2/2.6.23-rc2-mm1/broken-out/fix-hpet-init-race.patch
?

  parent reply	other threads:[~2007-08-09 20:31 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-08 23:17 [PATCH] x86_64: Avoid NMI Watchdog and/or long wait in setup_APIC_timer Aaron Durbin
2007-08-09  0:26 ` Andi Kleen
2007-08-09  0:44   ` Aaron Durbin
2007-08-09  0:50     ` Andi Kleen
2007-08-09 20:30 ` Andrew Morton [this message]
2007-08-09 21:16   ` Aaron Durbin
2007-08-09 21:56     ` Andrew Morton
  -- strict thread matches above, loose matches on Subject: below --
2007-08-09  3:45 Aaron Durbin
2007-08-08 23:08 Aaron Durbin

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=20070809133011.2d03c04a.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=adurbin@google.com \
    --cc=ak@suse.de \
    --cc=holt@sgi.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.