From owner-svn-src-head@freebsd.org Sat Nov 26 10:33:55 2016 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 37281C55BFF; Sat, 26 Nov 2016 10:33:55 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id E98EB10BB; Sat, 26 Nov 2016 10:33:54 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id uAQAXswj045483; Sat, 26 Nov 2016 10:33:54 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id uAQAXsX2045482; Sat, 26 Nov 2016 10:33:54 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201611261033.uAQAXsX2045482@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 26 Nov 2016 10:33:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r309189 - head/sys/x86/x86 X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Nov 2016 10:33:55 -0000 Author: kib Date: Sat Nov 26 10:33:53 2016 New Revision: 309189 URL: https://svnweb.freebsd.org/changeset/base/309189 Log: Fix automatic eventtimer hardware selection when ARAT (APIC-Timer-always-running) is not implemented. If machine has ncpus >= 8 and non-FSB interrupt routing from HPET, default HPET eventtimer quality 450 is reduced by 100, i.e. it is 350. On the other hand, LAPIC default quality is 600 and it is reduced by 200 if ARAT is not reported. We end up with HPET quality 350 < LAPIC quality 400, despite ARAT is not set. Then, since deep Cx states are active by default, eventtimer fail. E.g., on Nehalem Core i7 CPU and X58 chipset, LAPIC only works in C0/C1/C1E and HPET does not implement FSB mode, which otherwise requires manual switch to HPET to get working system. Set LAPIC eventtimer quality to 100 if no ARAT. While there, do not ignore deadlint TSC mode for LAPIC timer if ARAT is not implemented. If user manually selected LAPIC eventtimer on such CPU, there is no reason to not use deadline if available and not disabled administratively. Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/sys/x86/x86/local_apic.c Modified: head/sys/x86/x86/local_apic.c ============================================================================== --- head/sys/x86/x86/local_apic.c Sat Nov 26 10:20:33 2016 (r309188) +++ head/sys/x86/x86/local_apic.c Sat Nov 26 10:33:53 2016 (r309189) @@ -478,8 +478,9 @@ native_lapic_init(vm_paddr_t addr) lapic_et.et_quality = 600; if (!arat) { lapic_et.et_flags |= ET_FLAGS_C3STOP; - lapic_et.et_quality -= 200; - } else if ((cpu_feature & CPUID_TSC) != 0 && + lapic_et.et_quality = 100; + } + if ((cpu_feature & CPUID_TSC) != 0 && (cpu_feature2 & CPUID2_TSCDLT) != 0 && tsc_is_invariant && tsc_freq != 0) { lapic_timer_tsc_deadline = 1;