From: Sean Christopherson <seanjc@google.com>
To: Jim Mattson <jmattson@google.com>
Cc: Aaron Lewis <aaronlewis@google.com>,
kvm@vger.kernel.org, pbonzini@redhat.com
Subject: Re: [PATCH] KVM: x86: Fix a stall when KVM_SET_MSRS is called on the pmu counters
Date: Fri, 28 Oct 2022 22:43:44 +0000 [thread overview]
Message-ID: <Y1xbINshcICWxxfa@google.com> (raw)
In-Reply-To: <CALMp9eT9S4_k9cFR26idssjV+Yz4VH23hXA10PVTGJwNALKeWw@mail.gmail.com>
On Fri, Oct 28, 2022, Jim Mattson wrote:
> On Fri, Oct 28, 2022 at 2:51 PM Sean Christopherson <seanjc@google.com> wrote:
> >
> > On Fri, Oct 28, 2022, Aaron Lewis wrote:
> > > On Fri, Oct 28, 2022 at 4:26 PM Sean Christopherson <seanjc@google.com> wrote:
> > > >
> > > > On Fri, Oct 28, 2022, Aaron Lewis wrote:
> > > > @@ -3778,16 +3775,13 @@ int kvm_set_msr_common(struct kvm_vcpu *vcpu, struct msr_data *msr_info)
> > > >
> > > > case MSR_K7_PERFCTR0 ... MSR_K7_PERFCTR3:
> > > > case MSR_P6_PERFCTR0 ... MSR_P6_PERFCTR1:
> > > > - pr = true;
> > > > - fallthrough;
> > > > case MSR_K7_EVNTSEL0 ... MSR_K7_EVNTSEL3:
> > > > case MSR_P6_EVNTSEL0 ... MSR_P6_EVNTSEL1:
> > > > if (kvm_pmu_is_valid_msr(vcpu, msr))
> > > > return kvm_pmu_set_msr(vcpu, msr_info);
> > > >
> > > > - if (pr || data != 0)
> > > > - vcpu_unimpl(vcpu, "disabled perfctr wrmsr: "
> > > > - "0x%x data 0x%llx\n", msr, data);
> > > > + if (data)
> > > > + kvm_pr_unimpl_wrmsr(vcpu, msr, data);
> > >
> > > Any reason to keep the check for 'data' around? Now that it's
> > > checking for 'report_ignored_msrs' maybe we don't need that check as
> > > well. I'm not sure what the harm is in removing it, and with this
> > > change we are additionally restricting pmu counter == 0 from printing.
> >
> > Checking 'dat' doesn't restrict counter 0, it skips printing if the guest (or host)
> > is writing '0', e.g. it would also skip the case you encountered where the host is
> > blindly "restoring" unused MSRs.
>
> The VMM is only blind because KVM_GET_MSR_INDEX_LIST poked it in the
> eye. It would be nice to have an API that the VMM could query for the
> list of supported MSRs.
That should be a fairly easy bug fix, kvm_init_msr_list() can and should omit PMU
MSRs if enable_pmu==false.
next prev parent reply other threads:[~2022-10-28 22:43 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-10-28 13:00 [PATCH] KVM: x86: Fix a stall when KVM_SET_MSRS is called on the pmu counters Aaron Lewis
2022-10-28 16:26 ` Sean Christopherson
2022-10-28 20:47 ` Aaron Lewis
2022-10-28 21:50 ` Sean Christopherson
2022-10-28 22:01 ` Jim Mattson
2022-10-28 22:43 ` Sean Christopherson [this message]
2022-11-02 17:55 ` Paolo Bonzini
2022-11-02 23:15 ` Aaron Lewis
2022-10-29 0:34 ` Aaron Lewis
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=Y1xbINshcICWxxfa@google.com \
--to=seanjc@google.com \
--cc=aaronlewis@google.com \
--cc=jmattson@google.com \
--cc=kvm@vger.kernel.org \
--cc=pbonzini@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