# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1222434309 -3600
# Node ID d1d9915041de9083ee1332c79107aa2740eede03
# Parent 08374be213188c10eb7c170c143ca0d0d17e55d8
X86 and IA64: Update cpufreq statistic logic for supporting both x86
and ia64
Signed-off-by: Yu, Ke <ke.yu@xxxxxxxxx>
Signed-off-by: Liu, Jinsong <jinsong.liu@xxxxxxxxx>
---
tools/libxc/xc_pm.c | 1
xen/arch/ia64/xen/dom0_ops.c | 10 ------
xen/arch/x86/acpi/cpufreq/cpufreq.c | 4 +-
xen/drivers/acpi/pmstat.c | 2 +
xen/drivers/cpufreq/utility.c | 49 +++++++++++++-----------------
xen/include/acpi/cpufreq/processor_perf.h | 2 -
6 files changed, 29 insertions(+), 39 deletions(-)
diff -r 08374be21318 -r d1d9915041de tools/libxc/xc_pm.c
--- a/tools/libxc/xc_pm.c Fri Sep 26 14:04:38 2008 +0100
+++ b/tools/libxc/xc_pm.c Fri Sep 26 14:05:09 2008 +0100
@@ -66,6 +66,7 @@ int xc_pm_get_pxstat(int xc_handle, int
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);
diff -r 08374be21318 -r d1d9915041de xen/arch/ia64/xen/dom0_ops.c
--- a/xen/arch/ia64/xen/dom0_ops.c Fri Sep 26 14:04:38 2008 +0100
+++ b/xen/arch/ia64/xen/dom0_ops.c Fri Sep 26 14:05:09 2008 +0100
@@ -459,16 +459,6 @@ long arch_do_sysctl(xen_sysctl_t *op, XE
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)
{
diff -r 08374be21318 -r d1d9915041de xen/arch/x86/acpi/cpufreq/cpufreq.c
--- a/xen/arch/x86/acpi/cpufreq/cpufreq.c Fri Sep 26 14:04:38 2008 +0100
+++ b/xen/arch/x86/acpi/cpufreq/cpufreq.c Fri Sep 26 14:05:09 2008 +0100
@@ -307,6 +307,7 @@ static int acpi_cpufreq_target(struct cp
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 cp
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;
diff -r 08374be21318 -r d1d9915041de xen/drivers/acpi/pmstat.c
--- a/xen/drivers/acpi/pmstat.c Fri Sep 26 14:04:38 2008 +0100
+++ b/xen/drivers/acpi/pmstat.c Fri Sep 26 14:05:09 2008 +0100
@@ -126,6 +126,7 @@ int do_get_pm_info(struct xen_sysctl_get
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
ret = pmstat_reset_cx_stat(op->cpuid);
break;
}
+#endif
default:
printk("not defined sub-hypercall @ do_get_pm_info\n");
diff -r 08374be21318 -r d1d9915041de xen/drivers/cpufreq/utility.c
--- a/xen/drivers/cpufreq/utility.c Fri Sep 26 14:04:38 2008 +0100
+++ b/xen/drivers/cpufreq/utility.c Fri Sep 26 14:05:09 2008 +0100
@@ -39,36 +39,31 @@ struct cpufreq_policy *__read_mostly c
* Px STATISTIC INFO *
*********************************************************************/
-void cpufreq_statistic_update(cpumask_t cpumask, uint8_t from, uint8_t to)
-{
- uint32_t i;
+void cpufreq_statistic_update(unsigned int cpu, uint8_t from, uint8_t to)
+{
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();
-
- 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;
-
- if ( !pxpt || !pmpt )
- continue;
-
- 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;
- }
+ total_idle_ns = get_cpu_idle_time(cpu);
+ 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;
}
int cpufreq_statistic_init(unsigned int cpuid)
diff -r 08374be21318 -r d1d9915041de xen/include/acpi/cpufreq/processor_perf.h
--- a/xen/include/acpi/cpufreq/processor_perf.h Fri Sep 26 14:04:38 2008 +0100
+++ b/xen/include/acpi/cpufreq/processor_perf.h Fri Sep 26 14:05:09 2008 +0100
@@ -9,7 +9,7 @@ int get_cpu_id(u8);
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);
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|