From patchwork Wed Dec 13 07:00:07 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jia He X-Patchwork-Id: 10109367 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E3DA460327 for ; Wed, 13 Dec 2017 07:00:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DEF6828D6A for ; Wed, 13 Dec 2017 07:00:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D150C28E6B; Wed, 13 Dec 2017 07:00:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, DKIM_VALID, FREEMAIL_FROM, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 4BA4928D6A for ; Wed, 13 Dec 2017 07:00:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: References:List-Owner; bh=SS04oE10tu9xmZuM/bCioeKDonlKdIxdyB+8RQZ0g7A=; b=rtP V11nilCYvFnNdb2d+pDyfvCZc67aaOjrsaiIdWkBrMlkxQBZ8FYhtEP7vJ4IDjeIery6y7P7fWWIE DsxxqHd691bTMeDDRmDvPmHHUJ/D7QGsvEUBcTg7G+EAaJrKErGS4rjVjyRTBXkKjzILcDAKZLNQv eB7wDo5odkK4KcblocTfbmm3h6b+SNlz3b+dT+ARdXAA7FaapeS4SsVd25NdVwWkmShBozVSzT5pP EHYdeMlbkemq5kpusgidB0Fak3JulcCC4s0KkJ8ZPqsAtV62tCQ71KpuD9hbKISjwfNzJ5o4iW5lu 91fIe9pAPL+HsQ6eE/ZWUbo5UWQFGIA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1eP12B-0003bI-VX; Wed, 13 Dec 2017 07:00:51 +0000 Received: from mail-pl0-x241.google.com ([2607:f8b0:400e:c01::241]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1eP128-0003ZY-90 for linux-arm-kernel@lists.infradead.org; Wed, 13 Dec 2017 07:00:50 +0000 Received: by mail-pl0-x241.google.com with SMTP id s10so491327plj.5 for ; Tue, 12 Dec 2017 23:00:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=9y1Kcl57J+rT1Iv6A8QErCirj2/cLkp2CDM7eaRe9LY=; b=s+5fg7xmKirvtm1z42OPbSVfTn+cjyS+bdX3qgTo+6Wk7cgcFbI5RkNXrZoUuOPvmz gJLCMzZ8u3V/RgufOXl0Qu5fOyu6mGJ/kEc5gT4oVhqZyK2oe9kvhtJwGuK8hYprEpIg RiR5mXvwqymZfmb9hZ72+K5Mo90iDavjpSki3RuVlV7Mev6HyXI35KRAsfpkmObua5ox BhIofQgBE7VKBGuu1sq//T2omVRu8xpvkUelMyjirBuH8IkTwVem4FWuEIH1hLwmWeAg qydjX5ieC8wzCCFnT5Vlyf5tzSviUlhL9i2BUIERs5yfOmf2OaerLUELHEsnjhKepfQo Cjhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=9y1Kcl57J+rT1Iv6A8QErCirj2/cLkp2CDM7eaRe9LY=; b=i/grY2fGlQ4nrgl2WnnWs6GyoiNcSsaK7ue1GM9pNxLg3aQF9qBqTamZQItTBgv6Ss xRX0cbnfBktvKv/NmfiIbPxbqv6TrjgEdY1aIUfJd2lMbpjl/vvvnWcZ+BbOIXHTJzLr SWo9luhND2Tf6neWPRqeacCaMg1yFgu/Unfd2BXdJFt8aITK7pZ0bEuQeQZQbZf7wi7j +Dr/gFWgUofkD7aOpOTvOcUlbgVwjavbAumoJjaRuJBQGXOJ5HwNNHI0BUVJA8NWO0qG kUsHUg8cpexqGnBz+PHhd8CXGuJWorTwpq8AQuZVSEShcBTh64+ABzPXVUwWNaskCN+p qlNw== X-Gm-Message-State: AKGB3mKLkyV7xboU4eN0XCRM2KiwNKT5yF65Wrf3ij2/vIlTM23KAkrW 1C4776d/OVT/8vePfM7hmhg= X-Google-Smtp-Source: ACJfBou8dtfi8doXrrwhKlayVIc78YaWqR/e/JHNYkA7SxD/2fqSDG01MP24ZEUgv7p3NISrTkdY5w== X-Received: by 10.84.244.199 with SMTP id f7mr4932992plt.181.1513148427481; Tue, 12 Dec 2017 23:00:27 -0800 (PST) Received: from localhost.localdomain ([38.106.11.25]) by smtp.gmail.com with ESMTPSA id h69sm1808065pfe.107.2017.12.12.23.00.21 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 12 Dec 2017 23:00:26 -0800 (PST) From: Jia He To: Christoffer Dall , Marc Zyngier , linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171212_230048_416951_379A7A8F X-CRM114-Status: GOOD ( 10.76 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jia He , Jia He , linux-kernel@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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); }