diff options
author | Keir Fraser <keir.fraser@citrix.com> | 2010-05-14 20:37:02 +0100 |
---|---|---|
committer | Keir Fraser <keir.fraser@citrix.com> | 2010-05-14 20:37:02 +0100 |
commit | 7f01473211b2586130c653d3b1ac15acc082d4df (patch) | |
tree | 48cda4464ba8a8ff424e5c3d7dd9d0aa3a9fa9c3 /xen/common/perfc.c | |
parent | f9ffb1134c8be2f6bffd14578c179d3f12371abd (diff) | |
download | xen-7f01473211b2586130c653d3b1ac15acc082d4df.tar.gz xen-7f01473211b2586130c653d3b1ac15acc082d4df.tar.bz2 xen-7f01473211b2586130c653d3b1ac15acc082d4df.zip |
Remove many uses of cpu_possible_map and iterators over NR_CPUS.
The significant remaining culprits for x86 are credit2, hpet, and
percpu-area subsystems. To be dealt with in a separate patch.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
Diffstat (limited to 'xen/common/perfc.c')
-rw-r--r-- | xen/common/perfc.c | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/xen/common/perfc.c b/xen/common/perfc.c index 5e1e196a5f..3d30556ea6 100644 --- a/xen/common/perfc.c +++ b/xen/common/perfc.c @@ -114,8 +114,6 @@ void perfc_printall(unsigned char key) } printk("\n"); } - - arch_perfc_printall(); } void perfc_reset(unsigned char key) @@ -136,13 +134,13 @@ void perfc_reset(unsigned char key) switch ( perfc_info[i].type ) { case TYPE_SINGLE: - for_each_possible_cpu ( cpu ) + for_each_online_cpu ( cpu ) per_cpu(perfcounters, cpu)[j] = 0; case TYPE_S_SINGLE: ++j; break; case TYPE_ARRAY: - for_each_possible_cpu ( cpu ) + for_each_online_cpu ( cpu ) memset(per_cpu(perfcounters, cpu) + j, 0, perfc_info[i].nr_elements * sizeof(perfc_t)); case TYPE_S_ARRAY: @@ -157,15 +155,22 @@ void perfc_reset(unsigned char key) static xen_sysctl_perfc_desc_t perfc_d[NR_PERFCTRS]; static xen_sysctl_perfc_val_t *perfc_vals; static unsigned int perfc_nbr_vals; -static int perfc_init = 0; +static cpumask_t perfc_cpumap; + static int perfc_copy_info(XEN_GUEST_HANDLE_64(xen_sysctl_perfc_desc_t) desc, XEN_GUEST_HANDLE_64(xen_sysctl_perfc_val_t) val) { unsigned int i, j, v; /* We only copy the name and array-size information once. */ - if ( !perfc_init ) + if ( !cpus_equal(cpu_online_map, perfc_cpumap) ) { + unsigned int nr_cpus; + perfc_cpumap = cpu_online_map; + nr_cpus = cpus_weight(perfc_cpumap); + + perfc_nbr_vals = 0; + for ( i = 0; i < NR_PERFCTRS; i++ ) { safe_strcpy(perfc_d[i].name, perfc_info[i].name); @@ -174,7 +179,7 @@ static int perfc_copy_info(XEN_GUEST_HANDLE_64(xen_sysctl_perfc_desc_t) desc, { case TYPE_SINGLE: case TYPE_S_SINGLE: - perfc_d[i].nr_vals = num_possible_cpus(); + perfc_d[i].nr_vals = nr_cpus; break; case TYPE_ARRAY: case TYPE_S_ARRAY: @@ -183,8 +188,9 @@ static int perfc_copy_info(XEN_GUEST_HANDLE_64(xen_sysctl_perfc_desc_t) desc, } perfc_nbr_vals += perfc_d[i].nr_vals; } + + xfree(perfc_vals); perfc_vals = xmalloc_array(xen_sysctl_perfc_val_t, perfc_nbr_vals); - perfc_init = 1; } if ( guest_handle_is_null(desc) ) @@ -205,14 +211,14 @@ static int perfc_copy_info(XEN_GUEST_HANDLE_64(xen_sysctl_perfc_desc_t) desc, { case TYPE_SINGLE: case TYPE_S_SINGLE: - for_each_possible_cpu ( cpu ) + for_each_cpu_mask ( cpu, perfc_cpumap ) perfc_vals[v++] = per_cpu(perfcounters, cpu)[j]; ++j; break; case TYPE_ARRAY: case TYPE_S_ARRAY: memset(perfc_vals + v, 0, perfc_d[i].nr_vals * sizeof(*perfc_vals)); - for_each_possible_cpu ( cpu ) + for_each_cpu_mask ( cpu, perfc_cpumap ) { perfc_t *counters = per_cpu(perfcounters, cpu) + j; unsigned int k; |