Re: [PATCH] KVM: add KVM_CAP_VMX_APICV to advertise hardware apic-v support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2014-12-11 20:53+0800, zhanghailiang:
> On 2014/12/11 19:48, Paolo Bonzini wrote:
> >On 11/12/2014 09:07, zhanghailiang wrote:
> >>User space (i.e. QEMU) should be able to check whether KVM
> >>supports apic-v. User space will use this to decide whether enable
> >>emulated MSR-based APIC (i.e. hyperv-vapic).
> >
> >Did you see an improvement in some workload?
> >
> 
> Yes, compared with using hyperv-vapic, using apic-v reduces lots of VM exit.
> 
> (1) Using Hyperv-vapic
>             693288 kvm:kvm_apic                                                 [100.00%]
>            1228026 kvm:kvm_exit                                                 [100.00%]
>             536450 kvm:kvm_msr                                                  [100.00%]
>             164441 kvm:kvm_apic_ipi                                             [100.00%]
>             377100 kvm:kvm_eoi                                                  [100.00%]
>                901 kvm:kvm_mmio                                                 [100.00%]
> (2) Using apic-v
>             324926 kvm:kvm_apic                                                 [100.00%]
>             898841 kvm:kvm_exit                                                 [100.00%]
>                 60 kvm:kvm_msr                                                  [100.00%]
>             164641 kvm:kvm_apic_ipi                                             [100.00%]
>                665 kvm:kvm_eoi                                                  [100.00%]
>                949 kvm:kvm_mmio                                                 [100.00%]
> 
> >I think it's a Windows bug---it should prefer x2apic to hv-vapic if both
> >are available.
> >
> 
> No, i don't think it is a windows bug, it has nothing to do with x2apic, but apic-v
> (need hardware support, i.e. Haswell cpu). When we don't passthough host cpu model to Guest os,
> it has no idea about whether it supports apic-v in host, so the choose should be done by qemu.

Nice, thank you.

> Actually, qemu has a option 'hv_vapic' for -cpu, we can choose not to configure it if we know
> there is apic-v support in host. But IMHO, we'd better to do it automatically.

hv-vapic has a legitimate use case with xapic without apic-v, so it
makes sense to disable it there.
(I'd dislike if QEMU disabled it without giving a control about it.)

> PS:
> This is the perf data when we configure x2apic but without configure hv-vapic and disable apic-v in kvm.
> It is the worst result, compared with the above two cases.

I'm not aware of any benefit of using the hyper-v MSR over x2apic MSR,
so if Windows does that, I'd call it a bug too ...

>            1616665 kvm:kvm_entry                                                [100.00%]
>            1634073 kvm:kvm_exit                                                 [100.00%]
>                  0 kvm:kvm_msr                                                  [100.00%]
>             181544 kvm:kvm_apic_ipi                                             [100.00%]
>             368745 kvm:kvm_eoi                                                  [100.00%]
>             568249 kvm:kvm_mmio                                                 [100.00%]

and it's simple to see why, Windows doesn't do x2apic.
--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux