Commit 780de406 authored by Nicholas Piggin's avatar Nicholas Piggin Committed by Michael Ellerman

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: default avatarNicholas Piggin <npiggin@gmail.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Link: https://lore.kernel.org/r/20201217134731.488135-5-npiggin@gmail.com
parent 54bb5033
...@@ -666,20 +666,16 @@ static void do_exit_flush_lazy_tlb(void *arg) ...@@ -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 * This IPI may be initiated from any source including those not
* is a single-threaded process, so there will not be another racing * running the mm, so there may be a racing IPI that comes after
* IPI coming in where we would find our cpumask already clear. * this one which finds the cpumask already clear. Check and avoid
* * underflowing the active_cpus count in that case. The race should
* Nothing else clears our bit in the cpumask except CPU offlining, * not otherwise be a problem, but the TLB must be flushed because
* in which case we should not be taking IPIs here. However check * that's what the caller expects.
* this just in case the logic is wrong somewhere, and don't underflow
* the active_cpus count.
*/ */
if (cpumask_test_cpu(cpu, mm_cpumask(mm))) { if (cpumask_test_cpu(cpu, mm_cpumask(mm))) {
atomic_dec(&mm->context.active_cpus); atomic_dec(&mm->context.active_cpus);
cpumask_clear_cpu(cpu, mm_cpumask(mm)); cpumask_clear_cpu(cpu, mm_cpumask(mm));
} else {
WARN_ON_ONCE(1);
} }
out_flush: out_flush:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment