diff options
| author | Jeff Garzik <jgarzik@pobox.com> | 2005-11-10 04:12:10 -0500 |
|---|---|---|
| committer | Jeff Garzik <jgarzik@pobox.com> | 2005-11-10 04:12:10 -0500 |
| commit | 2f67bdb23d74a6c6fd4f98f64239c5c34d1833cc (patch) | |
| tree | fe533abe3e7c400848647b95e4806f5125c654c3 /arch/sparc64/kernel/smp.c | |
| parent | d40d9d29c020f8466c96f8e3ad4b7c014ff1085d (diff) | |
| parent | 3b44f137b9a846c5452d9e6e1271b79b1dbcc942 (diff) | |
Merge branch 'master'
Diffstat (limited to 'arch/sparc64/kernel/smp.c')
| -rw-r--r-- | arch/sparc64/kernel/smp.c | 95 |
1 files changed, 26 insertions, 69 deletions
diff --git a/arch/sparc64/kernel/smp.c b/arch/sparc64/kernel/smp.c index b137fd63f5e1..797a65493fb8 100644 --- a/arch/sparc64/kernel/smp.c +++ b/arch/sparc64/kernel/smp.c | |||
| @@ -168,6 +168,9 @@ void __init smp_callin(void) | |||
| 168 | rmb(); | 168 | rmb(); |
| 169 | 169 | ||
| 170 | cpu_set(cpuid, cpu_online_map); | 170 | cpu_set(cpuid, cpu_online_map); |
| 171 | |||
| 172 | /* idle thread is expected to have preempt disabled */ | ||
| 173 | preempt_disable(); | ||
| 171 | } | 174 | } |
| 172 | 175 | ||
| 173 | void cpu_panic(void) | 176 | void cpu_panic(void) |
| @@ -839,43 +842,29 @@ void smp_flush_tlb_all(void) | |||
| 839 | * questionable (in theory the big win for threads is the massive sharing of | 842 | * questionable (in theory the big win for threads is the massive sharing of |
| 840 | * address space state across processors). | 843 | * address space state across processors). |
| 841 | */ | 844 | */ |
| 845 | |||
| 846 | /* This currently is only used by the hugetlb arch pre-fault | ||
| 847 | * hook on UltraSPARC-III+ and later when changing the pagesize | ||
| 848 | * bits of the context register for an address space. | ||
| 849 | */ | ||
| 842 | void smp_flush_tlb_mm(struct mm_struct *mm) | 850 | void smp_flush_tlb_mm(struct mm_struct *mm) |
| 843 | { | 851 | { |
| 844 | /* | 852 | u32 ctx = CTX_HWBITS(mm->context); |
| 845 | * This code is called from two places, dup_mmap and exit_mmap. In the | 853 | int cpu = get_cpu(); |
| 846 | * former case, we really need a flush. In the later case, the callers | ||
| 847 | * are single threaded exec_mmap (really need a flush), multithreaded | ||
| 848 | * exec_mmap case (do not need to flush, since the caller gets a new | ||
| 849 | * context via activate_mm), and all other callers of mmput() whence | ||
| 850 | * the flush can be optimized since the associated threads are dead and | ||
| 851 | * the mm is being torn down (__exit_mm and other mmput callers) or the | ||
| 852 | * owning thread is dissociating itself from the mm. The | ||
| 853 | * (atomic_read(&mm->mm_users) == 0) check ensures real work is done | ||
| 854 | * for single thread exec and dup_mmap cases. An alternate check might | ||
| 855 | * have been (current->mm != mm). | ||
| 856 | * Kanoj Sarcar | ||
| 857 | */ | ||
| 858 | if (atomic_read(&mm->mm_users) == 0) | ||
| 859 | return; | ||
| 860 | |||
| 861 | { | ||
| 862 | u32 ctx = CTX_HWBITS(mm->context); | ||
| 863 | int cpu = get_cpu(); | ||
| 864 | 854 | ||
| 865 | if (atomic_read(&mm->mm_users) == 1) { | 855 | if (atomic_read(&mm->mm_users) == 1) { |
| 866 | mm->cpu_vm_mask = cpumask_of_cpu(cpu); | 856 | mm->cpu_vm_mask = cpumask_of_cpu(cpu); |
| 867 | goto local_flush_and_out; | 857 | goto local_flush_and_out; |
| 868 | } | 858 | } |
| 869 | 859 | ||
| 870 | smp_cross_call_masked(&xcall_flush_tlb_mm, | 860 | smp_cross_call_masked(&xcall_flush_tlb_mm, |
| 871 | ctx, 0, 0, | 861 | ctx, 0, 0, |
| 872 | mm->cpu_vm_mask); | 862 | mm->cpu_vm_mask); |
| 873 | 863 | ||
| 874 | local_flush_and_out: | 864 | local_flush_and_out: |
| 875 | __flush_tlb_mm(ctx, SECONDARY_CONTEXT); | 865 | __flush_tlb_mm(ctx, SECONDARY_CONTEXT); |
| 876 | 866 | ||
| 877 | put_cpu(); | 867 | put_cpu(); |
| 878 | } | ||
| 879 | } | 868 | } |
| 880 | 869 | ||
| 881 | void smp_flush_tlb_pending(struct mm_struct *mm, unsigned long nr, unsigned long *vaddrs) | 870 | void smp_flush_tlb_pending(struct mm_struct *mm, unsigned long nr, unsigned long *vaddrs) |
| @@ -883,34 +872,13 @@ void smp_flush_tlb_pending(struct mm_struct *mm, unsigned long nr, unsigned long | |||
| 883 | u32 ctx = CTX_HWBITS(mm->context); | 872 | u32 ctx = CTX_HWBITS(mm->context); |
| 884 | int cpu = get_cpu(); | 873 | int cpu = get_cpu(); |
| 885 | 874 | ||
| 886 | if (mm == current->active_mm && atomic_read(&mm->mm_users) == 1) { | 875 | if (mm == current->active_mm && atomic_read(&mm->mm_users) == 1) |
| 887 | mm->cpu_vm_mask = cpumask_of_cpu(cpu); | 876 | mm->cpu_vm_mask = cpumask_of_cpu(cpu); |
| 888 | goto local_flush_and_out; | 877 | else |
| 889 | } else { | 878 | smp_cross_call_masked(&xcall_flush_tlb_pending, |
| 890 | /* This optimization is not valid. Normally | 879 | ctx, nr, (unsigned long) vaddrs, |
| 891 | * we will be holding the page_table_lock, but | 880 | mm->cpu_vm_mask); |
| 892 | * there is an exception which is copy_page_range() | ||
| 893 | * when forking. The lock is held during the individual | ||
| 894 | * page table updates in the parent, but not at the | ||
| 895 | * top level, which is where we are invoked. | ||
| 896 | */ | ||
| 897 | if (0) { | ||
| 898 | cpumask_t this_cpu_mask = cpumask_of_cpu(cpu); | ||
| 899 | |||
| 900 | /* By virtue of running under the mm->page_table_lock, | ||
| 901 | * and mmu_context.h:switch_mm doing the same, the | ||
| 902 | * following operation is safe. | ||
| 903 | */ | ||
| 904 | if (cpus_equal(mm->cpu_vm_mask, this_cpu_mask)) | ||
| 905 | goto local_flush_and_out; | ||
| 906 | } | ||
| 907 | } | ||
| 908 | |||
| 909 | smp_cross_call_masked(&xcall_flush_tlb_pending, | ||
| 910 | ctx, nr, (unsigned long) vaddrs, | ||
| 911 | mm->cpu_vm_mask); | ||
| 912 | 881 | ||
| 913 | local_flush_and_out: | ||
| 914 | __flush_tlb_pending(ctx, nr, vaddrs); | 882 | __flush_tlb_pending(ctx, nr, vaddrs); |
| 915 | 883 | ||
| 916 | put_cpu(); | 884 | put_cpu(); |
| @@ -1184,20 +1152,9 @@ void __init smp_cpus_done(unsigned int max_cpus) | |||
| 1184 | (bogosum/(5000/HZ))%100); | 1152 | (bogosum/(5000/HZ))%100); |
| 1185 | } | 1153 | } |
| 1186 | 1154 | ||
| 1187 | /* This needn't do anything as we do not sleep the cpu | ||
| 1188 | * inside of the idler task, so an interrupt is not needed | ||
| 1189 | * to get a clean fast response. | ||
| 1190 | * | ||
| 1191 | * XXX Reverify this assumption... -DaveM | ||
| 1192 | * | ||
| 1193 | * Addendum: We do want it to do something for the signal | ||
| 1194 | * delivery case, we detect that by just seeing | ||
| 1195 | * if we are trying to send this to an idler or not. | ||
| 1196 | */ | ||
| 1197 | void smp_send_reschedule(int cpu) | 1155 | void smp_send_reschedule(int cpu) |
| 1198 | { | 1156 | { |
| 1199 | if (cpu_data(cpu).idle_volume == 0) | 1157 | smp_receive_signal(cpu); |
| 1200 | smp_receive_signal(cpu); | ||
| 1201 | } | 1158 | } |
| 1202 | 1159 | ||
| 1203 | /* This is a nop because we capture all other cpus | 1160 | /* This is a nop because we capture all other cpus |
