linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Rene Herman <rene.herman@keyaccess.nl>
To: Robert Hancock <hancockr@shaw.ca>
Cc: "David P. Reed" <dpreed@reed.com>,
	linux-kernel@vger.kernel.org,
	Thomas Gleixner <tglx@linutronix.de>,
	Ingo Molnar <mingo@redhat.com>, "H. Peter Anvin" <hpa@zytor.com>
Subject: Re: RFC: outb 0x80 in inb_p, outb_p harmful on some modern AMD64 with MCP51 laptops
Date: Fri, 07 Dec 2007 06:09:24 +0100	[thread overview]
Message-ID: <4758D584.90105@keyaccess.nl> (raw)
In-Reply-To: <4758927F.50500@shaw.ca>

On 07-12-07 01:23, Robert Hancock wrote:

> David P. Reed wrote:
>> After much, much testing (months, off and on, pursuing hypotheses), 
>> I've discovered that the use of "outb al,0x80" instructions to "delay" 
>> after inb and outb instructions causes solid freezes on my HP dv9000z 
>> laptop, when ACPI is enabled.
>>
>> It takes a fair number of out's to 0x80, but the hard freeze is 
>> reliably reproducible by writing a driver that solely does a loop of 
>> 50 outb's to 0x80 and calling it in a loop 1000 times from user 
>> space.  !!!
>>
>> The serious impact is that the /dev/rtc and /dev/nvram devices are 
>> very unreliable - thus "hwclock" freezes very reliably while looping 
>> waiting for a new second value and calling "cat /dev/nvram" in a loop 
>> freezes the machine if done a few times in a row.
>>
>> This is reproducible, but requires a fair number of outb's to the 0x80 
>> diagnostic port, and seems to require ACPI to be on.
>>
>> io_64.h is the source of these particular instructions, via the 
>> CMOS_READ and CMOS_WRITE macros, which are defined in mc146818_64.h.  
>> (I wonder if the same problem occurs in 32-bit mode).
>>
>> I'm happy to complete and test a patch, but I'm curious what the right 
>> approach ought to be.  I have to say I have no clue as to what ACPI is 
>> doing on this chipset  (nvidia MCP51) that would make port 80 do 
>> this.  A raw random guess is that something is logging POST codes, but 
>> if so, not clear what is problematic in ACPI mode.
>>
>> ANy help/suggestions?
>>
>> Changing the delay instruction sequence from the outb to short jumps 
>> might be the safe thing.  But Linus, et al. may have experience with 
>> that on other architectures like older Pentiums etc.
> 
> The fact that these "pausing" calls are needed in the first place seems 
> rather cheesy. If there's hardware that's unable to respond to IO port 
> writes as fast as possible, then surely there's a better solution than 
> trying to stall the IOs by an arbitrary and hardware-dependent amount of 
> time, like udelay calls, etc. Does any remotely recent hardware even 
> need this?

The idea is that the delay is not in fact hardware dependent. With in the 
the absense of a POST board port 0x80 being sort of guaranteeed to not be 
decoded on PCI but forwarded to and left to die on ISA/LPC one should get 
the effect that the _next_ write will have survived an ISA/LPC bus address 
cycle acknowledgement timeout.

I believe.

And no, I don't believe any remotely recent hardware needs it and have in 
fact wondered about it since actual 386 days, having since that time never 
found a device that wouldn't in fact take back to back I/O even. Even back 
then (ie, legacy only systems, no forwarding from PCI or anything) BIOSes 
provided ISA bus wait-state settings which should be involved in getting 
insanely stupid and old hardware to behave...

Port 0xed has been suggested as an alternate port. Probably not a great 
"fix" but if replacing the out with a simple udelay() isn't that simple 
(during early boot I gather) then it might at least be something for you to 
try. I'd hope that the 0x80 in include/asm/io.h:native_io_delay() would be 
the only one you are running into, so you could change that to 0xed and see 
what catches fire.

If there are no sensible fixes, an 0x80/0xed choice could I assume be hung 
of DMI or something (if that _is_ parsed soon enough).

Rene.

  reply	other threads:[~2007-12-07  5:10 UTC|newest]

