Skip to content
  • Jan Kiszka's avatar
    4d25a066
    KVM: Don't automatically expose the TSC deadline timer in cpuid · 4d25a066
    Jan Kiszka authored
    
    
    Unlike all of the other cpuid bits, the TSC deadline timer bit is set
    unconditionally, regardless of what userspace wants.
    
    This is broken in several ways:
     - if userspace doesn't use KVM_CREATE_IRQCHIP, and doesn't emulate the TSC
       deadline timer feature, a guest that uses the feature will break
     - live migration to older host kernels that don't support the TSC deadline
       timer will cause the feature to be pulled from under the guest's feet;
       breaking it
     - guests that are broken wrt the feature will fail.
    
    Fix by not enabling the feature automatically; instead report it to userspace.
    Because the feature depends on KVM_CREATE_IRQCHIP, which we cannot guarantee
    will be called, we expose it via a KVM_CAP_TSC_DEADLINE_TIMER and not
    KVM_GET_SUPPORTED_CPUID.
    
    Fixes the Illumos guest kernel, which uses the TSC deadline timer feature.
    
    [avi: add the KVM_CAP + documentation]
    
    Reported-by: default avatarAlexey Zaytsev <alexey.zaytsev@gmail.com>
    Tested-by: default avatarAlexey Zaytsev <alexey.zaytsev@gmail.com>
    Signed-off-by: default avatarJan Kiszka <jan.kiszka@siemens.com>
    Signed-off-by: default avatarAvi Kivity <avi@redhat.com>
    4d25a066
    KVM: Don't automatically expose the TSC deadline timer in cpuid
    Jan Kiszka authored
    
    
    Unlike all of the other cpuid bits, the TSC deadline timer bit is set
    unconditionally, regardless of what userspace wants.
    
    This is broken in several ways:
     - if userspace doesn't use KVM_CREATE_IRQCHIP, and doesn't emulate the TSC
       deadline timer feature, a guest that uses the feature will break
     - live migration to older host kernels that don't support the TSC deadline
       timer will cause the feature to be pulled from under the guest's feet;
       breaking it
     - guests that are broken wrt the feature will fail.
    
    Fix by not enabling the feature automatically; instead report it to userspace.
    Because the feature depends on KVM_CREATE_IRQCHIP, which we cannot guarantee
    will be called, we expose it via a KVM_CAP_TSC_DEADLINE_TIMER and not
    KVM_GET_SUPPORTED_CPUID.
    
    Fixes the Illumos guest kernel, which uses the TSC deadline timer feature.
    
    [avi: add the KVM_CAP + documentation]
    
    Reported-by: default avatarAlexey Zaytsev <alexey.zaytsev@gmail.com>
    Tested-by: default avatarAlexey Zaytsev <alexey.zaytsev@gmail.com>
    Signed-off-by: default avatarJan Kiszka <jan.kiszka@siemens.com>
    Signed-off-by: default avatarAvi Kivity <avi@redhat.com>
Loading