Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > alt.os.linux > #51757

Re: Linux 4.20 is Running Slower Than 4.19 On Intel CPUs

From Rich <rich@example.invalid>
Newsgroups alt.os.linux, comp.os.linux.misc
Subject Re: Linux 4.20 is Running Slower Than 4.19 On Intel CPUs
Date 2018-11-21 12:22 +0000
Organization A noiseless patient Spider
Message-ID <pt3ima$qp6$1@dont-email.me> (permalink)
References (4 earlier) <3ct8cf-dgg.ln1@Telcontar.valinor> <psuvld$8q8$1@dont-email.me> <op.zsqztifda3w0dxdave@hodgins.homeip.net> <pt1uf2$9ec$1@gioia.aioe.org> <pt2v7s$dnq$6@dont-email.me>

Cross-posted to 2 groups.

Show all headers | View raw


In comp.os.linux.misc The Natural Philosopher <tnp@invalid.invalid> wrote:
> On 20/11/2018 21:31, Computer Nerd Kev wrote:
>> In comp.os.linux.misc David W. Hodgins <dwhodgins@nomail.afraid.org> wrote:
>>> On Mon, 19 Nov 2018 13:33:17 -0500, The Natural Philosopher <tnp@invalid.invalid> wrote:
>>>
>>>> Thse CPU bugs are all about caching.
>>>
>>> Not quite all. The meltdown class of bugs are about caching, but the
>>> spectre class bugs are about speculative execution.
>>> https://en.wikipedia.org/wiki/Meltdown_(security_vulnerability)
>>> https://en.wikipedia.org/wiki/Spectre_(security_vulnerability)
>>>
>>> For maximum safety, disable execution on all but one core/thread. :-(
>> 
>> I don't think that would do. The Pentium Pro was apparantly the first
>> Intel x86 CPU to support speculative execution, and it was only
>> available as a single-core CPU. The speculatively executed
>> instructions can be done with a single core while it's waiting for
>> a memory read or similar.
>> 
> 
> Intersting that people differentiate between 'speculative execution' and 
> 'caching'.
> 
> Or is caching 'speculative memory access' as opposed to 'speculative 
> execution'?

You could call it (caching) that (speculative memory access).

Caching works on the principal that most programs often access memory 
addresses that are nearby other memory addresses previously accessed by 
the same program.  I.e., consider walking an array (X[0] ... X[100]) 
and doing something.  First access is to X[0], second to X[1], third to 
X[2] and so on.  Caching works because when the program reads X[0] the 
cache actually reads in memory that holds X[0]...X[10].  So now 
accesses to X[1]...X[10] happen from the cache instead of each directly 
from main memory.

So, yes, in a way it is "speculative memory access".  The hardware does 
not know (with certianty) that retreiving X[1] will occur soon in time 
after X[0].  But such patterns happen often enough that the number of 
wins outnumber the number of losses, and the CPU sees an apparent 
increase in speed of access of main memory.

Speculative execution is actually performing program steps ahead of 
time.  I.e., if you had this if statement:
  
  status=compute_status_value();
  if (status == 5) {
     a=a+1;
  } else {
     a=a-1;
  }

Before you arrive at the "if", before the value of "status" is finished 
being computed, the hardware does not know which of a+1 or a-1 will be 
executed.  So it simply performs both, computing an a1=a+1 and a2=a-1.  
Then, a cycle or two later, when the value of status is fully computed, 
it will either keep a1 or keep a2 (depending on status' value) and 
throw the other one away.

If the wait for computing status is 2 cycles, and a+1 and a-1 each take 
one cycle, and two alu's are available, then in the 2 cycles it takes 
to obtain the final value of 'status' the cpu can also compute a+1 and 
a-1, and complete the computation of status and the final one of a+1 or 
a-1 in two cycles.

If instead it waited until status was final (2 cycles) and only then 
performed one of a+1 or a-1 (1 cycle) the complete computation would 
take 3 cycles (2 waiting for status, 1 computing a-1 [assuming status 
was not 5]).

This is the basic idea.  Where Intel went with this basic idea in later 
'i' chips was to run not just two instructions during wait time for 
other data, but hundreds (during waiting times that are otherwise 
thousands of clock cycles long), all while keeping track of the 
temporary answers until it was known which ones were needed, and 
deleting the unnecessary computational output.  Unfortunately for them, 
the step of "deleting the unnecessary computational output" did not 
clean up *all* visible state changes.  And it is the stuff that wasn't 
fully cleaned up that allows the timing side-channel attacks that are 
appearing with great regularity.

Back to alt.os.linux | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Linux 4.20 is Running Slower Than 4.19 On Intel CPUs Nomen Nescio <noreply@mixnym.net> - 2018-11-16 20:21 -0600
  Re: Linux 4.20 is Running Slower Than 4.19 On Intel CPUs "J.O. Aho" <user@example.net> - 2018-11-17 11:10 +0100
    Re: Linux 4.20 is Running Slower Than 4.19 On Intel CPUs "Carlos E.R." <robin_listas@es.invalid> - 2018-11-17 11:26 +0100
      Re: Linux 4.20 is Running Slower Than 4.19 On Intel CPUs Richard Kettlewell <invalid@invalid.invalid> - 2018-11-17 11:53 +0000
        Re: Linux 4.20 is Running Slower Than 4.19 On Intel CPUs "Carlos E.R." <robin_listas@es.invalid> - 2018-11-18 21:06 +0100
          Re: Linux 4.20 is Running Slower Than 4.19 On Intel CPUs Paul <nospam@needed.invalid> - 2018-11-18 15:46 -0500
            Re: Linux 4.20 is Running Slower Than 4.19 On Intel CPUs Bud Frede <frede@mouse-potato.com> - 2018-11-24 09:07 -0500
          Re: Linux 4.20 is Running Slower Than 4.19 On Intel CPUs "J.O. Aho" <user@example.net> - 2018-11-18 22:27 +0100
          Re: Linux 4.20 is Running Slower Than 4.19 On Intel CPUs Richard Kettlewell <invalid@invalid.invalid> - 2018-11-19 08:27 +0000
          Re: Linux 4.20 is Running Slower Than 4.19 On Intel CPUs The Natural Philosopher <tnp@invalid.invalid> - 2018-11-19 18:33 +0000
            Re: Linux 4.20 is Running Slower Than 4.19 On Intel CPUs "J.O. Aho" <user@example.net> - 2018-11-19 21:02 +0100
              Re: Linux 4.20 is Running Slower Than 4.19 On Intel CPUs The Natural Philosopher <tnp@invalid.invalid> - 2018-11-20 04:46 +0000
                Re: Linux 4.20 is Running Slower Than 4.19 On Intel CPUs "J.O. Aho" <user@example.net> - 2018-11-20 06:59 +0100
            Re: Linux 4.20 is Running Slower Than 4.19 On Intel CPUs not@telling.you.invalid (Computer Nerd Kev) - 2018-11-19 21:58 +0000
              Re: Linux 4.20 is Running Slower Than 4.19 On Intel CPUs "David W. Hodgins" <dwhodgins@nomail.afraid.org> - 2018-11-19 17:27 -0500
            Re: Linux 4.20 is Running Slower Than 4.19 On Intel CPUs "David W. Hodgins" <dwhodgins@nomail.afraid.org> - 2018-11-19 17:37 -0500
              Re: Linux 4.20 is Running Slower Than 4.19 On Intel CPUs Richard Kettlewell <invalid@invalid.invalid> - 2018-11-20 10:10 +0000
                Re: Linux 4.20 is Running Slower Than 4.19 On Intel CPUs Andreas Kohlbach <ank@spamfence.net> - 2018-11-20 15:51 -0500
              Re: Linux 4.20 is Running Slower Than 4.19 On Intel CPUs not@telling.you.invalid (Computer Nerd Kev) - 2018-11-20 21:31 +0000
                Re: Linux 4.20 is Running Slower Than 4.19 On Intel CPUs Rich <rich@example.invalid> - 2018-11-20 23:14 +0000
                Re: Linux 4.20 is Running Slower Than 4.19 On Intel CPUs The Natural Philosopher <tnp@invalid.invalid> - 2018-11-21 06:50 +0000
                Re: Linux 4.20 is Running Slower Than 4.19 On Intel CPUs Paul <nospam@needed.invalid> - 2018-11-21 04:24 -0500
                Re: Linux 4.20 is Running Slower Than 4.19 On Intel CPUs Richard Kettlewell <invalid@invalid.invalid> - 2018-11-21 10:56 +0000
                Re: Linux 4.20 is Running Slower Than 4.19 On Intel CPUs Rich <rich@example.invalid> - 2018-11-21 12:22 +0000
                Re: Linux 4.20 is Running Slower Than 4.19 On Intel CPUs Richard Kettlewell <invalid@invalid.invalid> - 2018-11-21 13:24 +0000
                Re: Linux 4.20 is Running Slower Than 4.19 On Intel CPUs The Natural Philosopher <tnp@invalid.invalid> - 2018-11-21 22:08 +0000
                Re: Linux 4.20 is Running Slower Than 4.19 On Intel CPUs William Unruh <unruh@invalid.ca> - 2018-11-21 23:53 +0000
                Re: Linux 4.20 is Running Slower Than 4.19 On Intel CPUs The Natural Philosopher <tnp@invalid.invalid> - 2018-11-24 11:46 +0000
                Re: Linux 4.20 is Running Slower Than 4.19 On Intel CPUs William Unruh <unruh@invalid.ca> - 2018-11-24 13:53 +0000
                Re: Linux 4.20 is Running Slower Than 4.19 On Intel CPUs The Natural Philosopher <tnp@invalid.invalid> - 2018-11-24 18:39 +0000
                Re: Linux 4.20 is Running Slower Than 4.19 On Intel CPUs Andreas Kohlbach <ank@spamfence.net> - 2018-11-24 15:47 -0500
                Re: Linux 4.20 is Running Slower Than 4.19 On Intel CPUs The Natural Philosopher <tnp@invalid.invalid> - 2018-11-25 07:51 +0000
                Re: Linux 4.20 is Running Slower Than 4.19 On Intel CPUs Andreas Kohlbach <ank@spamfence.net> - 2018-11-25 16:08 -0500
                Re: Linux 4.20 is Running Slower Than 4.19 On Intel CPUs Rich <rich@example.invalid> - 2018-11-24 15:24 +0000
          Re: Linux 4.20 is Running Slower Than 4.19 On Intel CPUs Soviet_Mario <SovietMario@CCCP.MIR> - 2018-11-30 11:32 +0100
            Re: Linux 4.20 is Running Slower Than 4.19 On Intel CPUs The Natural Philosopher <tnp@invalid.invalid> - 2018-12-01 05:13 +0000
    Re: Linux 4.20 is Running Slower Than 4.19 On Intel CPUs "Anonymous Remailer (austria)" <mixmaster@remailer.privacy.at> - 2018-11-18 06:23 +0100
      Re: Linux 4.20 is Running Slower Than 4.19 On Intel CPUs Jens Stuckelberger <Jens_Stuckelberger@nowhere.net> - 2018-11-19 19:06 +0000
        Re: Linux 4.20 is Running Slower Than 4.19 On Intel CPUs Anonymous <anonymous@hoi-polloi.org> - 2018-11-19 21:44 +0100
          Re: Linux 4.20 is Running Slower Than 4.19 On Intel CPUs Nomen Nescio <nobody@dizum.com> - 2018-11-20 10:19 +0100
        Re: Linux 4.20 is Running Slower Than 4.19 On Intel CPUs Dave Froble <davef@tsoft-inc.com> - 2018-11-19 18:44 -0500
          Re: Linux 4.20 is Running Slower Than 4.19 On Intel CPUs kludge@panix.com (Scott Dorsey) - 2018-11-19 19:00 -0500
            Re: Linux 4.20 is Running Slower Than 4.19 On Intel CPUs Bobbie Sellers <bliss@mouse-potato.com> - 2018-11-26 20:40 -0800
        Re: Linux 4.20 is Running Slower Than 4.19 On Intel CPUs Nomen Nescio <nobody@dizum.com> - 2018-11-20 10:09 +0100
    Re: Linux 4.20 is Running Slower Than 4.19 On Intel CPUs fr314159@gmail.com - 2018-11-28 07:26 -0800
      Re: Linux 4.20 is Running Slower Than 4.19 On Intel CPUs Jasen Betts <jasen@xnet.co.nz> - 2018-11-29 19:45 +0000
        Re: Linux 4.20 is Running Slower Than 4.19 On Intel CPUs Melzzzzz <Melzzzzz@zzzzz.com> - 2018-11-29 20:21 +0000
        Re: Linux 4.20 is Running Slower Than 4.19 On Intel CPUs "F. Russell" <fr@random.info> - 2018-11-29 20:26 +0000

csiph-web