Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp838619ybi; Fri, 12 Jul 2019 05:30:11 -0700 (PDT) X-Google-Smtp-Source: APXvYqwQX+HDt0dYaRhN+R2KlfY0syNuYn44T+zAC+fVjKcWwlow4IeTyfTQjS/2uDqBSQ0dRZ9J X-Received: by 2002:a17:90a:cb18:: with SMTP id z24mr11181402pjt.108.1562934611012; Fri, 12 Jul 2019 05:30:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562934611; cv=none; d=google.com; s=arc-20160816; b=tl/tcRkuMd8MwyN2KGDGmJ9XNO6dZaZdLjxEK67PMsdH4wAl8d8ZfZ/lQqSM02RbU8 oMGCPWufi9VQbnz8x/5LTzrFvz3cVxWJNt9G+FJK9IhkW1Hg8at4vrNudJL7LQJQ0c/D RQv+r+QZyCYt2+j2ydmUHRFLK3gKtg410dFGMfTXeruKWo5L3o++YppM4ReeEo17ij8D BXl6V7mJUZ8JfbufaMWkeBdsEdMgUwJ5fV4iKclQpHJSHnWtQSC+QALtrlLFsu7SEx2k RcWwhizryaRpXUZi6qe1tvhXZb0NChUONcpQh+BM5w+Hiwmfb7d7FdW77r04/V1u1j5A DArg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=WhCRknz7CTtuEwyqeWp6Em5vGwUfCr6c2QBB26H8uRc=; b=Sz4/0i2edyPvOFdvGoBYQQ33zKJSPafCfQdGQ61BrzHsbccofnY/NIz7kxhjAODulA 4X5HGMSTqABBabvsROtJ+CD00tanYnkanoI2StpOt+XCnRd/n30AfbkfvNFyPYotgSr8 KgJNoKdPJDvsaXUCHQcX658vEJ5rY7WmZzKepk+oOd36PXCBBHGjPtpMXdRPy3/5A/H9 GSXuK3/KH4n0M1UXeEHKjgIel5JY4lzdvk7iy020RrEnyu8EL5SulgCCEJ4Ey4LI/q98 6qYtoIzVQ3fFquLUwLHKy9fzqi+rkJ5mWOLZKTHARrf0+VSpLadJ4LIF2qPrECBEldAs 8LAQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Wq0WcIpc; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q4si8331391pfg.286.2019.07.12.05.29.55; Fri, 12 Jul 2019 05:30:11 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Wq0WcIpc; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728327AbfGLM2y (ORCPT + 99 others); Fri, 12 Jul 2019 08:28:54 -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: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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