ia64/xen-unstable
changeset 18554:d1d9915041de
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>
and ia64
Signed-off-by: Yu, Ke <ke.yu@intel.com>
Signed-off-by: Liu, Jinsong <jinsong.liu@intel.com>
author | Keir Fraser <keir.fraser@citrix.com> |
---|---|
date | Fri Sep 26 14:05:09 2008 +0100 (2008-09-26) |
parents | 08374be21318 |
children | 19b0a4f91712 |
files | tools/libxc/xc_pm.c xen/arch/ia64/xen/dom0_ops.c xen/arch/x86/acpi/cpufreq/cpufreq.c xen/drivers/acpi/pmstat.c xen/drivers/cpufreq/utility.c xen/include/acpi/cpufreq/processor_perf.h |
line diff
1.1 --- a/tools/libxc/xc_pm.c Fri Sep 26 14:04:38 2008 +0100 1.2 +++ b/tools/libxc/xc_pm.c Fri Sep 26 14:05:09 2008 +0100 1.3 @@ -66,6 +66,7 @@ int xc_pm_get_pxstat(int xc_handle, int 1.4 sysctl.cmd = XEN_SYSCTL_get_pmstat; 1.5 sysctl.u.get_pmstat.type = PMSTAT_get_pxstat; 1.6 sysctl.u.get_pmstat.cpuid = cpuid; 1.7 + sysctl.u.get_pmstat.u.getpx.total = max_px; 1.8 set_xen_guest_handle(sysctl.u.get_pmstat.u.getpx.trans_pt, pxpt->trans_pt); 1.9 set_xen_guest_handle(sysctl.u.get_pmstat.u.getpx.pt, 1.10 (pm_px_val_t *)pxpt->pt);
2.1 --- a/xen/arch/ia64/xen/dom0_ops.c Fri Sep 26 14:04:38 2008 +0100 2.2 +++ b/xen/arch/ia64/xen/dom0_ops.c Fri Sep 26 14:05:09 2008 +0100 2.3 @@ -459,16 +459,6 @@ long arch_do_sysctl(xen_sysctl_t *op, XE 2.4 return ret; 2.5 } 2.6 2.7 -int 2.8 -do_get_pm_info(struct xen_sysctl_get_pmstat *op) 2.9 -{ 2.10 - /* 2.11 - * For now just place holder to compile. 2.12 - * xen/common/sysctl.c refers this function. 2.13 - */ 2.14 - return -ENOSYS; 2.15 -} 2.16 - 2.17 static unsigned long 2.18 dom0vp_ioremap(struct domain *d, unsigned long mpaddr, unsigned long size) 2.19 {
3.1 --- a/xen/arch/x86/acpi/cpufreq/cpufreq.c Fri Sep 26 14:04:38 2008 +0100 3.2 +++ b/xen/arch/x86/acpi/cpufreq/cpufreq.c Fri Sep 26 14:05:09 2008 +0100 3.3 @@ -307,6 +307,7 @@ static int acpi_cpufreq_target(struct cp 3.4 struct drv_cmd cmd; 3.5 unsigned int next_state = 0; /* Index into freq_table */ 3.6 unsigned int next_perf_state = 0; /* Index into perf table */ 3.7 + unsigned int j; 3.8 int result = 0; 3.9 3.10 if (unlikely(data == NULL || 3.11 @@ -369,7 +370,8 @@ static int acpi_cpufreq_target(struct cp 3.12 if (!check_freqs(cmd.mask, freqs.new, data)) 3.13 return -EAGAIN; 3.14 3.15 - cpufreq_statistic_update(cmd.mask, perf->state, next_perf_state); 3.16 + for_each_cpu_mask(j, cmd.mask) 3.17 + cpufreq_statistic_update(j, perf->state, next_perf_state); 3.18 3.19 perf->state = next_perf_state; 3.20 policy->cur = freqs.new;
4.1 --- a/xen/drivers/acpi/pmstat.c Fri Sep 26 14:04:38 2008 +0100 4.2 +++ b/xen/drivers/acpi/pmstat.c Fri Sep 26 14:05:09 2008 +0100 4.3 @@ -126,6 +126,7 @@ int do_get_pm_info(struct xen_sysctl_get 4.4 break; 4.5 } 4.6 4.7 +#ifdef CONFIG_X86 4.8 case PMSTAT_get_max_cx: 4.9 { 4.10 op->u.getcx.nr = pmstat_get_cx_nr(op->cpuid); 4.11 @@ -144,6 +145,7 @@ int do_get_pm_info(struct xen_sysctl_get 4.12 ret = pmstat_reset_cx_stat(op->cpuid); 4.13 break; 4.14 } 4.15 +#endif 4.16 4.17 default: 4.18 printk("not defined sub-hypercall @ do_get_pm_info\n");
5.1 --- a/xen/drivers/cpufreq/utility.c Fri Sep 26 14:04:38 2008 +0100 5.2 +++ b/xen/drivers/cpufreq/utility.c Fri Sep 26 14:05:09 2008 +0100 5.3 @@ -39,36 +39,31 @@ struct cpufreq_policy *__read_mostly c 5.4 * Px STATISTIC INFO * 5.5 *********************************************************************/ 5.6 5.7 -void cpufreq_statistic_update(cpumask_t cpumask, uint8_t from, uint8_t to) 5.8 +void cpufreq_statistic_update(unsigned int cpu, uint8_t from, uint8_t to) 5.9 { 5.10 - uint32_t i; 5.11 uint64_t now; 5.12 + struct pm_px *pxpt = cpufreq_statistic_data[cpu]; 5.13 + struct processor_pminfo *pmpt = processor_pminfo[cpu]; 5.14 + uint64_t total_idle_ns; 5.15 + uint64_t tmp_idle_ns; 5.16 + 5.17 + if ( !pxpt || !pmpt ) 5.18 + return; 5.19 5.20 now = NOW(); 5.21 - 5.22 - for_each_cpu_mask(i, cpumask) { 5.23 - struct pm_px *pxpt = cpufreq_statistic_data[i]; 5.24 - struct processor_pminfo *pmpt = processor_pminfo[i]; 5.25 - uint64_t total_idle_ns; 5.26 - uint64_t tmp_idle_ns; 5.27 - 5.28 - if ( !pxpt || !pmpt ) 5.29 - continue; 5.30 + total_idle_ns = get_cpu_idle_time(cpu); 5.31 + tmp_idle_ns = total_idle_ns - pxpt->prev_idle_wall; 5.32 5.33 - total_idle_ns = get_cpu_idle_time(i); 5.34 - tmp_idle_ns = total_idle_ns - pxpt->prev_idle_wall; 5.35 + pxpt->u.last = from; 5.36 + pxpt->u.cur = to; 5.37 + pxpt->u.pt[to].count++; 5.38 + pxpt->u.pt[from].residency += now - pxpt->prev_state_wall; 5.39 + pxpt->u.pt[from].residency -= tmp_idle_ns; 5.40 5.41 - pxpt->u.last = from; 5.42 - pxpt->u.cur = to; 5.43 - pxpt->u.pt[to].count++; 5.44 - pxpt->u.pt[from].residency += now - pxpt->prev_state_wall; 5.45 - pxpt->u.pt[from].residency -= tmp_idle_ns; 5.46 + (*(pxpt->u.trans_pt + from * pmpt->perf.state_count + to))++; 5.47 5.48 - (*(pxpt->u.trans_pt + from * pmpt->perf.state_count + to))++; 5.49 - 5.50 - pxpt->prev_state_wall = now; 5.51 - pxpt->prev_idle_wall = total_idle_ns; 5.52 - } 5.53 + pxpt->prev_state_wall = now; 5.54 + pxpt->prev_idle_wall = total_idle_ns; 5.55 } 5.56 5.57 int cpufreq_statistic_init(unsigned int cpuid)
6.1 --- a/xen/include/acpi/cpufreq/processor_perf.h Fri Sep 26 14:04:38 2008 +0100 6.2 +++ b/xen/include/acpi/cpufreq/processor_perf.h Fri Sep 26 14:05:09 2008 +0100 6.3 @@ -9,7 +9,7 @@ 6.4 int get_cpu_id(u8); 6.5 int powernow_cpufreq_init(void); 6.6 6.7 -void cpufreq_statistic_update(cpumask_t, uint8_t, uint8_t); 6.8 +void cpufreq_statistic_update(unsigned int, uint8_t, uint8_t); 6.9 int cpufreq_statistic_init(unsigned int); 6.10 void cpufreq_statistic_exit(unsigned int); 6.11 void cpufreq_statistic_reset(unsigned int);