KVM: s390: interrupt: Fix single-stepping userspace-emulated instructions
authorIlya Leoshkevich <iii@linux.ibm.com>
Tue, 25 Jul 2023 14:37:19 +0000 (16:37 +0200)
committerJanosch Frank <frankja@linux.ibm.com>
Mon, 28 Aug 2023 09:24:20 +0000 (09:24 +0000)
commit1ad1fa820e6424ae75d3d9f59774e40c9c7ec1e5
tree615f046b44d9f358f3452cc4dbaac541c0347280
parentba853a4e1c7addc631df55535bf0b04c62dc79d8
KVM: s390: interrupt: Fix single-stepping userspace-emulated instructions

Single-stepping a userspace-emulated instruction that generates an
interrupt causes GDB to land on the instruction following it instead of
the respective interrupt handler.

The reason is that after arranging a KVM_EXIT_S390_SIEIC exit,
kvm_handle_sie_intercept() calls kvm_s390_handle_per_ifetch_icpt(),
which sets KVM_GUESTDBG_EXIT_PENDING. This bit, however, is not
processed immediately, but rather persists until the next ioctl(),
causing a spurious single-step exit.

Fix by clearing this bit in ioctl().

Reviewed-by: David Hildenbrand <david@redhat.com>
Reviewed-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com>
Message-ID: <20230725143857.228626-5-iii@linux.ibm.com>
Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com>
Signed-off-by: Janosch Frank <frankja@linux.ibm.com>
arch/s390/kvm/kvm-s390.c