KVM: Cap vcpu->halt_poll_ns before halting rather than after
authorDavid Matlack <dmatlack@google.com>
Thu, 17 Nov 2022 00:16:55 +0000 (16:16 -0800)
committerPaolo Bonzini <pbonzini@redhat.com>
Thu, 17 Nov 2022 15:49:06 +0000 (10:49 -0500)
commit97b6847ac10ba753849207e20df74a7c0ea03343
treecef366a2350c9b46721754b6caba7869d10ff784
parent6d3085e4d89ad7e6c7f1c6cf929d903393565861
KVM: Cap vcpu->halt_poll_ns before halting rather than after

Cap vcpu->halt_poll_ns based on the max halt polling time just before
halting, rather than after the last halt. This arguably provides better
accuracy if an admin disables halt polling in between halts, although
the improvement is nominal.

A side-effect of this change is that grow_halt_poll_ns() no longer needs
to access vcpu->kvm->max_halt_poll_ns, which will be useful in a future
commit where the max halt polling time can come from the module parameter
halt_poll_ns instead.

Signed-off-by: David Matlack <dmatlack@google.com>
Message-Id: <20221117001657.1067231-2-dmatlack@google.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
virt/kvm/kvm_main.c