Date: Mon, 16 Jan 2017 14:00:21 +0200 From: Konstantin Belousov <kostikbel@gmail.com> To: Jia-Shiun Li <jiashiun@gmail.com> Cc: freebsd-current <freebsd-current@freebsd.org> Subject: Re: TSC as timecounter makes system lag Message-ID: <20170116120021.GQ2349@kib.kiev.ua> In-Reply-To: <CAHNYxxNxJp6jVmS0petqMmhdMe0Bam%2BtgUzufFVYWnSSxeGxoA@mail.gmail.com> References: <CAHNYxxPy4K37jKzw0%2Bs_AX8ha9yeB_S3dK46s4EuXjdNbULCmQ@mail.gmail.com> <20170113120534.GC2349@kib.kiev.ua> <CAHNYxxNN3p4KGvAnQ0aYUFmucGBKKj4JWgATNYZS2n0WTMY78g@mail.gmail.com> <20170115202008.GL2349@kib.kiev.ua> <CAHNYxxNxJp6jVmS0petqMmhdMe0Bam%2BtgUzufFVYWnSSxeGxoA@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Jan 16, 2017 at 12:28:54PM +0800, Jia-Shiun Li wrote: > BTW please see my other mail of this thread. It seems to be related to > EARLY_AP_STARTUP option. Yes, I noted, I might have an idea, but the report that changing the timecounter makes the lags go away still does not fit into my understanding of the code. Most likely this is an interaction between the EARLY_AP_STARTUP and the fact that HPET interrupt is global, while most modern systems use LAPIC event timer, which is per-cpu, and the testing of the option was done on them. There are some differences in handling the configurations, see sys/kern/kern_clocksource.c, the option and ET_FLAG_PERCPU. > > > On Mon, Jan 16, 2017 at 4:20 AM, Konstantin Belousov <kostikbel@gmail.com> > wrote: > > > I still do not understand. Is the sysctl output below from the pristine > > boot where no timecounter/eventtimer reconfiguration were done ? > > > > Show me exact command which you used to revive the machine. Do not > > describe > > it by words, copy/paste from the console. > > > > > Don't have access to the exact machine right now. > Let me reproduce it on another with a c2d E7400. > > login as: jsli > Authenticating with public key "rsa-key-20160711@jsli-pc" > Last login: Mon Jan 16 11:11:28 2017 from tmux(1074).%1 > FreeBSD 12.0-CURRENT (GENERIC-NODEBUG) #24 r312210: Sun Jan 15 15:03:40 CST > 2017 > > Welcome to FreeBSD! > > Release Notes, Errata: https://www.FreeBSD.org/releases/ > Security Advisories: https://www.FreeBSD.org/security/ > FreeBSD Handbook: https://www.FreeBSD.org/handbook/ > FreeBSD FAQ: https://www.FreeBSD.org/faq/ > Questions List: https://lists.FreeBSD.org/mailman/listinfo/freebsd- > questions/ > FreeBSD Forums: https://forums.FreeBSD.org/ > > Documents installed with the system are in the /usr/local/share/doc/freebsd/ > directory, or can be installed later with: pkg install en-freebsd-doc > For other languages, replace "en" with a language code like de or fr. > > Show the version of FreeBSD installed: freebsd-version ; uname -a > Please include that output and any error messages when posting questions. > Introduction to manual pages: man man > FreeBSD directory layout: man hier > > Edit /etc/motd to change this login announcement. > jsli@jsli-bsd:~ % sysctl kern.eventtimer kern.timecounter > kern.eventtimer.periodic: 0 > kern.eventtimer.timer: HPET > kern.eventtimer.idletick: 0 > kern.eventtimer.singlemul: 2 > kern.eventtimer.choice: HPET(450) HPET1(440) HPET2(440) HPET3(440) > LAPIC(100) i8254(100) RTC(0) > kern.eventtimer.et.HPET3.quality: 440 > kern.eventtimer.et.HPET3.frequency: 14318180 > kern.eventtimer.et.HPET3.flags: 3 > kern.eventtimer.et.HPET2.quality: 440 > kern.eventtimer.et.HPET2.frequency: 14318180 > kern.eventtimer.et.HPET2.flags: 3 > kern.eventtimer.et.HPET1.quality: 440 > kern.eventtimer.et.HPET1.frequency: 14318180 > kern.eventtimer.et.HPET1.flags: 3 > kern.eventtimer.et.HPET.quality: 450 > kern.eventtimer.et.HPET.frequency: 14318180 > kern.eventtimer.et.HPET.flags: 3 > kern.eventtimer.et.RTC.quality: 0 > kern.eventtimer.et.RTC.frequency: 32768 > kern.eventtimer.et.RTC.flags: 17 > kern.eventtimer.et.i8254.quality: 100 > kern.eventtimer.et.i8254.frequency: 1193182 > kern.eventtimer.et.i8254.flags: 1 > kern.eventtimer.et.LAPIC.quality: 100 > kern.eventtimer.et.LAPIC.frequency: 0 > kern.eventtimer.et.LAPIC.flags: 15 > kern.timecounter.tsc_shift: 1 > kern.timecounter.smp_tsc_adjust: 0 > kern.timecounter.smp_tsc: 1 > kern.timecounter.invariant_tsc: 1 > kern.timecounter.fast_gettime: 1 > kern.timecounter.tick: 1 > kern.timecounter.choice: ACPI-fast(900) HPET(950) i8254(0) TSC-low(1000) > dummy(-1000000) > kern.timecounter.hardware: TSC-low > kern.timecounter.alloweddeviation: 5 > kern.timecounter.stepwarnings: 0 > kern.timecounter.tc.ACPI-fast.quality: 900 > kern.timecounter.tc.ACPI-fast.frequency: 3579545 > kern.timecounter.tc.ACPI-fast.counter: 5046106 > kern.timecounter.tc.ACPI-fast.mask: 16777215 > kern.timecounter.tc.HPET.quality: 950 > kern.timecounter.tc.HPET.frequency: 14318180 > kern.timecounter.tc.HPET.counter: 1449012340 > kern.timecounter.tc.HPET.mask: 4294967295 > kern.timecounter.tc.i8254.quality: 0 > kern.timecounter.tc.i8254.frequency: 1193182 > kern.timecounter.tc.i8254.counter: 10698 > kern.timecounter.tc.i8254.mask: 65535 > kern.timecounter.tc.TSC-low.quality: 1000 > kern.timecounter.tc.TSC-low.frequency: 1400076588 > kern.timecounter.tc.TSC-low.counter: 2260820915 > kern.timecounter.tc.TSC-low.mask: 4294967295 > jsli@jsli-bsd:~ % su > Password: > jsli@jsli-bsd:/home/jsli # sysctl kern.timecounter.hardware=HPET > kern.timecounter.hardware: TSC-low -> HPET > jsli@jsli-bsd:/home/jsli # sysctl kern.eventtimer kern.timecounter > kern.eventtimer.periodic: 0 > kern.eventtimer.timer: HPET > kern.eventtimer.idletick: 0 > kern.eventtimer.singlemul: 2 > kern.eventtimer.choice: HPET(450) HPET1(440) HPET2(440) HPET3(440) > LAPIC(100) i8254(100) RTC(0) > kern.eventtimer.et.HPET3.quality: 440 > kern.eventtimer.et.HPET3.frequency: 14318180 > kern.eventtimer.et.HPET3.flags: 3 > kern.eventtimer.et.HPET2.quality: 440 > kern.eventtimer.et.HPET2.frequency: 14318180 > kern.eventtimer.et.HPET2.flags: 3 > kern.eventtimer.et.HPET1.quality: 440 > kern.eventtimer.et.HPET1.frequency: 14318180 > kern.eventtimer.et.HPET1.flags: 3 > kern.eventtimer.et.HPET.quality: 450 > kern.eventtimer.et.HPET.frequency: 14318180 > kern.eventtimer.et.HPET.flags: 3 > kern.eventtimer.et.RTC.quality: 0 > kern.eventtimer.et.RTC.frequency: 32768 > kern.eventtimer.et.RTC.flags: 17 > kern.eventtimer.et.i8254.quality: 100 > kern.eventtimer.et.i8254.frequency: 1193182 > kern.eventtimer.et.i8254.flags: 1 > kern.eventtimer.et.LAPIC.quality: 100 > kern.eventtimer.et.LAPIC.frequency: 0 > kern.eventtimer.et.LAPIC.flags: 15 > kern.timecounter.tsc_shift: 1 > kern.timecounter.smp_tsc_adjust: 0 > kern.timecounter.smp_tsc: 1 > kern.timecounter.invariant_tsc: 1 > kern.timecounter.fast_gettime: 1 > kern.timecounter.tick: 1 > kern.timecounter.choice: ACPI-fast(900) HPET(950) i8254(0) TSC-low(1000) > dummy(-1000000) > kern.timecounter.hardware: HPET > kern.timecounter.alloweddeviation: 5 > kern.timecounter.stepwarnings: 0 > kern.timecounter.tc.ACPI-fast.quality: 900 > kern.timecounter.tc.ACPI-fast.frequency: 3579545 > kern.timecounter.tc.ACPI-fast.counter: 14385392 > kern.timecounter.tc.ACPI-fast.mask: 16777215 > kern.timecounter.tc.HPET.quality: 950 > kern.timecounter.tc.HPET.frequency: 14318180 > kern.timecounter.tc.HPET.counter: 2895655601 <(289)%20565-5601> > kern.timecounter.tc.HPET.mask: 4294967295 > kern.timecounter.tc.i8254.quality: 0 > kern.timecounter.tc.i8254.frequency: 1193182 > kern.timecounter.tc.i8254.counter: 43612 > kern.timecounter.tc.i8254.mask: 65535 > kern.timecounter.tc.TSC-low.quality: 1000 > kern.timecounter.tc.TSC-low.frequency: 1400076588 > kern.timecounter.tc.TSC-low.counter: 3635090463 > kern.timecounter.tc.TSC-low.mask: 4294967295 > jsli@jsli-bsd:/home/jsli # And, changing the _timecounter_ fixes the issue ? Can you double-check this ? With the settings above, i.e. HPET for both eventtimer and timecounter, please show vmstat -ia output for two times with the interval of 2 secs. What if you change _eventtimer_ to APIC and then immediately back to HPET, does the problem go away ? Also, if you set the loader tunable kern.eventtimer.timer to LAPIC, and do not enable C2+, does the system boot into the usable state ? > > > > > This is not a verbose dmesg. > > > > Sorry thought I enabled verbose boot on all my machines. > Attached dmesg.boot of the one above. Thank you.
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20170116120021.GQ2349>