Skip to content

Commit 9090825

Browse files
KAGA-KOKOMarc Zyngier
authored andcommitted
KVM: arm/arm64: Let the timer expire in hardirq context on RT
The timers are canceled from an preempt-notifier which is invoked with disabled preemption which is not allowed on PREEMPT_RT. The timer callback is short so in could be invoked in hard-IRQ context on -RT. Let the timer expire on hard-IRQ context even on -RT. Signed-off-by: Thomas Gleixner <[email protected]> Signed-off-by: Sebastian Andrzej Siewior <[email protected]> Signed-off-by: Marc Zyngier <[email protected]> Tested-by: Julien Grall <[email protected]> Acked-by: Marc Zyngier <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent ca185b2 commit 9090825

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

virt/kvm/arm/arch_timer.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ static inline bool userspace_irqchip(struct kvm *kvm)
8080
static void soft_timer_start(struct hrtimer *hrt, u64 ns)
8181
{
8282
hrtimer_start(hrt, ktime_add_ns(ktime_get(), ns),
83-
HRTIMER_MODE_ABS);
83+
HRTIMER_MODE_ABS_HARD);
8484
}
8585

8686
static void soft_timer_cancel(struct hrtimer *hrt)
@@ -697,11 +697,11 @@ void kvm_timer_vcpu_init(struct kvm_vcpu *vcpu)
697697
update_vtimer_cntvoff(vcpu, kvm_phys_timer_read());
698698
ptimer->cntvoff = 0;
699699

700-
hrtimer_init(&timer->bg_timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS);
700+
hrtimer_init(&timer->bg_timer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS_HARD);
701701
timer->bg_timer.function = kvm_bg_timer_expire;
702702

703-
hrtimer_init(&vtimer->hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS);
704-
hrtimer_init(&ptimer->hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS);
703+
hrtimer_init(&vtimer->hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS_HARD);
704+
hrtimer_init(&ptimer->hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_ABS_HARD);
705705
vtimer->hrtimer.function = kvm_hrtimer_expire;
706706
ptimer->hrtimer.function = kvm_hrtimer_expire;
707707

0 commit comments

Comments
 (0)