From: Arnd Bergmann <arnd@arndb.de>

I haven't had a chance to run the code yet, but in order to compile
on s390, I needed the below patch on top of yours.

In theory, I should be able to define up to 128 virtual cpus when 
running linux inside of VM, although I have never tried that as
defining more virtual cpus than installed ones just adds overhead.

Do you have any special test cases beyond booting the kernel
that I can do for the online cpus > 32 case? 
How many should I test (33, 65, 128)?

	Arnd <><



 25-akpm/arch/s390/kernel/smp.c         |    2 +-
 25-akpm/include/asm-s390/mmu_context.h |    2 +-
 25-akpm/include/asm-s390/tlbflush.h    |    6 ++++--
 25-akpm/kernel/module.c                |    2 +-
 4 files changed, 7 insertions(+), 5 deletions(-)

diff -puN arch/s390/kernel/smp.c~cpumask_t-s390-fix arch/s390/kernel/smp.c
--- 25/arch/s390/kernel/smp.c~cpumask_t-s390-fix	Tue Jul  8 13:48:40 2003
+++ 25-akpm/arch/s390/kernel/smp.c	Tue Jul  8 13:48:40 2003
@@ -427,7 +427,7 @@ void __init smp_check_cpus(unsigned int 
                 if (signal_processor(num_cpus, sigp_sense) ==
                     sigp_not_operational)
                         continue;
-		set_bit(num_cpus, &cpu_possible_map);
+		cpu_set(num_cpus, cpu_possible_map);
                 num_cpus++;
         }
         printk("Detected %d CPU's\n",(int) num_cpus);
diff -puN include/asm-s390/mmu_context.h~cpumask_t-s390-fix include/asm-s390/mmu_context.h
--- 25/include/asm-s390/mmu_context.h~cpumask_t-s390-fix	Tue Jul  8 13:48:40 2003
+++ 25-akpm/include/asm-s390/mmu_context.h	Tue Jul  8 13:50:27 2003
@@ -42,7 +42,7 @@ static inline void switch_mm(struct mm_s
                              : : "m" (pgd) );
 #endif /* __s390x__ */
         }
-	set_bit(smp_processor_id(), &next->cpu_vm_mask);
+	cpu_set(smp_processor_id(), next->cpu_vm_mask);
 }
 
 #define deactivate_mm(tsk,mm)	do { } while (0)
diff -puN include/asm-s390/tlbflush.h~cpumask_t-s390-fix include/asm-s390/tlbflush.h
--- 25/include/asm-s390/tlbflush.h~cpumask_t-s390-fix	Tue Jul  8 13:48:40 2003
+++ 25-akpm/include/asm-s390/tlbflush.h	Tue Jul  8 13:48:40 2003
@@ -98,13 +98,15 @@ static inline void global_flush_tlb(void
 
 static inline void __flush_tlb_mm(struct mm_struct * mm)
 {
+	cpumask_t local_cpumask;
 	preempt_disable();
-	if (mm->cpu_vm_mask != (1UL << smp_processor_id())) {
+	local_cpumask = cpumask_of_cpu(smp_processor_id());
+	if (cpus_equal(mm->cpu_vm_mask, local_cpumask)) {
 		/* mm was active on more than one cpu. */
 		if (mm == current->active_mm &&
 		    atomic_read(&mm->mm_users) == 1)
 			/* this cpu is the only one using the mm. */
-			mm->cpu_vm_mask = 1UL << smp_processor_id();
+			mm->cpu_vm_mask = local_cpumask;
 		global_flush_tlb();
 	} else
 		local_flush_tlb();
diff -puN kernel/module.c~cpumask_t-s390-fix kernel/module.c
--- 25/kernel/module.c~cpumask_t-s390-fix	Tue Jul  8 13:48:40 2003
+++ 25-akpm/kernel/module.c	Tue Jul  8 13:48:41 2003
@@ -471,7 +471,7 @@ static int stopref(void *cpu)
 	struct sched_param param = { .sched_priority = MAX_RT_PRIO-1 };
 	setscheduler(current->pid, SCHED_FIFO, &param);
 #endif
-	set_cpus_allowed(current, cpumask_of_cpu((int)cpu));
+	set_cpus_allowed(current, cpumask_of_cpu((long)cpu));
 
 	/* Ack: we are alive */
 	atomic_inc(&stopref_thread_ack);

_