diff options
author | Mark Haywood <Mark.Haywood@Sun.COM> | 2009-01-27 14:26:26 -0500 |
---|---|---|
committer | Mark Haywood <Mark.Haywood@Sun.COM> | 2009-01-27 14:26:26 -0500 |
commit | fcddbe1ff917b2a8770cd3575f46e72601a06df6 (patch) | |
tree | bdcc3dce66b5719a154b4122023fc2d9f76395c1 /usr/src/uts/common/io/cpudrv.c | |
parent | 5002eb587d788b087976d3dc1f1a50b902f39da7 (diff) | |
download | illumos-joyent-fcddbe1ff917b2a8770cd3575f46e72601a06df6.tar.gz |
6779002 BAD TRAP: type=0 (#de Divide error) rp=ffffff001ef0ea60 addr=ffffff05112c51a0
Diffstat (limited to 'usr/src/uts/common/io/cpudrv.c')
-rw-r--r-- | usr/src/uts/common/io/cpudrv.c | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/usr/src/uts/common/io/cpudrv.c b/usr/src/uts/common/io/cpudrv.c index 4bf1f707cd..6f329fad4c 100644 --- a/usr/src/uts/common/io/cpudrv.c +++ b/usr/src/uts/common/io/cpudrv.c @@ -19,7 +19,7 @@ * CDDL HEADER END */ /* - * Copyright 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright 2009 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ @@ -587,7 +587,7 @@ cpudrv_power(dev_info_t *dip, int comp, int level) cpupm->lastquan_mstate[CMS_IDLE] = 0; cpupm->lastquan_mstate[CMS_SYSTEM] = 0; cpupm->lastquan_mstate[CMS_USER] = 0; - cpupm->lastquan_lbolt = 0; + cpupm->lastquan_ticks = 0; cpupm->cur_spd = new_spd; CPUDRV_PM_RESET_GOVERNOR_THREAD(cpupm); mutex_exit(&cpudsp->lock); @@ -953,7 +953,8 @@ cpudrv_pm_monitor(void *arg) cpu_t *cp; dev_info_t *dip; uint_t idle_cnt, user_cnt, system_cnt; - clock_t lbolt_cnt; + clock_t ticks; + uint_t tick_cnt; hrtime_t msnsecs[NCMSTATES]; boolean_t is_ready; @@ -1044,8 +1045,8 @@ cpudrv_pm_monitor(void *arg) * We can't do anything when we have just switched to a state * because there is no valid timestamp. */ - if (cpupm->lastquan_lbolt == 0) { - cpupm->lastquan_lbolt = lbolt; + if (cpupm->lastquan_ticks == 0) { + cpupm->lastquan_ticks = NSEC_TO_TICK(gethrtime()); mutex_exit(&cpu_lock); CPUDRV_PM_MONITOR_INIT(cpudsp); mutex_exit(&cpudsp->lock); @@ -1057,12 +1058,14 @@ cpudrv_pm_monitor(void *arg) * exactly at the requested period. This is not guaranteed * because this routine is called from a taskq that is dispatched * from a timeout routine. Handle this by finding out how many - * ticks have elapsed since the last call (lbolt_cnt) and adjusting + * ticks have elapsed since the last call and adjusting * the idle_cnt based on the delay added to the requested period * by timeout and taskq. */ - lbolt_cnt = lbolt - cpupm->lastquan_lbolt; - cpupm->lastquan_lbolt = lbolt; + ticks = NSEC_TO_TICK(gethrtime()); + tick_cnt = ticks - cpupm->lastquan_ticks; + ASSERT(tick_cnt != 0); + cpupm->lastquan_ticks = ticks; mutex_exit(&cpu_lock); /* * Time taken between recording the current counts and @@ -1085,18 +1088,19 @@ cpudrv_pm_monitor(void *arg) * the following DPRINTF. PROM calls generated by other * DPRINTFs changes the timing. */ - if (lbolt_cnt > cur_spd->quant_cnt) { + if (tick_cnt > cur_spd->quant_cnt) { DPRINTF(D_PM_MONITOR_DELAY, ("cpudrv_pm_monitor: instance %d: " - "lbolt count %ld > quantum_count %u\n", - ddi_get_instance(dip), lbolt_cnt, cur_spd->quant_cnt)); + "tick count %d > quantum_count %u\n", + ddi_get_instance(dip), tick_cnt, cur_spd->quant_cnt)); } #endif /* DEBUG */ /* * Adjust counts based on the delay added by timeout and taskq. */ - idle_cnt = (idle_cnt * cur_spd->quant_cnt) / lbolt_cnt; - user_cnt = (user_cnt * cur_spd->quant_cnt) / lbolt_cnt; + idle_cnt = (idle_cnt * cur_spd->quant_cnt) / tick_cnt; + user_cnt = (user_cnt * cur_spd->quant_cnt) / tick_cnt; + if ((user_cnt > cur_spd->user_hwm) || (idle_cnt < cur_spd->idle_lwm && cur_spd->idle_blwm_cnt >= cpudrv_pm_idle_blwm_cnt_max)) { cur_spd->idle_blwm_cnt = 0; |