[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen-unstable] Rename for_each_cpu() to for_each_possible_cpu()



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1247660150 -3600
# Node ID 91407452cdb62f427c74e227956dc34a107cab46
# Parent  faa216e744ad8199ede2df753ae88fdfe816d5bb
Rename for_each_cpu() to for_each_possible_cpu()

... to be more precise in naming, and also to match Linux.

Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>
---
 xen/arch/ia64/linux-xen/perfmon.c           |   18 +++++++++---------
 xen/arch/ia64/linux-xen/smpboot.c           |    6 +++---
 xen/arch/ia64/linux-xen/sn/kernel/sn2_smp.c |    4 ++--
 xen/arch/ia64/xen/privop_stat.c             |    4 ++--
 xen/arch/ia64/xen/xensetup.c                |    3 +--
 xen/arch/x86/hpet.c                         |    2 +-
 xen/arch/x86/nmi.c                          |    2 +-
 xen/arch/x86/smpboot.c                      |    2 +-
 xen/arch/x86/time.c                         |    2 +-
 xen/common/perfc.c                          |    8 ++++----
 xen/common/schedule.c                       |    2 +-
 xen/common/timer.c                          |    2 +-
 xen/common/tmem_xen.c                       |    2 +-
 xen/include/xen/cpumask.h                   |    8 ++++----
 14 files changed, 32 insertions(+), 33 deletions(-)

