public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Corey Minyard <minyard@acm.org>
To: Andi Kleen <ak@muc.de>
Cc: lkml <linux-kernel@vger.kernel.org>, akpm@osdl.org
Subject: Re: [PATCH] NMI/CMOS RTC race fix for x86-64
Date: Mon, 07 Mar 2005 17:33:19 -0600	[thread overview]
Message-ID: <422CE4BF.5090600@acm.org> (raw)
In-Reply-To: <20050307215300.GA36024@muc.de>

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

Patch is attached.  Thanks.

-Corey

Andi Kleen wrote:

>>>But in this case it isnt. Instead of all this complexity 
>>>just remove the NMI reassert code from the NMI handler.
>>>It is oudated and mostly useless on modern systems anyways.
>>>
>>>
>>>      
>>>
>>"mostly useless" and "completely useless" are two different things.
>>    
>>
>
>It's completely useless (double checked the AMD8111 and ICH5 data sheets)
>
>There is nothing that should ever clear the NMI bit in this register.
>In fact the ICH5 datasheet even explicitely says software should
>never touch this bit. 
>
>It may have some meaning in ancient ISA chipsets, but that is 
>of no concern on x86-64.
>
>  
>
>>Do you want me to submit a patch that simply removes this?
>>    
>>
>
>Yes, please.
>
>-Andi
>  
>


[-- Attachment #2: nmicmos_x86_64_race.diff --]
[-- Type: text/plain, Size: 1132 bytes --]

This patch fixes a race between the CMOS clock setting and the NMI
code.  The NMI code indiscriminatly sets index registers and values
in the same place the CMOS clock is set.  If you are setting the
CMOS clock and an NMI occurs, Bad values could be written to or
read from the CMOS RAM, or the NMI operation might not occur
correctly.

Resetting the NMI is not required on x86_64 (in fact, it should
not be done according to the ICH5 documentation).  This patch
simply removes the useless code.

Signed-off-by: Corey Minyard <minyard@acm.org>

Index: linux-2.6.11-mm1/arch/x86_64/kernel/traps.c
===================================================================
--- linux-2.6.11-mm1.orig/arch/x86_64/kernel/traps.c
+++ linux-2.6.11-mm1/arch/x86_64/kernel/traps.c
@@ -620,15 +620,6 @@
 		mem_parity_error(reason, regs);
 	if (reason & 0x40)
 		io_check_error(reason, regs);
-
-	/*
-	 * Reassert NMI in case it became active meanwhile
-	 * as it's edge-triggered.
-	 */
-	outb(0x8f, 0x70);
-	inb(0x71);		/* dummy */
-	outb(0x0f, 0x70);
-	inb(0x71);		/* dummy */
 }
 
 asmlinkage void do_int3(struct pt_regs * regs, long error_code)

      reply	other threads:[~2005-03-07 23:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-03-07 18:48 [PATCH] NMI/CMOS RTC race fix for x86-64 Corey Minyard
2005-03-07 19:08 ` Andi Kleen
2005-03-07 20:50   ` Corey Minyard
2005-03-07 21:53     ` Andi Kleen
2005-03-07 23:33       ` Corey Minyard [this message]

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=422CE4BF.5090600@acm.org \
    --to=minyard@acm.org \
    --cc=ak@muc.de \
    --cc=akpm@osdl.org \
    --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