mirror of
https://github.com/torvalds/linux.git
synced 2024-12-27 13:22:23 +00:00
73a6fdc48b
When unlocking a spinlock, we use the sev instruction to signal other CPUs waiting on the lock. Since sev is not a memory access instruction, we require a dsb in order to ensure that the sev is not issued ahead of the store placing the lock in an unlocked state. However, as sev is only concerned with other processors in a multiprocessor system, we can restrict the scope of the preceding dsb to the inner-shareable domain. Furthermore, we can restrict the scope to consider only stores, since there are no independent loads on the unlock path. A side-effect of this change is that a spin_unlock operation no longer forces completion of pending TLB invalidation, something which we rely on when unlocking runqueues to ensure that CPU migration during TLB maintenance routines doesn't cause us to continue before the operation has completed. This patch adds the -ishst suffix to the ARMv7 definition of dsb_sev() and adds an inner-shareable dsb to the context-switch path when running a preemptible, SMP, v7 kernel. Reviewed-by: Catalin Marinas <catalin.marinas@arm.com> Signed-off-by: Will Deacon <will.deacon@arm.com>
29 lines
941 B
C
29 lines
941 B
C
#ifndef __ASM_ARM_SWITCH_TO_H
|
|
#define __ASM_ARM_SWITCH_TO_H
|
|
|
|
#include <linux/thread_info.h>
|
|
|
|
/*
|
|
* For v7 SMP cores running a preemptible kernel we may be pre-empted
|
|
* during a TLB maintenance operation, so execute an inner-shareable dsb
|
|
* to ensure that the maintenance completes in case we migrate to another
|
|
* CPU.
|
|
*/
|
|
#if defined(CONFIG_PREEMPT) && defined(CONFIG_SMP) && defined(CONFIG_CPU_V7)
|
|
#define finish_arch_switch(prev) dsb(ish)
|
|
#endif
|
|
|
|
/*
|
|
* switch_to(prev, next) should switch from task `prev' to `next'
|
|
* `prev' will never be the same as `next'. schedule() itself
|
|
* contains the memory barrier to tell GCC not to cache `current'.
|
|
*/
|
|
extern struct task_struct *__switch_to(struct task_struct *, struct thread_info *, struct thread_info *);
|
|
|
|
#define switch_to(prev,next,last) \
|
|
do { \
|
|
last = __switch_to(prev,task_thread_info(prev), task_thread_info(next)); \
|
|
} while (0)
|
|
|
|
#endif /* __ASM_ARM_SWITCH_TO_H */
|