• Bibo Mao's avatar
    LoongArch: KVM: Start SW timer only when vcpu is blocking · 8bc15d02
    Bibo Mao authored
    SW timer is enabled when vcpu thread is scheduled out, and it is to wake
    up vcpu from blocked queue. If vcpu thread is scheduled out but is not
    blocked, such as it is preempted by other threads, it is not necessary
    to enable SW timer. Since vcpu thread is still on running queue if it is
    preempted and SW timer is only to wake up vcpu on blocking queue, so SW
    timer is not useful in this situation.
    
    This patch enables SW timer only when vcpu is scheduled out and is
    blocking.
    Signed-off-by: default avatarBibo Mao <maobibo@loongson.cn>
    Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
    8bc15d02
timer.c 5.61 KB