kvmarm.lists.cs.columbia.edu archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] KVM: arm/arm64: Fixes for scheudling htimer of emulated timers
@ 2020-02-17 14:54 Tomasz Nowicki
  2020-02-17 14:54 ` [PATCH 1/2] KVM: arm/arm64: Fix spurious htimer setup for emulated timer Tomasz Nowicki
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Tomasz Nowicki @ 2020-02-17 14:54 UTC (permalink / raw)
  To: kvmarm, linux-arm-kernel; +Cc: gkulkarni, kvm, maz, Tomasz Nowicki, rrichter

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(-)

-- 
2.17.1

_______________________________________________
kvmarm mailing list
kvmarm@lists.cs.columbia.edu
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 1/2] KVM: arm/arm64: Fix spurious htimer setup for emulated timer
  2020-02-17 14:54 [PATCH 0/2] KVM: arm/arm64: Fixes for scheudling htimer of emulated timers Tomasz Nowicki
@ 2020-02-17 14:54 ` Tomasz Nowicki
  2020-02-17 14:54 ` [PATCH 2/2] KVM: arm/arm64: Fix htimer setup for emulated timer when irq goes down Tomasz Nowicki
  2020-02-17 18:00 ` [PATCH 0/2] KVM: arm/arm64: Fixes for scheudling htimer of emulated timers Marc Zyngier
  2 siblings, 0 replies; 5+ messages in thread
From: Tomasz Nowicki @ 2020-02-17 14:54 UTC (permalink / raw)
  To: kvmarm, linux-arm-kernel; +Cc: gkulkarni, kvm, maz, Tomasz Nowicki, rrichter

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.

Fixes: bee038a674875 ("KVM: arm/arm64: Rework the timer code to use a timer_map")
Signed-off-by: Tomasz Nowicki <tnowicki@marvell.com>
---
 virt/kvm/arm/arch_timer.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/virt/kvm/arm/arch_timer.c b/virt/kvm/arm/arch_timer.c
index 0d9438e9de2a..f1814f733ef8 100644
--- a/virt/kvm/arm/arch_timer.c
+++ b/virt/kvm/arm/arch_timer.c
@@ -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;
 	}
-- 
2.17.1

_______________________________________________
kvmarm mailing list
kvmarm@lists.cs.columbia.edu
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] KVM: arm/arm64: Fix htimer setup for emulated timer when irq goes down
  2020-02-17 14:54 [PATCH 0/2] KVM: arm/arm64: Fixes for scheudling htimer of emulated timers Tomasz Nowicki
  2020-02-17 14:54 ` [PATCH 1/2] KVM: arm/arm64: Fix spurious htimer setup for emulated timer Tomasz Nowicki
@ 2020-02-17 14:54 ` Tomasz Nowicki
  2020-02-17 18:00 ` [PATCH 0/2] KVM: arm/arm64: Fixes for scheudling htimer of emulated timers Marc Zyngier
  2 siblings, 0 replies; 5+ messages in thread
From: Tomasz Nowicki @ 2020-02-17 14:54 UTC (permalink / raw)
  To: kvmarm, linux-arm-kernel; +Cc: gkulkarni, kvm, maz, Tomasz Nowicki, rrichter

We 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.

Fixes: bee038a674875 ("KVM: arm/arm64: Rework the timer code to use a timer_map")
Signed-off-by: Tomasz Nowicki <tnowicki@marvell.com>
---
 virt/kvm/arm/arch_timer.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/virt/kvm/arm/arch_timer.c b/virt/kvm/arm/arch_timer.c
index f1814f733ef8..de14520c6cc2 100644
--- a/virt/kvm/arm/arch_timer.c
+++ b/virt/kvm/arm/arch_timer.c
@@ -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
-- 
2.17.1

_______________________________________________
kvmarm mailing list
kvmarm@lists.cs.columbia.edu
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 0/2] KVM: arm/arm64: Fixes for scheudling htimer of emulated timers
  2020-02-17 14:54 [PATCH 0/2] KVM: arm/arm64: Fixes for scheudling htimer of emulated timers Tomasz Nowicki
  2020-02-17 14:54 ` [PATCH 1/2] KVM: arm/arm64: Fix spurious htimer setup for emulated timer Tomasz Nowicki
  2020-02-17 14:54 ` [PATCH 2/2] KVM: arm/arm64: Fix htimer setup for emulated timer when irq goes down Tomasz Nowicki
@ 2020-02-17 18:00 ` Marc Zyngier
  2020-02-17 18:35   ` Tomasz Nowicki
  2 siblings, 1 reply; 5+ messages in thread
From: Marc Zyngier @ 2020-02-17 18:00 UTC (permalink / raw)
  To: Tomasz Nowicki; +Cc: gkulkarni, kvm, rrichter, linux-arm-kernel, kvmarm

On 2020-02-17 14:54, Tomasz Nowicki wrote:
> 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.
-- 
Jazz is not dead. It just smells funny...
_______________________________________________
kvmarm mailing list
kvmarm@lists.cs.columbia.edu
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Re: [PATCH 0/2] KVM: arm/arm64: Fixes for scheudling htimer of emulated timers
  2020-02-17 18:00 ` [PATCH 0/2] KVM: arm/arm64: Fixes for scheudling htimer of emulated timers Marc Zyngier
@ 2020-02-17 18:35   ` Tomasz Nowicki
  0 siblings, 0 replies; 5+ messages in thread
From: Tomasz Nowicki @ 2020-02-17 18:35 UTC (permalink / raw)
  To: Marc Zyngier; +Cc: gkulkarni, kvm, rrichter, linux-arm-kernel, kvmarm

On 17.02.2020 19:00, Marc Zyngier wrote:
> ----------------------------------------------------------------------
> On 2020-02-17 14:54, Tomasz Nowicki wrote:
>> 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
kvmarm@lists.cs.columbia.edu
https://lists.cs.columbia.edu/mailman/listinfo/kvmarm

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-02-17 18:35 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-17 14:54 [PATCH 0/2] KVM: arm/arm64: Fixes for scheudling htimer of emulated timers Tomasz Nowicki
2020-02-17 14:54 ` [PATCH 1/2] KVM: arm/arm64: Fix spurious htimer setup for emulated timer Tomasz Nowicki
2020-02-17 14:54 ` [PATCH 2/2] KVM: arm/arm64: Fix htimer setup for emulated timer when irq goes down Tomasz Nowicki
2020-02-17 18:00 ` [PATCH 0/2] KVM: arm/arm64: Fixes for scheudling htimer of emulated timers Marc Zyngier
2020-02-17 18:35   ` Tomasz Nowicki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).