Author: jkim Date: Tue Apr 12 22:15:46 2011 New Revision: 220579 URL: http://svn.freebsd.org/changeset/base/220579
Log: Probe capability to find effective frequency. When the TSC is P-state invariant, APERF/MPERF ratio can be used to find effective frequency. Modified: head/sys/amd64/amd64/identcpu.c head/sys/i386/i386/identcpu.c head/sys/x86/x86/tsc.c Modified: head/sys/amd64/amd64/identcpu.c ============================================================================== --- head/sys/amd64/amd64/identcpu.c Tue Apr 12 22:12:23 2011 (r220578) +++ head/sys/amd64/amd64/identcpu.c Tue Apr 12 22:15:46 2011 (r220579) @@ -396,8 +396,11 @@ printcpuinfo(void) * If this CPU supports P-state invariant TSC then * mention the capability. */ - if (tsc_is_invariant) + if (tsc_is_invariant) { printf("\n TSC: P-state invariant"); + if (tsc_perf_stat) + printf(", performance statistics"); + } } } Modified: head/sys/i386/i386/identcpu.c ============================================================================== --- head/sys/i386/i386/identcpu.c Tue Apr 12 22:12:23 2011 (r220578) +++ head/sys/i386/i386/identcpu.c Tue Apr 12 22:15:46 2011 (r220579) @@ -873,8 +873,11 @@ printcpuinfo(void) * If this CPU supports P-state invariant TSC then * mention the capability. */ - if (tsc_is_invariant) + if (tsc_is_invariant) { printf("\n TSC: P-state invariant"); + if (tsc_perf_stat) + printf(", performance statistics"); + } } } else if (cpu_vendor_id == CPU_VENDOR_CYRIX) { Modified: head/sys/x86/x86/tsc.c ============================================================================== --- head/sys/x86/x86/tsc.c Tue Apr 12 22:12:23 2011 (r220578) +++ head/sys/x86/x86/tsc.c Tue Apr 12 22:15:46 2011 (r220579) @@ -49,6 +49,8 @@ __FBSDID("$FreeBSD$"); uint64_t tsc_freq; int tsc_is_invariant; +int tsc_perf_stat; + static eventhandler_tag tsc_levels_tag, tsc_pre_tag, tsc_post_tag; SYSCTL_INT(_kern_timecounter, OID_AUTO, invariant_tsc, CTLFLAG_RDTUN, @@ -151,6 +153,7 @@ tsc_freq_intel(void) static void probe_tsc_freq(void) { + u_int regs[4]; uint64_t tsc1, tsc2; switch (cpu_vendor_id) { @@ -178,6 +181,12 @@ probe_tsc_freq(void) break; } + if (cpu_high >= 6) { + do_cpuid(6, regs); + if ((regs[2] & CPUID_PERF_STAT) != 0) + tsc_perf_stat = 1; + } + if (tsc_skip_calibration) { if (cpu_vendor_id == CPU_VENDOR_INTEL) tsc_freq_intel(); _______________________________________________ svn-src-all@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"