Re: [PATCH v4 2/7] KVM: X86: Enable fastpath when APICv is enabled

From: Paolo Bonzini
Date: Mon May 04 2020 - 13:07:01 EST


On 30/04/20 15:34, Vitaly Kuznetsov wrote:
>> static enum exit_fastpath_completion vmx_exit_handlers_fastpath(struct kvm_vcpu *vcpu)
>> {
>> - if (!is_guest_mode(vcpu)) {
>> + if (!is_guest_mode(vcpu) && vcpu->arch.apicv_active) {
>> switch (to_vmx(vcpu)->exit_reason) {
>> case EXIT_REASON_MSR_WRITE:
>> return handle_fastpath_set_msr_irqoff(vcpu);
> I think that apicv_active checks are specific to APIC MSRs but
> handle_fastpath_set_msr_irqoff() can handle any other MSR as well. I'd
> suggest to move the check inside handle_fastpath_set_msr_irqoff().
>
> Also, enabling Hyper-V SynIC leads to disabling apicv. It it still
> pointless to keep fastpath enabled?

Indeed, only fast paths that only apply to apicv should be disabled (and
ideally there should be a WARN_ON in the code that doesn't support !apicv).

Paolo