[RFC PATCH v3 0/5] x86/kvm: Virtual suspend time injection support

Hikaru Nishida
2021-10-20T12:04:53Z

Hi,

This patch series adds virtual suspend time injection support to KVM.
It is an updated version of the following series:
v2:
https://lore.kernel.org/kvm/20210806100710.2425336-1-hikalium@chromium.org/
v1:
https://lore.kernel.org/kvm/20210426090644.2218834-1-hikalium@chromium.org/

Please take a look again.

To kvm/arm64 folks:
I'm going to implement this mechanism to ARM64 as well but not
sure which function should be used to make an IRQ (like kvm_apic_set_irq
in x86) and if it is okay to use kvm_gfn_to_hva_cache /
kvm_write_guest_cached for sharing the suspend duration.
Please let me know if there is other suitable way or any suggestions.

Thanks,

Hikaru Nishida

Changes in v3:
- Used PM notifier instead of modifying timekeeping_resume()
- This avoids holding kvm_lock under interrupt disabled context.
- Used KVM_REQ_* to make a request for vcpus.
- Reused HYPERVISOR_CALLBACK_VECTOR IRQ instead of adding a new one.
- Extracted arch-independent parts.
- Fixed other reviewed points.

Hikaru Nishida (5):
timekeeping: Expose tk->offs_boot via ktime_get_offs_boot_ns
kvm/x86: Include asm/pvclock.h in asm/kvmclock.h
kvm/x86: virtual suspend time injection: Add common definitions
kvm/x86: virtual suspend time injection: Implement host side
kvm/x86: virtual suspend time injection: Implement guest side

Documentation/virt/kvm/cpuid.rst | 3 +
Documentation/virt/kvm/msr.rst | 30 ++++++++
arch/x86/Kconfig | 13 ++++
arch/x86/include/asm/idtentry.h | 2 +-
arch/x86/include/asm/kvm_host.h | 2 +
arch/x86/include/asm/kvmclock.h | 11 +++
arch/x86/include/uapi/asm/kvm_para.h | 6 ++
arch/x86/kernel/kvm.c | 14 +++-
arch/x86/kernel/kvmclock.c | 26 +++++++
arch/x86/kvm/Kconfig | 13 ++++
arch/x86/kvm/cpuid.c | 4 +
arch/x86/kvm/x86.c | 109 +++++++++++++++++++++++++++
arch/x86/mm/fault.c | 2 +-
include/linux/kvm_host.h | 48 ++++++++++++
include/linux/timekeeper_internal.h | 5 ++
include/linux/timekeeping.h | 6 ++
kernel/time/timekeeping.c | 56 ++++++++++++++
virt/kvm/kvm_main.c | 88 +++++++++++++++++++++
18 files changed, 432 insertions(+), 6 deletions(-)

--
2.33.0.1079.g6e70778dc9-goog