diff -r faa216e744ad -r 91407452cdb6 xen/arch/ia64/linux-xen/perfmon.c
--- a/xen/arch/ia64/linux-xen/perfmon.c Wed Jul 15 13:07:30 2009 +0100
+++ b/xen/arch/ia64/linux-xen/perfmon.c Wed Jul 15 13:15:50 2009 +0100
@@ -7313,7 +7313,7 @@ xenpfm_context_create(XEN_GUEST_HANDLE(p
                goto out;
 
        /* XXX fmt */
-       for_each_cpu(cpu) {
+       for_each_possible_cpu(cpu) {
                ctx[cpu] = pfm_context_create(&kreq);
                if (ctx[cpu] == NULL) {
                        error = -ENOMEM;
@@ -7325,20 +7325,20 @@ xenpfm_context_create(XEN_GUEST_HANDLE(p
 
        BUG_ON(in_irq());
        spin_lock(&xenpfm_context_lock);
-       for_each_cpu(cpu) {
+       for_each_possible_cpu(cpu) {
                if (per_cpu(xenpfm_context, cpu) != NULL) {
                        error = -EBUSY;
                        break;
                }
        }
-       for_each_cpu(cpu) {
+       for_each_possible_cpu(cpu) {
                per_cpu(xenpfm_context, cpu) = ctx[cpu];
                ctx[cpu] = NULL;
        }
        spin_unlock(&xenpfm_context_lock);
 
 out:
-       for_each_cpu(cpu) {
+       for_each_possible_cpu(cpu) {
                if (ctx[cpu] != NULL)
                        pfm_context_free(ctx[cpu]);
        }
@@ -7358,7 +7358,7 @@ again:
        need_unload = 0;
        BUG_ON(in_irq());
        spin_lock_irqsave(&xenpfm_context_lock, flags);
-       for_each_cpu(cpu) {
+       for_each_possible_cpu(cpu) {
                ctx = per_cpu(xenpfm_context, cpu);
                if (ctx == NULL) {
                        error = -EINVAL;
@@ -7369,7 +7369,7 @@ again:
                        need_unload = 1;
        }
        if (error) {
-               for_each_cpu(cpu) {
+               for_each_possible_cpu(cpu) {
                        ctx = per_cpu(xenpfm_context, cpu);
                        if (ctx == NULL)
                                break;
@@ -7378,7 +7378,7 @@ again:
                goto out;
        }
        if (need_unload) {
-               for_each_cpu(cpu)
+               for_each_possible_cpu(cpu)
                        UNPROTECT_CTX_NOIRQ(per_cpu(xenpfm_context, cpu));
                spin_unlock_irqrestore(&xenpfm_context_lock, flags);
 
@@ -7388,7 +7388,7 @@ again:
                goto again;
        }
 
-       for_each_cpu(cpu) {
+       for_each_possible_cpu(cpu) {
                pfm_context_t* ctx = per_cpu(xenpfm_context, cpu);
                per_cpu(xenpfm_context, cpu) = NULL;
 
@@ -7740,7 +7740,7 @@ xenpfm_start_stop_locked(int is_start)
        arg.is_start = is_start;
        atomic_set(&arg.started, 1); /* 1 for this cpu */
        atomic_set(&arg.finished, 0);
-       for_each_cpu(cpu)
+       for_each_possible_cpu(cpu)
                arg.error[cpu] = 0;
 
        BUG_ON(!spin_is_locked(&xenpfm_context_lock));
diff -r faa216e744ad -r 91407452cdb6 xen/arch/ia64/linux-xen/smpboot.c
--- a/xen/arch/ia64/linux-xen/smpboot.c Wed Jul 15 13:07:30 2009 +0100
+++ b/xen/arch/ia64/linux-xen/smpboot.c Wed Jul 15 13:15:50 2009 +0100
@@ -675,7 +675,7 @@ remove_from_mtinfo(int cpu)
 {
        int i;
 
-       for_each_cpu(i)
+       for_each_possible_cpu(i)
                if (mt_info[i].valid &&  mt_info[i].socket_id ==
                                                cpu_data(cpu)->socket_id)
                        mt_info[i].valid = 0;
@@ -874,7 +874,7 @@ check_for_mtinfo_index(void)
 {
        int i;
        
-       for_each_cpu(i)
+       for_each_possible_cpu(i)
                if (!mt_info[i].valid)
                        return i;
 
@@ -892,7 +892,7 @@ check_for_new_socket(__u16 logical_addre
        int i;
        __u32 sid = c->socket_id;
 
-       for_each_cpu(i) {
+       for_each_possible_cpu(i) {
                if (mt_info[i].valid && mt_info[i].proc_fixed_addr == 
logical_address
                    && mt_info[i].socket_id == sid) {
                        c->core_id = mt_info[i].core_id;
diff -r faa216e744ad -r 91407452cdb6 xen/arch/ia64/linux-xen/sn/kernel/sn2_smp.c
--- a/xen/arch/ia64/linux-xen/sn/kernel/sn2_smp.c       Wed Jul 15 13:07:30 
2009 +0100
+++ b/xen/arch/ia64/linux-xen/sn/kernel/sn2_smp.c       Wed Jul 15 13:15:50 
2009 +0100
@@ -211,7 +211,7 @@ sn2_global_tlb_purge(unsigned long start
        spin_lock(&sn2_ptcg_lock2);
        node_set(cpu_to_node(smp_processor_id()), nodes_flushed);
        i = 0;
-       for_each_cpu(cpu) {
+       for_each_possible_cpu(cpu) {
                cnode = cpu_to_node(cpu);
                if (!node_isset(cnode, nodes_flushed)) {
                        cpu_set(cpu, selected_cpus);
@@ -269,7 +269,7 @@ sn2_global_tlb_purge(struct mm_struct *m
                i++;
        }
 #else
-       for_each_cpu(cpu) {
+       for_each_possible_cpu(cpu) {
                cnode = cpu_to_node(cpu);
                node_set(cnode, nodes_flushed);
                lcpu = cpu;
diff -r faa216e744ad -r 91407452cdb6 xen/arch/ia64/xen/privop_stat.c
--- a/xen/arch/ia64/xen/privop_stat.c   Wed Jul 15 13:07:30 2009 +0100
+++ b/xen/arch/ia64/xen/privop_stat.c   Wed Jul 15 13:15:50 2009 +0100
@@ -65,7 +65,7 @@ void gather_privop_addrs(void)
 {
        unsigned int cpu;
 
-       for_each_cpu ( cpu ) {
+       for_each_possible_cpu ( cpu ) {
                perfc_t *perfcounters = per_cpu(perfcounters, cpu);
                struct privop_addr_count *s = per_cpu(privop_addr_counter, cpu);
                int i, j;
@@ -92,7 +92,7 @@ void reset_privop_addrs(void)
 {
        unsigned int cpu;
 
-       for_each_cpu ( cpu ) {
+       for_each_possible_cpu ( cpu ) {
                struct privop_addr_count *v = per_cpu(privop_addr_counter, cpu);
                int i, j;
 
diff -r faa216e744ad -r 91407452cdb6 xen/arch/ia64/xen/xensetup.c
--- a/xen/arch/ia64/xen/xensetup.c      Wed Jul 15 13:07:30 2009 +0100
+++ b/xen/arch/ia64/xen/xensetup.c      Wed Jul 15 13:15:50 2009 +0100
@@ -606,8 +606,7 @@ skip_move:
     smp_prepare_cpus(max_cpus);
 
     /* We aren't hotplug-capable yet. */
-    for_each_cpu ( i )
-        cpu_set(i, cpu_present_map);
+    cpus_or(cpu_present_map, cpu_present_map, cpu_possible_map);
 
     /*  Enable IRQ to receive IPI (needed for ITC sync).  */
     local_irq_enable();
diff -r faa216e744ad -r 91407452cdb6 xen/arch/x86/hpet.c
--- a/xen/arch/x86/hpet.c       Wed Jul 15 13:07:30 2009 +0100
+++ b/xen/arch/x86/hpet.c       Wed Jul 15 13:15:50 2009 +0100
@@ -590,7 +590,7 @@ void hpet_broadcast_init(void)
     legacy_hpet_event.flags = 0;
     spin_lock_init(&legacy_hpet_event.lock);
 
-    for_each_cpu(i)
+    for_each_possible_cpu(i)
         per_cpu(cpu_bc_channel, i) = &legacy_hpet_event;
 
     if ( !force_hpet_broadcast )
diff -r faa216e744ad -r 91407452cdb6 xen/arch/x86/nmi.c
--- a/xen/arch/x86/nmi.c        Wed Jul 15 13:07:30 2009 +0100
+++ b/xen/arch/x86/nmi.c        Wed Jul 15 13:15:50 2009 +0100
@@ -460,7 +460,7 @@ static void do_nmi_stats(unsigned char k
     struct vcpu *v;
 
     printk("CPU\tNMI\n");
-    for_each_cpu ( i )
+    for_each_possible_cpu ( i )
         printk("%3d\t%3d\n", i, nmi_count(i));
 
     if ( ((d = dom0) == NULL) || (d->vcpu == NULL) ||
diff -r faa216e744ad -r 91407452cdb6 xen/arch/x86/smpboot.c
--- a/xen/arch/x86/smpboot.c    Wed Jul 15 13:07:30 2009 +0100
+++ b/xen/arch/x86/smpboot.c    Wed Jul 15 13:15:50 2009 +0100
@@ -1163,7 +1163,7 @@ static void __init smp_boot_cpus(unsigne
         * construct cpu_sibling_map, so that we can tell sibling CPUs
         * efficiently.
         */
-       for_each_cpu(cpu) {
+       for_each_possible_cpu(cpu) {
                cpus_clear(per_cpu(cpu_sibling_map, cpu));
                cpus_clear(per_cpu(cpu_core_map, cpu));
        }
diff -r faa216e744ad -r 91407452cdb6 xen/arch/x86/time.c
--- a/xen/arch/x86/time.c       Wed Jul 15 13:07:30 2009 +0100
+++ b/xen/arch/x86/time.c       Wed Jul 15 13:15:50 2009 +0100
@@ -1227,7 +1227,7 @@ int __init init_xen_time(void)
     if ( opt_consistent_tscs )
     {
         int cpu;
-        for_each_cpu ( cpu )
+        for_each_possible_cpu ( cpu )
             per_cpu(cpu_time, cpu).tsc_scale = per_cpu(cpu_time, 0).tsc_scale;
     }
 
diff -r faa216e744ad -r 91407452cdb6 xen/common/perfc.c
--- a/xen/common/perfc.c        Wed Jul 15 13:07:30 2009 +0100
+++ b/xen/common/perfc.c        Wed Jul 15 13:15:50 2009 +0100
@@ -136,13 +136,13 @@ void perfc_reset(unsigned char key)
         switch ( perfc_info[i].type )
         {
         case TYPE_SINGLE:
-            for_each_cpu ( cpu )
+            for_each_possible_cpu ( cpu )
                 per_cpu(perfcounters, cpu)[j] = 0;
         case TYPE_S_SINGLE:
             ++j;
             break;
         case TYPE_ARRAY:
-            for_each_cpu ( cpu )
+            for_each_possible_cpu ( cpu )
                 memset(per_cpu(perfcounters, cpu) + j, 0,
                        perfc_info[i].nr_elements * sizeof(perfc_t));
         case TYPE_S_ARRAY:
@@ -205,14 +205,14 @@ static int perfc_copy_info(XEN_GUEST_HAN
         {
         case TYPE_SINGLE:
         case TYPE_S_SINGLE:
-            for_each_cpu ( cpu )
+            for_each_possible_cpu ( cpu )
                 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_cpu ( cpu )
+            for_each_possible_cpu ( cpu )
             {
                 perfc_t *counters = per_cpu(perfcounters, cpu) + j;
                 unsigned int k;
diff -r faa216e744ad -r 91407452cdb6 xen/common/schedule.c
--- a/xen/common/schedule.c     Wed Jul 15 13:07:30 2009 +0100
+++ b/xen/common/schedule.c     Wed Jul 15 13:15:50 2009 +0100
@@ -918,7 +918,7 @@ void __init scheduler_init(void)
 
     open_softirq(SCHEDULE_SOFTIRQ, schedule);
 
-    for_each_cpu ( i )
+    for_each_possible_cpu ( i )
     {
         spin_lock_init(&per_cpu(schedule_data, i).schedule_lock);
         init_timer(&per_cpu(schedule_data, i).s_timer, s_timer_fn, NULL, i);
diff -r faa216e744ad -r 91407452cdb6 xen/common/timer.c
--- a/xen/common/timer.c        Wed Jul 15 13:07:30 2009 +0100
+++ b/xen/common/timer.c        Wed Jul 15 13:15:50 2009 +0100
@@ -529,7 +529,7 @@ void __init timer_init(void)
     SET_HEAP_SIZE(&dummy_heap, 0);
     SET_HEAP_LIMIT(&dummy_heap, 0);
 
-    for_each_cpu ( i )
+    for_each_possible_cpu ( i )
     {
         spin_lock_init(&per_cpu(timers, i).lock);
         per_cpu(timers, i).heap = &dummy_heap;
diff -r faa216e744ad -r 91407452cdb6 xen/common/tmem_xen.c
--- a/xen/common/tmem_xen.c     Wed Jul 15 13:07:30 2009 +0100
+++ b/xen/common/tmem_xen.c     Wed Jul 15 13:15:50 2009 +0100
@@ -317,7 +317,7 @@ EXPORT int tmh_init(void)
 
     dstmem_order = get_order_from_pages(LZO_DSTMEM_PAGES);
     workmem_order = get_order_from_bytes(LZO1X_1_MEM_COMPRESS);
-    for_each_cpu ( cpu )
+    for_each_possible_cpu ( cpu )
     {
         pi = alloc_domheap_pages(0,dstmem_order,0);
         per_cpu(dstmem, cpu) = p1 = ((pi == NULL) ? NULL : page_to_virt(pi));
diff -r faa216e744ad -r 91407452cdb6 xen/include/xen/cpumask.h
--- a/xen/include/xen/cpumask.h Wed Jul 15 13:07:30 2009 +0100
+++ b/xen/include/xen/cpumask.h Wed Jul 15 13:15:50 2009 +0100
@@ -61,7 +61,7 @@
  *
  * int any_online_cpu(mask)            First online cpu in mask, or NR_CPUS
  *
- * for_each_cpu(cpu)                   for-loop cpu over cpu_possible_map
+ * for_each_possible_cpu(cpu)          for-loop cpu over cpu_possible_map
  * for_each_online_cpu(cpu)            for-loop cpu over cpu_online_map
  * for_each_present_cpu(cpu)           for-loop cpu over cpu_present_map
  *
@@ -402,9 +402,9 @@ extern cpumask_t cpu_present_map;
        cpu;                                    \
 })
 
-#define for_each_cpu(cpu)        for_each_cpu_mask((cpu), cpu_possible_map)
-#define for_each_online_cpu(cpu)  for_each_cpu_mask((cpu), cpu_online_map)
-#define for_each_present_cpu(cpu) for_each_cpu_mask((cpu), cpu_present_map)
+#define for_each_possible_cpu(cpu) for_each_cpu_mask((cpu), cpu_possible_map)
+#define for_each_online_cpu(cpu)   for_each_cpu_mask((cpu), cpu_online_map)
+#define for_each_present_cpu(cpu)  for_each_cpu_mask((cpu), cpu_present_map)
 
 /* Copy to/from cpumap provided by control tools. */
 struct xenctl_cpumap;

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.