1
0

094-MIPS-c-r4k-Fix-size-calc-when-avoiding-IPIs-for-smal.patch 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. From: Paul Burton <paul.burton@imgtec.com>
  2. Date: Mon, 5 Sep 2016 15:24:54 +0100
  3. Subject: [PATCH] MIPS: c-r4k: Fix size calc when avoiding IPIs for small
  4. icache flushes
  5. Commit f70ddc07b637 ("MIPS: c-r4k: Avoid small flush_icache_range SMP
  6. calls") adds checks to force use of hit-type cache ops for small icache
  7. flushes where they are globalised & index-type cache ops aren't, in
  8. order to avoid the overhead of IPIs in those cases. However it
  9. calculated the size of the region being flushed incorrectly, subtracting
  10. the end address from the start address rather than the reverse. This
  11. would have led to an overflow with size wrapping round to some large
  12. value, and likely to the special case for avoiding IPIs not actually
  13. being hit.
  14. Signed-off-by: Paul Burton <paul.burton@imgtec.com>
  15. Cc: James Hogan <james.hogan@imgtec.com>
  16. Fixes: f70ddc07b637 ("MIPS: c-r4k: Avoid small flush_icache_range SMP calls")
  17. Reviewed-by: James Hogan <james.hogan@imgtec.com>
  18. Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>
  19. Cc: Huacai Chen <chenhc@lemote.com>
  20. Cc: linux-mips@linux-mips.org
  21. Cc: linux-kernel@vger.kernel.org
  22. Patchwork: https://patchwork.linux-mips.org/patch/14211/
  23. Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
  24. ---
  25. --- a/arch/mips/mm/c-r4k.c
  26. +++ b/arch/mips/mm/c-r4k.c
  27. @@ -781,7 +781,7 @@ static void r4k_flush_icache_range(unsig
  28. * If address-based cache ops are globalized, then we may be
  29. * able to avoid the IPI for small flushes.
  30. */
  31. - size = start - end;
  32. + size = end - start;
  33. cache_size = icache_size;
  34. if (!cpu_has_ic_fills_f_dc) {
  35. size *= 2;