summaryrefslogtreecommitdiff
path: root/virt
diff options
context:
space:
mode:
authorMaxim Levitsky <mlevitsk@redhat.com>2022-06-06 21:11:49 +0300
committerPaolo Bonzini <pbonzini@redhat.com>2022-06-07 11:28:50 -0400
commit11d39e8cc43e1c6737af19ca9372e590061b5ad2 (patch)
treefeee041f9516abcf98426e67cd4038c5a99bcac7 /virt
parenteae260be3a0111a28fe95923e117a55dddec0384 (diff)
KVM: SVM: fix tsc scaling cache logic
SVM uses a per-cpu variable to cache the current value of the tsc scaling multiplier msr on each cpu. Commit 1ab9287add5e2 ("KVM: X86: Add vendor callbacks for writing the TSC multiplier") broke this caching logic. Refactor the code so that all TSC scaling multiplier writes go through a single function which checks and updates the cache. This fixes the following scenario: 1. A CPU runs a guest with some tsc scaling ratio. 2. New guest with different tsc scaling ratio starts on this CPU and terminates almost immediately. This ensures that the short running guest had set the tsc scaling ratio just once when it was set via KVM_SET_TSC_KHZ. Due to the bug, the per-cpu cache is not updated. 3. The original guest continues to run, it doesn't restore the msr value back to its own value, because the cache matches, and thus continues to run with a wrong tsc scaling ratio. Fixes: 1ab9287add5e2 ("KVM: X86: Add vendor callbacks for writing the TSC multiplier") Signed-off-by: Maxim Levitsky <mlevitsk@redhat.com> Message-Id: <20220606181149.103072-1-mlevitsk@redhat.com> Cc: stable@vger.kernel.org Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'virt')
0 files changed, 0 insertions, 0 deletions