Date: Fri, 24 Feb 2017 22:50:19 +0800 From: Jia-Shiun Li <jiashiun@gmail.com> To: Konstantin Belousov <kostikbel@gmail.com> Cc: John Baldwin <jhb@freebsd.org>, freebsd-current <freebsd-current@freebsd.org>, Konstantin Belousov <kib@freebsd.org> Subject: Re: TSC as timecounter makes system lag Message-ID: <CAHNYxxMLX8kfJAuP-ua65d3UN1DH-BOU8i1vqRUdzAOVvgaH_w@mail.gmail.com> In-Reply-To: <CAHNYxxNiCP08dQ6bTJzHuAUmqwQUQJn%2B%2BCKMsCLiHQy2PxjP5A@mail.gmail.com> References: <20170113120534.GC2349@kib.kiev.ua> <20170223100829.GR2092@kib.kiev.ua> <CAHNYxxPDQtu5oJw2FEibYPaxZb==8CiSYyX6i2CXoi5DDB7PEw@mail.gmail.com> <2204246.QKzIRnxiUQ@ralph.baldwin.cx> <CAHNYxxNB2QT4_h6RtMz9-sAc5br_VBWj6-NafSXuf88W56BmBQ@mail.gmail.com> <20170224114541.GU2092@kib.kiev.ua> <CAHNYxxNiCP08dQ6bTJzHuAUmqwQUQJn%2B%2BCKMsCLiHQy2PxjP5A@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
--001a1144d05c0e02bb054947db7c Content-Type: text/plain; charset=UTF-8 On Fri, Feb 24, 2017 at 9:32 PM, Jia-Shiun Li <jiashiun@gmail.com> wrote: > On Fri, Feb 24, 2017 at 7:45 PM, Konstantin Belousov <kostikbel@gmail.com> > wrote: > >> On Fri, Feb 24, 2017 at 12:15:26PM +0800, Jia-Shiun Li wrote: >> > Tested working on E7400 against r313909. And changing timecounter >> from/to >> > TSC >> > correctly enables/disables C2. >> > >> > The latter part cpu_disable_c2_sleep++ is not needed. When >> > init_TSC_tc() got called timecounter is not yet tsc_timecounter. >> > inittimecounter() later will do the work calling tc_windup(). >> > >> >> You mean, just this >> - if (cpu_deepest_sleep >= 2 && cpu_vendor_id == CPU_VENDOR_INTEL && >> + if (cpu_vendor_id == CPU_VENDOR_INTEL && >> is enough to fix the issue ? If yes, we can remove the cpu_deepest_sleep >> variable. This is John' observation, I think he would prefer to prepare >> the patch. >> > > Correct. That's enough. > > Since that's simple enough... patch attached. Tested against r313909 too. -Jia-Shiun. --001a1144d05c0e02bb054947db7c Content-Type: application/octet-stream; name="fix-tsc-timecounter.patch" Content-Disposition: attachment; filename="fix-tsc-timecounter.patch" Content-Transfer-Encoding: base64 X-Attachment-Id: f_izjwv51t0 SW5kZXg6IHN5cy9kZXYvYWNwaWNhL2FjcGlfY3B1LmMKPT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PQotLS0gc3lzL2Rldi9h Y3BpY2EvYWNwaV9jcHUuYwkocmV2aXNpb24gMzEzOTA5KQorKysgc3lzL2Rldi9hY3BpY2EvYWNw aV9jcHUuYwkod29ya2luZyBjb3B5KQpAQCAtNzAzLDcgKzcwMyw2IEBACiAgICAgc2MtPmNwdV9u b25fYzIgPSBzYy0+Y3B1X2N4X2NvdW50OwogICAgIHNjLT5jcHVfbm9uX2MzID0gc2MtPmNwdV9j eF9jb3VudDsKICAgICBzYy0+Y3B1X2N4X2NvdW50Kys7Ci0gICAgY3B1X2RlZXBlc3Rfc2xlZXAg PSAxOwogCiAgICAgLyogCiAgICAgICogVGhlIHNwZWMgc2F5cyBQX0JMSyBtdXN0IGJlIDYgYnl0 ZXMgbG9uZy4gIEhvd2V2ZXIsIHNvbWUgc3lzdGVtcwpAQCAtNzI5LDcgKzcyOCw2IEBACiAJICAg IGN4X3B0cisrOwogCSAgICBzYy0+Y3B1X25vbl9jMyA9IHNjLT5jcHVfY3hfY291bnQ7CiAJICAg IHNjLT5jcHVfY3hfY291bnQrKzsKLQkgICAgY3B1X2RlZXBlc3Rfc2xlZXAgPSAyOwogCX0KICAg ICB9CiAgICAgaWYgKHNjLT5jcHVfcF9ibGtfbGVuIDwgNikKQEAgLTc0Niw3ICs3NDQsNiBAQAog CSAgICBjeF9wdHItPnRy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09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT0KLS0tIHN5cy94ODYveDg2L3RzYy5jCShyZXZpc2lvbiAzMTM5MDkpCisrKyBzeXMveDg2L3g4 Ni90c2MuYwkod29ya2luZyBjb3B5KQpAQCAtNTQyLDcgKzU0Miw3IEBACiAJICogcmVzdWx0IGlu Y29ycmVjdCBydW50aW1lcyBmb3Iga2VybmVsIGlkbGUgdGhyZWFkcyAoYnV0IG5vdAogCSAqIGZv ciBhbnkgbm9uLWlkbGUgdGhyZWFkcykuCiAJICovCi0JaWYgKGNwdV9kZWVwZXN0X3NsZWVwID49 IDIgJiYgY3B1X3ZlbmRvcl9pZCA9PSBDUFVfVkVORE9SX0lOVEVMICYmCisJaWYgKGNwdV92ZW5k b3JfaWQgPT0gQ1BVX1ZFTkRPUl9JTlRFTCAmJgogCSAgICAoYW1kX3BtaW5mbyAmIEFNRFBNX1RT Q19JTlZBUklBTlQpID09IDApIHsKIAkJdHNjX3RpbWVjb3VudGVyLnRjX2ZsYWdzIHw9IFRDX0ZM QUdTX0MyU1RPUDsKIAkJaWYgKGJvb3R2ZXJib3NlKQo= --001a1144d05c0e02bb054947db7c--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAHNYxxMLX8kfJAuP-ua65d3UN1DH-BOU8i1vqRUdzAOVvgaH_w>