Thread overview: 109+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <fa./27SNSh+L5T3iqFNPdHClEu+yT0@ifi.uio.no>
2007-12-07  0:23 ` RFC: outb 0x80 in inb_p, outb_p harmful on some modern AMD64 with MCP51 laptops Robert Hancock
2007-12-07  5:09   ` Rene Herman [this message]
2007-12-07  5:54     ` David P. Reed
2007-12-07  7:17       ` Rene Herman
2007-12-07  7:34         ` Rene Herman
2007-12-07 10:49     ` Andi Kleen
2007-12-06 22:38 David P. Reed
2007-12-07  0:15 ` Alan Cox
2007-12-07 10:44 ` Andi Kleen
2007-12-07 14:50   ` David P. Reed
2007-12-05 11:10     ` Pavel Machek
2007-12-08  0:21       ` Andi Kleen
2007-12-07 14:54     ` Andi Kleen
2007-12-07 15:43       ` Rene Herman
2007-12-07 16:28         ` Rene Herman
2007-12-11  0:31           ` H. Peter Anvin
2007-12-11  5:53       ` H. Peter Anvin
2007-12-07 16:04   ` Alan Cox
2007-12-07 16:31     ` Andi Kleen
2007-12-07 17:19       ` Alan Cox
2007-12-07 18:45         ` Rene Herman
2007-12-07 18:42           ` Alan Cox
2007-12-07 19:25             ` Rene Herman
2007-12-07 21:45               ` Alan Cox
2007-12-08 19:25     ` David P. Reed
2007-12-08 19:50       ` Andi Kleen
2007-12-08 20:47         ` David P. Reed
2007-12-08 21:04           ` Alan Cox
2007-12-08 20:26       ` Alan Cox
2007-12-11  5:58         ` H. Peter Anvin
2007-12-09  5:04       ` Rene Herman
2007-12-09 13:22       ` Pavel Machek
2007-12-11 15:14       ` Lennart Sorensen
2007-12-09 12:54     ` Pavel Machek
2007-12-09 13:41       ` Dr. David Alan Gilbert
2007-12-09 15:54       ` Ondrej Zary
2007-12-09 16:59       ` Andi Kleen
2007-12-09 21:25         ` Pavel Machek
2007-12-09 22:29           ` Alan Cox
2007-12-09 23:22             ` Pavel Machek
2007-12-10 12:02               ` Alan Cox
2007-12-10  4:17           ` Rene Herman
2007-12-10 11:30             ` Krzysztof Halasa
2007-12-10 12:08               ` Rene Herman
2007-12-10 18:02               ` Ondrej Zary
2007-12-11  1:10               ` David Newall
2007-12-11  1:25                 ` H. Peter Anvin
2007-12-11  1:42                   ` David Newall
2007-12-11  1:46                     ` H. Peter Anvin
2007-12-11  1:51                     ` H. Peter Anvin
2007-12-11  7:40                     ` Paul Rolland
2007-12-11  9:50                       ` Rene Herman
2007-12-11 12:08                         ` David Newall
2007-12-11 13:16                           ` Rene Herman
2007-12-11 13:32                             ` Paul Rolland
2007-12-11 14:15                               ` Rene Herman
2007-12-11 15:28                                 ` Rene Herman
2007-12-11 15:37                                   ` Paul Rolland
2007-12-11 15:53                                     ` Rene Herman
2007-12-11 16:58                                       ` David P. Reed
2007-12-11 17:01                                         ` Rene Herman
2007-12-11 17:05                                         ` H. Peter Anvin
2007-12-11 17:32                                         ` Alan Cox
2007-12-11 19:19                                           ` David P. Reed
2007-12-11 19:36                                             ` Pavel Machek
2007-12-11 20:16                                             ` Alan Cox
2007-12-11 20:27                                             ` linux-os (Dick Johnson)
2007-12-11 20:34                                               ` Rene Herman
2007-12-11 21:03                                                 ` David P. Reed
2007-12-11 23:56                                               ` David P. Reed
2007-12-12 13:11                                                 ` linux-os (Dick Johnson)
2007-12-12 16:12                                                   ` Alan Cox
2007-12-14 14:33                                                     ` Ingo Molnar
2007-12-16 21:26                                                       ` Pavel Machek
2007-12-17  0:02                                                         ` Alan Cox
2007-12-17  0:03                                                         ` Alan Cox
2007-12-17  0:28                                                           ` Pavel Machek
2007-12-17 14:42                                                             ` Ingo Molnar
2007-12-27 10:39                                                               ` Pavel Machek
2007-12-11 16:32                                   ` John Stoffel
2007-12-11 16:40                                     ` Rene Herman
2007-12-11 13:50                             ` David Newall
2007-12-11 14:14                               ` Rene Herman
2007-12-11 14:25                               ` Alan Cox
2007-12-12 22:18                                 ` David Newall
2007-12-12 23:00                                   ` Alan Cox
2007-12-13 13:13                                     ` David P. Reed
2007-12-13 13:21                                       ` Alan Cox
2007-12-14  1:50                                         ` David P. Reed
2007-12-14 15:16                                           ` Alan Cox
2007-12-11 15:41                               ` linux-os (Dick Johnson)
2007-12-11 16:30                                 ` Andi Kleen
2007-12-11 16:50                                   ` Rene Herman
2007-12-11 17:00                                     ` David P. Reed
2007-12-11 17:04                                       ` Rene Herman
2007-12-11 17:27                                         ` Rene Herman
2007-12-11 19:18                                         ` Pavel Machek
2007-12-11 19:16                                     ` Pavel Machek
2007-12-11 19:59                                       ` Rene Herman
2007-12-11 19:59                                       ` Rene Herman
2007-12-11 20:00                                       ` Rene Herman
2007-12-11 20:00                                       ` Rene Herman
2007-12-11 13:14                     ` Alan Cox
2007-12-11 13:32                       ` Andi Kleen
2007-12-11 13:47                         ` Pavel Machek
2007-12-11 13:50                           ` Andi Kleen
2007-12-14 13:33                             ` Ingo Molnar
2007-12-11  6:54                   ` Rene Herman
2007-12-11 17:01                     ` H. Peter Anvin

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=4758D584.90105@keyaccess.nl \
    --to=rene.herman@keyaccess.nl \
    --cc=dpreed@reed.com \
    --cc=hancockr@shaw.ca \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.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).