Re: [EXTERNAL] [PATCH] KVM: x86: revalidate steal time cache if MSR value changes
From: David Woodhouse
Date: Mon Aug 08 2022 - 08:43:06 EST
On Thu, 2022-08-04 at 15:28 +0200, Paolo Bonzini wrote:
> @@ -3397,13 +3398,12 @@ static void record_steal_time(struct kvm_vcpu *vcpu)=
> slots = kvm_memslots(vcpu->kvm);
>
> if (unlikely(slots->generation != ghc->generation ||
> + gpa != ghc->gpa ||
> kvm_is_error_hva(ghc->hva) || !ghc->memslot)) {
If we have to fix the same bug in two open-coded versions of the same
thing then surely it's time for something like...
static inline bool kvm_gfn_to_hva_cache_valid(struct kvm *kvm,
struct gfn_to_hva_cache *ghc,
gpa_t gpa)
{
struct kvm_memslots *slots = kvm_memslots(kvm);
return !unlikely(slots->generation != ghc->generation ||
gpa != ghc->gpa ||
kvm_is_error_hva(ghc->hva) || !ghc->memslot);
}
Attachment:
smime.p7s
Description: S/MIME cryptographic signature