public inbox for kvmarm@lists.cs.columbia.edu
 help / color / mirror / Atom feed
From: Jia He <hejianet@gmail.com>
To: Christoffer Dall <christoffer.dall@linaro.org>,
	Marc Zyngier <marc.zyngier@arm.com>,
	linux-arm-kernel@lists.infradead.org,
	kvmarm@lists.cs.columbia.edu
Cc: linux-kernel@vger.kernel.org, Jia He <hejianet@gmail.com>,
	Jia He <jia.he@hxt-semitech.com>
Subject: [PATCH] KVM: arm/arm64: don't set vtimer->cnt_ctl in kvm_arch_timer_handler
Date: Tue, 12 Dec 2017 23:00:07 -0800	[thread overview]
Message-ID: <1513148407-2611-1-git-send-email-hejianet@gmail.com> (raw)

In our Armv8a server (qualcomm Amberwing, non VHE), after applying
Christoffer's timer optimizing patchset(Optimize arch timer register
handling), the guest is hang during kernel booting.

The error root cause might be as follows:
1. in kvm_arch_timer_handler, it reset vtimer->cnt_ctl with current
cntv_ctl register value. And then it missed some cases to update timer's
irq (irq.level) when kvm_timer_irq_can_fire() is false
2. It causes kvm_vcpu_check_block return 0 instead of -EINTR
	kvm_vcpu_check_block
		kvm_cpu_has_pending_timer
			kvm_timer_is_pending
				kvm_timer_should_fire
3. Thus, the kvm hyp code can not break the loop in kvm_vcpu_block (halt
poll process) and the guest is hang forever

Fixes: b103cc3f10c0 ("KVM: arm/arm64: Avoid timer save/restore in vcpu entry/exit")
Signed-off-by: Jia He <jia.he@hxt-semitech.com>
---
 virt/kvm/arm/arch_timer.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/virt/kvm/arm/arch_timer.c b/virt/kvm/arm/arch_timer.c
index f9555b1..bb86433 100644
--- a/virt/kvm/arm/arch_timer.c
+++ b/virt/kvm/arm/arch_timer.c
@@ -100,7 +100,6 @@ static irqreturn_t kvm_arch_timer_handler(int irq, void *dev_id)
 	vtimer = vcpu_vtimer(vcpu);
 
 	if (!vtimer->irq.level) {
-		vtimer->cnt_ctl = read_sysreg_el0(cntv_ctl);
 		if (kvm_timer_irq_can_fire(vtimer))
 			kvm_timer_update_irq(vcpu, true, vtimer);
 	}
-- 
2.7.4

             reply	other threads:[~2017-12-13  7:00 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-13  7:00 Jia He [this message]
2017-12-13  8:56 ` [PATCH] KVM: arm/arm64: don't set vtimer->cnt_ctl in kvm_arch_timer_handler Marc Zyngier
2017-12-13  9:08   ` Auger Eric
2017-12-13  9:27     ` Marc Zyngier
2017-12-13  9:34       ` Christoffer Dall
2017-12-13  9:20   ` Christoffer Dall
2017-12-13  9:18 ` Christoffer Dall
2017-12-14  4:57   ` Jia He
2017-12-14  5:35     ` Jia He
2017-12-14 13:09     ` Christoffer Dall
2017-12-14 15:28       ` Jia He
2017-12-14 15:45         ` Christoffer Dall
2017-12-15  2:27           ` Jia He
2017-12-15  9:09             ` Marc Zyngier
2017-12-15 10:10               ` Christoffer Dall
2017-12-15 10:33                 ` Marc Zyngier
2017-12-15 11:15                   ` Christoffer Dall
2017-12-15 10:04             ` Christoffer Dall
2017-12-21  9:16               ` Jia He
2017-12-21 11:35                 ` Christoffer Dall

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1513148407-2611-1-git-send-email-hejianet@gmail.com \
    --to=hejianet@gmail.com \
    --cc=christoffer.dall@linaro.org \
    --cc=jia.he@hxt-semitech.com \
    --cc=kvmarm@lists.cs.columbia.edu \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marc.zyngier@arm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox