Skip to contentSkip to conversation

ia64: replace old cpumask functions with new one

PATCH KOSAKI Motohiro 2 participants 4 messages Jun 23, 2011 – Jul 13, 2011

lore
Share & tools
lore
#0 lore raw

We plan to remove old obsolete cpumask functions and plan to change task->cpus_allowed implementation in future.

Then, this patch replace them with newer recommended functions.

---
 arch/ia64/include/asm/acpi.h            |    6 ++--
 arch/ia64/kernel/acpi.c                 |    6 ++--
 arch/ia64/kernel/cpufreq/acpi-cpufreq.c |    4 +-
 arch/ia64/kernel/iosapic.c              |    2 +-
 arch/ia64/kernel/irq_ia64.c             |   48 ++++++++++++++-------------
 arch/ia64/kernel/mca.c                  |   14 ++++----
 arch/ia64/kernel/msi_ia64.c             |   10 +++---
 arch/ia64/kernel/numa.c                 |   10 +++---
 arch/ia64/kernel/salinfo.c              |   27 ++++++++-------
 arch/ia64/kernel/setup.c                |   12 +++---
 arch/ia64/kernel/smp.c                  |   11 +++---
 arch/ia64/kernel/smpboot.c              |   56 +++++++++++++++---------------
 arch/ia64/kernel/topology.c             |   11 +++---
 arch/ia64/sn/kernel/sn2/sn_hwperf.c     |    2 +-
 14 files changed, 112 insertions(+), 107 deletions(-)
arch/ia64/include/asm/acpi.h +3 -3
index a06dfb1..226c3bb 100644
@@ -169,7 +169,7 @@ static inline void arch_acpi_set_pdc_bits(u32 *buf)
 #ifdef CONFIG_ACPI_NUMA
 extern cpumask_t early_cpu_possible_map;
 #define for_each_possible_early_cpu(cpu)  \
