• Andi Kleen's avatar
    x86: allow TSC clock source on AMD Fam10h and some cleanup · 51fc97b9
    Andi Kleen authored
    After a lot of discussions with AMD it turns out that TSC
    on Fam10h CPUs is synchronized when the CONSTANT_TSC cpuid bit is set.
    Or rather that if there are ever systems where that is not
    true it would be their BIOS' task to disable the bit.
    
    So finally use TSC gettimeofday on Fam10h by default.
    
    Or rather it is always used now on CPUs where the AMD
    specific CONSTANT_TSC bit is set.
    
    This gives a nice speed bost for gettimeofday() on these systems
    which tends to be by far the most common v/syscall.
    
    On a Fam10h system here TSC gtod uses about 20% of the CPU time of
    acpi_pm based gtod(). This was measured on 32bit, on 64bit
    it is even better because TSC gtod() can use a vsyscall
    and stay in ring 3, which acpi_pm doesn't.
    
    The Intel check simply checks for CONSTANT_TSC too without hardcoding
    Intel vendor. This is equivalent on 64bit because all 64bit capable Intel
    CPUs will have CONSTANT_TSC set.
    
    On Intel there is no CPU supplied CONSTANT_TSC bit currently,
    but we synthesize one based on hardcoded knowledge which steppings
    have p-state invariant TSC.
    
    So the new logic is now: On CPUs which have the AMD specific
    CONSTANT_TSC bit set or on Intel CPUs which are new enough
    to be known to have p-state invariant TSC always use
    TSC based gettimeofday()
    
    Cc: lenb@kernel.org
    Signed-off-by: default avatarAndi Kleen <ak@suse.de>
    Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
    Signed-off-by: default avatarThomas Gleixner <tglx@linutronix.de>
    51fc97b9
tsc_64.c 7.83 KB