Re: [PATCH] s390: convert old cpumask API into new one

From: Thiago Farina
Date: Thu Apr 28 2011 - 11:43:41 EST


On Thu, Apr 28, 2011 at 12:01 PM, KOSAKI Motohiro
<kosaki.motohiro@xxxxxxxxxxxxxx> wrote:
> Adapt new API.
>
> Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@xxxxxxxxxxxxxx>
> Cc: Martin Schwidefsky <schwidefsky@xxxxxxxxxx>
> Cc: Heiko Carstens <heiko.carstens@xxxxxxxxxx>
> Cc: linux390@xxxxxxxxxx
> Cc: linux-s390@xxxxxxxxxxxxxxx
> ---
> Âarch/s390/include/asm/tlbflush.h | Â Â2 +-
> Âarch/s390/kernel/smp.c      |  24 ++++++++++++------------
> Âarch/s390/kernel/time.c     Â|  Â4 ++--
> Âarch/s390/kernel/topology.c   Â|  16 ++++++++--------
> Â4 files changed, 23 insertions(+), 23 deletions(-)
>
> diff --git a/arch/s390/include/asm/tlbflush.h b/arch/s390/include/asm/tlbflush.h
> index 4fdcefc..b7a4f2e 100644
> --- a/arch/s390/include/asm/tlbflush.h
> +++ b/arch/s390/include/asm/tlbflush.h
> @@ -50,7 +50,7 @@ static inline void __tlb_flush_full(struct mm_struct *mm)
> Â Â Â Â/*
> Â Â Â Â * If the process only ran on the local cpu, do a local flush.
> Â Â Â Â */
> - Â Â Â local_cpumask = cpumask_of_cpu(smp_processor_id());
> + Â Â Â cpumask_copy(&local_cpumask, cpumask_of(smp_processor_id()));
> Â Â Â Âif (cpumask_equal(mm_cpumask(mm), &local_cpumask))
> Â Â Â Â Â Â Â Â__tlb_flush_local();
> Â Â Â Âelse
> diff --git a/arch/s390/kernel/smp.c b/arch/s390/kernel/smp.c
> index 63c7d9f..4cc09b8 100644
> --- a/arch/s390/kernel/smp.c
> +++ b/arch/s390/kernel/smp.c
> @@ -335,7 +335,7 @@ static int smp_rescan_cpus_sigp(cpumask_t avail)
> Â Â Â Â Â Â Â Âsmp_cpu_polarization[logical_cpu] = POLARIZATION_UNKNWN;
> Â Â Â Â Â Â Â Âif (!cpu_stopped(logical_cpu))
> Â Â Â Â Â Â Â Â Â Â Â Âcontinue;
> - Â Â Â Â Â Â Â cpu_set(logical_cpu, cpu_present_map);
> + Â Â Â Â Â Â Â set_cpu_present(logical_cpu, true);
> Â Â Â Â Â Â Â Âsmp_cpu_state[logical_cpu] = CPU_STATE_CONFIGURED;
> Â Â Â Â Â Â Â Âlogical_cpu = cpumask_next(logical_cpu, &avail);
> Â Â Â Â Â Â Â Âif (logical_cpu >= nr_cpu_ids)
> @@ -367,7 +367,7 @@ static int smp_rescan_cpus_sclp(cpumask_t avail)
> Â Â Â Â Â Â Â Â Â Â Â Âcontinue;
> Â Â Â Â Â Â Â Â__cpu_logical_map[logical_cpu] = cpu_id;
> Â Â Â Â Â Â Â Âsmp_cpu_polarization[logical_cpu] = POLARIZATION_UNKNWN;
> - Â Â Â Â Â Â Â cpu_set(logical_cpu, cpu_present_map);
> + Â Â Â Â Â Â Â set_cpu_present(logical_cpu, true);
> Â Â Â Â Â Â Â Âif (cpu >= info->configured)
> Â Â Â Â Â Â Â Â Â Â Â Âsmp_cpu_state[logical_cpu] = CPU_STATE_STANDBY;
> Â Â Â Â Â Â Â Âelse
> @@ -385,7 +385,7 @@ static int __smp_rescan_cpus(void)
> Â{
> Â Â Â Âcpumask_t avail;
>
> - Â Â Â cpus_xor(avail, cpu_possible_map, cpu_present_map);
> + Â Â Â cpumask_xor(&avail, cpu_possible_mask, cpu_present_mask);
> Â Â Â Âif (smp_use_sigp_detection)
> Â Â Â Â Â Â Â Âreturn smp_rescan_cpus_sigp(avail);
> Â Â Â Âelse
> @@ -467,7 +467,7 @@ int __cpuinit start_secondary(void *cpuvoid)
> Â Â Â Ânotify_cpu_starting(smp_processor_id());
> Â Â Â Â/* Mark this cpu as online */
> Â Â Â Âipi_call_lock();
> - Â Â Â cpu_set(smp_processor_id(), cpu_online_map);
> + Â Â Â set_cpu_online(smp_processor_id(), true);
> Â Â Â Âipi_call_unlock();
> Â Â Â Â/* Switch on interrupts */
> Â Â Â Âlocal_irq_enable();
> @@ -644,7 +644,7 @@ int __cpu_disable(void)
> Â Â Â Âstruct ec_creg_mask_parms cr_parms;
> Â Â Â Âint cpu = smp_processor_id();
>
> - Â Â Â cpu_clear(cpu, cpu_online_map);
> + Â Â Â set_cpu_online(cpu, false);
>
> Â Â Â Â/* Disable pfault pseudo page faults on this cpu. */
> Â Â Â Âpfault_fini();
> @@ -738,8 +738,8 @@ void __init smp_prepare_boot_cpu(void)
> Â Â Â ÂBUG_ON(smp_processor_id() != 0);
>
> Â Â Â Âcurrent_thread_info()->cpu = 0;
> - Â Â Â cpu_set(0, cpu_present_map);
> - Â Â Â cpu_set(0, cpu_online_map);
> + Â Â Â set_cpu_present(0, true);
> + Â Â Â set_cpu_online(0, true);
> Â Â Â ÂS390_lowcore.percpu_offset = __per_cpu_offset[0];
> Â Â Â Âcurrent_set[0] = current;
> Â Â Â Âsmp_cpu_state[0] = CPU_STATE_CONFIGURED;
> @@ -1016,21 +1016,21 @@ int __ref smp_rescan_cpus(void)
>
> Â Â Â Âget_online_cpus();
> Â Â Â Âmutex_lock(&smp_cpu_state_mutex);
> - Â Â Â newcpus = cpu_present_map;
> + Â Â Â cpumask_copy(&newcpus, cpu_present_mask);
> Â Â Â Ârc = __smp_rescan_cpus();
> Â Â Â Âif (rc)
> Â Â Â Â Â Â Â Âgoto out;
> - Â Â Â cpus_andnot(newcpus, cpu_present_map, newcpus);
> - Â Â Â for_each_cpu_mask(cpu, newcpus) {
> + Â Â Â cpumask_andnot(&newcpus, cpu_present_mask, &newcpus);
> + Â Â Â for_each_cpu(cpu,&newcpus) {
please, could you add a space between cpu and ,&newcpus?

> Â Â Â Â Â Â Â Ârc = smp_add_present_cpu(cpu);
> Â Â Â Â Â Â Â Âif (rc)
> - Â Â Â Â Â Â Â Â Â Â Â cpu_clear(cpu, cpu_present_map);
> + Â Â Â Â Â Â Â Â Â Â Â set_cpu_present(cpu, false);
> Â Â Â Â}
> Â Â Â Ârc = 0;
> Âout:
> Â Â Â Âmutex_unlock(&smp_cpu_state_mutex);
> Â Â Â Âput_online_cpus();
> - Â Â Â if (!cpus_empty(newcpus))
> + Â Â Â if (!cpumask_empty(&newcpus))
> Â Â Â Â Â Â Â Âtopology_schedule_update();
> Â Â Â Âreturn rc;
> Â}
> diff --git a/arch/s390/kernel/time.c b/arch/s390/kernel/time.c
> index 87be655..a59557f 100644
> --- a/arch/s390/kernel/time.c
> +++ b/arch/s390/kernel/time.c
> @@ -810,7 +810,7 @@ static int etr_sync_clock_stop(struct etr_aib *aib, int port)
> Â Â Â Âetr_sync.etr_port = port;
> Â Â Â Âget_online_cpus();
> Â Â Â Âatomic_set(&etr_sync.cpus, num_online_cpus() - 1);
> - Â Â Â rc = stop_machine(etr_sync_clock, &etr_sync, &cpu_online_map);
> + Â Â Â rc = stop_machine(etr_sync_clock, &etr_sync, cpu_online_mask);
> Â Â Â Âput_online_cpus();
> Â Â Â Âreturn rc;
> Â}
> @@ -1579,7 +1579,7 @@ static void stp_work_fn(struct work_struct *work)
> Â Â Â Âmemset(&stp_sync, 0, sizeof(stp_sync));
> Â Â Â Âget_online_cpus();
> Â Â Â Âatomic_set(&stp_sync.cpus, num_online_cpus() - 1);
> - Â Â Â stop_machine(stp_sync_clock, &stp_sync, &cpu_online_map);
> + Â Â Â stop_machine(stp_sync_clock, &stp_sync, cpu_online_mask);
> Â Â Â Âput_online_cpus();
>
> Â Â Â Âif (!check_sync_clock())
> diff --git a/arch/s390/kernel/topology.c b/arch/s390/kernel/topology.c
> index 94b06c3..2eafb8c 100644
> --- a/arch/s390/kernel/topology.c
> +++ b/arch/s390/kernel/topology.c
> @@ -52,20 +52,20 @@ static cpumask_t cpu_group_map(struct mask_info *info, unsigned int cpu)
> Â{
> Â Â Â Âcpumask_t mask;
>
> - Â Â Â cpus_clear(mask);
> + Â Â Â cpumask_clear(&mask);
> Â Â Â Âif (!topology_enabled || !MACHINE_HAS_TOPOLOGY) {
> Â Â Â Â Â Â Â Âcpumask_copy(&mask, cpumask_of(cpu));
> Â Â Â Â Â Â Â Âreturn mask;
> Â Â Â Â}
> Â Â Â Âwhile (info) {
> - Â Â Â Â Â Â Â if (cpu_isset(cpu, info->mask)) {
> + Â Â Â Â Â Â Â if (cpumask_test_cpu(cpu, &info->mask)) {
> Â Â Â Â Â Â Â Â Â Â Â Âmask = info->mask;
> Â Â Â Â Â Â Â Â Â Â Â Âbreak;
> Â Â Â Â Â Â Â Â}
> Â Â Â Â Â Â Â Âinfo = info->next;
> Â Â Â Â}
> - Â Â Â if (cpus_empty(mask))
> - Â Â Â Â Â Â Â mask = cpumask_of_cpu(cpu);
> + Â Â Â if (cpumask_empty(&mask))
> + Â Â Â Â Â Â Â cpumask_copy(&mask, cpumask_of(cpu));
> Â Â Â Âreturn mask;
> Â}
>
> @@ -85,10 +85,10 @@ static void add_cpus_to_mask(struct topology_cpu *tl_cpu,
> Â Â Â Â Â Â Â Â Â Â Â Âif (cpu_logical_map(lcpu) != rcpu)
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Âcontinue;
> Â#ifdef CONFIG_SCHED_BOOK
> - Â Â Â Â Â Â Â Â Â Â Â cpu_set(lcpu, book->mask);
> + Â Â Â Â Â Â Â Â Â Â Â cpumask_set_cpu(lcpu, &book->mask);
> Â Â Â Â Â Â Â Â Â Â Â Âcpu_book_id[lcpu] = book->id;
> Â#endif
> - Â Â Â Â Â Â Â Â Â Â Â cpu_set(lcpu, core->mask);
> + Â Â Â Â Â Â Â Â Â Â Â cpumask_set_cpu(lcpu, &core->mask);
> Â Â Â Â Â Â Â Â Â Â Â Âcpu_core_id[lcpu] = core->id;
> Â Â Â Â Â Â Â Â Â Â Â Âsmp_cpu_polarization[lcpu] = tl_cpu->pp;
> Â Â Â Â Â Â Â Â}
> @@ -101,13 +101,13 @@ static void clear_masks(void)
>
> Â Â Â Âinfo = &core_info;
> Â Â Â Âwhile (info) {
> - Â Â Â Â Â Â Â cpus_clear(info->mask);
> + Â Â Â Â Â Â Â cpumask_clear(&info->mask);
> Â Â Â Â Â Â Â Âinfo = info->next;
> Â Â Â Â}
> Â#ifdef CONFIG_SCHED_BOOK
> Â Â Â Âinfo = &book_info;
> Â Â Â Âwhile (info) {
> - Â Â Â Â Â Â Â cpus_clear(info->mask);
> + Â Â Â Â Â Â Â cpumask_clear(&info->mask);
> Â Â Â Â Â Â Â Âinfo = info->next;
> Â Â Â Â}
> Â#endif
> --
> 1.7.3.1
>
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@xxxxxxxxxxxxxxx
> More majordomo info at Âhttp://vger.kernel.org/majordomo-info.html
> Please read the FAQ at Âhttp://www.tux.org/lkml/
>
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/