diff options
-rw-r--r-- | arch/mips/include/asm/smp.h | 2 | ||||
-rw-r--r-- | arch/mips/kernel/smp.c | 6 | ||||
-rw-r--r-- | arch/mips/mm/c-r4k.c | 17 |
3 files changed, 18 insertions, 7 deletions
diff --git a/arch/mips/include/asm/smp.h b/arch/mips/include/asm/smp.h index 0c534a03bb36..8bc6c70a4030 100644 --- a/arch/mips/include/asm/smp.h +++ b/arch/mips/include/asm/smp.h | |||
@@ -23,7 +23,7 @@ | |||
23 | extern int smp_num_siblings; | 23 | extern int smp_num_siblings; |
24 | extern cpumask_t cpu_sibling_map[]; | 24 | extern cpumask_t cpu_sibling_map[]; |
25 | extern cpumask_t cpu_core_map[]; | 25 | extern cpumask_t cpu_core_map[]; |
26 | extern cpumask_t cpu_foreign_map; | 26 | extern cpumask_t cpu_foreign_map[]; |
27 | 27 | ||
28 | #define raw_smp_processor_id() (current_thread_info()->cpu) | 28 | #define raw_smp_processor_id() (current_thread_info()->cpu) |
29 | 29 | ||
diff --git a/arch/mips/kernel/smp.c b/arch/mips/kernel/smp.c index 783d5f50ab9d..f95f094f36e4 100644 --- a/arch/mips/kernel/smp.c +++ b/arch/mips/kernel/smp.c | |||
@@ -72,7 +72,7 @@ EXPORT_SYMBOL(cpu_core_map); | |||
72 | * A logcal cpu mask containing only one VPE per core to | 72 | * A logcal cpu mask containing only one VPE per core to |
73 | * reduce the number of IPIs on large MT systems. | 73 | * reduce the number of IPIs on large MT systems. |
74 | */ | 74 | */ |
75 | cpumask_t cpu_foreign_map __read_mostly; | 75 | cpumask_t cpu_foreign_map[NR_CPUS] __read_mostly; |
76 | EXPORT_SYMBOL(cpu_foreign_map); | 76 | EXPORT_SYMBOL(cpu_foreign_map); |
77 | 77 | ||
78 | /* representing cpus for which sibling maps can be computed */ | 78 | /* representing cpus for which sibling maps can be computed */ |
@@ -141,7 +141,9 @@ void calculate_cpu_foreign_map(void) | |||
141 | cpumask_set_cpu(i, &temp_foreign_map); | 141 | cpumask_set_cpu(i, &temp_foreign_map); |
142 | } | 142 | } |
143 | 143 | ||
144 | cpumask_copy(&cpu_foreign_map, &temp_foreign_map); | 144 | for_each_online_cpu(i) |
145 | cpumask_andnot(&cpu_foreign_map[i], | ||
146 | &temp_foreign_map, &cpu_sibling_map[i]); | ||
145 | } | 147 | } |
146 | 148 | ||
147 | struct plat_smp_ops *mp_ops; | 149 | struct plat_smp_ops *mp_ops; |
diff --git a/arch/mips/mm/c-r4k.c b/arch/mips/mm/c-r4k.c index 2a4bb5057ebc..57374f0c33f2 100644 --- a/arch/mips/mm/c-r4k.c +++ b/arch/mips/mm/c-r4k.c | |||
@@ -56,7 +56,9 @@ | |||
56 | * @type: Type of cache operations (R4K_HIT or R4K_INDEX). | 56 | * @type: Type of cache operations (R4K_HIT or R4K_INDEX). |
57 | * | 57 | * |
58 | * Decides whether a cache op needs to be performed on every core in the system. | 58 | * Decides whether a cache op needs to be performed on every core in the system. |
59 | * This may change depending on the @type of cache operation. | 59 | * This may change depending on the @type of cache operation, as well as the set |
60 | * of online CPUs, so preemption should be disabled by the caller to prevent CPU | ||
61 | * hotplug from changing the result. | ||
60 | * | 62 | * |
61 | * Returns: 1 if the cache operation @type should be done on every core in | 63 | * Returns: 1 if the cache operation @type should be done on every core in |
62 | * the system. | 64 | * the system. |
@@ -71,9 +73,15 @@ static inline bool r4k_op_needs_ipi(unsigned int type) | |||
71 | 73 | ||
72 | /* | 74 | /* |
73 | * Hardware doesn't globalize the required cache ops, so SMP calls may | 75 | * Hardware doesn't globalize the required cache ops, so SMP calls may |
74 | * be needed. | 76 | * be needed, but only if there are foreign CPUs (non-siblings with |
77 | * separate caches). | ||
75 | */ | 78 | */ |
76 | return true; | 79 | /* cpu_foreign_map[] undeclared when !CONFIG_SMP */ |
80 | #ifdef CONFIG_SMP | ||
81 | return !cpumask_empty(&cpu_foreign_map[0]); | ||
82 | #else | ||
83 | return false; | ||
84 | #endif | ||
77 | } | 85 | } |
78 | 86 | ||
79 | /* | 87 | /* |
@@ -90,7 +98,8 @@ static inline void r4k_on_each_cpu(unsigned int type, | |||
90 | { | 98 | { |
91 | preempt_disable(); | 99 | preempt_disable(); |
92 | if (r4k_op_needs_ipi(type)) | 100 | if (r4k_op_needs_ipi(type)) |
93 | smp_call_function_many(&cpu_foreign_map, func, info, 1); | 101 | smp_call_function_many(&cpu_foreign_map[smp_processor_id()], |
102 | func, info, 1); | ||
94 | func(info); | 103 | func(info); |
95 | preempt_enable(); | 104 | preempt_enable(); |
96 | } | 105 | } |