debuggers.hg

changeset 19984:91407452cdb6

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@novell.com>
author Keir Fraser <keir.fraser@citrix.com>
date Wed Jul 15 13:15:50 2009 +0100 (2009-07-15)
parents faa216e744ad
children 855d0f17e364
files xen/arch/ia64/linux-xen/perfmon.c xen/arch/ia64/linux-xen/smpboot.c xen/arch/ia64/linux-xen/sn/kernel/sn2_smp.c xen/arch/ia64/xen/privop_stat.c xen/arch/ia64/xen/xensetup.c xen/arch/x86/hpet.c xen/arch/x86/nmi.c xen/arch/x86/smpboot.c xen/arch/x86/time.c xen/common/perfc.c xen/common/schedule.c xen/common/timer.c xen/common/tmem_xen.c xen/include/xen/cpumask.h
line diff
     1.1 --- a/xen/arch/ia64/linux-xen/perfmon.c	Wed Jul 15 13:07:30 2009 +0100
     1.2 +++ b/xen/arch/ia64/linux-xen/perfmon.c	Wed Jul 15 13:15:50 2009 +0100
     1.3 @@ -7313,7 +7313,7 @@ xenpfm_context_create(XEN_GUEST_HANDLE(p
     1.4  		goto out;
     1.5  
     1.6  	/* XXX fmt */
     1.7 -	for_each_cpu(cpu) {
     1.8 +	for_each_possible_cpu(cpu) {
     1.9  		ctx[cpu] = pfm_context_create(&kreq);
    1.10  		if (ctx[cpu] == NULL) {
    1.11  			error = -ENOMEM;
    1.12 @@ -7325,20 +7325,20 @@ xenpfm_context_create(XEN_GUEST_HANDLE(p
    1.13  
    1.14  	BUG_ON(in_irq());
    1.15  	spin_lock(&xenpfm_context_lock);
    1.16 -	for_each_cpu(cpu) {
    1.17 +	for_each_possible_cpu(cpu) {
    1.18  		if (per_cpu(xenpfm_context, cpu) != NULL) {
    1.19  			error = -EBUSY;
    1.20  			break;
    1.21  		}
    1.22  	}
    1.23 -	for_each_cpu(cpu) {
    1.24 +	for_each_possible_cpu(cpu) {
    1.25  		per_cpu(xenpfm_context, cpu) = ctx[cpu];
    1.26  		ctx[cpu] = NULL;
    1.27  	}
    1.28  	spin_unlock(&xenpfm_context_lock);
    1.29  
    1.30  out:
    1.31 -	for_each_cpu(cpu) {
    1.32 +	for_each_possible_cpu(cpu) {
    1.33  		if (ctx[cpu] != NULL)
    1.34  			pfm_context_free(ctx[cpu]);
    1.35  	}
    1.36 @@ -7358,7 +7358,7 @@ again:
    1.37  	need_unload = 0;
    1.38  	BUG_ON(in_irq());
    1.39  	spin_lock_irqsave(&xenpfm_context_lock, flags);
    1.40 -	for_each_cpu(cpu) {
    1.41 +	for_each_possible_cpu(cpu) {
    1.42  		ctx = per_cpu(xenpfm_context, cpu);
    1.43  		if (ctx == NULL) {
    1.44  			error = -EINVAL;
    1.45 @@ -7369,7 +7369,7 @@ again:
    1.46  			need_unload = 1;
    1.47  	}
    1.48  	if (error) {
    1.49 -		for_each_cpu(cpu) {
    1.50 +		for_each_possible_cpu(cpu) {
    1.51  			ctx = per_cpu(xenpfm_context, cpu);
    1.52  			if (ctx == NULL)
    1.53  				break;
    1.54 @@ -7378,7 +7378,7 @@ again:
    1.55  		goto out;
    1.56  	}
    1.57  	if (need_unload) {
    1.58 -		for_each_cpu(cpu)
    1.59 +		for_each_possible_cpu(cpu)
    1.60  			UNPROTECT_CTX_NOIRQ(per_cpu(xenpfm_context, cpu));
    1.61  		spin_unlock_irqrestore(&xenpfm_context_lock, flags);
    1.62  
    1.63 @@ -7388,7 +7388,7 @@ again:
    1.64  		goto again;
    1.65  	}
    1.66  
    1.67 -	for_each_cpu(cpu) {
    1.68 +	for_each_possible_cpu(cpu) {
    1.69  		pfm_context_t* ctx = per_cpu(xenpfm_context, cpu);
    1.70  		per_cpu(xenpfm_context, cpu) = NULL;
    1.71  
    1.72 @@ -7740,7 +7740,7 @@ xenpfm_start_stop_locked(int is_start)
    1.73  	arg.is_start = is_start;
    1.74  	atomic_set(&arg.started, 1); /* 1 for this cpu */
    1.75  	atomic_set(&arg.finished, 0);
    1.76 -	for_each_cpu(cpu)
    1.77 +	for_each_possible_cpu(cpu)
    1.78  		arg.error[cpu] = 0;
    1.79  
    1.80  	BUG_ON(!spin_is_locked(&xenpfm_context_lock));
     2.1 --- a/xen/arch/ia64/linux-xen/smpboot.c	Wed Jul 15 13:07:30 2009 +0100
     2.2 +++ b/xen/arch/ia64/linux-xen/smpboot.c	Wed Jul 15 13:15:50 2009 +0100
     2.3 @@ -675,7 +675,7 @@ remove_from_mtinfo(int cpu)
     2.4  {
     2.5  	int i;
     2.6  
     2.7 -	for_each_cpu(i)
     2.8 +	for_each_possible_cpu(i)
     2.9  		if (mt_info[i].valid &&  mt_info[i].socket_id ==
    2.10  		    				cpu_data(cpu)->socket_id)
    2.11  			mt_info[i].valid = 0;
    2.12 @@ -874,7 +874,7 @@ check_for_mtinfo_index(void)
    2.13  {
    2.14  	int i;
    2.15  	
    2.16 -	for_each_cpu(i)
    2.17 +	for_each_possible_cpu(i)
    2.18  		if (!mt_info[i].valid)
    2.19  			return i;
    2.20  
    2.21 @@ -892,7 +892,7 @@ check_for_new_socket(__u16 logical_addre
    2.22  	int i;
    2.23  	__u32 sid = c->socket_id;
    2.24  
    2.25 -	for_each_cpu(i) {
    2.26 +	for_each_possible_cpu(i) {
    2.27  		if (mt_info[i].valid && mt_info[i].proc_fixed_addr == logical_address
    2.28  		    && mt_info[i].socket_id == sid) {
    2.29  			c->core_id = mt_info[i].core_id;
     3.1 --- a/xen/arch/ia64/linux-xen/sn/kernel/sn2_smp.c	Wed Jul 15 13:07:30 2009 +0100
     3.2 +++ b/xen/arch/ia64/linux-xen/sn/kernel/sn2_smp.c	Wed Jul 15 13:15:50 2009 +0100
     3.3 @@ -211,7 +211,7 @@ sn2_global_tlb_purge(unsigned long start
     3.4  	spin_lock(&sn2_ptcg_lock2);
     3.5  	node_set(cpu_to_node(smp_processor_id()), nodes_flushed);
     3.6  	i = 0;
     3.7 -	for_each_cpu(cpu) {
     3.8 +	for_each_possible_cpu(cpu) {
     3.9  		cnode = cpu_to_node(cpu);
    3.10  		if (!node_isset(cnode, nodes_flushed)) {
    3.11  			cpu_set(cpu, selected_cpus);
    3.12 @@ -269,7 +269,7 @@ sn2_global_tlb_purge(struct mm_struct *m
    3.13  		i++;
    3.14  	}
    3.15  #else
    3.16 -	for_each_cpu(cpu) {
    3.17 +	for_each_possible_cpu(cpu) {
    3.18  		cnode = cpu_to_node(cpu);
    3.19  		node_set(cnode, nodes_flushed);
    3.20  		lcpu = cpu;
     4.1 --- a/xen/arch/ia64/xen/privop_stat.c	Wed Jul 15 13:07:30 2009 +0100
     4.2 +++ b/xen/arch/ia64/xen/privop_stat.c	Wed Jul 15 13:15:50 2009 +0100
     4.3 @@ -65,7 +65,7 @@ void gather_privop_addrs(void)
     4.4  {
     4.5  	unsigned int cpu;
     4.6  
     4.7 -	for_each_cpu ( cpu ) {
     4.8 +	for_each_possible_cpu ( cpu ) {
     4.9  		perfc_t *perfcounters = per_cpu(perfcounters, cpu);
    4.10  		struct privop_addr_count *s = per_cpu(privop_addr_counter, cpu);
    4.11  		int i, j;
    4.12 @@ -92,7 +92,7 @@ void reset_privop_addrs(void)
    4.13  {
    4.14  	unsigned int cpu;
    4.15  
    4.16 -	for_each_cpu ( cpu ) {
    4.17 +	for_each_possible_cpu ( cpu ) {
    4.18  		struct privop_addr_count *v = per_cpu(privop_addr_counter, cpu);
    4.19  		int i, j;
    4.20  
     5.1 --- a/xen/arch/ia64/xen/xensetup.c	Wed Jul 15 13:07:30 2009 +0100
     5.2 +++ b/xen/arch/ia64/xen/xensetup.c	Wed Jul 15 13:15:50 2009 +0100
     5.3 @@ -606,8 +606,7 @@ skip_move:
     5.4      smp_prepare_cpus(max_cpus);
     5.5  
     5.6      /* We aren't hotplug-capable yet. */
     5.7 -    for_each_cpu ( i )
     5.8 -        cpu_set(i, cpu_present_map);
     5.9 +    cpus_or(cpu_present_map, cpu_present_map, cpu_possible_map);
    5.10  
    5.11      /*  Enable IRQ to receive IPI (needed for ITC sync).  */
    5.12      local_irq_enable();
     6.1 --- a/xen/arch/x86/hpet.c	Wed Jul 15 13:07:30 2009 +0100
     6.2 +++ b/xen/arch/x86/hpet.c	Wed Jul 15 13:15:50 2009 +0100
     6.3 @@ -590,7 +590,7 @@ void hpet_broadcast_init(void)
     6.4      legacy_hpet_event.flags = 0;
     6.5      spin_lock_init(&legacy_hpet_event.lock);
     6.6  
     6.7 -    for_each_cpu(i)
     6.8 +    for_each_possible_cpu(i)
     6.9          per_cpu(cpu_bc_channel, i) = &legacy_hpet_event;
    6.10  
    6.11      if ( !force_hpet_broadcast )
     7.1 --- a/xen/arch/x86/nmi.c	Wed Jul 15 13:07:30 2009 +0100
     7.2 +++ b/xen/arch/x86/nmi.c	Wed Jul 15 13:15:50 2009 +0100
     7.3 @@ -460,7 +460,7 @@ static void do_nmi_stats(unsigned char k
     7.4      struct vcpu *v;
     7.5  
     7.6      printk("CPU\tNMI\n");
     7.7 -    for_each_cpu ( i )
     7.8 +    for_each_possible_cpu ( i )
     7.9          printk("%3d\t%3d\n", i, nmi_count(i));
    7.10  
    7.11      if ( ((d = dom0) == NULL) || (d->vcpu == NULL) ||
     8.1 --- a/xen/arch/x86/smpboot.c	Wed Jul 15 13:07:30 2009 +0100
     8.2 +++ b/xen/arch/x86/smpboot.c	Wed Jul 15 13:15:50 2009 +0100
     8.3 @@ -1163,7 +1163,7 @@ static void __init smp_boot_cpus(unsigne
     8.4  	 * construct cpu_sibling_map, so that we can tell sibling CPUs
     8.5  	 * efficiently.
     8.6  	 */
     8.7 -	for_each_cpu(cpu) {
     8.8 +	for_each_possible_cpu(cpu) {
     8.9  		cpus_clear(per_cpu(cpu_sibling_map, cpu));
    8.10  		cpus_clear(per_cpu(cpu_core_map, cpu));
    8.11  	}
     9.1 --- a/xen/arch/x86/time.c	Wed Jul 15 13:07:30 2009 +0100
     9.2 +++ b/xen/arch/x86/time.c	Wed Jul 15 13:15:50 2009 +0100
     9.3 @@ -1227,7 +1227,7 @@ int __init init_xen_time(void)
     9.4      if ( opt_consistent_tscs )
     9.5      {
     9.6          int cpu;
     9.7 -        for_each_cpu ( cpu )
     9.8 +        for_each_possible_cpu ( cpu )
     9.9              per_cpu(cpu_time, cpu).tsc_scale = per_cpu(cpu_time, 0).tsc_scale;
    9.10      }
    9.11  
    10.1 --- a/xen/common/perfc.c	Wed Jul 15 13:07:30 2009 +0100
    10.2 +++ b/xen/common/perfc.c	Wed Jul 15 13:15:50 2009 +0100
    10.3 @@ -136,13 +136,13 @@ void perfc_reset(unsigned char key)
    10.4          switch ( perfc_info[i].type )
    10.5          {
    10.6          case TYPE_SINGLE:
    10.7 -            for_each_cpu ( cpu )
    10.8 +            for_each_possible_cpu ( cpu )
    10.9                  per_cpu(perfcounters, cpu)[j] = 0;
   10.10          case TYPE_S_SINGLE:
   10.11              ++j;
   10.12              break;
   10.13          case TYPE_ARRAY:
   10.14 -            for_each_cpu ( cpu )
   10.15 +            for_each_possible_cpu ( cpu )
   10.16                  memset(per_cpu(perfcounters, cpu) + j, 0,
   10.17                         perfc_info[i].nr_elements * sizeof(perfc_t));
   10.18          case TYPE_S_ARRAY:
   10.19 @@ -205,14 +205,14 @@ static int perfc_copy_info(XEN_GUEST_HAN
   10.20          {
   10.21          case TYPE_SINGLE:
   10.22          case TYPE_S_SINGLE:
   10.23 -            for_each_cpu ( cpu )
   10.24 +            for_each_possible_cpu ( cpu )
   10.25                  perfc_vals[v++] = per_cpu(perfcounters, cpu)[j];
   10.26              ++j;
   10.27              break;
   10.28          case TYPE_ARRAY:
   10.29          case TYPE_S_ARRAY:
   10.30              memset(perfc_vals + v, 0, perfc_d[i].nr_vals * sizeof(*perfc_vals));
   10.31 -            for_each_cpu ( cpu )
   10.32 +            for_each_possible_cpu ( cpu )
   10.33              {
   10.34                  perfc_t *counters = per_cpu(perfcounters, cpu) + j;
   10.35                  unsigned int k;
    11.1 --- a/xen/common/schedule.c	Wed Jul 15 13:07:30 2009 +0100
    11.2 +++ b/xen/common/schedule.c	Wed Jul 15 13:15:50 2009 +0100
    11.3 @@ -918,7 +918,7 @@ void __init scheduler_init(void)
    11.4  
    11.5      open_softirq(SCHEDULE_SOFTIRQ, schedule);
    11.6  
    11.7 -    for_each_cpu ( i )
    11.8 +    for_each_possible_cpu ( i )
    11.9      {
   11.10          spin_lock_init(&per_cpu(schedule_data, i).schedule_lock);
   11.11          init_timer(&per_cpu(schedule_data, i).s_timer, s_timer_fn, NULL, i);
    12.1 --- a/xen/common/timer.c	Wed Jul 15 13:07:30 2009 +0100
    12.2 +++ b/xen/common/timer.c	Wed Jul 15 13:15:50 2009 +0100
    12.3 @@ -529,7 +529,7 @@ void __init timer_init(void)
    12.4      SET_HEAP_SIZE(&dummy_heap, 0);
    12.5      SET_HEAP_LIMIT(&dummy_heap, 0);
    12.6  
    12.7 -    for_each_cpu ( i )
    12.8 +    for_each_possible_cpu ( i )
    12.9      {
   12.10          spin_lock_init(&per_cpu(timers, i).lock);
   12.11          per_cpu(timers, i).heap = &dummy_heap;
    13.1 --- a/xen/common/tmem_xen.c	Wed Jul 15 13:07:30 2009 +0100
    13.2 +++ b/xen/common/tmem_xen.c	Wed Jul 15 13:15:50 2009 +0100
    13.3 @@ -317,7 +317,7 @@ EXPORT int tmh_init(void)
    13.4  
    13.5      dstmem_order = get_order_from_pages(LZO_DSTMEM_PAGES);
    13.6      workmem_order = get_order_from_bytes(LZO1X_1_MEM_COMPRESS);
    13.7 -    for_each_cpu ( cpu )
    13.8 +    for_each_possible_cpu ( cpu )
    13.9      {
   13.10          pi = alloc_domheap_pages(0,dstmem_order,0);
   13.11          per_cpu(dstmem, cpu) = p1 = ((pi == NULL) ? NULL : page_to_virt(pi));
    14.1 --- a/xen/include/xen/cpumask.h	Wed Jul 15 13:07:30 2009 +0100
    14.2 +++ b/xen/include/xen/cpumask.h	Wed Jul 15 13:15:50 2009 +0100
    14.3 @@ -61,7 +61,7 @@
    14.4   *
    14.5   * int any_online_cpu(mask)		First online cpu in mask, or NR_CPUS
    14.6   *
    14.7 - * for_each_cpu(cpu)			for-loop cpu over cpu_possible_map
    14.8 + * for_each_possible_cpu(cpu)		for-loop cpu over cpu_possible_map
    14.9   * for_each_online_cpu(cpu)		for-loop cpu over cpu_online_map
   14.10   * for_each_present_cpu(cpu)		for-loop cpu over cpu_present_map
   14.11   *
   14.12 @@ -402,9 +402,9 @@ extern cpumask_t cpu_present_map;
   14.13  	cpu;					\
   14.14  })
   14.15  
   14.16 -#define for_each_cpu(cpu)	  for_each_cpu_mask((cpu), cpu_possible_map)
   14.17 -#define for_each_online_cpu(cpu)  for_each_cpu_mask((cpu), cpu_online_map)
   14.18 -#define for_each_present_cpu(cpu) for_each_cpu_mask((cpu), cpu_present_map)
   14.19 +#define for_each_possible_cpu(cpu) for_each_cpu_mask((cpu), cpu_possible_map)
   14.20 +#define for_each_online_cpu(cpu)   for_each_cpu_mask((cpu), cpu_online_map)
   14.21 +#define for_each_present_cpu(cpu)  for_each_cpu_mask((cpu), cpu_present_map)
   14.22  
   14.23  /* Copy to/from cpumap provided by control tools. */
   14.24  struct xenctl_cpumap;