X86 and IA64: Update cpufreq statistic logic for supporting both x86

and ia64

Signed-off-by: Yu, Ke <ke.yu@intel.com>
Signed-off-by: Liu, Jinsong <jinsong.liu@intel.com>
This commit is contained in:
Keir Fraser committed 2008-09-26 14:05:09 +01:00
1 parent 6b4ce8b388
commit c06a7db0c5
6 files changed
+25 -35

No files matched your search

+1
View File
@@ -66,6 +66,7 @@ int xc_pm_get_pxstat(int xc_handle, int cpuid, struct xc_px_stat *pxpt)
sysctl.cmd = XEN_SYSCTL_get_pmstat;
sysctl.u.get_pmstat.type = PMSTAT_get_pxstat;
sysctl.u.get_pmstat.cpuid = cpuid;
sysctl.u.get_pmstat.u.getpx.total = max_px;
set_xen_guest_handle(sysctl.u.get_pmstat.u.getpx.trans_pt, pxpt->trans_pt);
set_xen_guest_handle(sysctl.u.get_pmstat.u.getpx.pt,
(pm_px_val_t *)pxpt->pt);
-10
View File
@@ -459,16 +459,6 @@ long arch_do_sysctl(xen_sysctl_t *op, XEN_GUEST_HANDLE(xen_sysctl_t) u_sysctl)
return ret;
}
int
do_get_pm_info(struct xen_sysctl_get_pmstat *op)
{
/*
* For now just place holder to compile.
* xen/common/sysctl.c refers this function.
*/
return -ENOSYS;
}
static unsigned long
dom0vp_ioremap(struct domain *d, unsigned long mpaddr, unsigned long size)
{
+3 -1
View File
@@ -307,6 +307,7 @@ static int acpi_cpufreq_target(struct cpufreq_policy *policy,
struct drv_cmd cmd;
unsigned int next_state = 0; /* Index into freq_table */
unsigned int next_perf_state = 0; /* Index into perf table */
unsigned int j;
int result = 0;
if (unlikely(data == NULL ||
@@ -369,7 +370,8 @@ static int acpi_cpufreq_target(struct cpufreq_policy *policy,
if (!check_freqs(cmd.mask, freqs.new, data))
return -EAGAIN;
cpufreq_statistic_update(cmd.mask, perf->state, next_perf_state);
for_each_cpu_mask(j, cmd.mask)
cpufreq_statistic_update(j, perf->state, next_perf_state);
perf->state = next_perf_state;
policy->cur = freqs.new;
+2
View File
@@ -126,6 +126,7 @@ int do_get_pm_info(struct xen_sysctl_get_pmstat *op)
break;
}
#ifdef CONFIG_X86
case PMSTAT_get_max_cx:
{
op->u.getcx.nr = pmstat_get_cx_nr(op->cpuid);
@@ -144,6 +145,7 @@ int do_get_pm_info(struct xen_sysctl_get_pmstat *op)
ret = pmstat_reset_cx_stat(op->cpuid);
break;
}
#endif
default:
printk("not defined sub-hypercall @ do_get_pm_info\n");
+18 -23
View File
@@ -39,36 +39,31 @@ struct cpufreq_policy *__read_mostly cpufreq_cpu_policy[NR_CPUS];
* Px STATISTIC INFO *
*********************************************************************/
void cpufreq_statistic_update(cpumask_t cpumask, uint8_t from, uint8_t to)
void cpufreq_statistic_update(unsigned int cpu, uint8_t from, uint8_t to)
{
uint32_t i;
uint64_t now;
struct pm_px *pxpt = cpufreq_statistic_data[cpu];
struct processor_pminfo *pmpt = processor_pminfo[cpu];
uint64_t total_idle_ns;
uint64_t tmp_idle_ns;
if ( !pxpt || !pmpt )
return;
now = NOW();
total_idle_ns = get_cpu_idle_time(cpu);
tmp_idle_ns = total_idle_ns - pxpt->prev_idle_wall;
for_each_cpu_mask(i, cpumask) {
struct pm_px *pxpt = cpufreq_statistic_data[i];
struct processor_pminfo *pmpt = processor_pminfo[i];
uint64_t total_idle_ns;
uint64_t tmp_idle_ns;
pxpt->u.last = from;
pxpt->u.cur = to;
pxpt->u.pt[to].count++;
pxpt->u.pt[from].residency += now - pxpt->prev_state_wall;
pxpt->u.pt[from].residency -= tmp_idle_ns;
if ( !pxpt || !pmpt )
continue;
(*(pxpt->u.trans_pt + from * pmpt->perf.state_count + to))++;
total_idle_ns = get_cpu_idle_time(i);
tmp_idle_ns = total_idle_ns - pxpt->prev_idle_wall;
pxpt->u.last = from;
pxpt->u.cur = to;
pxpt->u.pt[to].count++;
pxpt->u.pt[from].residency += now - pxpt->prev_state_wall;
pxpt->u.pt[from].residency -= tmp_idle_ns;
(*(pxpt->u.trans_pt + from * pmpt->perf.state_count + to))++;
pxpt->prev_state_wall = now;
pxpt->prev_idle_wall = total_idle_ns;
}
pxpt->prev_state_wall = now;
pxpt->prev_idle_wall = total_idle_ns;
}
int cpufreq_statistic_init(unsigned int cpuid)
+1 -1
View File
@@ -9,7 +9,7 @@
int get_cpu_id(u8);
int powernow_cpufreq_init(void);
void cpufreq_statistic_update(cpumask_t, uint8_t, uint8_t);
void cpufreq_statistic_update(unsigned int, uint8_t, uint8_t);
int cpufreq_statistic_init(unsigned int);
void cpufreq_statistic_exit(unsigned int);
void cpufreq_statistic_reset(unsigned int);
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.