Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 21 Jan 2021 12:58:08 GMT
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 9f47eeffa3cf - main - x86: switch kernel TSC timecounter to RDTSCP on AMD Zen CPUs
Message-ID:  <202101211258.10LCw8PA053593@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=9f47eeffa3cfdcb512e2011fb00fc23c7c1a7d75

commit 9f47eeffa3cfdcb512e2011fb00fc23c7c1a7d75
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2021-01-21 12:53:15 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2021-01-21 12:55:31 +0000

    x86: switch kernel TSC timecounter to RDTSCP on AMD Zen CPUs
    
    Reported by:    many
    Tested by:      gallatin, mikael, rhurlin
    MFC after:      1 week
    Sponsored by:   The FreeBSD Foundation
---
 sys/x86/x86/tsc.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)

diff --git a/sys/x86/x86/tsc.c b/sys/x86/x86/tsc.c
index 85924df98312..de0a1505c2f6 100644
--- a/sys/x86/x86/tsc.c
+++ b/sys/x86/x86/tsc.c
@@ -633,19 +633,12 @@ init:
 
 	/*
 	 * Timecounter implementation selection, top to bottom:
-	 * - For AMD Zens and newer, use LFENCE;RDTSC.
 	 * - If RDTSCP is available, use RDTSCP.
 	 * - If fence instructions are provided (SSE2), use LFENCE;RDTSC
 	 *   on Intel, and MFENCE;RDTSC on AMD.
 	 * - For really old CPUs, just use RDTSC.
 	 */
-	if ((cpu_vendor_id == CPU_VENDOR_AMD ||
-	    cpu_vendor_id == CPU_VENDOR_HYGON) &&
-	    CPUID_TO_FAMILY(cpu_id) >= 0x17) {
-		tsc_timecounter.tc_get_timecount = shift > 0 ?
-		    tsc_get_timecount_low_lfence :
-		    tsc_get_timecount_lfence;
-	} else if ((amd_feature & AMDID_RDTSCP) != 0) {
+	if ((amd_feature & AMDID_RDTSCP) != 0) {
 		tsc_timecounter.tc_get_timecount = shift > 0 ?
 		    tscp_get_timecount_low : tscp_get_timecount;
 	} else if ((cpu_feature & CPUID_SSE2) != 0 && mp_ncpus > 1) {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202101211258.10LCw8PA053593>