Re: Waiting for bufdaemon

From: Konstantin Belousov <kostikbel_at_gmail.com>
Date: Wed, 20 Jan 2021 12:18:44 +0200
On Wed, Jan 20, 2021 at 11:02:21AM +0100, Jakob Alvermark wrote:
> This patch hides the problem for me. The system seems to work better now.
> 
> No waiting on reboot, and the webcam works better.
I am curious what do you mean by the above reference to webcam.
Can you explain it with more details, even if only the impressions?

I probably going to commit the following patch in the next 24 hours.

commit 02505d07bca320a638c96918ac9076c6eece2fff
Author: Konstantin Belousov <kib_at_FreeBSD.org>
Date:   Wed Jan 20 11:32:21 2021 +0200

    AMD Zen CPUs: switch TSC timecounter to RDTSCP
    
    Reported by:    many
    MFC after:      1 weel
    Sponsored by:   The FreeBSD Foundation

diff --git a/lib/libc/x86/sys/__vdso_gettc.c b/lib/libc/x86/sys/__vdso_gettc.c
index 7f224f8758cb..7a64f2a0b556 100644
--- a/lib/libc/x86/sys/__vdso_gettc.c
+++ b/lib/libc/x86/sys/__vdso_gettc.c
_at__at_ -125,7 +125,7 _at__at_ struct tsc_selector_tag {
 };
 
 static const struct tsc_selector_tag tsc_selector[] = {
-	[0] = {				/* Intel or AMD Zen+, LFENCE */
+	[0] = {				/* Intel, LFENCE */
 		.ts_rdtsc32 =	rdtsc32_mb_lfence,
 		.ts_rdtsc_low =	rdtsc_low_mb_lfence,
 	},
_at__at_ -164,9 +164,6 _at__at_ tsc_selector_idx(u_int cpu_feature)
 	do_cpuid(1, p);
 	cpu_id = p[0];
 
-	if (amd_cpu && CPUID_TO_FAMILY(cpu_id) >= 0x17)
-		return (0);
-
 	if (cpu_feature != 0) {
 		do_cpuid(0x80000000, p);
 		cpu_exthigh = p[0];
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
_at__at_ -633,19 +633,12 _at__at_ init_TSC_tc(void)
 
 	/*
 	 * 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) {
Received on Wed Jan 20 2021 - 09:18:53 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:41:26 UTC