s390/delay: simplify udelay
authorHeiko Carstens <hca@linux.ibm.com>
Fri, 4 Dec 2020 11:32:42 +0000 (12:32 +0100)
committerHeiko Carstens <hca@linux.ibm.com>
Wed, 16 Dec 2020 13:55:49 +0000 (14:55 +0100)
commitdd6cfe553212b6311cac27ecd2f67621857fb10a
tree75a5501adcd811dd9647cd7835d98fafdee32b8c
parent91c2bad6aec98a51663ce9eec7c4825c1ca0b870
s390/delay: simplify udelay

udelay is implemented by using quite subtle details to make it
possible to load an idle psw and waiting for an interrupt even in irq
context or when interrupts are disabled. Also handling (or better: no
handling) of softirqs is taken into account.

All this is done to optimize for something which should in normal
circumstances never happen: calling udelay to busy wait. Therefore get
rid of the whole complexity and just busy loop like other
architectures are doing it also.

It could have been possible to use diag 0x44 instead of cpu_relax() in
the busy loop, however we have seen too many bad things happen with
diag 0x44 that it seems to be better to simply busy loop.

Also note that with this new implementation kernel preemption does
work when within the udelay loop. This did not work before.

To get a feeling what the former code optimizes for: IPL'ing a kernel
with 'defconfig' and afterwards compiling a kernel ends with a total
of zero udelay calls.

Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
arch/s390/include/asm/delay.h
arch/s390/include/asm/processor.h
arch/s390/kernel/entry.S
arch/s390/lib/delay.c