public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: "Michael S. Zick" <lkml@morethan.org>
To: "H. Peter Anvin" <hpa@zytor.com>
Cc: Ingo Molnar <mingo@elte.hu>, Thomas Gleixner <tglx@linutronix.de>,
	linux-kernel@vger.kernel.org
Subject: Re: [BUG FIX] Make x86_32 uni-processor Atomic ops, Atomic
Date: Fri, 22 May 2009 19:45:59 -0500	[thread overview]
Message-ID: <200905221946.01808.lkml@morethan.org> (raw)
In-Reply-To: <4A173580.9050304@zytor.com>

On Fri May 22 2009, H. Peter Anvin wrote:
> If there is a driver which relies on locked operations to be atomic with
> respect to the I/O subsystem, it needs to use true locks, not LOCK_PREFIX.
> 
> An interrupt cannot interrupt between two parts of a lockable
> instruction even if it isn't locked (there are non-atomic instructions
> in the x86 architecture, but they can never be locked.)
> 
> The other thing that you might be seeing is that a locked operation may
> be slow enough to keep an otherwise-present race condition from being
> triggered.
> 
> > That tells us nothing, since the CPU technical details are under NDA.
> 
> Have you considered that you might be running into a CPU bug or design
> error?  There was the out-of-order store bug on the Winchip that needed
> workarounds (CONFIG_X86_OOSTORE) that I don't think were ever well
> tested and might very well have bitrotted?
> 
> > All that can be done in this case is report behavior differences from
> > the closest publicly described processor (Pentium-M).
> > 
> > For that purpose, I suggest that a single processor box, with other 
> > hardware that makes memory access independent of the processor's 
> > control using a processor older than P-4 is a potential test bed.
> > "Other hardware that makes memory access..." I previously termed:
> > "buss master DMA" - which is overly specific.  It misleads people
> > into thinking I am seeing hardware control issues rather than
> > non-exclusive memory access.
> > 
> > My earlier comments about taking an interrupt between the memory read
> > and the memory write operations is from a different manual than the
> > one posted.  A manual that only applies to processors older than 
> > the ones supported by the Linux kernel.  
> > Sorry, my bad, grabbed the wrong book, posted the correct link (SH).
> > 
> > Until one or more specific usages of the LOCK_PREFIX macro can be 
> > demonstrated to be incorrect (at least for some of the processors 
> > using this code) - -
> > 
> > Then making the posted change is a single point change that gives a 
> > pair of builds (one with, one without) to compare the behavior of on 
> > the test bed.
> > 
> > It is *not* the preferred change for a general release kernel, the
> > preferred change would be one that makes a specific rather than
> > general correction.  
> > Perhaps only for some functions, perhaps only for some of the 
> > processors that currently select this code.
> > 
> > The observation that executing an unnecessary 'lock' opcode in some
> > cases slows down the machine is not felt by myself to be significant 
> > to duplicating my observations.  Note: I have been wrong before.
> 
> What makes you draw that conclusion, in particular?  A lock prefix
> typically slows down the following instruction dramatically, on some
> processors by many hundreds of cycles.
> 
> > This is as informative as I can make the message.
> > 
> > PS: *not* a single machine failure, tested on five machines, owned
> > by four different people, two brands, with different use histories.
> 
> What do they have in common?
>

Same integrated motherboard.
There is very little information to be gained from staring at a glowing
power on light, that only glows back.  ;)
The lockdep dump posted is the best source of information.

Other observations -

Here is something which these machines do, which may not be happening
with your choice of test machines:

ACPI: Core revision 20090320
..TIMER: vector=0x30 apic1=0 pin1=0 apic2=-1 pin2=-1
..MP-BIOS bug: 8254 timer not connected to IO-APIC
...trying to set up timer (IRQ0) through the 8259A ...
..... (found apic 0 pin 0) ...
....... works.

Note: This is on a Uni-processor build.
I have not yet examined the code that generates that set of messages.
Might be a broken work-around?

With the LOCK_PREFIX == ""

Test conditions (same as the lockdep dump) -
VLC playing streaming audio over the wired net connection (8139too) -
from 4 to 8 ssh remote terminal sessions, each running "top" set
to use different display intervales (different in 0.1 second steps) -
Fixed cpu speed at half the rated clock (for the purpose of testing).
Now just hang back and listen for 10 minutes to 4 hours -

When the machine stops running -
You will still hear bursts of sound - -
I am *guessing* that this means the chip set and bus clocks are running,
also that DMA is running - with the result that the HD audio driver
is just replaying the same buffer offset.
There is a PCI-to-PCIe bridge in the chip set and the HD audio hardware
(also on chip) is the only thing detected on the PCIe bus.

The "hold down power button to stop" still works -
I presume that means at least that internal timer is still running.

Repeat the above, *with* LOCK_PREFIX == "\n\tlock; "
When the machine stops - with only minutes rather than hours of uptime -
The machine is silent - I presume this means that DMA is not running.
The "hold down power button to stop" still works -
So clocks are not totally off.

= = = =

Either "lock-up" situation acts as if:
*) cpu is halted with interrupts off; or
*) cpu is in a tight loop with interrupts off
The primary difference is that the DMA has been stopped in the second case.
Presuming my two guesses on that subject above are correct.

Mike

> 	-hpa
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
> 
> 



  reply	other threads:[~2009-05-23  0:46 UTC|newest]

