mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Jim Mattson <jmattson@google.com>
Cc: Sean Christopherson <sean.j.christopherson@intel.com>,
	"Xu, Like" <like.xu@intel.com>,
	Vitaly Kuznetsov <vkuznets@redhat.com>,
	Wanpeng Li <wanpengli@tencent.com>,
	Joerg Roedel <joro@8bytes.org>, kvm list <kvm@vger.kernel.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Like Xu <like.xu@linux.intel.com>
Subject: Re: [PATCH] KVM: VMX: Always treat MSR_IA32_PERF_CAPABILITIES as a valid PMU MSR
Date: Thu, 4 Jun 2020 18:49:44 +0200	[thread overview]
Message-ID: <285863c6-ef4b-a6f0-d223-ebc7cc515f84@redhat.com> (raw)
In-Reply-To: <CALMp9eQoKJg36AabLErekJ-U10-DkRHW=dn14q0bxQHh7XrGMQ@mail.gmail.com>

On 04/06/20 18:44, Jim Mattson wrote:
>>> I don't know if I would call it a "good assumption" so much as a "necessary
>>> assumption".  KVM_{GET,SET}_MSRS are allowed, and must function correctly,
>>> if they're called prior to KVM_SET_CPUID{2}.
>> Generally speaking this is not the case for the PMU; get_gp_pmc for
>> example depends on pmu->nr_arch_gp_counters which is initialized based
>> on CPUID leaf 0xA.
>>
>> The assumption that this patch fixes is that you can blindly take the
>> output of KVM_GET_MSR_INDEX_LIST and pass it to KVM_{GET,SET}_MSRS.
> 
> Is that an assumption or an invariant?

Both, I guess (a valid assumption for userspace, an invariant to be
respected for the kernel code).

The part where we don't fare to well, is that a bunch of MSRs that need
save/restore are _not_ included in KVM_GET_MSR_INDEX_LIST (and the PMU
is the biggest if not the only offender there).

Paolo


      reply	other threads:[~2020-06-04 16:49 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-03 20:33 Sean Christopherson
2020-06-04  1:37 ` Xu, Like
2020-06-04 15:16   ` Sean Christopherson
2020-06-04 16:20     ` Paolo Bonzini
2020-06-04 16:44       ` Jim Mattson
2020-06-04 16:49         ` Paolo Bonzini [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=285863c6-ef4b-a6f0-d223-ebc7cc515f84@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=jmattson@google.com \
    --cc=joro@8bytes.org \
    --cc=kvm@vger.kernel.org \
    --cc=like.xu@intel.com \
    --cc=like.xu@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sean.j.christopherson@intel.com \
    --cc=vkuznets@redhat.com \
    --cc=wanpengli@tencent.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®