Skip to content

vITS Migration fixes and reset

Eric Auger kvm kvmarm lkml 6 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v6 Latest9 patches 12 repliesIn review
  2. v510 patches 13 repliesSuperseded
  3. v411 patches 17 repliesSuperseded
Earlier versions · 3
VersionPostedPatchesRepliesStatus
v311 patches0 repliesSuperseded
v210 patches35 repliesSuperseded
v19 patches5 repliesSuperseded

Changes in v6 from the cover letter

as per the discussions we had in the KVM forum, :
- don't try to fix everything without reset IOCTL
- removed "KVM: arm/arm64: vgic-its: Save the collection table before device tables"
- remove "The command queue is not allocated:" in API doc
- rework the locking in last patch
- vgic_its_free_device_list and vgic_its_free_collection_list do not take the its->lock anymore. The caller does.
- in vgic_its_restore_collection_table(), return 0 if last vgic_its_restore_cte returned +1

Patches in v6 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/9KVM: arm/arm64: vgic-its: Fix return value for device table restorevirt/kvm/arm/vgic/vgic-its.c+15 -50 replies
2/9KVM: arm/arm64: vgic-its: Fix vgic_its_restore_collection_table returned valuevirt/kvm/arm/vgic/vgic-its.c+4 -01 reply
3/9KVM: arm/arm64: vgic-its: Check CBASER/BASER validity before enabling the ITSvirt/kvm/arm/vgic/vgic-its.c+11 -00 replies
4/9KVM: arm/arm64: vgic-its: Check GITS_BASER Valid bit before saving tablesvirt/kvm/arm/vgic/vgic-its.c+11 -90 replies
5/9KVM: arm/arm64: vgic-its: Remove kvm_its_unmap_devicevirt/kvm/arm/vgic/vgic-its.c+2 -121 reply
6/9KVM: arm/arm64: vgic-its: New helper functions to free the cachesvirt/kvm/arm/vgic/vgic-its.c+20 -211 reply
7/9KVM: arm/arm64: vgic-its: Free caches when GITS_BASER Valid bit is clearedvirt/kvm/arm/vgic/vgic-its.c+22 -42 replies
8/9KVM: arm/arm64: Document KVM_DEV_ARM_ITS_CTRL_RESETDocumentation/virtual/kvm/devices/arm-vgic-its.txt+20 -02 replies
9/9KVM: arm/arm64: vgic-its: Implement KVM_DEV_ARM_ITS_CTRL_RESETarch/arm/include/uapi/asm/kvm.h arch/arm64/include/uapi/asm/kvm.h virt/kvm/arm/vgic/vgic-its.c+58 -492 replies

Reviews trailers per patch

All 9 patches have a Reviewed-by or Acked-by.

PatchChristoffer DallAndre PrzywaraMarc Zyngier
1/9R-b
2/9A-b
3/9R-b
4/9R-b R-b R-b
5/9A-b A-b
6/9A-b
7/9R-b R-b
8/9A-b R-b
9/9R-b R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes. Scroll the table sideways for all 3 reviewers.

Read the v6 thread

Cover letter [PATCH v6 0/9] vITS Migration fixes and reset

This series fixes various bugs observed when saving/restoring the ITS state before the guest writes the ITS registers (on first boot or after reset/reboot).

This is a follow up of Wanghaibin's series [1] plus additional patches following additional code review. It also proposes one ITS reset implementation.

Currently, the in-kernel emulated ITS is not reset. After a reset/reboot, the ITS register values and caches are left unchanged. Registers may point to some tables in guest memory which do not exist anymore. If an ITS state backup is initiated before the guest re-writes the registers, the save fails because inconsistencies are detected. Also restore of data saved as such moment is failing.

Patches [1-4] are fixes of bugs observed during migration at early guets boot stage.
- handle case where all collection, device and ITT entries are invalid on restore (which is not an error)
- Check the GITS_BASER<n> valid bit before attempting the save any table
- Check the GITS_BASER<n> and GITS_CBASER are valid before enabling the ITS

Patches [5-9] allow to empty the caches on reset and implement a new ITS reset IOCTL

Best Regards

Eric

Git: complete series available at
https://github.com/eauger/linux/tree/v4.14-rc5-its-reset-v6

* Testing:
- on Cavium using a virtio-net-pci guest and various sequences of guest shutdown -r now, virsh reset, virsh suspend/resume, virsh reboot, virsh save.restore, virsh shutdown

References:
[1] [RFC PATCH 0/3] fix migrate failed when vm is in booting
https://www.spinics.net/lists/kvm-arm/msg27121.html

History:
v5 -> v6:
as per the discussions we had in the KVM forum, :
- don't try to fix everything without reset IOCTL
- removed "KVM: arm/arm64: vgic-its: Save the collection table before device tables"
- remove "The command queue is not allocated:" in API doc
- rework the locking in last patch
- vgic_its_free_device_list and vgic_its_free_collection_list do not take the its->lock anymore. The caller does.
- in vgic_its_restore_collection_table(), return 0 if last vgic_its_restore_cte returned +1

v4 -> v5:
- came back to the original version of
KVM: arm/arm64: vgic-its: Fix return value for device table restore Rework of error handling will come later
- remove [PATCH v4 03/11] KVM: arm/arm64: vgic-its: Improve error reporting on device table save as of now
- remove KVM: arm/arm64: vgic-its: Always attempt to save/restore device and collection tables
inversing the save order of device/collection tables fixes the same issue
- reword ITS IOCTL doc
- add mutex lock in vgic_its_free_collection_list
- remove vgic_its_unmap_device

v3 -> v4:
- fixes a bug in indirect mode: in handle_l1_dte, set *valid at the beginning of the function

v2 -> v3:
- Revisited error handling in restore functions
- Added "KVM: arm/arm64: vgic-its: fix vgic_its_restore_collection_table returned value"
- Added "KVM: arm/arm64: vgic-its: Check CBASER/BASER validity before enabling the ITS"
- Removed KVM: arm/arm64: vgic-its: Always allow clearing GITS_CREADR/CWRITER
- Reworded documentation according to Christoffer's comments

v1 -> v2:
- added KVM: arm/arm64: vgic-its: Always attempt to save/restore device and collection tables

PATCH v1
- series including 2 modified patches of Wanghaibin

Eric Auger (7):
KVM: arm/arm64: vgic-its: Fix vgic_its_restore_collection_table
returned value
KVM: arm/arm64: vgic-its: Check CBASER/BASER validity before enabling
the ITS
KVM: arm/arm64: vgic-its: Check GITS_BASER Valid bit before saving
tables
KVM: arm/arm64: vgic-its: Remove kvm_its_unmap_device
KVM: arm/arm64: vgic-its: Free caches when GITS_BASER Valid bit is
cleared
KVM: arm/arm64: Document KVM_DEV_ARM_ITS_CTRL_RESET
KVM: arm/arm64: vgic-its: Implement KVM_DEV_ARM_ITS_CTRL_RESET

wanghaibin (2):
KVM: arm/arm64: vgic-its: Fix return value for device table restore
KVM: arm/arm64: vgic-its: New helper functions to free the caches

 Documentation/virtual/kvm/devices/arm-vgic-its.txt |  20 ++
 arch/arm/include/uapi/asm/kvm.h                    |   1 +
 arch/arm64/include/uapi/asm/kvm.h                  |   1 +
 virt/kvm/arm/vgic/vgic-its.c                       | 241 ++++++++++++---------
 4 files changed, 163 insertions(+), 100 deletions(-)
Signature · 1 line
2.5.5