Thread overview: 90+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-22 16:39 [BUG FIX] Make x86_32 uni-processor Atomic ops, Atomic Michael S. Zick
2009-05-22 18:23 ` Andi Kleen
2009-05-22 18:36 ` Ingo Molnar
2009-05-22 18:59   ` H. Peter Anvin
2009-05-22 19:20     ` Michael S. Zick
2009-05-22 22:21     ` Michael S. Zick
2009-05-22 23:30       ` H. Peter Anvin
2009-05-23  0:45         ` Michael S. Zick [this message]
2009-05-23  0:51           ` H. Peter Anvin
2009-05-23 10:44             ` Michael S. Zick
2009-05-23 11:18               ` Michael S. Zick
2009-05-24  7:04               ` Harald Welte
2009-05-24 12:48                 ` Michael S. Zick
2009-05-24 15:43                 ` Michael S. Zick
2009-05-27 22:13               ` Roland Dreier
2009-05-27 22:33                 ` Michael S. Zick
2009-05-23 15:52             ` Michael S. Zick
2009-05-23 18:04             ` Michael S. Zick
2009-05-23 23:44               ` H. Peter Anvin
2009-05-24  6:49                 ` Harald Welte
2009-05-24 12:38                   ` Michael S. Zick
2009-05-24 17:31                     ` Harald Welte
2009-05-27 12:18                   ` Re:[VIA Support] was: " Michael S. Zick
2009-05-27 12:22                     ` [VIA " Michael S. Zick
2009-05-27 12:47                     ` Harald Welte
2009-05-27 13:00                       ` Michael S. Zick
2009-05-29 12:06                     ` Michael S. Zick
2009-05-30 15:48                   ` Michael S. Zick
2009-05-24 12:27                 ` Michael S. Zick
2009-05-24 17:22                   ` Harald Welte
2009-05-24 18:00                   ` H. Peter Anvin
2009-05-24 18:32                     ` Michael S. Zick
2009-05-24 18:46                       ` H. Peter Anvin
2009-05-24 19:09                         ` Michael S. Zick
2009-05-25 19:03                         ` Michael S. Zick
2009-05-25 19:18                           ` Michael S. Zick
2009-05-25 19:46                             ` Michael S. Zick
2009-05-25 21:10                               ` Michael S. Zick
2009-05-25 21:17                                 ` H. Peter Anvin
2009-05-25 23:03                                   ` Michael S. Zick
2009-05-25 23:35                                     ` Michael S. Zick
2009-05-26  0:05                                     ` H. Peter Anvin
2009-05-26 12:37                                       ` Michael S. Zick
2009-05-26 17:13                                         ` H. Peter Anvin
2009-05-25  1:31                       ` i2c-viapro / via-fb drivers on VIA CX700 Harald Welte
2009-05-25 12:54                         ` Michael S. Zick
2009-05-27 13:36                         ` Michael S. Zick
2009-05-25 16:05                       ` [BUG FIX] Make x86_32 uni-processor Atomic ops, Atomic Michael S. Zick
2009-05-28 20:30                     ` Pavel Machek
2009-05-28 20:54                       ` Michael S. Zick
2009-05-28 23:15                         ` [Futex RFC] was " Michael S. Zick
2009-05-29  2:00                           ` Michael S. Zick
2009-05-27 17:01                 ` LOCK prefix on uni processor has its use (was Re: [BUG FIX] Make x86_32 uni-processor Atomic ops, Atomic) Harald Welte
2009-05-27 17:10                   ` Michael S. Zick
2009-05-27 17:19                   ` Thomas Gleixner
2009-05-27 17:25                     ` Michael S. Zick
2009-05-27 18:08                   ` LOCK prefix on uni processor has its use Andi Kleen
2009-05-27 18:22                     ` Michael S. Zick
2009-05-27 18:33                       ` Michael S. Zick
2009-05-27 18:55                         ` Michael S. Zick
2009-05-27 18:38                       ` Andi Kleen
2009-06-02 12:48                     ` Harald Welte
2009-06-02 13:03                       ` Andi Kleen
2009-06-02 13:26                         ` Michael S. Zick
2009-06-02 13:42                           ` Andi Kleen
2009-06-03 11:46                             ` Michael S. Zick
2009-05-28  2:56                   ` LOCK prefix on uni processor has its use (was Re: [BUG FIX] Make x86_32 uni-processor Atomic ops, Atomic) H. Peter Anvin
2009-05-23 20:51             ` [BUG FIX] Make x86_32 uni-processor Atomic ops, Atomic Michael S. Zick
2009-05-28 12:48       ` Pavel Machek
2009-05-28 13:29         ` Michael S. Zick
2009-05-28 20:50           ` Pavel Machek
2009-05-28 20:58             ` Michael S. Zick
2009-05-28 21:16               ` Pavel Machek
2009-05-28 21:21                 ` Michael S. Zick
2009-05-22 19:17   ` Michael S. Zick
     [not found] ` <200905221343.30638.lkml@morethan.org>
     [not found]   ` <20090522192329.GF846@one.firstfloor.org>
2009-05-22 19:53     ` Michael S. Zick
2009-05-22 20:05       ` Samuel Thibault
2009-05-22 20:32         ` Michael S. Zick
2009-05-22 20:42           ` Andi Kleen
2009-05-22 20:57             ` Michael S. Zick
2009-05-22 20:43           ` Samuel Thibault
2009-05-22 21:59             ` Andi Kleen
2009-05-22 22:00               ` Samuel Thibault
2009-05-22 22:14                 ` Andi Kleen
2009-05-22 22:14                   ` Samuel Thibault
2009-05-22 20:45           ` Roland Dreier
2009-05-24 18:59           ` Robert Hancock
  -- strict thread matches above, loose matches on Subject: below --
2009-05-22 18:50 Michael S. Zick
2009-05-22 19:24 ` Roland Dreier
2009-05-22 20:03   ` Michael S. Zick

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=200905221946.01808.lkml@morethan.org \
    --to=lkml@morethan.org \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --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