svn commit: r309189 - head/sys/x86/x86

Konstantin Belousov kib at FreeBSD.org
Sat Nov 26 10:33:55 UTC 2016


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;


More information about the svn-src-all mailing list