From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A9186C742B9 for ; Fri, 12 Jul 2019 12:38:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8384320645 for ; Fri, 12 Jul 2019 12:38:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1562935122; bh=uZ6LwPsp/KCDy/oucGPOKyVCGfUM2ptFOLsDxSTVslQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=XgnYIJTTUnWgH+JaLcDEbOAz+a/VMBlOO8coppREliTj0vLWOx8sxEYBKvHXyzelZ MmSvXZfcX5+oGxWyZKMcDB4dPTcGGu1Bnl584Ln1k5ixE8dbl1L0k+clqaJo4Ko2W9 kCAPULdaJmg4m6opWS6R17VbW+tw7LblTDjjdfN0= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728509AbfGLM2t (ORCPT ); Fri, 12 Jul 2019 08:28:49 -0400 Received: from mail.kernel.org ([198.145.29.99]:43184 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727897AbfGLM2t (ORCPT ); Fri, 12 Jul 2019 08:28:49 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9387821707; Fri, 12 Jul 2019 12:28:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1562934528; bh=uZ6LwPsp/KCDy/oucGPOKyVCGfUM2ptFOLsDxSTVslQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Wq0WcIpc0RwVaWIzl+JtReiab80LR990sfy36jTclBMtEkk9ra80hzWmYuYkDI3B9 gSevVjKfnWAGAwiUMq+9COHOhmU+sz2unRCXRTlsc8RVXmFbtRzk0ECmVrdI8589oy sRb0FHn3cQPQkU676Q40uM7ur6m1iutgu42bCmnM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andrew Jones , Marc Zyngier , Sasha Levin Subject: [PATCH 5.1 086/138] KVM: arm/arm64: Fix emulated ptimer irq injection Date: Fri, 12 Jul 2019 14:19:10 +0200 Message-Id: <20190712121632.043617479@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190712121628.731888964@linuxfoundation.org> References: <20190712121628.731888964@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org [ Upstream commit e4e5a865e9a9e8e47ac1959b629e9f3ae3b062f2 ] The emulated ptimer needs to track the level changes, otherwise the the interrupt will never get deasserted, resulting in the guest getting stuck in an interrupt storm if it enables ptimer interrupts. This was found with kvm-unit-tests; the ptimer tests hung as soon as interrupts were enabled. Typical Linux guests don't have a problem as they prefer using the virtual timer. Fixes: bee038a674875 ("KVM: arm/arm64: Rework the timer code to use a timer_map") Signed-off-by: Andrew Jones [Simplified the patch to res we only care about emulated timers here] Signed-off-by: Marc Zyngier Signed-off-by: Sasha Levin --- virt/kvm/arm/arch_timer.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/virt/kvm/arm/arch_timer.c b/virt/kvm/arm/arch_timer.c index 7fc272ecae16..1b1c449ceaf4 100644 --- a/virt/kvm/arm/arch_timer.c +++ b/virt/kvm/arm/arch_timer.c @@ -321,14 +321,15 @@ static void kvm_timer_update_irq(struct kvm_vcpu *vcpu, bool new_level, } } +/* Only called for a fully emulated timer */ static void timer_emulate(struct arch_timer_context *ctx) { bool should_fire = kvm_timer_should_fire(ctx); trace_kvm_timer_emulate(ctx, should_fire); - if (should_fire) { - kvm_timer_update_irq(ctx->vcpu, true, ctx); + if (should_fire != ctx->irq.level) { + kvm_timer_update_irq(ctx->vcpu, should_fire, ctx); return; } -- 2.20.1