I want to generate x86 CPU to Memory traffic on Linux OS (Ubuntu 18) using gcc tool chain that should first fill up tlb (translation look aside buffer) and then cause tlb invalidates as it has already filled up. I have created simple code below but I am not sure if it can achieve the goal of filling up tlb and then invalidating it
#include<stdio.h>
int main()
{
int array[1000];
int i;
long sum = 0;
for(i=0; i < 1000;i++)
{
array[i] = i;
}
for(i=0; i < 1000;i++)
{
sum += array[i]
}
return 0;
}
Here is the processor specific info in case it is useful
processor : 0
vendor_id : AuthenticAMD
cpu family : 23
model : 1
model name : AMD EPYC 7281 16-Core Processor
stepping : 2
microcode : 0x8001227
cpu MHz : 2694.732
cache size : 512 KB
physical id : 0
siblings : 32
core id : 0
cpu cores : 16
apicid : 0
initial apicid : 0
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
The crux is to have answers to the following
- what triggers tlb invalidates to happen?
- How can one test tlb invalidates did happen?