From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marc Zyngier Subject: Re: [PATCH 2/2] KVM: arm/arm64: Fix timer enable flow Date: Fri, 15 Dec 2017 14:29:33 +0000 Message-ID: <86a7ykvzci.wl-marc.zyngier@arm.com> References: <20171215141656.25815-1-christoffer.dall@linaro.org> <20171215141656.25815-3-christoffer.dall@linaro.org> Mime-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII Return-path: In-Reply-To: <20171215141656.25815-3-christoffer.dall@linaro.org> Sender: kvm-owner@vger.kernel.org To: Christoffer Dall Cc: kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org, kvm@vger.kernel.org, Jia He List-Id: kvmarm@lists.cs.columbia.edu On Fri, 15 Dec 2017 14:16:56 +0000, Christoffer Dall wrote: > > When enabling the timer on the first run, we fail to ever restore the > state and mark it as loaded. That means, that in the initial entry to > the VCPU ioctl, unless we exit to userspace for some reason such as a > pending signal, if the guest programs a timer and blocks, we will wait > forever, because we never read back the hardware state (the loaded flag > is not set), and so we think the timer is disabled, and we never > schedule a background soft timer. > > The end result? The VCPU blocks forever, and the only solution is to > kill the thread. > > Fixes: 4a2c4da1250d ("arm/arm64: KVM: Load the timer state when enabling the timer") > Reported-by: Marc Zyngier > Signed-off-by: Christoffer Dall > --- > virt/kvm/arm/arch_timer.c | 5 +---- > 1 file changed, 1 insertion(+), 4 deletions(-) > > diff --git a/virt/kvm/arm/arch_timer.c b/virt/kvm/arm/arch_timer.c > index 14c018f990a7..cc29a8148328 100644 > --- a/virt/kvm/arm/arch_timer.c > +++ b/virt/kvm/arm/arch_timer.c > @@ -846,10 +846,7 @@ int kvm_timer_enable(struct kvm_vcpu *vcpu) > no_vgic: > preempt_disable(); > timer->enabled = 1; > - if (!irqchip_in_kernel(vcpu->kvm)) > - kvm_timer_vcpu_load_user(vcpu); > - else > - kvm_timer_vcpu_load_vgic(vcpu); > + kvm_timer_vcpu_load(vcpu); > preempt_enable(); > > return 0; > -- > 2.14.2 > Reviewed-by: Marc Zyngier Tested-by: Marc Zyngier M.