2
0

091-MIPS-c-r4k-Exclude-sibling-CPUs-in-SMP-calls.patch 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  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. When performing SMP calls to foreign cores, exclude sibling CPUs from
  5. the provided map, as we already handle the local core on the current
  6. CPU. This prevents an IPI call from for example core 0, VPE 1 to VPE 0
  7. on the same core.
  8. Signed-off-by: James Hogan <james.hogan@imgtec.com>
  9. Cc: Ralf Baechle <ralf@linux-mips.org>
  10. Cc: Paul Burton <paul.burton@imgtec.com>
  11. Cc: linux-mips@linux-mips.org
  12. ---
  13. --- a/arch/mips/mm/c-r4k.c
  14. +++ b/arch/mips/mm/c-r4k.c
  15. @@ -96,8 +96,17 @@ static inline void r4k_on_each_cpu(unsig
  16. void (*func) (void *info), void *info)
  17. {
  18. preempt_disable();
  19. - if (r4k_op_needs_ipi(type))
  20. - smp_call_function_many(&cpu_foreign_map, func, info, 1);
  21. + /* cpu_foreign_map and cpu_sibling_map[] undeclared when !CONFIG_SMP */
  22. +#ifdef CONFIG_SMP
  23. + if (r4k_op_needs_ipi(type)) {
  24. + struct cpumask mask;
  25. +
  26. + /* exclude sibling CPUs */
  27. + cpumask_andnot(&mask, &cpu_foreign_map,
  28. + &cpu_sibling_map[smp_processor_id()]);
  29. + smp_call_function_many(&mask, func, info, 1);
  30. + }
  31. +#endif
  32. func(info);
  33. preempt_enable();
  34. }