Weakly ordered WC stores in Haswell

By: Linus Torvalds (torvalds.delete@this.linux-foundation.org), September 15, 2015 11:23 am
Room: Moderated Discussions
Linus Torvalds (torvalds.delete@this.linux-foundation.org) on September 15, 2015 8:46 am wrote:
>
> Weak memory orderings are bad. Barriers are not a feature to
> be encouraged, they are mis-features to be lamented and made excuses for.

In other words, rather than your default "everything should be weakly ordered, and you software suckers have to add barriers to random places", the hardware people should say:"we really cannot make this particular ordering go fast, so here's how you handle it, and here's why we cannot make it go fast without your help".

This is why I'd claim that architectures should never ever need barriers between earlier reads and later writes. There just isn't any conceivable performance advantage of delaying the read, or trying to move the write up. It just simply does not help. A piece of hardware that re-orders those two accesses without a barrier is just gratuitously doing stupid things.

Your memory pipeline already has to track way more complicated orderings just for the single-threaded case, the "I'll do reads before subsequent writes" really isn't a big stretch.

Same goes for the read dependency barrier. It just doesn't really help hardware, and it very much does hurt software.

And honestly, the same largely goes for write barriers. Those things are queued anyway, and aren't performance-critical. The main performance win comes from just merging temporally adjacent writes (think things like memory copies or clear, or even just building a frame on the stack), which you can do without re-ordering the writes. You might as well keep the write queue a queue, make it slightly bigger, and tell people they don't need write barriers.

Read vs read without a dependency? Now we're starting to approach the kind of situation where a hardware designer can actually articulate some very deep reason to say "we'd actually like to re-order those unless you tell us not to". At least they can make a good excuse for why that's the case.

Not buffering a write across a later read? Now that a hardware designer can make a really good argument for needing a barrier, because even the absolute simplest implementation with trivial buffers etc would want to re-order things.

See? Instead of your insane "barriers are inherently good", the rule should be "barriers need a damn good actual design reason for them, because they are a pain for software". Just "we may want to do insane things in the future" is not a good enough reason.

