All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sean Christopherson <seanjc@google.com>
To: "Dr. David Alan Gilbert" <dgilbert@redhat.com>
Cc: Vitaly Kuznetsov <vkuznets@redhat.com>,
	Paolo Bonzini <pbonzini@redhat.com>,
	linux-kernel@vger.kernel.org, kvm@vger.kernel.org,
	Dave Young <ruyang@redhat.com>, Xiaoying Yan <yiyan@redhat.com>,
	David Woodhouse <dwmw@amazon.co.uk>,
	stable@vger.kernel.org
Subject: Re: [PATCH] KVM: x86: revalidate steal time cache if MSR value changes
Date: Thu, 4 Aug 2022 17:42:11 +0000	[thread overview]
Message-ID: <YuwE83glEswjkTq0@google.com> (raw)
In-Reply-To: <Yuv9BoFtf9q3Ew5G@work-vm>

On Thu, Aug 04, 2022, Dr. David Alan Gilbert wrote:
> * Vitaly Kuznetsov (vkuznets@redhat.com) wrote:
> > Paolo Bonzini <pbonzini@redhat.com> writes:
> > > -		gfn_t gfn = vcpu->arch.st.msr_val & KVM_STEAL_VALID_BITS;
> > > -
> > >  		/* We rely on the fact that it fits in a single page. */
> > >  		BUILD_BUG_ON((sizeof(*st) - 1) & KVM_STEAL_VALID_BITS);
> > >  
> > > -		if (kvm_gfn_to_hva_cache_init(vcpu->kvm, ghc, gfn, sizeof(*st)) ||
> > > +		if (kvm_gfn_to_hva_cache_init(vcpu->kvm, ghc, gpa, sizeof(*st)) ||
> > 
> > (It would be nice to somehow get at least a warning when 'gfn_t' is used
> > instead of 'gpa_t' and vice versa)
> 
> Can't sparse be taught to do that?

Hmm, it probably could, but the result would likely be a mess.  E.g. anything that
shifts the GPA on-demand will require explicit casts to make sparse happy.

This particular case is solvable without sparse, e.g. WARN if gpa[11:0]!=0, or
even better rework the function to actually take a @gfn and then WARN if the
incoming gfn would yield an illegal gpa.

  reply	other threads:[~2022-08-04 17:42 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-04 13:28 [PATCH] KVM: x86: revalidate steal time cache if MSR value changes 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 [this message]
2022-08-04 15:54 ` Dr. David Alan Gilbert
2022-08-08 12:42 ` [EXTERNAL] " David Woodhouse

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=YuwE83glEswjkTq0@google.com \
    --to=seanjc@google.com \
    --cc=dgilbert@redhat.com \
    --cc=dwmw@amazon.co.uk \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=ruyang@redhat.com \
    --cc=stable@vger.kernel.org \
    --cc=vkuznets@redhat.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.