From owner-svn-src-all@FreeBSD.ORG Tue Dec 7 22:34:51 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 AF2FE1065673; Tue, 7 Dec 2010 22:34:51 +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 6A43F8FC18; Tue, 7 Dec 2010 22:34:51 +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 oB7MYppU082114; Tue, 7 Dec 2010 22:34:51 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id oB7MYpor082111; Tue, 7 Dec 2010 22:34:51 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <201012072234.oB7MYpor082111@svn.freebsd.org> From: Jung-uk Kim Date: Tue, 7 Dec 2010 22:34:51 +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: r216275 - 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:34:51 -0000 Author: jkim Date: Tue Dec 7 22:34:51 2010 New Revision: 216275 URL: http://svn.freebsd.org/changeset/base/216275 Log: Do not register a event handler for CPU freqency changes when it is found P-state invariant. This is continuation of r216274. Modified: head/sys/amd64/amd64/identcpu.c head/sys/i386/i386/identcpu.c Modified: head/sys/amd64/amd64/identcpu.c ============================================================================== --- head/sys/amd64/amd64/identcpu.c Tue Dec 7 22:23:26 2010 (r216274) +++ head/sys/amd64/amd64/identcpu.c Tue Dec 7 22:34:51 2010 (r216275) @@ -109,6 +109,8 @@ static int hw_clockrate; SYSCTL_INT(_hw, OID_AUTO, clockrate, CTLFLAG_RD, &hw_clockrate, 0, "CPU instruction clock rate"); +static eventhandler_tag tsc_post_tag; + static char cpu_brand[48]; static struct { @@ -433,21 +435,31 @@ panicifcpuunsupported(void) /* Update TSC freq with the value indicated by the caller. */ static void -tsc_freq_changed(void *arg, const struct cf_level *level, int status) +tsc_freq_changed(void *arg __unused, const struct cf_level *level, int status) { /* * 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. */ hw_clockrate = level->total_set.freq; } -EVENTHANDLER_DEFINE(cpufreq_post_change, tsc_freq_changed, NULL, - EVENTHANDLER_PRI_ANY); +static void +hook_tsc_freq(void *arg __unused) +{ + + if (tsc_is_invariant) + return; + + tsc_post_tag = EVENTHANDLER_REGISTER(cpufreq_post_change, + tsc_freq_changed, NULL, EVENTHANDLER_PRI_ANY); +} + +SYSINIT(hook_tsc_freq, SI_SUB_CONFIGURE, SI_ORDER_ANY, hook_tsc_freq, NULL); /* * Final stage of CPU identification. Modified: head/sys/i386/i386/identcpu.c ============================================================================== --- head/sys/i386/i386/identcpu.c Tue Dec 7 22:23:26 2010 (r216274) +++ head/sys/i386/i386/identcpu.c Tue Dec 7 22:34:51 2010 (r216275) @@ -100,6 +100,8 @@ static int hw_clockrate; SYSCTL_INT(_hw, OID_AUTO, clockrate, CTLFLAG_RD, &hw_clockrate, 0, "CPU instruction clock rate"); +static eventhandler_tag tsc_post_tag; + static char cpu_brand[48]; #define MAX_BRAND_INDEX 8 @@ -1049,21 +1051,31 @@ identifycyrix(void) /* Update TSC freq with the value indicated by the caller. */ static void -tsc_freq_changed(void *arg, const struct cf_level *level, int status) +tsc_freq_changed(void *arg __unused, const struct cf_level *level, int status) { /* * 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. */ hw_clockrate = level->total_set.freq; } -EVENTHANDLER_DEFINE(cpufreq_post_change, tsc_freq_changed, NULL, - EVENTHANDLER_PRI_ANY); +static void +hook_tsc_freq(void *arg __unused) +{ + + if (tsc_is_invariant) + return; + + tsc_post_tag = EVENTHANDLER_REGISTER(cpufreq_post_change, + tsc_freq_changed, NULL, EVENTHANDLER_PRI_ANY); +} + +SYSINIT(hook_tsc_freq, SI_SUB_CONFIGURE, SI_ORDER_ANY, hook_tsc_freq, NULL); /* * Final stage of CPU identification. -- Should I check TI?