v1.5 branch refresh based upon upstream master @ c8677ca89e53e3be7988d54280fce166cc894a7e
[librecmc/librecmc.git] / target / linux / generic / pending-4.4 / 091-MIPS-c-r4k-Exclude-sibling-CPUs-in-SMP-calls.patch
1 From: James Hogan <james.hogan@imgtec.com>
2 Date: Thu, 3 Mar 2016 21:30:42 +0000
3 Subject: [PATCH] MIPS: c-r4k: Exclude sibling CPUs in SMP calls
4
5 When performing SMP calls to foreign cores, exclude sibling CPUs from
6 the provided map, as we already handle the local core on the current
7 CPU. This prevents an IPI call from for example core 0, VPE 1 to VPE 0
8 on the same core.
9
10 Signed-off-by: James Hogan <james.hogan@imgtec.com>
11 Cc: Ralf Baechle <ralf@linux-mips.org>
12 Cc: Paul Burton <paul.burton@imgtec.com>
13 Cc: linux-mips@linux-mips.org
14 ---
15
16 --- a/arch/mips/mm/c-r4k.c
17 +++ b/arch/mips/mm/c-r4k.c
18 @@ -96,8 +96,17 @@ static inline void r4k_on_each_cpu(unsig
19                                    void (*func) (void *info), void *info)
20  {
21         preempt_disable();
22 -       if (r4k_op_needs_ipi(type))
23 -               smp_call_function_many(&cpu_foreign_map, func, info, 1);
24 +       /* cpu_foreign_map and cpu_sibling_map[] undeclared when !CONFIG_SMP */
25 +#ifdef CONFIG_SMP
26 +       if (r4k_op_needs_ipi(type)) {
27 +               struct cpumask mask;
28 +
29 +               /* exclude sibling CPUs */
30 +               cpumask_andnot(&mask, &cpu_foreign_map,
31 +                              &cpu_sibling_map[smp_processor_id()]);
32 +               smp_call_function_many(&mask, func, info, 1);
33 +       }
34 +#endif
35         func(info);
36         preempt_enable();
37  }