From: Peter Xu <peterx@redhat.com>
To: Alexander Graf <graf@amazon.com>,
Sean Christopherson <sean.j.christopherson@intel.com>
Cc: Sean Christopherson <sean.j.christopherson@intel.com>,
Paolo Bonzini <pbonzini@redhat.com>,
Vitaly Kuznetsov <vkuznets@redhat.com>,
Wanpeng Li <wanpengli@tencent.com>,
Jim Mattson <jmattson@google.com>, Joerg Roedel <joro@8bytes.org>,
kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
Aaron Lewis <aaronlewis@google.com>
Subject: Re: [PATCH 2/2] KVM: VMX: Ignore userspace MSR filters for x2APIC when APICV is enabled
Date: Wed, 7 Oct 2020 12:44:31 -0400 [thread overview]
Message-ID: <20201007164431.GE6026@xz-x1> (raw)
In-Reply-To: <bcb15eb1-8d3e-ff6d-d11f-667884584f1f@amazon.com>
On Wed, Oct 07, 2020 at 04:01:59PM +0200, Alexander Graf wrote:
>
>
> On 05.10.20 21:55, Sean Christopherson wrote:
> >
> > Rework the resetting of the MSR bitmap for x2APIC MSRs to ignore
> > userspace filtering when APICV is enabled. Allowing userspace to
> > intercept reads to x2APIC MSRs when APICV is fully enabled for the guest
> > simply can't work. The LAPIC and thus virtual APIC is in-kernel and
> > cannot be directly accessed by userspace. If userspace wants to
> > intercept x2APIC MSRs, then it should first disable APICV.
> >
> > Opportunistically change the behavior to reset the full range of MSRs if
> > and only if APICV is enabled for KVM. The MSR bitmaps are initialized
> > to intercept all reads and writes by default, and enable_apicv cannot be
> > toggled after KVM is loaded. I.e. if APICV is disabled, simply toggle
> > the TPR MSR accordingly.
> >
> > Note, this still allows userspace to intercept reads and writes to TPR,
> > and writes to EOI and SELF_IPI. It is at least plausible userspace
> > interception could work for those registers, though it is still silly.
> >
> > Cc: Alexander Graf <graf@amazon.com>
> > Cc: Aaron Lewis <aaronlewis@google.com>
> > Cc: Peter Xu <peterx@redhat.com>
> > Signed-off-by: Sean Christopherson <sean.j.christopherson@intel.com>
>
> I'm not opposed in general to leaving APICV handled registers out of the
> filtering logic. However, this really needs a note in the documentation
> then, no?
If we want to forbid apicv msrs, should we even fail KVM_X86_SET_MSR_FILTER
directly then?
I've no strong opinion on whether these msrs should be restricted. I'm not sure
whether my understanding is correct here - to me, kvm should always depend on
the userspace to do the right thing to make the vm work. To me, as long as the
error is self-contained and it does not affect kvm as a whole or the host, then
it seems still fine.
However I do agree that I also worried about vmx_update_msr_bitmap_x2apic()
being slower. Majorly I see calls from vmx_refresh_apicv_exec_ctrl() or
nested, so I'm not sure whether that could make sense for some workload. Btw,
that seems to be another change corresponds to the idea to restrict msr
filitering on apicv regs.
Thanks,
--
Peter Xu
next prev parent reply other threads:[~2020-10-07 16:46 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-10-05 19:55 [PATCH 0/2] KVM: VMX: x2APIC + APICV MSR fix and cleanup Sean Christopherson
2020-10-05 19:55 ` [PATCH 1/2] KVM: VMX: Fix x2APIC MSR intercept handling on !APICV platforms Sean Christopherson
2020-10-05 19:55 ` [PATCH 2/2] KVM: VMX: Ignore userspace MSR filters for x2APIC when APICV is enabled Sean Christopherson
2020-10-07 14:01 ` Alexander Graf
2020-10-07 16:44 ` Peter Xu [this message]
2020-10-19 16:32 ` Paolo Bonzini
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=20201007164431.GE6026@xz-x1 \
--to=peterx@redhat.com \
--cc=aaronlewis@google.com \
--cc=graf@amazon.com \
--cc=jmattson@google.com \
--cc=joro@8bytes.org \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
--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®