Software Tuning, Performance Optimization & Platform Monitoring
Discussion around monitoring and software tuning methodologies, Performance Monitoring Unit (PMU) of Intel microprocessors, and platform monitoring

Can clflush evict any address

Younis_A_
Beginner
241 Views

Hi

I'm wondering, can clflush instruction flush any type of addresses in a cache line (logical, linear or physical address) or has to be only a linear address.

Thank you in advance for your help

0 Kudos
2 Replies
McCalpinJohn
Black Belt
241 Views

The description in Volume 2 "Instruction Set Reference" of the Intel Software Developer's Guide seems clear enough -- CLFLUSH takes a linear address as its argument and flushes the cache line containing that linear address from all levels of the memory hierarchy and from all caches in the system.

Inside the L1 cache, all aliased virtual to physical translations map to the same cache set (on current Intel processors) so there is no difference between evicting the linear address and the physical address.   (This can be more complex with other processors.)

Outside of the L1 cache, all addresses used by the system are physical addresses, so it is the physical address that gets broadcast globally for eviction.  If that cache line was loaded into a cache using a different virtual address, it will get evicted anyway, which may be unexpected.   (Virtual address aliasing is frowned on for data, but it is heavily used for instructions in Address Space Layout Randomization.)

 

Younis_A_
Beginner
240 Views

Thank you so much John.

Reply