• Henrik Gramner's avatar
    x86: Serialize rdtsc in read_time() · d1a6cb19
    Henrik Gramner authored
    Improves the accuracy of measurements, especially in short sections.
    
    To quote the Intel 64 and IA-32 Architectures Software Developer's Manual:
    "The RDTSC instruction is not a serializing instruction. It does not necessarily
    wait until all previous instructions have been executed before reading the counter.
    Similarly, subsequent instructions may begin execution before the read operation
    is performed. If software requires RDTSC to be executed only after all previous
    instructions have completed locally, it can either use RDTSCP (if the processor
    supports that instruction) or execute the sequence LFENCE;RDTSC."
    
    SSE2 is a requirement for lfence so only use it on SSE2-capable systems.
    Prefer lfence;rdtsc over rdtscp since rdtscp is supported on fewer systems.
    Signed-off-by: 's avatarLuca Barbato <lu_zero@gentoo.org>
    d1a6cb19
Name
Last commit
Last update
..
Makefile Loading commit data...
asm.h Loading commit data...
bswap.h Loading commit data...
cpu.c Loading commit data...
cpu.h Loading commit data...
cpuid.asm Loading commit data...
emms.asm Loading commit data...
emms.h Loading commit data...
float_dsp.asm Loading commit data...
float_dsp_init.c Loading commit data...
intreadwrite.h Loading commit data...
lls.asm Loading commit data...
lls_init.c Loading commit data...
timer.h Loading commit data...
w64xmmtest.h Loading commit data...
x86inc.asm Loading commit data...
x86util.asm Loading commit data...