• Wanpeng Li's avatar
    KVM: X86: Choose qspinlock when dedicated physical CPUs are available · b2798ba0
    Wanpeng Li authored
    Waiman Long mentioned that:
    > Generally speaking, unfair lock performs well for VMs with a small
    > number of vCPUs. Native qspinlock may perform better than pvqspinlock
    > if there is vCPU pinning and there is no vCPU over-commitment.
    
    This patch uses the KVM_HINTS_DEDICATED performance hint, which is
    provided by the hypervisor admin, to choose the qspinlock algorithm
    when a dedicated physical CPU is available.
    
    PV_DEDICATED = 1, PV_UNHALT = anything: default is qspinlock
    PV_DEDICATED = 0, PV_UNHALT = 1: default is Hybrid PV queued/unfair lock
    PV_DEDICATED = 0, PV_UNHALT = 0: default is tas
    
    Cc: Paolo Bonzini <pbonzini@redhat.com>
    Cc: Radim Krčmář <rkrcmar@redhat.com>
    Cc: Eduardo Habkost <ehabkost@redhat.com>
    Signed-off-by: default avatarWanpeng Li <wanpengli@tencent.com>
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    Signed-off-by: default avatarRadim Krčmář <rkrcmar@redhat.com>
    b2798ba0
kvm.c 17.5 KB