diff options
author | Sean Christopherson <sean.j.christopherson@intel.com> | 2018-08-28 00:21:10 +0200 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2018-09-20 00:26:46 +0200 |
commit | 4c008127e4716d246b44b403f8a65ae9744d32c4 (patch) | |
tree | 6929ce3ff3de455fa4d1d79aa8e916299bd5f78e /crypto/blowfish_generic.c | |
parent | KVM: SVM: Switch to bitmap_zalloc() (diff) | |
download | linux-4c008127e4716d246b44b403f8a65ae9744d32c4.tar.xz linux-4c008127e4716d246b44b403f8a65ae9744d32c4.zip |
KVM: VMX: immediately mark preemption timer expired only for zero value
A VMX preemption timer value of '0' at the time of VMEnter is
architecturally guaranteed to cause a VMExit prior to the CPU
executing any instructions in the guest. This architectural
definition is in place to ensure that a previously expired timer
is correctly recognized by the CPU as it is possible for the timer
to reach zero and not trigger a VMexit due to a higher priority
VMExit being signalled instead, e.g. a pending #DB that morphs into
a VMExit.
Whether by design or coincidence, commit f4124500c2c1 ("KVM: nVMX:
Fully emulate preemption timer") special cased timer values of '0'
and '1' to ensure prompt delivery of the VMExit. Unlike '0', a
timer value of '1' has no has no architectural guarantees regarding
when it is delivered.
Modify the timer emulation to trigger immediate VMExit if and only
if the timer value is '0', and document precisely why '0' is special.
Do this even if calibration of the virtual TSC failed, i.e. VMExit
will occur immediately regardless of the frequency of the timer.
Making only '0' a special case gives KVM leeway to be more aggressive
in ensuring the VMExit is injected prior to executing instructions in
the nested guest, and also eliminates any ambiguity as to why '1' is
a special case, e.g. why wasn't the threshold for a "short timeout"
set to 10, 100, 1000, etc...
Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'crypto/blowfish_generic.c')
0 files changed, 0 insertions, 0 deletions