]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
x86/mm: Remove 'mm' argument from unuse_temporary_mm() again
authorPeter Zijlstra <peterz@infradead.org>
Wed, 2 Apr 2025 09:45:37 +0000 (11:45 +0200)
committerIngo Molnar <mingo@kernel.org>
Sat, 12 Apr 2025 08:05:56 +0000 (10:05 +0200)
Now that unuse_temporary_mm() lives in tlb.c it can access
cpu_tlbstate.loaded_mm.

[ mingo: Merged it on top of x86/alternatives ]

Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Rik van Riel <riel@surriel.com>
Cc: "H. Peter Anvin" <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Link: https://lore.kernel.org/r/20250402094540.3586683-5-mingo@kernel.org
arch/x86/include/asm/mmu_context.h
arch/x86/kernel/alternative.c
arch/x86/mm/tlb.c

index b103e1709a67436ac9f49d9dedb5c298ef123609..988c1179263416aa4af114998c03706799931c74 100644 (file)
@@ -273,6 +273,6 @@ unsigned long __get_current_cr3_fast(void);
 #include <asm-generic/mmu_context.h>
 
 extern struct mm_struct *use_temporary_mm(struct mm_struct *temp_mm);
-extern void unuse_temporary_mm(struct mm_struct *mm, struct mm_struct *prev_mm);
+extern void unuse_temporary_mm(struct mm_struct *prev_mm);
 
 #endif /* _ASM_X86_MMU_CONTEXT_H */
index bdbdfa0e4d0608a48503c341634bb1749d8314d5..ddbc303e41e367afe59c5d159c748c541060a778 100644 (file)
@@ -2211,7 +2211,7 @@ static void *__text_poke(text_poke_f func, void *addr, const void *src, size_t l
         * instruction that already allows the core to see the updated version.
         * Xen-PV is assumed to serialize execution in a similar manner.
         */
-       unuse_temporary_mm(text_poke_mm, prev_mm);
+       unuse_temporary_mm(prev_mm);
 
        /*
         * Flushing the TLB might involve IPIs, which would require enabled
index f3da20bfcf0e12a1f10b7b2125194a53818e28f0..38fdcf875d5fa60835b2a86acbdee8f962475991 100644 (file)
@@ -1018,14 +1018,14 @@ struct mm_struct *use_temporary_mm(struct mm_struct *temp_mm)
        return prev_mm;
 }
 
-void unuse_temporary_mm(struct mm_struct *mm, struct mm_struct *prev_mm)
+void unuse_temporary_mm(struct mm_struct *prev_mm)
 {
        lockdep_assert_irqs_disabled();
 
-       switch_mm_irqs_off(NULL, prev_mm, current);
-
        /* Clear the cpumask, to indicate no TLB flushing is needed anywhere */
-       cpumask_clear_cpu(raw_smp_processor_id(), mm_cpumask(mm));
+       cpumask_clear_cpu(smp_processor_id(), mm_cpumask(this_cpu_read(cpu_tlbstate.loaded_mm)));
+
+       switch_mm_irqs_off(NULL, prev_mm, current);
 
        /*
         * Restore the breakpoints if they were disabled before the temporary mm