]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
x86/mm: Remove the mm_cpumask(prev) warning from switch_mm_irqs_off()
authorPeter Zijlstra <peterz@infradead.org>
Thu, 17 Apr 2025 12:34:13 +0000 (14:34 +0200)
committerIngo Molnar <mingo@kernel.org>
Thu, 17 Apr 2025 12:46:25 +0000 (14:46 +0200)
The CONFIG_DEBUG_VM=y warning in switch_mm_irqs_off() started
triggering in testing:

VM_WARN_ON_ONCE(prev != &init_mm && !cpumask_test_cpu(cpu, mm_cpumask(prev)));

AFAIU what happens is that unuse_temporary_mm() clears the mm_cpumask()
for the current CPU, while switch_mm_irqs_off() then checks that the
mm_cpumask() bit is set for the current CPU.

While this behaviour hasn't really changed since the following commit:

  209954cbc7d0 ("x86/mm/tlb: Update mm_cpumask lazily")

introduced both, but the warning is wrong, so remove it.

[ mingo: Patchified Peter's email. ]

Reported-by: syzbot+c2537ce72a879a38113e@syzkaller.appspotmail.com
Reported-by: Borislav Petkov <bp@alien8.de>
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Brian Gerst <brgerst@gmail.com>
Cc: Juergen Gross <jgross@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: Rik van Riel <riel@surriel.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org
Link: https://lore.kernel.org/r/20250414135629.GA17910@noisy.programming.kicks-ass.net
arch/x86/mm/tlb.c

index c9b87e5f569a85bde59210cb58b8f081a64e0fd5..79c124f6f3f222800f049516264f2224347a14bd 100644 (file)
@@ -905,14 +905,6 @@ void switch_mm_irqs_off(struct mm_struct *unused, struct mm_struct *next,
                this_cpu_write(cpu_tlbstate.loaded_mm, LOADED_MM_SWITCHING);
                barrier();
 
-               /*
-                * Leave this CPU in prev's mm_cpumask. Atomic writes to
-                * mm_cpumask can be expensive under contention. The CPU
-                * will be removed lazily at TLB flush time.
-                */
-               VM_WARN_ON_ONCE(prev != &init_mm && !cpumask_test_cpu(cpu,
-                               mm_cpumask(prev)));
-
                /* Start receiving IPIs and then read tlb_gen (and LAM below) */
                if (next != &init_mm && !cpumask_test_cpu(cpu, mm_cpumask(next)))
                        cpumask_set_cpu(cpu, mm_cpumask(next));