-	for_each_cpu_mask((cpu), early_cpu_possible_map)
+	for_each_cpu((cpu), &early_cpu_possible_map)
 
 static inline void per_cpu_scan_finalize(int min_cpus, int reserve_cpus)
 {
@@ -177,13 +177,13 @@ static inline void per_cpu_scan_finalize(int min_cpus, int reserve_cpus)
 	int cpu;
 	int next_nid = 0;
 
-	low_cpu = cpus_weight(early_cpu_possible_map);
+	low_cpu = cpumask_weight(&early_cpu_possible_map);
 
 	high_cpu = max(low_cpu, min_cpus);
 	high_cpu = min(high_cpu + reserve_cpus, NR_CPUS);
 
 	for (cpu = low_cpu; cpu < high_cpu; cpu++) {
-		cpu_set(cpu, early_cpu_possible_map);
+		cpumask_set_cpu(cpu, &early_cpu_possible_map);
 		if (node_cpuid[cpu].nid = NUMA_NO_NODE) {
 			node_cpuid[cpu].nid = next_nid;
 			next_nid++;
arch/ia64/kernel/acpi.c +3 -3
index 3be485a..8bb460e 100644
@@ -492,7 +492,7 @@ acpi_numa_processor_affinity_init(struct acpi_srat_cpu_affinity *pa)
 	    (pa->apic_id << 8) | (pa->local_sapic_eid);
 	/* nid should be overridden as logical node id later */
 	node_cpuid[srat_num_cpus].nid = pxm;
-	cpu_set(srat_num_cpus, early_cpu_possible_map);
+	cpumask_set_cpu(srat_num_cpus, &early_cpu_possible_map);
 	srat_num_cpus++;
 }
 
@@ -920,7 +920,7 @@ static int __cpuinit _acpi_map_lsapic(acpi_handle handle, int *pcpu)
 
 	acpi_map_cpu2node(handle, cpu, physid);
 
-	cpu_set(cpu, cpu_present_map);
+	set_cpu_present(cpu, true);
 	ia64_cpu_to_sapicid[cpu] = physid;
 
 	acpi_processor_set_pdc(handle);
@@ -939,7 +939,7 @@ EXPORT_SYMBOL(acpi_map_lsapic);
 int acpi_unmap_lsapic(int cpu)
 {
 	ia64_cpu_to_sapicid[cpu] = -1;
-	cpu_clear(cpu, cpu_present_map);
+	set_cpu_present(cpu, false);
 
 #ifdef CONFIG_ACPI_NUMA
 	/* NUMA specific cleanup's */
arch/ia64/kernel/cpufreq/acpi-cpufreq.c +2 -2
index f09b174..1711786 100644
@@ -110,7 +110,7 @@ processor_get_freq (
 
 	pr_debug("processor_get_freq\n");
 
-	saved_mask = current->cpus_allowed;
+	cpumask_copy(&saved_mask, tsk_cpus_allowed(current));
 	set_cpus_allowed_ptr(current, cpumask_of(cpu));
 	if (smp_processor_id() != cpu)
 		goto migrate_end;
@@ -148,7 +148,7 @@ processor_set_freq (
 
 	pr_debug("processor_set_freq\n");
 
-	saved_mask = current->cpus_allowed;
+	cpumask_copy(&saved_mask, tsk_cpus_allowed(current));
 	set_cpus_allowed_ptr(current, cpumask_of(cpu));
 	if (smp_processor_id() != cpu) {
 		retval = -EAGAIN;
arch/ia64/kernel/iosapic.c +1 -1
index b0f9afe..cb36cc8 100644
@@ -691,7 +691,7 @@ skip_numa_setup:
 	do {
 		if (++cpu >= nr_cpu_ids)
 			cpu = 0;
-	} while (!cpu_online(cpu) || !cpu_isset(cpu, domain));
+	} while (!cpu_online(cpu) || !cpumask_test_cpu(cpu, &domain));
 
 	return cpu_physical_id(cpu);
 #else  /* CONFIG_SMP */
arch/ia64/kernel/irq_ia64.c +25 -23

132 lines not on this page · raw message

arch/ia64/kernel/mca.c +7 -7
index 84fb405..cf23f43 100644
@@ -1294,7 +1294,7 @@ ia64_mca_handler(struct pt_regs *regs, struct switch_stack *sw,
 		monarch_cpu = cpu;
 		sos->monarch = 1;
 	} else {
-		cpu_set(cpu, mca_cpu);
+		cpumask_set_cpu(cpu, &mca_cpu);
 		sos->monarch = 0;
 	}
 	mprintk(KERN_INFO "Entered OS MCA handler. PSP=%lx cpu=%d "
@@ -1317,7 +1317,7 @@ ia64_mca_handler(struct pt_regs *regs, struct switch_stack *sw,
 		 */
 		ia64_mca_wakeup_all();
 	} else {
-		while (cpu_isset(cpu, mca_cpu))
+		while (cpumask_test_cpu(cpu, &mca_cpu))
 			cpu_relax();	/* spin until monarch wakes us */
 	}
 
@@ -1356,9 +1356,9 @@ ia64_mca_handler(struct pt_regs *regs, struct switch_stack *sw,
 		 * and put this cpu in the rendez loop.
 		 */
 		for_each_online_cpu(i) {
-			if (cpu_isset(i, mca_cpu)) {
+			if (cpumask_test_cpu(i, &mca_cpu)) {
 				monarch_cpu = i;
-				cpu_clear(i, mca_cpu);	/* wake next cpu */
+				cpumask_clear_cpu(i, &mca_cpu);	/* wake next cpu */
 				while (monarch_cpu != -1)
 					cpu_relax();	/* spin until last cpu leaves */
 				set_curr_task(cpu, previous_current);
@@ -1513,7 +1513,7 @@ static void
 ia64_mca_cmc_poll (unsigned long dummy)
 {
 	/* Trigger a CMC interrupt cascade  */
-	platform_send_ipi(first_cpu(cpu_online_map), IA64_CMCP_VECTOR, IA64_IPI_DM_INT, 0);
+	platform_send_ipi(cpumask_first(cpu_online_mask), IA64_CMCP_VECTOR, IA64_IPI_DM_INT, 0);
 }
 
 /*
@@ -1589,7 +1589,7 @@ static void
 ia64_mca_cpe_poll (unsigned long dummy)
 {
 	/* Trigger a CPE interrupt cascade  */
-	platform_send_ipi(first_cpu(cpu_online_map), IA64_CPEP_VECTOR, IA64_IPI_DM_INT, 0);
+	platform_send_ipi(cpumask_first(cpu_online_mask), IA64_CPEP_VECTOR, IA64_IPI_DM_INT, 0);
 }
 
 #endif /* CONFIG_ACPI */
@@ -1825,7 +1825,7 @@ format_mca_init_stack(void *mca_data, unsigned long offset,
 	ti->cpu = cpu;
 	p->stack = ti;
 	p->state = TASK_UNINTERRUPTIBLE;
-	cpu_set(cpu, p->cpus_allowed);
+	cpumask_set_cpu(cpu, &*tsk_cpus_allowed(p));
 	INIT_LIST_HEAD(&p->tasks);
 	p->parent = p->real_parent = p->group_leader = p;
 	INIT_LIST_HEAD(&p->children);
arch/ia64/kernel/msi_ia64.c +5 -5
index 009df54..8aa458c 100644
@@ -17,7 +17,7 @@ static int ia64_set_msi_irq_affinity(struct irq_data *idata,
 {
 	struct msi_msg msg;
 	u32 addr, data;
-	int cpu = first_cpu(*cpu_mask);
+	int cpu = cpumask_first(cpu_mask);
 	unsigned int irq = idata->irq;
 
 	if (!cpu_online(cpu))
@@ -57,8 +57,8 @@ int ia64_setup_msi_irq(struct pci_dev *pdev, struct msi_desc *desc)
 		return irq;
 
 	irq_set_msi_desc(irq, desc);
-	cpus_and(mask, irq_to_domain(irq), cpu_online_map);
-	dest_phys_id = cpu_physical_id(first_cpu(mask));
+	cpumask_and(&mask, &irq_to_domain(irq), cpu_online_mask);
+	dest_phys_id = cpu_physical_id(cpumask_first(&mask));
 	vector = irq_to_vector(irq);
 
 	msg.address_hi = 0;
@@ -179,8 +179,8 @@ msi_compose_msg(struct pci_dev *pdev, unsigned int irq, struct msi_msg *msg)
 	unsigned dest;
 	cpumask_t mask;
 
-	cpus_and(mask, irq_to_domain(irq), cpu_online_map);
-	dest = cpu_physical_id(first_cpu(mask));
+	cpumask_and(&mask, &irq_to_domain(irq), cpu_online_mask);
+	dest = cpu_physical_id(cpumask_first(&mask));
 
 	msg->address_hi = 0;
 	msg->address_lo diff --git a/arch/ia64/kernel/numa.c b/arch/ia64/kernel/numa.c

index c93420c..4d5437e 100644

arch/ia64/kernel/numa.c +5 -5
@@ -39,7 +39,7 @@ void __cpuinit map_cpu_to_node(int cpu, int nid)
 	}
 	/* sanity check first */
 	oldnid = cpu_to_node_map[cpu];
-	if (cpu_isset(cpu, node_to_cpu_mask[oldnid])) {
+	if (cpumask_test_cpu(cpu, &node_to_cpu_mask[oldnid])) {
 		return; /* nothing to do */
 	}
 	/* we don't have cpu-driven node hot add yet...
@@ -47,16 +47,16 @@ void __cpuinit map_cpu_to_node(int cpu, int nid)
 	if (!node_online(nid))
 		nid = first_online_node;
 	cpu_to_node_map[cpu] = nid;
-	cpu_set(cpu, node_to_cpu_mask[nid]);
+	cpumask_set_cpu(cpu, &node_to_cpu_mask[nid]);
 	return;
 }
 
 void __cpuinit unmap_cpu_from_node(int cpu, int nid)
 {
-	WARN_ON(!cpu_isset(cpu, node_to_cpu_mask[nid]));
+	WARN_ON(!cpumask_test_cpu(cpu, &node_to_cpu_mask[nid]));
 	WARN_ON(cpu_to_node_map[cpu] != nid);
 	cpu_to_node_map[cpu] = 0;
-	cpu_clear(cpu, node_to_cpu_mask[nid]);
+	cpumask_clear_cpu(cpu, &node_to_cpu_mask[nid]);
 }
 
 
@@ -71,7 +71,7 @@ void __init build_cpu_to_node_map(void)
 	int cpu, i, node;
 
 	for(node=0; node < MAX_NUMNODES; node++)
-		cpus_clear(node_to_cpu_mask[node]);
+		cpumask_clear(&node_to_cpu_mask[node]);
 
 	for_each_possible_early_cpu(cpu) {
 		node = -1;
arch/ia64/kernel/salinfo.c +14 -13
index 79802e5..b47c530 100644
@@ -255,7 +255,7 @@ salinfo_log_wakeup(int type, u8 *buffer, u64 size, int irqsafe)
 			data_saved->buffer = buffer;
 		}
 	}
-	cpu_set(smp_processor_id(), data->cpu_event);
+	cpumask_set_cpu(smp_processor_id(), &data->cpu_event);
 	if (irqsafe) {
 		salinfo_work_to_do(data);
 		spin_unlock_irqrestore(&data_saved_lock, flags);
@@ -273,7 +273,7 @@ salinfo_timeout_check(struct salinfo_data *data)
 	unsigned long flags;
 	if (!data->open)
 		return;
-	if (!cpus_empty(data->cpu_event)) {
+	if (!cpumask_empty(&data->cpu_event)) {
 		spin_lock_irqsave(&data_saved_lock, flags);
 		salinfo_work_to_do(data);
 		spin_unlock_irqrestore(&data_saved_lock, flags);
@@ -309,7 +309,7 @@ salinfo_event_read(struct file *file, char __user *buffer, size_t count, loff_t
 	int i, n, cpu = -1;
 
 retry:
-	if (cpus_empty(data->cpu_event) && down_trylock(&data->mutex)) {
+	if (cpumask_empty(&data->cpu_event) && down_trylock(&data->mutex)) {
 		if (file->f_flags & O_NONBLOCK)
 			return -EAGAIN;
 		if (down_interruptible(&data->mutex))
@@ -318,9 +318,9 @@ retry:
 
 	n = data->cpu_check;
 	for (i = 0; i < nr_cpu_ids; i++) {
-		if (cpu_isset(n, data->cpu_event)) {
+		if (cpumask_test_cpu(n, &data->cpu_event)) {
 			if (!cpu_online(n)) {
-				cpu_clear(n, data->cpu_event);
+				cpumask_clear_cpu(n, &data->cpu_event);
 				continue;
 			}
 			cpu = n;
@@ -404,7 +404,8 @@ salinfo_log_release(struct inode *inode, struct file *file)
 static void
 call_on_cpu(int cpu, void (*fn)(void *), void *arg)
 {
-	cpumask_t save_cpus_allowed = current->cpus_allowed;
+	cpumask_t save_cpus_allowed;
+	cpumask_copy(&save_cpus_allowed, tsk_cpus_allowed(current));
 	set_cpus_allowed_ptr(current, cpumask_of(cpu));
 	(*fn)(arg);
 	set_cpus_allowed_ptr(current, &save_cpus_allowed);
@@ -454,7 +455,7 @@ retry:
 		call_on_cpu(cpu, salinfo_log_read_cpu, data);
 	if (!data->log_size) {
 		data->state = STATE_NO_DATA;
-		cpu_clear(cpu, data->cpu_event);
+		cpumask_clear_cpu(cpu, &data->cpu_event);
 	} else {
 		data->state = STATE_LOG_RECORD;
 	}
@@ -496,11 +497,11 @@ salinfo_log_clear(struct salinfo_data *data, int cpu)
 	unsigned long flags;
 	spin_lock_irqsave(&data_saved_lock, flags);
 	data->state = STATE_NO_DATA;
-	if (!cpu_isset(cpu, data->cpu_event)) {
+	if (!cpumask_test_cpu(cpu, &data->cpu_event)) {
 		spin_unlock_irqrestore(&data_saved_lock, flags);
 		return 0;
 	}
-	cpu_clear(cpu, data->cpu_event);
+	cpumask_clear_cpu(cpu, &data->cpu_event);
 	if (data->saved_num) {
 		shift1_data_saved(data, data->saved_num - 1);
 		data->saved_num = 0;
@@ -514,7 +515,7 @@ salinfo_log_clear(struct salinfo_data *data, int cpu)
 	salinfo_log_new_read(cpu, data);
 	if (data->state = STATE_LOG_RECORD) {
 		spin_lock_irqsave(&data_saved_lock, flags);
-		cpu_set(cpu, data->cpu_event);
+		cpumask_set_cpu(cpu, &data->cpu_event);
 		salinfo_work_to_do(data);
 		spin_unlock_irqrestore(&data_saved_lock, flags);
 	}
@@ -588,7 +589,7 @@ salinfo_cpu_callback(struct notifier_block *nb, unsigned long action, void *hcpu
 		for (i = 0, data = salinfo_data;
 		     i < ARRAY_SIZE(salinfo_data);
 		     ++i, ++data) {
-			cpu_set(cpu, data->cpu_event);
+			cpumask_set_cpu(cpu, &data->cpu_event);
 			salinfo_work_to_do(data);
 		}
 		spin_unlock_irqrestore(&data_saved_lock, flags);
@@ -608,7 +609,7 @@ salinfo_cpu_callback(struct notifier_block *nb, unsigned long action, void *hcpu
 					shift1_data_saved(data, j);
 				}
 			}
-			cpu_clear(cpu, data->cpu_event);
+			cpumask_clear_cpu(cpu, &data->cpu_event);
 		}
 		spin_unlock_irqrestore(&data_saved_lock, flags);
 		break;
@@ -663,7 +664,7 @@ salinfo_init(void)
 
 		/* we missed any events before now */
 		for_each_online_cpu(j)
-			cpu_set(j, data->cpu_event);
+			cpumask_set_cpu(j, &data->cpu_event);
 
 		*sdir++ = dir;
 	}
arch/ia64/kernel/setup.c +6 -6
index 5e2c724..2112cb9 100644
@@ -467,7 +467,7 @@ mark_bsp_online (void)
 {
 #ifdef CONFIG_SMP
 	/* If we register an early console, allow CPU 0 to printk */
-	cpu_set(smp_processor_id(), cpu_online_map);
+	set_cpu_online(smp_processor_id(), true);
 #endif
 }
 
@@ -544,8 +544,8 @@ setup_arch (char **cmdline_p)
 #  ifdef CONFIG_ACPI_HOTPLUG_CPU
 	prefill_possible_map();
 #  endif
-	per_cpu_scan_finalize((cpus_weight(early_cpu_possible_map) = 0 ?
-		32 : cpus_weight(early_cpu_possible_map)),
+	per_cpu_scan_finalize((cpumask_weight(&early_cpu_possible_map) = 0 ?
+		32 : cpumask_weight(&early_cpu_possible_map)),
 		additional_cpus > 0 ? additional_cpus : 0);
 # endif
 #endif /* CONFIG_APCI_BOOT */
@@ -684,7 +684,7 @@ show_cpuinfo (struct seq_file *m, void *v)
 		   c->itc_freq / 1000000, c->itc_freq % 1000000,
 		   lpj*HZ/500000, (lpj*HZ/5000) % 100);
 #ifdef CONFIG_SMP
-	seq_printf(m, "siblings   : %u\n", cpus_weight(cpu_core_map[cpunum]));
+	seq_printf(m, "siblings   : %u\n", cpumask_weight(&cpu_core_map[cpunum]));
 	if (c->socket_id != -1)
 		seq_printf(m, "physical id: %u\n", c->socket_id);
 	if (c->threads_per_core > 1 || c->cores_per_socket > 1)
@@ -915,8 +915,8 @@ cpu_init (void)
 	 * (must be done after per_cpu area is setup)
 	 */
 	if (smp_processor_id() = 0) {
-		cpu_set(0, per_cpu(cpu_sibling_map, 0));
-		cpu_set(0, cpu_core_map[0]);
+		cpumask_set_cpu(0, &per_cpu(cpu_sibling_map, 0));
+		cpumask_set_cpu(0, &cpu_core_map[0]);
 	} else {
 		/*
 		 * Set ar.k3 so that assembly code in MCA handler can compute
arch/ia64/kernel/smp.c +6 -5
index be450a3..9f86422 100644
@@ -77,7 +77,7 @@ stop_this_cpu(void)
 	/*
 	 * Remove this CPU:
 	 */
-	cpu_clear(smp_processor_id(), cpu_online_map);
+	set_cpu_online(smp_processor_id(), false);
 	max_xtp();
 	local_irq_disable();
 	cpu_halt();
@@ -257,17 +257,18 @@ void
 smp_flush_tlb_cpumask(cpumask_t xcpumask)
 {
 	unsigned short *counts = __ia64_per_cpu_var(shadow_flush_counts);
-	cpumask_t cpumask = xcpumask;
+	cpumask_t cpumask;
 	int mycpu, cpu, flush_mycpu = 0;
 
+	cpumask_copy(&cpumask, &xcpumask);
 	preempt_disable();
 	mycpu = smp_processor_id();
 
-	for_each_cpu_mask(cpu, cpumask)
+	for_each_cpu(cpu, &cpumask)
 		counts[cpu] = local_tlb_flush_counts[cpu].count & 0xffff;
 
 	mb();
-	for_each_cpu_mask(cpu, cpumask) {
+	for_each_cpu(cpu, &cpumask) {
 		if (cpu = mycpu)
 			flush_mycpu = 1;
 		else
@@ -277,7 +278,7 @@ smp_flush_tlb_cpumask(cpumask_t xcpumask)
 	if (flush_mycpu)
 		smp_local_flush_tlb();
 
-	for_each_cpu_mask(cpu, cpumask)
+	for_each_cpu(cpu, &cpumask)
 		while(counts[cpu] = (local_tlb_flush_counts[cpu].count & 0xffff))
 			udelay(FLUSH_DELAY);
 
arch/ia64/kernel/smpboot.c +28 -28

153 lines not on this page · raw message

arch/ia64/kernel/topology.c +6 -5
index 0e0e0cc..737a5b4 100644
@@ -147,7 +147,7 @@ static void __cpuinit cache_shared_cpu_map_setup( unsigned int cpu,
 
 	if (cpu_data(cpu)->threads_per_core <= 1 &&
 		cpu_data(cpu)->cores_per_socket <= 1) {
-		cpu_set(cpu, this_leaf->shared_cpu_map);
+		cpumask_set_cpu(cpu, &this_leaf->shared_cpu_map);
 		return;
 	}
 
@@ -163,7 +163,7 @@ static void __cpuinit cache_shared_cpu_map_setup( unsigned int cpu,
 			if (cpu_data(cpu)->socket_id = cpu_data(j)->socket_id
 				&& cpu_data(j)->core_id = csi.log1_cid
 				&& cpu_data(j)->thread_id = csi.log1_tid)
-				cpu_set(j, this_leaf->shared_cpu_map);
+				cpumask_set_cpu(j, &this_leaf->shared_cpu_map);
 
 		i++;
 	} while (i < num_shared &&
@@ -176,7 +176,7 @@ static void __cpuinit cache_shared_cpu_map_setup( unsigned int cpu,
 static void __cpuinit cache_shared_cpu_map_setup(unsigned int cpu,
 		struct cache_info * this_leaf)
 {
-	cpu_set(cpu, this_leaf->shared_cpu_map);
+	cpumask_set_cpu(cpu, &this_leaf->shared_cpu_map);
 	return;
 }
 #endif
@@ -219,7 +219,8 @@ static ssize_t show_shared_cpu_map(struct cache_info *this_leaf, char *buf)
 	ssize_t	len;
 	cpumask_t shared_cpu_map;
 
-	cpus_and(shared_cpu_map, this_leaf->shared_cpu_map, cpu_online_map);
+	cpumask_and(&shared_cpu_map, &this_leaf->shared_cpu_map,
+		    cpu_online_mask);
 	len = cpumask_scnprintf(buf, NR_CPUS+1, &shared_cpu_map);
 	len += sprintf(buf+len, "\n");
 	return len;
@@ -360,7 +361,7 @@ static int __cpuinit cache_add_dev(struct sys_device * sys_dev)
 	if (all_cpu_cache_info[cpu].kobj.parent)
 		return 0;
 
-	oldmask = current->cpus_allowed;
+	cpumask_copy(&oldmask, tsk_cpus_allowed(current));
 	retval = set_cpus_allowed_ptr(current, cpumask_of(cpu));
 	if (unlikely(retval))
 		return retval;
arch/ia64/sn/kernel/sn2/sn_hwperf.c +1 -1
index 30862c0..b1f53e4 100644
@@ -627,7 +627,7 @@ static int sn_hwperf_op_cpu(struct sn_hwperf_op_info *op_info)
 		}
 		else {
 			/* migrate the task before calling SAL */
-			save_allowed = current->cpus_allowed;
+			cpumask_copy(&save_allowed, tsk_cpus_allowed(current));
 			set_cpus_allowed_ptr(current, cpumask_of(cpu));
 			sn_hwperf_call_sal(op_info);
 			set_cpus_allowed_ptr(current, &save_allowed);
Signature · 1 line
1.7.3.1
#1 lore raw

2011/6/23 KOSAKI Motohiro <[email protected]>:

Quoted 2 lines

We plan to remove old obsolete cpumask functions and plan to change task->cpus_allowed implementation in future.

...

Quoted 1 line

 arch/ia64/kernel/smpboot.c              |   56 +++++++++++++++---------------

I get some new warnings in this file with your patch:

arch/ia64/kernel/smpboot.c:454: warning: passing argument 2 of ‘cpumask_set_cpu’ discards qualifiers from pointer target type arch/ia64/kernel/smpboot.c:581: warning: passing argument 1 of ‘cpumask_clear’ discards qualifiers from pointer target type arch/ia64/kernel/smpboot.c:613: warning: passing argument 2 of ‘cpumask_set_cpu’ discards qualifiers from pointer target type arch/ia64/kernel/smpboot.c:637: warning: passing argument 2 of ‘cpumask_set_cpu’ discards qualifiers from pointer target type arch/ia64/kernel/smpboot.c:745: warning: passing argument 2 of ‘cpumask_clear_cpu’ discards qualifiers from pointer target type

Four of the five involve "cpu_callin_mask" which is "volatile", the other is for "cpu_present_mask" - not sure what the problem is for this one.

-Tony

#2 lore raw
Quoted 20 lines · Tony Luck

2011/6/23 KOSAKI Motohiro <[email protected]>:

Quoted 2 lines

We plan to remove old obsolete cpumask functions and plan to change task->cpus_allowed implementation in future.

...

Quoted 1 line
 arch/ia64/kernel/smpboot.c              |   56 +++++++++++++++---------------

I get some new warnings in this file with your patch:

arch/ia64/kernel/smpboot.c:454: warning: passing argument 2 of ‘cpumask_set_cpu’ discards qualifiers from pointer target type arch/ia64/kernel/smpboot.c:581: warning: passing argument 1 of ‘cpumask_clear’ discards qualifiers from pointer target type arch/ia64/kernel/smpboot.c:613: warning: passing argument 2 of ‘cpumask_set_cpu’ discards qualifiers from pointer target type arch/ia64/kernel/smpboot.c:637: warning: passing argument 2 of ‘cpumask_set_cpu’ discards qualifiers from pointer target type arch/ia64/kernel/smpboot.c:745: warning: passing argument 2 of ‘cpumask_clear_cpu’ discards qualifiers from pointer target type

Quoted 2 lines

Four of the five involve "cpu_callin_mask" which is "volatile", the other is for "cpu_present_mask" - not sure what the problem is for this one.

Sorry for the delay. I'm sorry for the annoying you.
But ummm.. I can't understand the author expect which effect by this volatile. If I am correct, its volatile has no effect. we can simply remove it.

So, I'll respin this.

Thanks.

#3 lore raw
Quoted 2 lines

But ummm.. I can't understand the author expect which effect by this volatile. If I am correct, its volatile has no effect. we can simply remove it.

It may be a legacy from when cpumask was a simple integer type. The boot cpu wakes up each "AP" cpu in turn - and spins looking at cpu_callin_mask waiting to see if the cpu has really woken up, since the AP cpu will set its own bit in this mask when it begins execution.

Making the original integer mask a volatile was a way to make sure that the compiler did not optimize away the re-read of this variable in the loop.

When NR_CPUS is small enough - we still use a simple integer for cpumask type - don't we? So if you remove the volatile, look very carefully at this loop:

        for (timeout = 0; timeout < 100000; timeout++) {
                if (cpu_isset(cpu, cpu_callin_map))
                        break;  /* It has booted */
                udelay(100);
        }

to make sure that the cpu_isset() check really does look at cpu_callin_map every time (and not at some cached in a register copy of it). Booting would become painfully slow if we get stuck for 10 seconds per cpu just here.

-Tony