summaryrefslogtreecommitdiff
path: root/arch/powerpc/mm
diff options
context:
space:
mode:
authorNicholas Piggin <npiggin@gmail.com>2020-12-17 23:47:28 +1000
committerMichael Ellerman <mpe@ellerman.id.au>2021-02-09 01:09:44 +1100
commit780de40601aabeca41bc9aa717a329a77aa85e1a (patch)
treef507cbc288fd168cd062c5c433de14d95a1cc0cf /arch/powerpc/mm
parent54bb503345b81399575e2b7a3a6497ae212ad827 (diff)
powerpc/64s/radix: Allow mm_cpumask trimming from external sources
mm_cpumask trimming is currently restricted to be issued by the current thread of a single-threaded mm. This patch relaxes that and allows the mask to be trimmed from any context. Signed-off-by: Nicholas Piggin <npiggin@gmail.com> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/20201217134731.488135-5-npiggin@gmail.com
Diffstat (limited to 'arch/powerpc/mm')
-rw-r--r--arch/powerpc/mm/book3s64/radix_tlb.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/arch/powerpc/mm/book3s64/radix_tlb.c b/arch/powerpc/mm/book3s64/radix_tlb.c
index 3d8b494c39f6..c27ef2ff8950 100644
--- a/arch/powerpc/mm/book3s64/radix_tlb.c
+++ b/arch/powerpc/mm/book3s64/radix_tlb.c
@@ -666,20 +666,16 @@ static void do_exit_flush_lazy_tlb(void *arg)
}
/*
- * This IPI is only initiated from a CPU which is running mm which
- * is a single-threaded process, so there will not be another racing
- * IPI coming in where we would find our cpumask already clear.
- *
- * Nothing else clears our bit in the cpumask except CPU offlining,
- * in which case we should not be taking IPIs here. However check
- * this just in case the logic is wrong somewhere, and don't underflow
- * the active_cpus count.
+ * This IPI may be initiated from any source including those not
+ * running the mm, so there may be a racing IPI that comes after
+ * this one which finds the cpumask already clear. Check and avoid
+ * underflowing the active_cpus count in that case. The race should
+ * not otherwise be a problem, but the TLB must be flushed because
+ * that's what the caller expects.
*/
if (cpumask_test_cpu(cpu, mm_cpumask(mm))) {
atomic_dec(&mm->context.active_cpus);
cpumask_clear_cpu(cpu, mm_cpumask(mm));
- } else {
- WARN_ON_ONCE(1);
}
out_flush: