Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

s390/mm: ensure switch_mm() is executed with interrupts disabled

Architecture callback switch_mm() is allowed to be called with
enabled interrupts. However, our implementation of switch_mm()
does not expect that. Let's follow other architectures and make
sure switch_mm() is always executed with interrupts disabled,
regardless of what happens with the generic kernel code in the
future.

Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
Reviewed-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>

authored by

Alexander Gordeev and committed by
Vasily Gorbik
bdb8c935 27c1dac0

+13 -2
+13 -2
arch/s390/include/asm/mmu_context.h
··· 70 70 return 0; 71 71 } 72 72 73 - static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, 74 - struct task_struct *tsk) 73 + static inline void switch_mm_irqs_off(struct mm_struct *prev, struct mm_struct *next, 74 + struct task_struct *tsk) 75 75 { 76 76 int cpu = smp_processor_id(); 77 77 ··· 84 84 __ctl_load(s390_invalid_asce, 7, 7); 85 85 if (prev != next) 86 86 cpumask_clear_cpu(cpu, &prev->context.cpu_attach_mask); 87 + } 88 + #define switch_mm_irqs_off switch_mm_irqs_off 89 + 90 + static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, 91 + struct task_struct *tsk) 92 + { 93 + unsigned long flags; 94 + 95 + local_irq_save(flags); 96 + switch_mm_irqs_off(prev, next, tsk); 97 + local_irq_restore(flags); 87 98 } 88 99 89 100 #define finish_arch_post_lock_switch finish_arch_post_lock_switch