mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@linux-foundation.org>
To: Jarek Poplawski <jarkao2@o2.pl>
Cc: Nick Piggin <npiggin@suse.de>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	Andi Kleen <ak@suse.de>
Subject: Re: [rfc][patch 3/3] x86: optimise barriers
Date: Fri, 12 Oct 2007 08:13:52 -0700 (PDT)	[thread overview]
Message-ID: <alpine.LFD.0.999.0710120802160.6887@woody.linux-foundation.org> (raw)
In-Reply-To: <20071012082534.GB1962@ff.dom.local>



On Fri, 12 Oct 2007, Jarek Poplawski wrote:
> 
> First it looks like a really great thing that it's revealed at last.
> But then... there is probably some confusion: did we have to use
> ineffective code for so long?

I think the chip manufacturers really wanted to keep their options open.

Having the option to re-order loads in architecturally visible ways was 
something that they probably felt they really wanted to have. On the other 
hand:

 - I bet they had noticed that things break, and some applications depend 
   on fairly strong ordering (not necessarily in Linux-land, but..)

   I suspect hw manufacturers go through life hoping that "software 
   improves". They probably thought that getting rid of the old 16-bit 
   windows would mean that less people depended on undefined behaviour. 

   And I suspect that they started noticing that no, with threads and 
   JVM's and things, *more* people started depending on fairly strong 
   memory ordering.

 - I suspect Intel in particular noticed that they can do a lot of very 
   aggressive re-ordering at a microarchitectural level, but can still 
   guarantee that *architecturally* they never show it (dynamic detection 
   of reordered loads being replayed on cache dirty events etc).

IOW, I suspect that both Intel and AMD noticed that while they had wanted 
to keep their options open, those options weren't really realistic, and 
not something that the market wanted (aggressive use of threading wants 
*stricter* memory ordering, not looser), and they could work well enough 
with a fairly strict memory model.

> So, maybe linux needs something like this, instead of waiting few
> years with each new model for vendors goodwill? IMHO, even for less
> popular processors, this could be checked under some debugging option
> at the system start (after disabling suspicios barrier for a while
> plus some WARN_ONs).

Quite frankly, even *within* Intel and AMD, there are damn few people who 
understand exactly what the memory ordering requirements and guarantees 
are and historically were for the different CPU's.

I would bet that had you asked a random (but still competent) Intel/AMD 
engineer that wasn't really intimately involved with the actual design of 
the cache protocols and memory pipelines, they would absolutely not have 
been able to tell you how the CPU actually worked.

So no, there's no way a software person could have afforded to say "it 
seems to work on my setup even without the barrier". On a dual-socket 
setup with s shared bus, that says absolutely *nothing* about the 
behaviour of the exact same CPU when used with a multi-bus chipset. Not to 
mention another revisions of the same CPU - much less a whole other 
microarchitecture.

So yes, I've personally been aware for about a year that the memory 
ordering was going to likely be documented, but no way was I going to 
depend on it until Intel and AMD were ready to state so *publicly*. 
Because before that happens, they may have noticed errata etc that made it 
not work out.

Also, please note that we didn't even just change the barriers immediately 
when the docs came out. I want to do it soon - still *early* in the 2.6.24 
development cycle - exactly because bugs happen, and if somebody notices 
something strange, we'll have more time to perhaps decide that "oops, 
there's something bad going on, let's undo this for the real 2.6.24 
release until we can figure out the exact pattern".

		Linus

  parent reply	other threads:[~2007-10-12 15:14 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-04  5:21 [rfc][patch 1/3] x86_64: fence nontemproal stores Nick Piggin
2007-10-04  5:22 ` [rfc][patch 2/3] x86: fix IO write barriers Nick Piggin
2007-10-04 17:32   ` Dave Jones
2007-10-04 17:53     ` Andi Kleen
2007-10-04 18:10       ` Dave Jones
2007-10-04 18:21         ` Andi Kleen
2007-10-04 18:41           ` Dave Jones
2007-10-04 18:58             ` Andi Kleen
2007-10-04 19:08               ` Dave Jones
2007-10-04 20:52                 ` Alan Cox
2007-10-04  5:23 ` [rfc][patch 3/3] x86: optimise barriers Nick Piggin
2007-10-12  8:25   ` Jarek Poplawski
2007-10-12  8:42     ` Helge Hafting
2007-10-12  9:12       ` Jarek Poplawski
2007-10-12  9:44         ` Nick Piggin
2007-10-12 10:04           ` Jarek Poplawski
2007-10-12 12:44         ` Helge Hafting
2007-10-12 13:29           ` Jarek Poplawski
2007-10-15 10:17             ` Helge Hafting
2007-10-15 11:53               ` Jarek Poplawski
2007-10-12  8:57     ` Nick Piggin
2007-10-12  9:55       ` Jarek Poplawski
2007-10-12 10:42         ` Nick Piggin
2007-10-12 11:55           ` Jarek Poplawski
2007-10-12 12:10             ` Jarek Poplawski
2007-10-12 15:13     ` Linus Torvalds [this message]
2007-10-15  7:44       ` Jarek Poplawski
2007-10-15  8:09         ` Nick Piggin
2007-10-15  9:10           ` Jarek Poplawski
2007-10-15  9:24             ` Jarek Poplawski
2007-10-16  0:50             ` Nick Piggin
2007-10-16  9:00               ` Jarek Poplawski
2007-10-16  9:14                 ` david
2007-10-16 12:49                   ` Jarek Poplawski
2007-10-15 14:38         ` David Schwartz

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=alpine.LFD.0.999.0710120802160.6887@woody.linux-foundation.org \
    --to=torvalds@linux-foundation.org \
    --cc=ak@suse.de \
    --cc=jarkao2@o2.pl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=npiggin@suse.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

all inboxes | Powered by JetHome®