mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH 0/2] KVM: s390: vsie: fix instruction retry for nested guests in ESA mode
@ 2026-11-25 15:16 Yvan Janssens
  2026-11-25 15:16 ` [PATCH 1/2] KVM: s390: vsie: Rewind the PSW of ESA mode guests in the right format Yvan Janssens
  2026-11-25 15:16 ` [PATCH 2/2] KVM: s390: selftests: Add a test for nested guests in ESA mode Yvan Janssens
  0 siblings, 2 replies; 3+ messages in thread
From: Yvan Janssens @ 2026-11-25 15:16 UTC (permalink / raw)
  To: Christian Borntraeger, Janosch Frank, Claudio Imbrenda
  Cc: David Hildenbrand, Eric Farman, Hendrik Brueckner,
	Heiko Carstens, Vasily Gorbik, Alexander Gordeev, Sven Schnelle,
	Paolo Bonzini, Sean Christopherson, Shuah Khan, kvm, linux-s390,
	linux-kselftest, linux-kernel

Since v7.1 a nested hypervisor can run its guests in ESA mode (the
ESA/390-compatibility mode of the machine) when user space enables
KVM_CAP_S390_VSIE_ESAMODE. One piece of vsie still treats the PSW of such a
guest as a z/Architecture PSW: the rewind that vsie uses to have an
instruction repeated. For a state description in ESA/390 format the
instruction is skipped instead, and a stray value is left in the half of
the PSW field that such a state description does not use.

What a nested guest sees: the first STORE FACILITY LIST EXTENDED after
every entry into SIE does nothing (operand and condition code untouched),
because vsie intercepts it to shadow the facility list. A program that
tests facility bits gets zeros.

Patch 1 is the fix, patch 2 a selftest that reproduces the problem with a
small guest 2 that issues SIE itself (modelled on the vsie selftest that is
queued in kvm-s390 next). The series is based on v7.4-rc4-260-g4dce97c6c265.

Why it matters beyond one instruction: backward compatibility is a
defining property of this platform, and the ESA/390-compatibility mode is
the architecture's mechanism for running older programs on machines that
only start in z/Architecture mode. Any hypervisor that runs as a KVM guest
and gives its own guests that mode depends on vsie handling such state
descriptions exactly like the machine.

Testing (z14)
- On an LPAR running v7.3.6 with patch 1 (the host owns SIE) the selftest
  of patch 2 passes all three checks: the unused doubleword stays 0, the
  PSW ends behind the last instruction, and the first STFLE stores the
  designated list.
- Without patch 1 (v7.3.6, test kernel running as a KVM guest above a level
  that passed ESA mode state descriptions on): the unused PSW doubleword
  comes back as 0x7ffffff8 and neither STFLE stores anything. In such a
  nested setup above a host without the fix, checks 1 and 3 still fail
  with patch 1 in the test kernel, because the defect acts once per level.
- On a host whose lower level refuses ESA mode state descriptions the test
  skips (validity 0x0001 seen by guest 2).
- KVM selftests (12 s390 tests and 5 generic ones) and the s390x
  kvm-unit-tests (37 pass, 4 fail, 21 skip) give the same result for every
  test with and without the series (v7.3.6, nested setup); the 4 failures
  (sclp-1g, sclp-3g, css, edat) are the same with the unmodified module.
- Built with W=1 and sparse without warnings; checkpatch --strict is clean
  apart from the MAINTAINERS note for the new file.
- Not tested: MOVE PAGE partial execution and the addressing-exception
  path for a guest in ESA mode. MOVE PAGE is not available in the mode
  without the ESA/XC facilities, so the first should not occur.

Assistance: the series was prepared with an AI coding assistant (see the
Assisted-by tags); the defect was found while tracing why a facility test
failed in a nested guest, the analysis, fix and test were written with the
assistant and reviewed by the submitter.

Yvan Janssens (2):
  KVM: s390: vsie: Rewind the PSW of ESA mode guests in the right format
  KVM: s390: selftests: Add a test for nested guests in ESA mode

 arch/s390/kvm/s390/vsie.c                     |  23 ++-
 tools/testing/selftests/kvm/Makefile.kvm      |   1 +
 .../selftests/kvm/s390/vsie_esa_test.c        | 180 ++++++++++++++++++
 3 files changed, 202 insertions(+), 2 deletions(-)
 create mode 100644 tools/testing/selftests/kvm/s390/vsie_esa_test.c


base-commit: 4dce97c6c265544342e716e62fd24bbb232590c5
-- 
2.47.3



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-11-25 15:17 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-25 15:16 [PATCH 0/2] KVM: s390: vsie: fix instruction retry for nested guests in ESA mode Yvan Janssens
2026-11-25 15:16 ` [PATCH 1/2] KVM: s390: vsie: Rewind the PSW of ESA mode guests in the right format Yvan Janssens
2026-11-25 15:16 ` [PATCH 2/2] KVM: s390: selftests: Add a test for nested guests in ESA mode Yvan Janssens

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®