Skip to content

KVM: s390: pv: fix clock comparator late after suspend/resume

Nico Boehr kvm 4 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest1 patch 2 repliesIn review
  2. v32 patches 5 repliesSuperseded
  3. v2 RFC1 patch 4 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v1 RFC1 patch1 replySuperseded

Changes in v4 from the cover letter

---
- squash both commits
- update docs (thanks Janosch)
- add a comment (thanks Janosch)

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/1KVM: s390: pv: don't allow userspace to set the clock under PVDocumentation/virt/kvm/devices/vm.rst arch/s390/kvm/kvm-s390.c arch/s390/kvm/kvm-s390.h+20 -101 reply

Reviews trailers per patch

The patch has a Reviewed-by or Acked-by.

PatchClaudio ImbrendaJanosch Frank
1/1R-b R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v4 thread

Cover letter [PATCH v4 0/1] KVM: s390: pv: fix clock comparator late after suspend/resume

v3->v4:
---
- squash both commits
- update docs (thanks Janosch)
- add a comment (thanks Janosch)

v2->v3:
---
- add commit to remove kvm_s390_set_tod_clock() function (thanks Claudio)

v1->v2:
---
- fix broken migration due to deadlock

After a PV guest in QEMU has been paused and resumed, clock comparator interrupts are delivered to the guest much too late.

This is caused by QEMU's tod-kvm device restoring the guest's TOD clock upon guest resume. This is not possible with PV, since the guest's TOD clock is controlled by the ultravisor.

Even if not allowed under PV, KVM allowed the respective call from userspace (VM attribute KVM_S390_VM_TOD) and updated its internal data structures on this call. This can make the ultravisor's and KVM's view of the guest TOD clock inconsistent. This in turn can lead to the late delivery of clock comparator interrupts when KVM calculates when to wake the guest.

This fixes the kernel portion of the problem by disallowing the vm attr call for the guest TOD clock so userspace cannot mess up KVM's view of the guest TOD. This fix causes an ugly warning in QEMU though, hence another fix is due for QEMU to simply not even attempt to set the guest TOD on resume.

Nico Boehr (1):
KVM: s390: pv: don't allow userspace to set the clock under PV

 Documentation/virt/kvm/devices/vm.rst |  3 +++
 arch/s390/kvm/kvm-s390.c              | 26 +++++++++++++++++---------
 arch/s390/kvm/kvm-s390.h              |  1 -
 3 files changed, 20 insertions(+), 10 deletions(-)
Signature · 1 line
2.36.1