Linus
< Previous Post in ThreadNext Post in Thread >
TopicPosted ByDate
Weakly ordered WC stores in HaswellGabriele Svelto2015/09/11 11:35 PM
  Weakly ordered WC stores in Haswelldmcq2015/09/12 01:26 AM
    Weakly ordered WC stores in HaswellJonah L2015/09/12 02:56 AM
      Forum bug: the "Preview" button posts (NT)Jonah L2015/09/12 02:57 AM
        Can you describe the bug more fully?David Kanter2015/09/12 09:01 AM
          Can you describe the bug more fully?Johah L2015/09/12 10:55 AM
            Can you describe the bug more fully?David Kanter2015/09/12 12:24 PM
              Can you describe the bug more fully?Johah L2015/09/12 01:56 PM
      Weakly ordered WC stores in Haswelldmcq2015/09/12 04:19 AM
        Weakly ordered WC stores in HaswellRicardo B2015/09/12 08:07 AM
          Weakly ordered WC stores in Haswelldmcq2015/09/12 08:53 AM
            Weakly ordered WC stores in HaswellRicardo B2015/09/12 09:02 AM
              Weakly ordered WC stores in Haswelldmcq2015/09/12 04:22 PM
                Weakly ordered WC stores in HaswellRicardo B2015/09/13 08:32 AM
                  Weakly ordered WC stores in Haswellnksingh2015/09/13 07:02 PM
                    Weakly ordered WC stores in HaswellRicardo B2015/09/14 03:43 AM
                      Weakly ordered WC stores in Haswelldmcq2015/09/14 07:31 AM
                        Weakly ordered WC stores in HaswellWilco2015/09/14 11:27 AM
                          Weakly ordered WC stores in HaswellRicardo B2015/09/14 02:35 PM
                            Weakly ordered WC stores in HaswellWilco2015/09/15 02:27 AM
                              Weakly ordered WC stores in HaswellRicardo B2015/09/15 06:00 AM
                          Weakly ordered WC stores in Haswelldmcq2015/09/14 05:05 PM
                            Weakly ordered WC stores in HaswellWilco2015/09/15 02:20 AM
                            Weakly ordered WC stores in HaswellLinus Torvalds2015/09/15 08:46 AM
                              Weakly ordered WC stores in HaswellLinus Torvalds2015/09/15 11:23 AM
                              Weakly ordered WC stores in Haswelldmcq2015/09/15 11:27 AM
                                Weakly ordered WC stores in HaswellLinus Torvalds2015/09/15 01:01 PM
                                  Weakly ordered WC stores in Haswelldmcq2015/09/15 03:46 PM
                                  Weakly ordered WC stores in HaswellRicardo B2015/09/15 04:14 PM
                                    Weakly ordered WC stores in HaswellLinus Torvalds2015/09/15 05:56 PM
                                      Weakly ordered WC stores in HaswellRicardo B2015/09/15 06:40 PM
                                        Weakly ordered WC stores in HaswellLinus Torvalds2015/09/15 09:07 PM
                                      non-casuality on AlphaMichael S2015/09/16 06:39 AM
                                        non-casuality on AlphaLinus Torvalds2015/09/16 08:48 AM
                                Weakly ordered WC stores in HaswellMartin Kristiansen2015/09/16 04:49 AM
                                  Weakly ordered WC stores in HaswellRicardo B2015/09/16 02:14 PM
                              Weakly ordered WC stores in HaswellEconMan2015/09/16 08:00 PM
                                Weakly ordered WC stores in HaswellDavid Kanter2015/09/16 11:06 PM
                                  L0 register file ideaEconMan2015/09/18 07:49 PM
                                    Units of pWatts make no senseJonah L2015/09/19 05:24 AM
                                      Units of pWatts make no senseEconMan2015/09/19 02:50 PM
                                    L0 register file ideaDavid Kanter2015/09/19 11:30 PM
                                      L0 register file ideaEconMan2015/09/20 09:45 AM
                                        L0 register file ideaDavid Kanter2015/09/20 10:49 PM
                                          L0 register file ideaEconMan2015/09/21 07:31 AM
                                            L0 register file ideaDavid Kanter2015/09/21 08:45 AM
                                              L0 register file ideaEconMan2015/09/21 07:37 PM
                                        L0 register file ideaWilco2015/09/21 12:47 PM
                                          L0 register file ideaMegol2015/09/22 03:44 AM
                                            L0 register file ideaWilco2015/09/22 11:36 AM
                                              L0 register file ideaEconMan2015/09/22 01:48 PM
                                                L0 register file ideaWilco2015/09/22 02:19 PM
                                                  L0 register file ideaEconMan2015/09/22 03:19 PM
                                                    L0 register file ideaWilco2015/09/23 02:05 AM
                                                      L0 register file ideaEconMan2015/09/23 10:32 PM
                                                        L0 register file ideaNoSpammer2015/09/24 12:09 AM
                                                          L0 register file ideaEconMan2015/09/25 04:20 PM
                                                            L0 register file ideaKlimax2015/09/26 05:45 AM
                                                              L0 register file ideaEconMan2015/09/26 01:00 PM
                                                                L0 register file ideaKlimax2015/09/27 03:05 AM
                                                                  Microsoft would never make your PC slower over timeEconMan2015/09/27 10:45 AM
                                                                    tip:Grow up, shut up (NT)Megol2015/09/28 06:59 AM
                                Weakly ordered WC stores in HaswellLinus Torvalds2015/09/17 10:34 AM
                                  Weakly ordered WC stores in HaswellEconMan2015/09/19 04:19 PM
                                    Weakly ordered WC stores in HaswellLinus Torvalds2015/09/19 05:52 PM
                                      Weakly ordered WC stores in Haswelldmcq2015/09/20 03:31 AM
                                        Weakly ordered WC stores in Haswelldmcq2015/09/20 04:10 AM
                                          Weakly ordered WC stores in HaswellRicardo B2015/09/20 04:12 AM
                                            Weakly ordered WC stores in Haswelldmcq2015/09/20 05:32 AM
                                        Weakly ordered WC stores in HaswellLinus Torvalds2015/09/20 12:39 PM
                                          Weakly ordered WC stores in Haswelldmcq2015/09/20 01:49 PM
                                Weakly ordered WC stores in HaswellStubabe2015/09/18 03:45 PM
                            Weakly ordered WC stores in HaswellSimon Farnsworth2015/09/16 12:56 PM
                              Weakly ordered WC stores in HaswellRicardo B2015/09/16 01:43 PM
                                Weakly ordered WC stores in Haswelldmcq2015/09/16 03:08 PM
                                  Weakly ordered WC stores in HaswellRicardo B2015/09/16 04:54 PM
                                    Weakly ordered WC stores in Haswellanon2015/09/16 11:25 PM
                                      Weakly ordered WC stores in HaswellRicardo B2015/09/17 01:53 AM
                                        Weakly ordered WC stores in Haswellanon2015/09/17 04:25 AM
                                          Weakly ordered WC stores in HaswellJukka Larja2015/09/17 07:39 AM
                                            Weakly ordered WC stores in HaswellGabriele Svelto2015/09/17 02:20 PM
                                              ReferenceGabriele Svelto2015/09/17 02:22 PM
                                                ReferenceJukka Larja2015/09/17 09:57 PM
                                                  Wii U. I supose (NT)Michael S2015/09/18 01:46 AM
                                                Referencedmcq2015/09/18 01:59 AM
                                                  ReferenceMichael S2015/09/18 02:27 AM
                                                    ReferenceGabriele Svelto2015/09/18 03:10 AM
                                                  ReferenceGabriele Svelto2015/09/18 03:03 AM
                                                    Referencedmcq2015/09/18 12:54 PM
                                                      ReferenceGabriele Svelto2015/09/18 03:13 PM
                                                        Referencedmcq2015/09/18 03:48 PM
                                                ReferenceKonrad Schwarz2015/09/18 05:16 AM
                                              Weakly ordered WC stores in Haswellanon2015/09/18 01:28 AM
                                                Weakly ordered WC stores in HaswellGabriele Svelto2015/09/18 03:09 AM
                                                  Weakly ordered WC stores in Haswelldmcq2015/09/18 06:43 AM
                                                  Weakly ordered WC stores in Haswellanon2015/09/18 07:23 AM
                                                    Weakly ordered WC stores in HaswellGabriele Svelto2015/09/18 03:24 PM
                                                      Weakly ordered WC stores in Haswellanon2015/09/18 08:32 PM
                                                        Weakly ordered WC stores in HaswellGabriele Svelto2015/09/19 01:11 PM
                                                          Weakly ordered WC stores in Haswellanon2015/09/19 11:06 PM
                                            Weakly ordered WC stores in Haswellanon2015/09/18 01:40 AM
                                              Weakly ordered WC stores in HaswellJukka Larja2015/09/19 03:55 AM
                                                Weakly ordered WC stores in Haswellanon2015/09/19 06:35 AM
                                                  Weakly ordered WC stores in Haswelliz2015/09/19 12:18 PM
                                                  Weakly ordered WC stores in HaswellMichael S2015/09/19 12:47 PM
                                                    Weakly ordered WC stores in Haswellanon2015/09/19 10:39 PM
                                                Weakly ordered WC stores in HaswellGabriele Svelto2015/09/21 05:04 AM
                                              Weakly ordered WC stores in HaswellRicardo B2015/09/19 08:40 AM
                                                Weakly ordered WC stores in Haswellanon2015/09/19 09:16 AM
                                                  Weakly ordered WC stores in HaswellRicardo B2015/09/19 10:45 AM
                                                    Weakly ordered WC stores in Haswellanon2015/09/19 10:21 PM
                                                      Weakly ordered WC stores in HaswellMichael S2015/09/20 02:22 AM
                                                        Weakly ordered WC stores in Haswellanon2015/09/20 02:58 AM
                                                          Weakly ordered WC stores in HaswellMichael S2015/09/20 04:52 AM
                                                            Weakly ordered WC stores in Haswellanon2015/09/20 07:58 AM
                                                            Weakly ordered WC stores in HaswellMaynard Handley2015/09/20 02:16 PM
                                                          Weakly ordered WC stores in Haswelldmcq2015/09/20 05:43 AM
                                                            Weakly ordered WC stores in HaswellMaynard Handley2015/09/20 02:18 PM
                                                Weakly ordered WC stores in Haswelldmcq2015/09/19 10:08 AM
                                                  Weakly ordered WC stores in HaswellRicardo B2015/09/19 11:21 AM
                                                    Weakly ordered WC stores in Haswelldmcq2015/09/19 12:54 PM
                                                      Weakly ordered WC stores in HaswellRicardo B2015/09/19 01:26 PM
                                                        Weakly ordered WC stores in Haswelldmcq2015/09/20 05:27 AM
                                                          Weakly ordered WC stores in HaswellRicardo B2015/09/20 09:12 AM
                                                            Weakly ordered WC stores in Haswelldmcq2015/09/20 09:40 AM
                                                              Weakly ordered WC stores in HaswellRicardo B2015/09/20 10:08 AM
                                                                Weakly ordered WC stores in Haswelldmcq2015/09/20 10:41 AM
                                                                  Weakly ordered WC stores in HaswellRicardo B2015/09/20 11:26 AM
                                                                    Weakly ordered WC stores in Haswelldmcq2015/09/20 12:02 PM
                                                                      Weakly ordered WC stores in HaswellRicardo B2015/09/20 01:16 PM
                                                                Weakly ordered WC stores in HaswellMaynard Handley2015/09/20 02:23 PM
                                                                  Weakly ordered WC stores in HaswellRicardo B2015/09/20 05:13 PM
                                                                    Weakly ordered WC stores in Haswelldmcq2015/09/21 01:05 AM
                                                                      Weakly ordered WC stores in HaswellRicardo B2015/09/21 06:13 AM
                                                                        Weakly ordered WC stores in HaswellWilco2015/09/21 01:32 PM
                                                                          Weakly ordered WC stores in HaswellRicardo B2015/09/23 01:30 PM
                                                                            Weakly ordered WC stores in HaswellMaynard Handley2015/09/23 02:19 PM
                                                                              Weakly ordered WC stores in Haswelldmcq2015/09/23 03:17 PM
                                                                              Weakly ordered WC stores in HaswellRicardo B2015/09/24 01:47 AM
                                                                              Weakly ordered WC stores in HaswellRobin Morisset2015/09/30 01:08 AM
                                                                                Weakly ordered WC stores in HaswellMaynard Handley2015/09/30 01:12 AM
                                                                                Weakly ordered WC stores in HaswellGabriele Svelto2015/09/30 02:40 AM
                                                              Weakly ordered WC stores in HaswellMichael S2015/09/20 10:35 AM
                                                                Weakly ordered WC stores in Haswelldmcq2015/09/20 11:14 AM
                                                                  Weakly ordered WC stores in HaswellJukka Larja2015/09/21 06:31 AM
                                                                    Weakly ordered WC stores in Haswelldmcq2015/09/21 09:40 AM
                                                                      Weakly ordered WC stores in Haswelleli2015/09/22 02:15 AM
                                                                    Weakly ordered WC stores in HaswellEugene Nalimov2015/09/22 07:47 PM
                                                                      Weakly ordered WC stores in Haswelldmcq2015/09/23 04:05 AM
                                                                        Weakly ordered WC stores in HaswellLinus Torvalds2015/09/23 10:13 AM
                                                                          Weakly ordered WC stores in HaswellMichael S2015/09/23 11:13 AM
                                                                            Weakly ordered WC stores in Haswelldmcq2015/09/23 05:19 PM
                                                                              Weakly ordered WC stores in Haswelldmcq2015/09/23 05:34 PM
                                                                            Weakly ordered WC stores in HaswellLinus Torvalds2015/09/23 08:03 PM
                                                                              Weakly ordered WC stores in HaswellLinus Torvalds2015/09/23 08:07 PM
                                                                                Weakly ordered WC stores in Haswelldmcq2015/09/24 02:30 AM
                                                                                  Weakly ordered WC stores in HaswellLinus Torvalds2015/09/24 11:26 AM
                                                                                    Weakly ordered WC stores in Haswelldmcq2015/09/24 04:41 PM
                                                                                      Weakly ordered WC stores in HaswellLinus Torvalds2015/09/24 06:05 PM
                                                                              Weakly ordered WC stores in HaswellMichael S2015/09/24 01:36 AM
                                                                                Weakly ordered WC stores in Haswellnone2015/09/24 02:36 AM
                                                                                  Weakly ordered WC stores in Haswellgallier22015/09/24 04:13 AM
                                                                              Weakly ordered WC stores in Haswelldmcq2015/09/24 04:40 AM
                                                                                Weakly ordered WC stores in HaswellLinus Torvalds2015/09/24 11:35 AM
                                                                      Weakly ordered WC stores in HaswellMichael S2015/09/23 10:50 AM
                                                                        Weakly ordered WC stores in HaswellEugene Nalimov2015/09/23 01:39 PM
                                                                          Weakly ordered WC stores in HaswellMichael S2015/09/23 02:05 PM
                                                  Weakly ordered WC stores in HaswellLinus Torvalds2015/09/19 03:53 PM
                                                    Weakly ordered WC stores in Haswelldmcq2015/09/20 05:56 AM
                                                      Weakly ordered WC stores in HaswellLinus Torvalds2015/09/20 12:44 PM
                                                        Weakly ordered WC stores in Haswelldmcq2015/09/20 02:45 PM
                                                          Weakly ordered WC stores in HaswellLinus Torvalds2015/09/20 04:12 PM
                                                            Weakly ordered WC stores in Haswelldmcq2015/09/21 01:39 AM
                                    Weakly ordered WC stores in HaswellRicardo B2015/09/17 01:58 AM
                                      Weakly ordered WC stores in Haswelldmcq2015/09/17 04:19 AM
                                        Weakly ordered WC stores in Haswelldmcq2015/09/17 04:24 AM
                                          Weakly ordered WC stores in Haswelldmcq2015/09/17 08:00 AM
                                            converter Michael S2015/09/17 02:53 PM
                                              converter dmcq2015/09/17 05:27 PM
                                        Weakly ordered WC stores in HaswellKonrad Schwarz2015/09/18 05:34 AM
                                          Weakly ordered WC stores in Haswelldmcq2015/09/18 10:41 AM
                          Weakly ordered WC stores in HaswellKonrad Schwarz2015/09/16 11:46 PM
      Weakly ordered WC stores in HaswellRicardo B2015/09/12 08:30 AM
  Weakly ordered WC stores in HaswellRicardo B2015/09/12 07:16 AM
  Weakly ordered WC stores in HaswellLinus Torvalds2015/09/12 10:28 AM
    Oh well, screwed up the block quote (NT)Linus Torvalds2015/09/12 10:29 AM
    Weakly ordered WC stores in HaswellDavid Kanter2015/09/12 02:52 PM
      Weakly ordered WC stores in HaswellRicardo B2015/09/12 03:33 PM
      Weakly ordered WC stores in HaswellStubabe2015/09/13 12:25 AM
        Weakly ordered WC stores in HaswellGabriele Svelto2015/09/13 01:54 AM
    Weakly ordered WC stores in HaswellGabriele Svelto2015/09/13 01:56 AM
    Weakly ordered WC stores in HaswellGabriele Svelto2015/09/13 05:31 AM
  Weakly ordered WC stores in HaswellTravis Downs2019/10/12 12:53 PM
Reply to this Topic
Name:
Email:
Topic:
Body: No Text
How do you spell avocado?