From patchwork Fri May 3 16:11:10 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mihai Caraman X-Patchwork-Id: 241343 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id CC8F92C00DE for ; Sat, 4 May 2013 02:11:25 +1000 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933410Ab3ECQLX (ORCPT ); Fri, 3 May 2013 12:11:23 -0400 Received: from mail-db8lp0187.outbound.messaging.microsoft.com ([213.199.154.187]:57220 "EHLO db8outboundpool.messaging.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933306Ab3ECQLW (ORCPT ); Fri, 3 May 2013 12:11:22 -0400 Received: from mail147-db8-R.bigfish.com (10.174.8.225) by DB8EHSOBE024.bigfish.com (10.174.4.87) with Microsoft SMTP Server id 14.1.225.23; Fri, 3 May 2013 16:11:21 +0000 Received: from mail147-db8 (localhost [127.0.0.1]) by mail147-db8-R.bigfish.com (Postfix) with ESMTP id F2FBA60496; Fri, 3 May 2013 16:11:20 +0000 (UTC) X-Forefront-Antispam-Report: CIP:70.37.183.190; KIP:(null); UIP:(null); IPV:NLI; H:mail.freescale.net; RD:none; EFVD:NLI X-SpamScore: 3 X-BigFish: VS3(zcb8kzzz1f42h1fc6h1ee6h1de0h1fdah1202h1e76h1d1ah1d2ahzz8275bhz2dh2a8h668h839hd24he5bhf0ah1288h12a5h12a9h12bdh12e5h137ah139eh13b6h1441h1504h1537h162dh1631h1758h1898h18e1h1946h19b5h1ad9h1b0ah1d0ch1d2eh1d3fh1155h) Received: from mail147-db8 (localhost.localdomain [127.0.0.1]) by mail147-db8 (MessageSwitch) id 1367597479107088_4193; Fri, 3 May 2013 16:11:19 +0000 (UTC) Received: from DB8EHSMHS019.bigfish.com (unknown [10.174.8.243]) by mail147-db8.bigfish.com (Postfix) with ESMTP id 179F624008F; Fri, 3 May 2013 16:11:19 +0000 (UTC) Received: from mail.freescale.net (70.37.183.190) by DB8EHSMHS019.bigfish.com (10.174.4.29) with Microsoft SMTP Server (TLS) id 14.1.225.23; Fri, 3 May 2013 16:11:17 +0000 Received: from tx30smr01.am.freescale.net (10.81.153.31) by 039-SN1MMR1-003.039d.mgd.msft.net (10.84.1.16) with Microsoft SMTP Server (TLS) id 14.2.328.11; Fri, 3 May 2013 16:11:13 +0000 Received: from mcaraman-VirtualBox.ea.freescale.net (mcaraman-VirtualBox.ea.freescale.net [10.171.73.14]) by tx30smr01.am.freescale.net (8.14.3/8.14.0) with ESMTP id r43GBAEI000416; Fri, 3 May 2013 09:11:12 -0700 From: Mihai Caraman To: CC: , , Mihai Caraman Subject: [PATCH] KVM: PPC: Book3E 64: Fix IRQs warnings and hangs Date: Fri, 3 May 2013 19:11:10 +0300 Message-ID: <1367597470-22214-1-git-send-email-mihai.caraman@freescale.com> X-Mailer: git-send-email 1.7.4.1 MIME-Version: 1.0 X-OriginatorOrg: freescale.com Sender: kvm-ppc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm-ppc@vger.kernel.org A change in the generic code highlighted that we were running with IRQs (soft) enabled on Book3E 64-bit when trying to restart interrupts from handle_exit(). This is a lesson to configure lockdep often :) There is no reason to exit guest with soft_enabled == 1, a local_irq_enable() call will do this for us so get rid of kvmppc_layz_ee() calls. With this fix we eliminate irqs_disabled() warnings and some guest and host hangs revealed under stress tests, but guests still exhibit some unresponsiveness. The unresponsiveness has to do with the fact that arch_local_irq_restore() does not guarantees to hard enable interrupts. To do so replace exception function calls like timer_interrupt() with irq_happened flags. The local_irq_enable() call takes care of replaying them and lets the interrupts hard enabled. Signed-off-by: Mihai Caraman Acked-by: Benjamin Herrenschmidt --- arch/powerpc/kvm/booke.c | 9 +++------ 1 files changed, 3 insertions(+), 6 deletions(-) diff --git a/arch/powerpc/kvm/booke.c b/arch/powerpc/kvm/booke.c index 1020119..82f155e 100644 --- a/arch/powerpc/kvm/booke.c +++ b/arch/powerpc/kvm/booke.c @@ -673,7 +673,6 @@ int kvmppc_vcpu_run(struct kvm_run *kvm_run, struct kvm_vcpu *vcpu) ret = s; goto out; } - kvmppc_lazy_ee_enable(); kvm_guest_enter(); @@ -789,16 +788,16 @@ static void kvmppc_restart_interrupt(struct kvm_vcpu *vcpu, switch (exit_nr) { case BOOKE_INTERRUPT_EXTERNAL: kvmppc_fill_pt_regs(®s); - do_IRQ(®s); + local_paca->irq_happened |= PACA_IRQ_EE; break; case BOOKE_INTERRUPT_DECREMENTER: kvmppc_fill_pt_regs(®s); - timer_interrupt(®s); + local_paca->irq_happened |= PACA_IRQ_DEC; break; #if defined(CONFIG_PPC_FSL_BOOK3E) || defined(CONFIG_PPC_BOOK3E_64) case BOOKE_INTERRUPT_DOORBELL: kvmppc_fill_pt_regs(®s); - doorbell_exception(®s); + local_paca->irq_happened |= PACA_IRQ_DBELL; break; #endif case BOOKE_INTERRUPT_MACHINE_CHECK: @@ -1148,8 +1147,6 @@ int kvmppc_handle_exit(struct kvm_run *run, struct kvm_vcpu *vcpu, if (s <= 0) { local_irq_enable(); r = (s << 2) | RESUME_HOST | (r & RESUME_FLAG_NV); - } else { - kvmppc_lazy_ee_enable(); } }