* Document the interaction between KVM_CAP_HALT_POLL and halt_poll_ns

* s390: fix multi-epoch extension in nested guests
 
 * x86: fix uninitialized variable on nested triple fault
 -----BEGIN PGP SIGNATURE-----
 
 iQFIBAABCAAyFiEE8TM4V0tmI4mGbHaCv/vSX3jHroMFAmOPcBoUHHBib256aW5p
 QHJlZGhhdC5jb20ACgkQv/vSX3jHroN9sAgArbccE7GCXUP3snd08rdV2Y1efKq3
 SsZWlze/esVlsRBr4Z+lzMamCIdMwUT242XEq50pOjQeqYB0PjaIraDhd/lnhbk/
 pYITFCoOmRtT4PyUrfYZIFeQBo+yhuhrYN8WCLFCatqY4ec+9p5nCiaFk1Wn49ZD
 zFm+uVXhlTa+DGNjGzjBi3mAPqTpRNAxdlPAEHv+kyaQgfRlTSo37H8Xs6PfcLVe
 YnsGG47Ozx3pPe5Zo3Sr1k56CQLjNcY77lVWXskKIiABsM3G5YJ2BlGgG007zlSB
 4G0/GyJhb351c1MHk1O+AfMNPfD4shJfLdIm5bJNGdiFPz9XFdpqa49BNQ==
 =SKVi
 -----END PGP SIGNATURE-----

Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm

Pull kvm fixes from Paolo Bonzini:
 "Unless anything comes from the ARM side, this should be the last pull
  request for this release - and it's mostly documentation:

   - Document the interaction between KVM_CAP_HALT_POLL and halt_poll_ns

   - s390: fix multi-epoch extension in nested guests

   - x86: fix uninitialized variable on nested triple fault"

* tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm:
  KVM: Document the interaction between KVM_CAP_HALT_POLL and halt_poll_ns
  KVM: Move halt-polling documentation into common directory
  KVM: x86: fix uninitialized variable use on KVM_REQ_TRIPLE_FAULT
  KVM: s390: vsie: Fix the initialization of the epoch extension (epdx) field
This commit is contained in:
Linus Torvalds 2022-12-06 10:49:19 -08:00
commit 5b3e0cd872
6 changed files with 24 additions and 10 deletions

View File

@ -7213,14 +7213,13 @@ veto the transition.
:Parameters: args[0] is the maximum poll time in nanoseconds
:Returns: 0 on success; -1 on error
This capability overrides the kvm module parameter halt_poll_ns for the
target VM.
KVM_CAP_HALT_POLL overrides the kvm.halt_poll_ns module parameter to set the
maximum halt-polling time for all vCPUs in the target VM. This capability can
be invoked at any time and any number of times to dynamically change the
maximum halt-polling time.
VCPU polling allows a VCPU to poll for wakeup events instead of immediately
scheduling during guest halts. The maximum time a VCPU can spend polling is
controlled by the kvm module parameter halt_poll_ns. This capability allows
the maximum halt time to specified on a per-VM basis, effectively overriding
the module parameter for the target VM.
See Documentation/virt/kvm/halt-polling.rst for more information on halt
polling.
7.21 KVM_CAP_X86_USER_SPACE_MSR
-------------------------------

View File

@ -119,6 +119,19 @@ These module parameters can be set from the debugfs files in:
Note: that these module parameters are system wide values and are not able to
be tuned on a per vm basis.
Any changes to these parameters will be picked up by new and existing vCPUs the
next time they halt, with the notable exception of VMs using KVM_CAP_HALT_POLL
(see next section).
KVM_CAP_HALT_POLL
=================
KVM_CAP_HALT_POLL is a VM capability that allows userspace to override halt_poll_ns
on a per-VM basis. VMs using KVM_CAP_HALT_POLL ignore halt_poll_ns completely (but
still obey halt_poll_ns_grow, halt_poll_ns_grow_start, and halt_poll_ns_shrink).
See Documentation/virt/kvm/api.rst for more information on this capability.
Further Notes
=============

View File

@ -17,4 +17,5 @@ KVM
locking
vcpu-requests
halt-polling
review-checklist

View File

@ -10,7 +10,6 @@ KVM for x86 systems
amd-memory-encryption
cpuid
errata
halt-polling
hypercalls
mmu
msr

View File

@ -546,8 +546,10 @@ static int shadow_scb(struct kvm_vcpu *vcpu, struct vsie_page *vsie_page)
if (test_kvm_cpu_feat(vcpu->kvm, KVM_S390_VM_CPU_FEAT_CEI))
scb_s->eca |= scb_o->eca & ECA_CEI;
/* Epoch Extension */
if (test_kvm_facility(vcpu->kvm, 139))
if (test_kvm_facility(vcpu->kvm, 139)) {
scb_s->ecd |= scb_o->ecd & ECD_MEF;
scb_s->epdx = scb_o->epdx;
}
/* etoken */
if (test_kvm_facility(vcpu->kvm, 156))

View File

@ -10574,8 +10574,8 @@ static int vcpu_enter_guest(struct kvm_vcpu *vcpu)
vcpu->run->exit_reason = KVM_EXIT_SHUTDOWN;
vcpu->mmio_needed = 0;
r = 0;
goto out;
}
goto out;
}
if (kvm_check_request(KVM_REQ_APF_HALT, vcpu)) {
/* Page is swapped out. Do synthetic halt */