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.
This commit is contained in:
Jung-uk Kim 2010-12-07 22:23:26 +00:00
parent 78a661bbaa
commit 4a9c4056dc
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=216274
2 changed files with 16 additions and 20 deletions

View File

@ -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 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. */

View File

@ -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 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. */