On 09/19/18 03:29, Jonathan Gray wrote:
On Wed, Sep 19, 2018 at 03:03:12AM +0200, Leo Unglaub wrote:
The only big problem I have is that as soon as I start X I cannot use the
keyboard correctly. Every time I type a character on the keyboard it gets
repeated multiple times. Most often it gets repeated between 3 and 7 times.
Do you have any idea what I could to in order to fix/debug this?
Could be tsc desync.

Try a non-mp kernel or sysctl kern.timecounter.hardware=acpihpet0


thank you very much! The sysctl kern.timecounter.hardware=acpih option fixed
the issue for me!

Thank you very much!
Greetings
Leo


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.

I am going to try the patch below and report back to you as soon as I fixed my laptop. Because since I tryed the sysctl kern.timecounter.hardware=acpihpet option I cannot start my laptop anymore.

During boot it now always fails with the error message "cpu2: failed to become ready" and then the laptop just starts booting without a panic or a debug prompt.

I managed to take a picture with my Phone before the Laptop rebootet again: https://img3.picload.org/image/dlwdwodi/img_20180919_034116.jpg

As soon as i have it fixed i try the patch and report back to you.

Thanks and greetings
Leo



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;


--
Leo Unglaub

Website: https://leo.unglaub.at
XMPP: leo-ungl...@jabber.ccc.de

:wq

Reply via email to