mbox series

[0/2] LoongArch: KVM: Start SW timer only when vcpu is blocking

Message ID 20240130072238.2829831-1-maobibo@loongson.cn (mailing list archive)
Headers show
Series LoongArch: KVM: Start SW timer only when vcpu is blocking | expand

Message

maobibo Jan. 30, 2024, 7:22 a.m. UTC
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
however 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 and SW timer is only to wake up tasks 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. Also when SW timer is expired, it only wakes up vcpu
thread in blocking queue and need not restart SW timer.

Bibo Mao (2):
  LoongArch: KVM: Start SW timer only when vcpu is blocking
  LoongArch: KVM: Do not restart SW timer when it is expired

 arch/loongarch/kvm/timer.c | 42 ++++++++------------------------------
 1 file changed, 9 insertions(+), 33 deletions(-)


base-commit: 41bccc98fb7931d63d03f326a746ac4d429c1dd3