Hey,
i am sorry it took me so long to get back to you on this issue. As it
turns out this laptop has a lot of problems with OpenBSD so it took me a
long time to build your patch.
The patch below works fine and fixes the keyboard issue i had on my
Lenovo ThinkPad E485. Everything else works fine as expected!
Thanks for the patch!
Leo
On 09/19/18 03:29, Jonathan Gray wrote:
I had hoped it was gone with zen/17h. As it is very inconsistent as to
which systems have this problem (ie 16h apu laptop has the problem,
16h pcengines apu2 doesn't) we need to test if tsc is desynchronised
on boot.
Here is the old big hammer diff I had extended for 17h but I don't want
to force hpet in cases where tsc is not desynchronised between cores.
Index: tsc.c
===================================================================
RCS file: /cvs/src/sys/arch/amd64/amd64/tsc.c,v
retrieving revision 1.10
diff -u -p -r1.10 tsc.c
--- tsc.c 27 Jul 2018 21:11:31 -0000 1.10
+++ tsc.c 19 Sep 2018 01:16:24 -0000
@@ -32,6 +32,7 @@ int tsc_recalibrate;
uint64_t tsc_frequency;
int tsc_is_invariant;
+int tsc_desync;
uint tsc_get_timecount(struct timecounter *tc);
@@ -172,7 +173,7 @@ calibrate_tsc_freq(void)
return;
tsc_frequency = freq;
tsc_timecounter.tc_frequency = freq;
- if (tsc_is_invariant)
+ if (tsc_is_invariant && tsc_desync == 0)
tsc_timecounter.tc_quality = 2000;
}
@@ -206,10 +207,25 @@ tsc_timecounter_init(struct cpu_info *ci
tsc_frequency = tsc_freq_cpuid(ci);
tsc_is_invariant = 1;
+#ifdef MULTIPROCESSOR
+ /*
+ * TSC often desynchronised between cores on
+ * 15h (Bulldozer, Piledriver, Steamroller, Excavator)
+ * 16h (Jaguar, Puma)
+ * 17h (Zen)
+ */
+ if ((strcmp(cpu_vendor, "AuthenticAMD") == 0) &&
+ ((ci->ci_family == 0x15 && ci->ci_model <= 0x6f) ||
+ (ci->ci_family == 0x16 && ci->ci_model <= 0x3f) ||
+ (ci->ci_family == 0x17 && ci->ci_model <= 0x1f)))
+ tsc_desync = 1;
+#endif
+
/* Newer CPUs don't require recalibration */
if (tsc_frequency > 0) {
tsc_timecounter.tc_frequency = tsc_frequency;
- tsc_timecounter.tc_quality = 2000;
+ if (tsc_desync == 0)
+ tsc_timecounter.tc_quality = 2000;
} else {
tsc_recalibrate = 1;
tsc_frequency = cpufreq;