Re: [EXTERNAL] [PATCH] KVM: x86: revalidate steal time cache if MSR value changes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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


[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux