KVM: arm/arm64: Fixes for scheudling htimer of emulated timers
cover KVM: arm/arm64: Fixes for scheudling htimer of emulated timers
This small series contains two fixes which were found while testing Marc's ARM NV patch set, where we are going to have at most 4 timers and the two are purely emulated.
First patch cancels hrtimer when the timer should fire and there is no change in irq line level which suppresses timer interrupt storm when guest enables interrupts.
Second patch makes sure that hrtimer is scheduled when timer irq line goes down and there is still some time to expire.
Tomasz Nowicki (2):
KVM: arm/arm64: Fix spurious htimer setup for emulated timer
KVM: arm/arm64: Fix htimer setup for emulated timer when irq goes down
virt/kvm/arm/arch_timer.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
Signature · 6 lines
2.17.1 _______________________________________________ kvmarm mailing list [email protected] https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
PATCH 1/2 KVM: arm/arm64: Fix spurious htimer setup for emulated timer
The emulated timer needs no further software timer if the timer should fire now and there is no change in irq line level: (should_fire == 1 && should_fire == ctx->irq.level). In that case htimer should be simply canceled.
--- virt/kvm/arm/arch_timer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
virt/kvm/arm/arch_timer.c +1 -1
@@ -326,7 +326,7 @@ static void timer_emulate(struct arch_timer_context *ctx)* scheduled for the future. If the timer cannot fire at all, * then we also don't need a soft timer. */ -if (!kvm_timer_irq_can_fire (ctx)) { +if (should_fire || !kvm_timer_irq_can_fire (ctx)) {soft_timer_cancel (&ctx->hrtimer);return ; }
Signature · 1 line
2.17.1
PATCH 2/2 KVM: arm/arm64: Fix htimer setup for emulated timer when irq goes down
In reply to Tomasz NowickiWe still need to schedule software timer if the line goes down (should_fire == 0 && should_fire != ctx->irq.level) and there is still some time to expire again.
--- virt/kvm/arm/arch_timer.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-)
virt/kvm/arm/arch_timer.c +1 -3
@@ -316,10 +316,8 @@ static void timer_emulate(struct arch_timer_context *ctx)trace_kvm_timer_emulate (ctx, should_fire); -if (should_fire != ctx->irq.level) { +if (should_fire != ctx->irq.level)kvm_timer_update_irq (ctx->vcpu, should_fire, ctx); -return ; - }/* * If the timer can fire now, we don't need to have a soft timer
Signature · 6 lines
2.17.1 _______________________________________________ kvmarm mailing list [email protected] https://lists.cs.columbia.edu/mailman/listinfo/kvmarm
Marc Zyngier
maintainerQuoted 3 lines · Tomasz Nowicki
This small series contains two fixes which were found while testing Marc's ARM NV patch set, where we are going to have at most 4 timers and the two are purely emulated.
What are these patches fixing? the NV series? or mainline?
Thanks,
M.
Signature · 1 line
Jazz is not dead. It just smells funny...
Quoted 8 lines · Marc Zyngier
----------------------------------------------------------------------
Quoted 3 lines · Tomasz Nowicki
This small series contains two fixes which were found while testing Marc's ARM NV patch set, where we are going to have at most 4 timers and the two are purely emulated.
What are these patches fixing? the NV series? or mainline?
Both, but found when testing NV.
Tomasz
_______________________________________________
kvmarm mailing list
[email protected]
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm