s390/spinlock: do not yield to a CPU in udelay/mdelay
It does not make sense to try to relinquish the time slice with diag 0x9c to a CPU in a state that does not allow to schedule the CPU. The scenario where this can happen is a CPU waiting in udelay/mdelay while holding a spin-lock. Add a CIF bit to tag a CPU in enabled wait and use it to detect that the yield of a CPU will not be successful and skip the diagnose call. Reviewed-by: Heiko Carstens <heiko.carstens@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
This commit is contained in:
@@ -18,12 +18,14 @@
|
||||
#define CIF_NOHZ_DELAY 2 /* delay HZ disable for a tick */
|
||||
#define CIF_FPU 3 /* restore FPU registers */
|
||||
#define CIF_IGNORE_IRQ 4 /* ignore interrupt (for udelay) */
|
||||
#define CIF_ENABLED_WAIT 5 /* in enabled wait state */
|
||||
|
||||
#define _CIF_MCCK_PENDING _BITUL(CIF_MCCK_PENDING)
|
||||
#define _CIF_ASCE _BITUL(CIF_ASCE)
|
||||
#define _CIF_NOHZ_DELAY _BITUL(CIF_NOHZ_DELAY)
|
||||
#define _CIF_FPU _BITUL(CIF_FPU)
|
||||
#define _CIF_IGNORE_IRQ _BITUL(CIF_IGNORE_IRQ)
|
||||
#define _CIF_ENABLED_WAIT _BITUL(CIF_ENABLED_WAIT)
|
||||
|
||||
#ifndef __ASSEMBLY__
|
||||
|
||||
@@ -52,6 +54,16 @@ static inline int test_cpu_flag(int flag)
|
||||
return !!(S390_lowcore.cpu_flags & (1UL << flag));
|
||||
}
|
||||
|
||||
/*
|
||||
* Test CIF flag of another CPU. The caller needs to ensure that
|
||||
* CPU hotplug can not happen, e.g. by disabling preemption.
|
||||
*/
|
||||
static inline int test_cpu_flag_of(int flag, int cpu)
|
||||
{
|
||||
struct _lowcore *lc = lowcore_ptr[cpu];
|
||||
return !!(lc->cpu_flags & (1UL << flag));
|
||||
}
|
||||
|
||||
#define arch_needs_cpu() test_cpu_flag(CIF_NOHZ_DELAY)
|
||||
|
||||
/*
|
||||
|
Reference in New Issue
Block a user