mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Woodhouse <dwmw2@infradead.org>
To: Paolo Bonzini <pbonzini@redhat.com>,
	linux-kernel@vger.kernel.org, kvm@vger.kernel.org,
	Metin Kaya <metikaya@amazon.co.uk>
Cc: Dave Young <ruyang@redhat.com>, Xiaoying Yan <yiyan@redhat.com>,
	"Dr . David Alan Gilbert" <dgilbert@redhat.com>,
	stable@vger.kernel.org
Subject: Re: [EXTERNAL] [PATCH] KVM: x86: revalidate steal time cache if MSR value changes
Date: Mon, 08 Aug 2022 13:42:58 +0100	[thread overview]
Message-ID: <4e29402770a7a254a1ea8ca8165af641ed0832ed.camel@infradead.org> (raw)
In-Reply-To: <20220804132832.420648-1-pbonzini@redhat.com>

[-- Attachment #1: Type: text/plain, Size: 819 bytes --]

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 #2: smime.p7s --]
[-- Type: application/pkcs7-signature, Size: 5965 bytes --]

      parent reply	other threads:[~2022-08-08 12:43 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-04 13:28 Paolo Bonzini
2022-08-04 13:56 ` Vitaly Kuznetsov
2022-08-04 17:08   ` Dr. David Alan Gilbert
2022-08-04 17:42     ` Sean Christopherson
2022-08-04 15:54 ` Dr. David Alan Gilbert
2022-08-08 12:42 ` David Woodhouse [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4e29402770a7a254a1ea8ca8165af641ed0832ed.camel@infradead.org \
    --to=dwmw2@infradead.org \
    --cc=dgilbert@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=metikaya@amazon.co.uk \
    --cc=pbonzini@redhat.com \
    --cc=ruyang@redhat.com \
    --cc=stable@vger.kernel.org \
    --cc=yiyan@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®