What happens to non-transitory storage if the data is already in the cache?

When you use non-temporary storage, such as movntq, and the data is already in the cache, will the storage update the cache instead of writing to memory? Or will he update the cache line and write it out, expelling it? Or what?

Here's a fun dilemma. Suppose thread A loads a cache line containing x and y. Thread B writes x to NT storage. Subject A writes to y. There the data race here, if B is stored to x, may be in transit to memory at boot time. If A sees the old value of x, but the record X has already occurred, then a later record of y and a possible write back to the cache line will be clobber with an unrelated value of x. I assume the processor will somehow prevent this? I don’t see how anyone could create a reliable system using NT repositories if that were acceptable behavior.

+4
source share
2 answers

. , x86, , L1 , L2 ( , ) -, .

, . .

+5

( , Pentium M) NT, , , NT.

, , , ( ); + clflush, , . IDK, , ; NT, , , , , , - .

Intel x86 volume 1, ch 10.4.6.2 :

, - (WB), WT (WC), :

  • , , . 1

    1 (, Pentium M) , , , WC, .

  • WC.

. : 11 " " Intel® 64 IA-32, 3A.


Intel, 7.4.1.3 . [].

, :

  • [NT UC WP: .]
  • Write-Combining (WC), , .

  • (, Write-Back (WB) Write-Through (WT)), :

    • - 1 - , . . :

      (a) , ,
      (b) ( WC).

      ( ) . Pentium 4, Intel Core Solo Intel Core Duo ( ). Pentium M .

      , , . , , . [ , "" Pentium M ]

    • - CASE 2 - , WB WT; WC. -. .

+2

Source: https://habr.com/ru/post/1622017/


All Articles