[parisc-linux-cvs] linux-2.5 tausq
Randolph Chung
Randolph Chung <randolph@tausq.org>
Sun, 28 Jul 2002 17:34:03 -0700
> various smp compile fixes
Index: arch/parisc/vmlinux.lds
===================================================================
RCS file: /var/cvs/linux-2.5/arch/parisc/vmlinux.lds,v
retrieving revision 1.3
diff -u -p -r1.3 vmlinux.lds
--- arch/parisc/vmlinux.lds 20 Jul 2002 16:27:05 -0000 1.3
+++ arch/parisc/vmlinux.lds 29 Jul 2002 00:27:18 -0000
@@ -55,6 +55,11 @@ SECTIONS
*(.initcall7.init)
}
__initcall_end = .;
+ . = ALIGN(32);
+ __per_cpu_start = .;
+ .data.percpu : { *(.data.percpu) }
+ __per_cpu_end = .;
+ . = ALIGN(4096);
__init_end = .;
Index: arch/parisc/vmlinux64.lds
===================================================================
RCS file: /var/cvs/linux-2.5/arch/parisc/vmlinux64.lds,v
retrieving revision 1.2
diff -u -p -r1.2 vmlinux64.lds
--- arch/parisc/vmlinux64.lds 23 Jul 2002 06:50:00 -0000 1.2
+++ arch/parisc/vmlinux64.lds 29 Jul 2002 00:27:18 -0000
@@ -58,6 +58,11 @@ SECTIONS
*(.initcall7.init)
}
__initcall_end = .;
+ . = ALIGN(32);
+ __per_cpu_start = .;
+ .data.percpu : { *(.data.percpu) }
+ __per_cpu_end = .;
+ . = ALIGN(4096);
__init_end = .;
Index: arch/parisc/kernel/parisc_ksyms.c
===================================================================
RCS file: /var/cvs/linux-2.5/arch/parisc/kernel/parisc_ksyms.c,v
retrieving revision 1.3
diff -u -p -r1.3 parisc_ksyms.c
--- arch/parisc/kernel/parisc_ksyms.c 20 Jul 2002 16:27:06 -0000 1.3
+++ arch/parisc/kernel/parisc_ksyms.c 29 Jul 2002 00:27:18 -0000
@@ -63,9 +63,6 @@ EXPORT_SYMBOL(__global_sti);
EXPORT_SYMBOL(__global_cli);
EXPORT_SYMBOL(__global_save_flags);
EXPORT_SYMBOL(__global_restore_flags);
-
-#include <linux/smp.h>
-EXPORT_SYMBOL(smp_num_cpus);
#endif /* CONFIG_SMP */
#include <asm/atomic.h>
Index: arch/parisc/kernel/smp.c
===================================================================
RCS file: /var/cvs/linux-2.5/arch/parisc/kernel/smp.c,v
retrieving revision 1.1
diff -u -p -r1.1 smp.c
--- arch/parisc/kernel/smp.c 20 Jul 2002 16:27:06 -0000 1.1
+++ arch/parisc/kernel/smp.c 29 Jul 2002 00:27:19 -0000
@@ -50,6 +50,7 @@
#include <asm/processor.h>
#include <asm/ptrace.h>
#include <asm/unistd.h>
+#include <asm/cacheflush.h>
#define kDEBUG 0
@@ -67,6 +68,7 @@ volatile unsigned long cpu_online_map =
int smp_num_cpus = 1;
int smp_threads_ready = 0;
+unsigned long cache_decay_ticks;
static int max_cpus = -1; /* Command line */
struct smp_call_struct {
void (*func) (void *info);
@@ -505,7 +507,7 @@ void __init smp_callin(void)
* task could get scheduled before we had a chance to remove it from the
* run-queue...
*/
-static int fork_by_hand(void)
+static struct task_struct *fork_by_hand(void)
{
struct pt_regs regs;
@@ -513,7 +515,7 @@ static int fork_by_hand(void)
* don't care about the regs settings since
* we'll never reschedule the forked task.
*/
- return do_fork(CLONE_VM|CLONE_PID, 0, ®s, 0);
+ return do_fork(CLONE_VM|CLONE_IDLETASK, 0, ®s, 0);
}
@@ -535,17 +537,12 @@ static int smp_boot_one_cpu(int cpuid, i
* Sheesh . . .
*/
- if (fork_by_hand() < 0)
+ if ((idle = fork_by_hand()) == 0)
panic("SMP: fork failed for CPU:%d", cpuid);
-
- idle = init_task.prev_task;
- if (!idle)
- panic("SMP: No idle process for CPU:%d", cpuid);
- task_set_cpu(idle, cpunum); /* manually schedule idle task */
- del_from_runqueue(idle);
+ init_idle(idle, cpunum);
unhash_process(idle);
- init_tasks[cpunum] = idle;
+ idle->thread_info->cpu = cpunum;
/* Let _start know what logical CPU we're booting
** (offset into init_tasks[],cpu_data[])
@@ -583,8 +580,8 @@ static int smp_boot_one_cpu(int cpuid, i
barrier();
}
- init_tasks[cpunum] = NULL;
- free_task_struct(idle);
+ put_task_struct(idle);
+ idle = NULL;
printk(KERN_CRIT "SMP: CPU:%d is stuck.\n", cpuid);
return -1;
@@ -623,8 +620,8 @@ void __init smp_boot_cpus(void)
/* Setup BSP mappings */
printk(KERN_DEBUG "SMP: bootstrap CPU ID is %d\n",bootstrap_processor);
- init_task.processor = bootstrap_processor;
- current->processor = bootstrap_processor;
+ init_task.thread_info->cpu = bootstrap_processor;
+ current->thread_info->cpu = bootstrap_processor;
cpu_online_map = 1 << bootstrap_processor; /* Mark Boostrap processor as present */
current->active_mm = &init_mm;
@@ -663,6 +660,11 @@ void __init smp_boot_cpus(void)
if (cpu_count == 1) {
printk(KERN_INFO "SMP: Bootstrap processor only.\n");
}
+
+ /*
+ * FIXME very rough.
+ */
+ cache_decay_ticks = HZ/100;
printk(KERN_INFO "SMP: Total %d of %d processors activated "
"(%lu.%02lu BogoMIPS noticed).\n",
Index: include/asm-parisc/bitops.h
===================================================================
RCS file: /var/cvs/linux-2.5/include/asm-parisc/bitops.h,v
retrieving revision 1.7
diff -u -p -r1.7 bitops.h
--- include/asm-parisc/bitops.h 24 Jul 2002 21:23:53 -0000 1.7
+++ include/asm-parisc/bitops.h 29 Jul 2002 00:27:19 -0000
@@ -335,6 +335,44 @@ found_middle:
return result + ffz(tmp);
}
+static __inline__ unsigned long find_next_bit(unsigned long *addr, unsigned long size, unsigned long offset)
+{
+ unsigned long *p = addr + (offset >> 6);
+ unsigned long result = offset & ~(BITS_PER_LONG-1);
+ unsigned long tmp;
+
+ if (offset >= size)
+ return size;
+ size -= result;
+ offset &= (BITS_PER_LONG-1);
+ if (offset) {
+ tmp = *(p++);
+ tmp &= (~0UL << offset);
+ if (size < BITS_PER_LONG)
+ goto found_first;
+ if (tmp)
+ goto found_middle;
+ size -= BITS_PER_LONG;
+ result += BITS_PER_LONG;
+ }
+ while (size & ~(BITS_PER_LONG-1)) {
+ if ((tmp = *(p++)))
+ goto found_middle;
+ result += BITS_PER_LONG;
+ size -= BITS_PER_LONG;
+ }
+ if (!size)
+ return result;
+ tmp = *p;
+
+found_first:
+ tmp &= (~0UL >> (BITS_PER_LONG - size));
+ if (tmp == 0UL) /* Are any bits set? */
+ return result + size; /* Nope. */
+found_middle:
+ return result + __ffs(tmp);
+}
+
#define _EXT2_HAVE_ASM_BITOPS_
#ifdef __KERNEL__
Index: include/asm-parisc/hardirq.h
===================================================================
RCS file: /var/cvs/linux-2.5/include/asm-parisc/hardirq.h,v
retrieving revision 1.5
diff -u -p -r1.5 hardirq.h
--- include/asm-parisc/hardirq.h 21 Jul 2002 17:13:16 -0000 1.5
+++ include/asm-parisc/hardirq.h 29 Jul 2002 00:27:19 -0000
@@ -62,9 +62,8 @@ extern spinlock_t global_irq_lock;
static inline int irqs_running (void)
{
int i;
- extern int smp_num_cpus;
- for (i = 0; i < smp_num_cpus; i++)
+ for (i = 0; i < NR_CPUS; i++)
if (local_irq_count(i))
return 1;
return 0;
Index: include/asm-parisc/smp.h
===================================================================
RCS file: /var/cvs/linux-2.5/include/asm-parisc/smp.h,v
retrieving revision 1.4
diff -u -p -r1.4 smp.h
--- include/asm-parisc/smp.h 21 Jul 2002 17:13:16 -0000 1.4
+++ include/asm-parisc/smp.h 29 Jul 2002 00:27:19 -0000
@@ -48,7 +48,20 @@ extern void smp_send_reschedule(int cpu)
#endif
#define smp_processor_id() (current_thread_info()->cpu)
+#define cpu_online(cpu) (cpu_online_map & (1<<(cpu)))
+extern inline unsigned int num_online_cpus(void)
+{
+ return hweight32(cpu_online_map);
+}
+
+extern inline int any_online_cpu(unsigned int mask)
+{
+ if (mask & cpu_online_map)
+ return __ffs(mask & cpu_online_map);
+
+ return -1;
+}
#endif /* CONFIG_SMP */
#define NO_PROC_ID 0xFF /* No processor magic marker */
--
Randolph Chung
Debian GNU/Linux Developer, hppa/ia64 ports
http://www.tausq.org/