From owner-svn-src-all@FreeBSD.ORG Tue Dec 7 22:23:26 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id BA6461065675; Tue, 7 Dec 2010 22:23:26 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id AAA018FC08; Tue, 7 Dec 2010 22:23:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id oB7MNQIo081849; Tue, 7 Dec 2010 22:23:26 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oB7MNQpM081846; Tue, 7 Dec 2010 22:23:26 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201012072223.oB7MNQpM081846@svn.freebsd.org> From: Jung-uk Kim Date: Tue, 7 Dec 2010 22:23:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r216274 - in head/sys: amd64/amd64 i386/i386 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 07 Dec 2010 22:23:26 -0000 Author: jkim Date: Tue Dec 7 22:23:26 2010 New Revision: 216274 URL: http://svn.freebsd.org/changeset/base/216274 Log: Now the P-state invariant TSC is probed early enough, do not register event handlers for CPU freqency changes when it is found P-state invariant. Adjust a comment about non-existent tsc_freq_max() while I am here. Modified: head/sys/amd64/amd64/tsc.c head/sys/i386/i386/tsc.c Modified: head/sys/amd64/amd64/tsc.c ============================================================================== --- head/sys/amd64/amd64/tsc.c Tue Dec 7 22:16:37 2010 (r216273) +++ head/sys/amd64/amd64/tsc.c Tue Dec 7 22:23:26 2010 (r216274) @@ -118,13 +118,15 @@ init_TSC(void) } /* - * Inform CPU accounting about our boot-time clock rate. Once the - * system is finished booting, we will get the real max clock rate - * via tsc_freq_max(). This also will be updated if someone loads - * a cpufreq driver after boot that discovers a new max frequency. + * Inform CPU accounting about our boot-time clock rate. This will + * be updated if someone loads a cpufreq driver after boot that + * discovers a new max frequency. */ set_cputicker(rdtsc, tsc_freq, 1); + if (tsc_is_invariant) + return; + /* Register to find out about changes in CPU frequency. */ tsc_pre_tag = EVENTHANDLER_REGISTER(cpufreq_pre_change, tsc_freq_changing, NULL, EVENTHANDLER_PRI_FIRST); @@ -169,9 +171,6 @@ tsc_levels_changed(void *arg, int unit) int count, error; uint64_t max_freq; - if (tsc_is_invariant) - return; - /* Only use values from the first CPU, assuming all are equal. */ if (unit != 0) return; @@ -205,8 +204,7 @@ static void tsc_freq_changing(void *arg, const struct cf_level *level, int *status) { - if (*status != 0 || timecounter != &tsc_timecounter || - tsc_is_invariant) + if (*status != 0 || timecounter != &tsc_timecounter) return; printf("timecounter TSC must not be in use when " @@ -222,7 +220,7 @@ tsc_freq_changed(void *arg, const struct * If there was an error during the transition or * TSC is P-state invariant, don't do anything. */ - if (status != 0 || tsc_is_invariant) + if (status != 0) return; /* Total setting for this level gives the new frequency in MHz. */ Modified: head/sys/i386/i386/tsc.c ============================================================================== --- head/sys/i386/i386/tsc.c Tue Dec 7 22:16:37 2010 (r216273) +++ head/sys/i386/i386/tsc.c Tue Dec 7 22:23:26 2010 (r216274) @@ -127,13 +127,15 @@ init_TSC(void) } /* - * Inform CPU accounting about our boot-time clock rate. Once the - * system is finished booting, we will get the real max clock rate - * via tsc_freq_max(). This also will be updated if someone loads - * a cpufreq driver after boot that discovers a new max frequency. + * Inform CPU accounting about our boot-time clock rate. This will + * be updated if someone loads a cpufreq driver after boot that + * discovers a new max frequency. */ set_cputicker(rdtsc, tsc_freq, 1); + if (tsc_is_invariant) + return; + /* Register to find out about changes in CPU frequency. */ tsc_pre_tag = EVENTHANDLER_REGISTER(cpufreq_pre_change, tsc_freq_changing, NULL, EVENTHANDLER_PRI_FIRST); @@ -197,9 +199,6 @@ tsc_levels_changed(void *arg, int unit) int count, error; uint64_t max_freq; - if (tsc_is_invariant) - return; - /* Only use values from the first CPU, assuming all are equal. */ if (unit != 0) return; @@ -233,8 +232,7 @@ static void tsc_freq_changing(void *arg, const struct cf_level *level, int *status) { - if (*status != 0 || timecounter != &tsc_timecounter || - tsc_is_invariant) + if (*status != 0 || timecounter != &tsc_timecounter) return; printf("timecounter TSC must not be in use when " @@ -250,7 +248,7 @@ tsc_freq_changed(void *arg, const struct * If there was an error during the transition or * TSC is P-state invariant, don't do anything. */ - if (status != 0 || tsc_is_invariant) + if (status != 0) return; /* Total setting for this level gives the new frequency in MHz. */