]> git.baikalelectronics.ru Git - kernel.git/commit
s390: fix irq state tracing
authorHeiko Carstens <hca@linux.ibm.com>
Wed, 2 Dec 2020 10:46:01 +0000 (11:46 +0100)
committerHeiko Carstens <hca@linux.ibm.com>
Wed, 2 Dec 2020 17:17:50 +0000 (18:17 +0100)
commit01992368f0da9a99474de85d65f4bbd9a1b45e4d
tree66c182f3aa06b05d2f6c9eed6c267f091330d616
parent2e2161764c93170eab353b3faaccb1c1cbc4667a
s390: fix irq state tracing

With commit 25c629a7efe3 ("sched/idle: Fix arch_cpu_idle() vs
tracing") common code calls arch_cpu_idle() with a lockdep state that
tells irqs are on.

This doesn't work very well for s390: psw_idle() will enable interrupts
to wait for an interrupt. As soon as an interrupt occurs the interrupt
handler will verify if the old context was psw_idle(). If that is the
case the interrupt enablement bits in the old program status word will
be cleared.

A subsequent test in both the external as well as the io interrupt
handler checks if in the old context interrupts were enabled. Due to
the above patching of the old program status word it is assumed the
old context had interrupts disabled, and therefore a call to
TRACE_IRQS_OFF (aka trace_hardirqs_off_caller) is skipped. Which in
turn makes lockdep incorrectly "think" that interrupts are enabled
within the interrupt handler.

Fix this by unconditionally calling TRACE_IRQS_OFF when entering
interrupt handlers. Also call unconditionally TRACE_IRQS_ON when
leaving interrupts handlers.

This leaves the special psw_idle() case, which now returns with
interrupts disabled, but has an "irqs on" lockdep state. So callers of
psw_idle() must adjust the state on their own, if required. This is
currently only __udelay_disabled().

Fixes: 25c629a7efe3 ("sched/idle: Fix arch_cpu_idle() vs tracing")
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
arch/s390/kernel/entry.S
arch/s390/lib/delay.c