Re: [PATCH 08/32] s390/dis: Improve show_code() output

From: Ilya Leoshkevich

Date: Mon Oct 12 2026 - 13:03:29 EST




On 10/1/26 12:32, Heiko Carstens wrote:
Replace the '>' and '*' instruction markers with explicit 'PSW >' and
'PGM >' markers which identify both the PSW address and the faulting
instruction.

Previously, '>' marked the PSW address, while '*' marked the preceding
instruction as a guess for the faulting instruction for suppressing
exceptions:

Krnl Code:
000003ff8dc7bff8: e310f0080004 lg %r1,8(%r15)
*000003ff8dc7bffe: e3a0e0000004 lg %r10,0(%r14)
>000003ff8dc7c004: a7280000 lhi %r2,0
000003ff8dc7c008: eb9ff0900024 stmg %r9,%r15,144(%r15)

Now 'PGM >' explicitly marks the faulting instruction without guessing
and 'PSW >' marks the PSW address:

Krnl Code:
000003ff8dc7bff8: e310f0080004 lg %r1,8(%r15)
PGM >000003ff8dc7bffe: e3a0e0000004 lg %r10,0(%r14)
PSW >000003ff8dc7c004: a7280000 lhi %r2,0
000003ff8dc7c008: eb9ff0900024 stmg %r9,%r15,144(%r15)

For nullifying exceptions where both addresses are the same,
'PGM+PSW >' is printed instead:

Krnl Code:
000003ff8dc7bff8: e310f0080004 lg %r1,8(%r15)
PGM+PSW >000003ff8dc7bffe: e3a0e0000004 lg %r10,0(%r14)
000003ff8dc7c004: a7280000 lhi %r2,0
000003ff8dc7c008: eb9ff0900024 stmg %r9,%r15,144(%r15)

show_code() may also be called in other contexts where pt_regs does not
originate from a program check (e.g. system calls). Introduce and set
PIF_PGM_CHECK to indicate when in program check context, and print the
PGM marker only in such a context.

Note that corner cases are not taken into account. Like before kprobes is
not considered, which means that the disassembly may contain unexpected
instructions, or that disassembly and/or instruction length count as well
as interruption do not match.

Signed-off-by: Heiko Carstens <hca@xxxxxxxxxxxxx>
---
arch/s390/include/asm/ptrace.h | 4 ++++
arch/s390/kernel/dis.c | 16 +++++++++++-----
arch/s390/kernel/early.c | 1 +
arch/s390/kernel/traps.c | 4 +++-
4 files changed, 19 insertions(+), 6 deletions(-)

Reviewed-by: Ilya Leoshkevich <iii@xxxxxxxxxxxxx>