Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751305AbdLMHA3 (ORCPT ); Wed, 13 Dec 2017 02:00:29 -0500 Received: from mail-pl0-f67.google.com ([209.85.160.67]:38941 "EHLO mail-pl0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750739AbdLMHA1 (ORCPT ); Wed, 13 Dec 2017 02:00:27 -0500 X-Google-Smtp-Source: ACJfBou8dtfi8doXrrwhKlayVIc78YaWqR/e/JHNYkA7SxD/2fqSDG01MP24ZEUgv7p3NISrTkdY5w== From: Jia He To: Christoffer Dall , Marc Zyngier , linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu Cc: linux-kernel@vger.kernel.org, Jia He , Jia He 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 Message-Id: <1513148407-2611-1-git-send-email-hejianet@gmail.com> X-Mailer: git-send-email 2.7.4 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1360 Lines: 36 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 --- 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