Re: [PATCH v4 08/17] kvm: x86: Introduce APICv pre-update hook

From: Roman Kagan
Date: Tue Nov 12 2019 - 06:12:25 EST


On Mon, Nov 11, 2019 at 06:08:05PM -0600, Suravee Suthikulpanit wrote:
> On 11/4/19 4:05 PM, Roman Kagan wrote:
> > On Fri, Nov 01, 2019 at 10:41:31PM +0000, Suthikulpanit, Suravee wrote:
> > > AMD SVM AVIC needs to update APIC backing page mapping before changing
> > > APICv mode. Introduce struct kvm_x86_ops.pre_update_apicv_exec_ctrl
> > > function hook to be called prior KVM APICv update request to each vcpu.
> > This again seems to mix up APIC backing page and APIC access page.
> >
> > And I must be missing something obvious, but why is it necessary to
> > unmap the APIC access page while AVIC is disabled? Does keeping it
> > around stand in the way when working with AVIC disabled?
>
> I have replied to patch 07/17 with explanation.
>
> Yes, keeping the APIC access page while disabling AVIC would cause
> the SVM to not function properly.

I wonder why? Once AVIC is disabled guest access to this page would
trigger a regular NPT fault vmexit, just as it would with the NPT entry
for this page destroyed, wouldn't it? So there would be no difference
from the host's POV. Am I missing something?

Thanks,
Roman.