From: "Radim Krčmář" <rkrcmar@redhat.com>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: linux-kernel@vger.kernel.org, kvm@vger.kernel.org,
David Woodhouse <dwmw@amazon.co.uk>,
KarimAllah Ahmed <karahmed@amazon.de>
Subject: Re: [PATCH v2 3/3] KVM: VMX: make MSR bitmaps per-VCPU
Date: Wed, 31 Jan 2018 19:14:13 +0100 [thread overview]
Message-ID: <20180131181413.GA660@flask> (raw)
In-Reply-To: <fc794c7a-dec4-34dd-d7ac-6c0d49f138f1@redhat.com>
2018-01-31 12:37-0500, Paolo Bonzini:
> On 30/01/2018 11:23, Radim Krčmář wrote:
> > 2018-01-27 09:50+0100, Paolo Bonzini:
> >> Place the MSR bitmap in struct loaded_vmcs, and update it in place
> >> every time the x2apic or APICv state can change. This is rare and
> >> the loop can handle 64 MSRs per iteration, in a similar fashion as
> >> nested_vmx_prepare_msr_bitmap.
> >>
> >> This prepares for choosing, on a per-VM basis, whether to intercept
> >> the SPEC_CTRL and PRED_CMD MSRs.
> >>
> >> Suggested-by: Jim Mattson <jmattson@google.com>
> >> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> >> ---
> >> diff --git a/arch/x86/kvm/vmx.c b/arch/x86/kvm/vmx.c
> >> @@ -10022,7 +10043,7 @@ static inline bool nested_vmx_merge_msr_bitmap(struct kvm_vcpu *vcpu,
> >> int msr;
> >> struct page *page;
> >> unsigned long *msr_bitmap_l1;
> >> - unsigned long *msr_bitmap_l0 = to_vmx(vcpu)->nested.msr_bitmap;
> >> + unsigned long *msr_bitmap_l0 = to_vmx(vcpu)->nested.vmcs02.msr_bitmap;
> >
> > The physical address of the nested msr_bitmap is never loaded into vmcs.
> >
> > The resolution you provided had extra hunk in prepare_vmcs02_full():
> >
> > + vmcs_write64(MSR_BITMAP, __pa(vmx->nested.vmcs02.msr_bitmap));
> >
> > I have queued that as:
> >
> > + if (cpu_has_vmx_msr_bitmap())
> > + vmcs_write64(MSR_BITMAP, __pa(vmx->nested.vmcs02.msr_bitmap));
>
> Hmm you're right, it should be in prepare_vmcs02() here (4.15-based),
> and then moved to prepare_vmcs02_full() as part of the conflict resolution.
It also makes sense to have it in nested_get_vmcs12_pages, where we call
nested_vmx_prepare_msr_bitmap() and disable MSR bitmaps.
> I'll send a v3.
Thanks.
next prev parent reply other threads:[~2018-01-31 18:14 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-01-27 8:50 [PATCH v2 0/3] Per-VCPU MSR bitmaps patches - topic branch for x86/pti Paolo Bonzini
2018-01-27 8:50 ` [PATCH v2 1/3] KVM: nVMX: Eliminate vmcs02 pool Paolo Bonzini
2018-01-27 8:50 ` [PATCH v2 2/3] KVM: VMX: introduce alloc_loaded_vmcs Paolo Bonzini
2018-01-29 10:31 ` David Hildenbrand
2018-01-27 8:50 ` [PATCH v2 3/3] KVM: VMX: make MSR bitmaps per-VCPU Paolo Bonzini
2018-01-29 10:35 ` David Hildenbrand
2018-01-30 13:07 ` [v2,3/3] " Mihai Carabas
2018-01-30 16:23 ` [PATCH v2 3/3] " Radim Krčmář
2018-01-30 16:30 ` David Woodhouse
2018-01-31 17:37 ` Paolo Bonzini
2018-01-31 18:14 ` Radim Krčmář [this message]
2018-01-29 12:53 ` [PATCH v2 0/3] Per-VCPU MSR bitmaps patches - topic branch for x86/pti David Woodhouse
2018-01-29 14:28 ` Paolo Bonzini
2018-01-29 14:57 ` 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=20180131181413.GA660@flask \
--to=rkrcmar@redhat.com \
--cc=dwmw@amazon.co.uk \
--cc=karahmed@amazon.de \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@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;
as well as URLs for NNTP newsgroup(s).