s390/mcck: cleanup user process termination path
authorAlexander Gordeev <agordeev@linux.ibm.com>
Sat, 17 Dec 2022 10:01:16 +0000 (11:01 +0100)
committerHeiko Carstens <hca@linux.ibm.com>
Tue, 28 Feb 2023 12:19:05 +0000 (13:19 +0100)
commite7ec1d2eac9cad57ff615ef6cc3e324ab7238b82
tree1e17b6a1b74d4bb6aef6b4f5b3821115f4f98d57
parent5e02c74905cb00184b6c5ae70b1c1bfae5b3bd17
s390/mcck: cleanup user process termination path

If a machine check interrupt hits while user process is
running __s390_handle_mcck() helper function is called
directly from the interrupt handler and terminates the
current process by calling make_task_dead() routine.

The make_task_dead() is not allowed to be called from
interrupt context which forces the machine check handler
switch to the kernel stack and enable local interrupts
first.

The __s390_handle_mcck() could also be called to service
pending work, but this time from the external interrupts
handler. It is the machine check handler that establishes
the work and schedules the external interrupt, therefore
the machine check interrupt itself should be disabled
while reading out the corresponding variable:

local_mcck_disable();
mcck = *this_cpu_ptr(&cpu_mcck);
memset(this_cpu_ptr(&cpu_mcck), 0, sizeof(mcck));
local_mcck_enable();

However, local_mcck_disable() does not have effect when
__s390_handle_mcck() is called directly form the machine
check handler, since the machine check interrupt is still
disabled. Therefore, it is not the opening bracket to the
following local_mcck_enable() function.

Simplify the user process termination flow by scheduling
the external interrupt and killing the affected process
from the interrupt context.

Assume a kernel-generated signal is always delivered and
ignore a value returned by do_send_sig_info() funciton.

Reviewed-by: Heiko Carstens <hca@linux.ibm.com>
Reviewed-by: Sven Schnelle <svens@linux.ibm.com>
Signed-off-by: Alexander Gordeev <agordeev@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
arch/s390/include/asm/nmi.h
arch/s390/kernel/entry.S
arch/s390/kernel/nmi.c
arch/s390/kernel/smp.c