Commit 4d6642d3 authored by Ivan Kokshaysky's avatar Ivan Kokshaysky Committed by Linus Torvalds

[PATCH] alpha: CPU logical mapping [3/10]

Hardware cpu_id to logical cpu mapping is gone.
Converted to cpu_online() etc.
parent cdc03222
...@@ -525,12 +525,9 @@ show_interrupts(struct seq_file *p, void *v) ...@@ -525,12 +525,9 @@ show_interrupts(struct seq_file *p, void *v)
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
seq_puts(p, " "); seq_puts(p, " ");
for (i = 0; i < smp_num_cpus; i++) for (i = 0; i < NR_CPUS; i++)
seq_printf(p, "CPU%d ", i); if (cpu_online(i))
#ifdef DO_BROADCAST_INTS seq_printf(p, "CPU%d ", i);
for (i = 0; i < smp_num_cpus; i++)
seq_printf(p, "TRY%d ", i);
#endif
seq_putc(p, '\n'); seq_putc(p, '\n');
#endif #endif
...@@ -542,14 +539,9 @@ show_interrupts(struct seq_file *p, void *v) ...@@ -542,14 +539,9 @@ show_interrupts(struct seq_file *p, void *v)
#ifndef CONFIG_SMP #ifndef CONFIG_SMP
seq_printf(p, "%10u ", kstat_irqs(i)); seq_printf(p, "%10u ", kstat_irqs(i));
#else #else
for (j = 0; j < smp_num_cpus; j++) for (j = 0; j < NR_CPUS; j++)
seq_printf(p, "%10u ", if (cpu_online(j))
kstat.irqs[cpu_logical_map(j)][i]); seq_printf(p, "%10u ", kstat.irqs[j][i]);
#ifdef DO_BROADCAST_INTS
for (j = 0; j < smp_num_cpus; j++)
seq_printf(p, "%10lu ",
irq_attempt(cpu_logical_map(j), i));
#endif
#endif #endif
seq_printf(p, " %14s", irq_desc[i].handler->typename); seq_printf(p, " %14s", irq_desc[i].handler->typename);
seq_printf(p, " %c%s", seq_printf(p, " %c%s",
...@@ -565,9 +557,9 @@ show_interrupts(struct seq_file *p, void *v) ...@@ -565,9 +557,9 @@ show_interrupts(struct seq_file *p, void *v)
} }
#if CONFIG_SMP #if CONFIG_SMP
seq_puts(p, "IPI: "); seq_puts(p, "IPI: ");
for (j = 0; j < smp_num_cpus; j++) for (i = 0; i < NR_CPUS; i++)
seq_printf(p, "%10lu ", if (cpu_online(i))
cpu_data[cpu_logical_map(j)].ipi_count); seq_printf(p, "%10lu ", cpu_data[i].ipi_count);
seq_putc(p, '\n'); seq_putc(p, '\n');
#endif #endif
seq_printf(p, "ERR: %10lu\n", irq_err_count); seq_printf(p, "ERR: %10lu\n", irq_err_count);
......
...@@ -1109,7 +1109,7 @@ show_cpuinfo(struct seq_file *f, void *slot) ...@@ -1109,7 +1109,7 @@ show_cpuinfo(struct seq_file *f, void *slot)
#ifdef CONFIG_SMP #ifdef CONFIG_SMP
seq_printf(f, "cpus active\t\t: %d\n" seq_printf(f, "cpus active\t\t: %d\n"
"cpu active mask\t\t: %016lx\n", "cpu active mask\t\t: %016lx\n",
smp_num_cpus, cpu_present_mask); num_online_cpus(), cpu_present_mask);
#endif #endif
return 0; return 0;
......
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
#include <asm/hardirq.h> #include <asm/hardirq.h>
#include <asm/softirq.h> #include <asm/softirq.h>
#include <asm/mmu_context.h> #include <asm/mmu_context.h>
#include <asm/tlbflush.h>
#define __KERNEL_SYSCALLS__ #define __KERNEL_SYSCALLS__
#include <asm/unistd.h> #include <asm/unistd.h>
...@@ -84,9 +85,6 @@ int smp_threads_ready; /* True once the per process idle is forked. */ ...@@ -84,9 +85,6 @@ int smp_threads_ready; /* True once the per process idle is forked. */
cycles_t cacheflush_time; cycles_t cacheflush_time;
unsigned long cache_decay_ticks; unsigned long cache_decay_ticks;
int __cpu_number_map[NR_CPUS];
int __cpu_logical_map[NR_CPUS];
extern void calibrate_delay(void); extern void calibrate_delay(void);
extern asmlinkage void entInt(void); extern asmlinkage void entInt(void);
...@@ -463,9 +461,6 @@ smp_boot_one_cpu(int cpuid, int cpunum) ...@@ -463,9 +461,6 @@ smp_boot_one_cpu(int cpuid, int cpunum)
init_idle(idle, cpuid); init_idle(idle, cpuid);
unhash_process(idle); unhash_process(idle);
__cpu_logical_map[cpunum] = cpuid;
__cpu_number_map[cpuid] = cpunum;
DBGS(("smp_boot_one_cpu: CPU %d state 0x%lx flags 0x%lx\n", DBGS(("smp_boot_one_cpu: CPU %d state 0x%lx flags 0x%lx\n",
cpuid, idle->state, idle->flags)); cpuid, idle->state, idle->flags));
...@@ -490,9 +485,7 @@ smp_boot_one_cpu(int cpuid, int cpunum) ...@@ -490,9 +485,7 @@ smp_boot_one_cpu(int cpuid, int cpunum)
barrier(); barrier();
} }
/* We must invalidate our stuff as we failed to boot the CPU. */ /* We failed to boot the CPU. */
__cpu_logical_map[cpunum] = -1;
__cpu_number_map[cpuid] = -1;
printk(KERN_ERR "SMP: Processor %d is stuck.\n", cpuid); printk(KERN_ERR "SMP: Processor %d is stuck.\n", cpuid);
return -1; return -1;
...@@ -562,12 +555,8 @@ smp_boot_cpus(void) ...@@ -562,12 +555,8 @@ smp_boot_cpus(void)
unsigned long bogosum; unsigned long bogosum;
/* Take care of some initial bookkeeping. */ /* Take care of some initial bookkeeping. */
memset(__cpu_number_map, -1, sizeof(__cpu_number_map));
memset(__cpu_logical_map, -1, sizeof(__cpu_logical_map));
memset(ipi_data, 0, sizeof(ipi_data)); memset(ipi_data, 0, sizeof(ipi_data));
__cpu_number_map[boot_cpuid] = 0;
__cpu_logical_map[0] = boot_cpuid;
current_thread_info()->cpu = boot_cpuid; current_thread_info()->cpu = boot_cpuid;
smp_store_cpu_info(boot_cpuid); smp_store_cpu_info(boot_cpuid);
...@@ -942,10 +931,9 @@ flush_tlb_mm(struct mm_struct *mm) ...@@ -942,10 +931,9 @@ flush_tlb_mm(struct mm_struct *mm)
if (mm == current->active_mm) { if (mm == current->active_mm) {
flush_tlb_current(mm); flush_tlb_current(mm);
if (atomic_read(&mm->mm_users) <= 1) { if (atomic_read(&mm->mm_users) <= 1) {
int i, cpu, this_cpu = smp_processor_id(); int cpu, this_cpu = smp_processor_id();
for (i = 0; i < smp_num_cpus; i++) { for (cpu = 0; cpu < NR_CPUS; cpu++) {
cpu = cpu_logical_map(i); if (!cpu_online(cpu) || cpu == this_cpu)
if (cpu == this_cpu)
continue; continue;
if (mm->context[cpu]) if (mm->context[cpu])
mm->context[cpu] = 0; mm->context[cpu] = 0;
...@@ -986,10 +974,9 @@ flush_tlb_page(struct vm_area_struct *vma, unsigned long addr) ...@@ -986,10 +974,9 @@ flush_tlb_page(struct vm_area_struct *vma, unsigned long addr)
if (mm == current->active_mm) { if (mm == current->active_mm) {
flush_tlb_current_page(mm, vma, addr); flush_tlb_current_page(mm, vma, addr);
if (atomic_read(&mm->mm_users) <= 1) { if (atomic_read(&mm->mm_users) <= 1) {
int i, cpu, this_cpu = smp_processor_id(); int cpu, this_cpu = smp_processor_id();
for (i = 0; i < smp_num_cpus; i++) { for (cpu = 0; cpu < NR_CPUS; cpu++) {
cpu = cpu_logical_map(i); if (!cpu_online(cpu) || cpu == this_cpu)
if (cpu == this_cpu)
continue; continue;
if (mm->context[cpu]) if (mm->context[cpu])
mm->context[cpu] = 0; mm->context[cpu] = 0;
...@@ -1036,10 +1023,9 @@ flush_icache_user_range(struct vm_area_struct *vma, struct page *page, ...@@ -1036,10 +1023,9 @@ flush_icache_user_range(struct vm_area_struct *vma, struct page *page,
if (mm == current->active_mm) { if (mm == current->active_mm) {
__load_new_mm_context(mm); __load_new_mm_context(mm);
if (atomic_read(&mm->mm_users) <= 1) { if (atomic_read(&mm->mm_users) <= 1) {
int i, cpu, this_cpu = smp_processor_id(); int cpu, this_cpu = smp_processor_id();
for (i = 0; i < smp_num_cpus; i++) { for (cpu = 0; cpu < NR_CPUS; cpu++) {
cpu = cpu_logical_map(i); if (!cpu_online(cpu) || cpu == this_cpu)
if (cpu == this_cpu)
continue; continue;
if (mm->context[cpu]) if (mm->context[cpu])
mm->context[cpu] = 0; mm->context[cpu] = 0;
......
...@@ -227,8 +227,9 @@ init_new_context(struct task_struct *tsk, struct mm_struct *mm) ...@@ -227,8 +227,9 @@ init_new_context(struct task_struct *tsk, struct mm_struct *mm)
{ {
int i; int i;
for (i = 0; i < smp_num_cpus; i++) for (i = 0; i < NR_CPUS; i++)
mm->context[cpu_logical_map(i)] = 0; if (cpu_online(i))
mm->context[i] = 0;
tsk->thread_info->pcb.ptbr tsk->thread_info->pcb.ptbr
= ((unsigned long)mm->pgd - IDENT_ADDR) >> PAGE_SHIFT; = ((unsigned long)mm->pgd - IDENT_ADDR) >> PAGE_SHIFT;
return 0; return 0;
......
...@@ -42,20 +42,16 @@ extern struct cpuinfo_alpha cpu_data[NR_CPUS]; ...@@ -42,20 +42,16 @@ extern struct cpuinfo_alpha cpu_data[NR_CPUS];
#define PROC_CHANGE_PENALTY 20 #define PROC_CHANGE_PENALTY 20
/* Map from cpu id to sequential logical cpu number. This will only
not be idempotent when cpus failed to come on-line. */
extern int __cpu_number_map[NR_CPUS];
#define cpu_number_map(cpu) __cpu_number_map[cpu]
/* The reverse map from sequential logical cpu number to cpu id. */
extern int __cpu_logical_map[NR_CPUS];
#define cpu_logical_map(cpu) __cpu_logical_map[cpu]
#define hard_smp_processor_id() __hard_smp_processor_id() #define hard_smp_processor_id() __hard_smp_processor_id()
#define smp_processor_id() (current_thread_info()->cpu) #define smp_processor_id() (current_thread_info()->cpu)
extern unsigned long cpu_present_mask; extern unsigned long cpu_present_mask;
#define cpu_online_map cpu_present_mask extern int smp_num_cpus;
#define cpu_online_map cpu_present_mask
#define num_online_cpus() (smp_num_cpus)
#define cpu_online(cpu) (cpu_present_mask & (1<<(cpu)))
#define cpu_possible(cpu) cpu_online(cpu)
extern int smp_call_function_on_cpu(void (*func) (void *info), void *info,int retry, int wait, unsigned long cpu); extern int smp_call_function_on_cpu(void (*func) (void *info), void *info,int retry, int wait, unsigned long cpu);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment