From patchwork Thu May 1 00:45:49 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mihai Caraman X-Patchwork-Id: 4097041 Return-Path: X-Original-To: patchwork-kvm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 121079F38E for ; Thu, 1 May 2014 00:46:20 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 39D5B202B8 for ; Thu, 1 May 2014 00:46:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5806F202E6 for ; Thu, 1 May 2014 00:46:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753502AbaEAAqQ (ORCPT ); Wed, 30 Apr 2014 20:46:16 -0400 Received: from mail-bl2lp0204.outbound.protection.outlook.com ([207.46.163.204]:17599 "EHLO na01-bl2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751309AbaEAAqO (ORCPT ); Wed, 30 Apr 2014 20:46:14 -0400 Received: from BY2PR03CA048.namprd03.prod.outlook.com (10.141.249.21) by BY2PR03MB507.namprd03.prod.outlook.com (10.141.143.21) with Microsoft SMTP Server (TLS) id 15.0.921.12; Thu, 1 May 2014 00:45:59 +0000 Received: from BN1AFFO11FD024.protection.gbl (2a01:111:f400:7c10::173) by BY2PR03CA048.outlook.office365.com (2a01:111:e400:2c5d::21) with Microsoft SMTP Server (TLS) id 15.0.934.12 via Frontend Transport; Thu, 1 May 2014 00:45:58 +0000 Received: from az84smr01.freescale.net (192.88.158.246) by BN1AFFO11FD024.mail.protection.outlook.com (10.58.52.84) with Microsoft SMTP Server (TLS) id 15.0.929.8 via Frontend Transport; Thu, 1 May 2014 00:45:58 +0000 Received: from fsr-fed1764-012.ea.freescale.net (fsr-fed1764-012-010171073213.ea.freescale.net [10.171.73.213]) by az84smr01.freescale.net (8.14.3/8.14.0) with ESMTP id s410jsZN008245; Wed, 30 Apr 2014 17:45:56 -0700 From: Mihai Caraman To: CC: , , Mihai Caraman Subject: [PATCH v2 1/4] KVM: PPC: e500mc: Revert "add load inst fixup" Date: Thu, 1 May 2014 03:45:49 +0300 Message-ID: <1398905152-18091-2-git-send-email-mihai.caraman@freescale.com> X-Mailer: git-send-email 1.7.11.7 In-Reply-To: <1398905152-18091-1-git-send-email-mihai.caraman@freescale.com> References: <1398905152-18091-1-git-send-email-mihai.caraman@freescale.com> X-EOPAttributedMessage: 0 X-Forefront-Antispam-Report: CIP:192.88.158.246; CTRY:US; IPV:NLI; EFV:NLI; SFV:NSPM; SFS:(10009001)(6009001)(428001)(189002)(199002)(36756003)(80022001)(47776003)(83322001)(93916002)(87286001)(81542001)(81342001)(20776003)(76482001)(74662001)(19580395003)(50466002)(92726001)(92566001)(31966008)(80976001)(62966002)(74502001)(44976005)(88136002)(86362001)(6806004)(48376002)(76176999)(19580405001)(99396002)(77982001)(46102001)(50986999)(87936001)(79102001)(50226001)(89996001)(77156001)(4396001)(101416001)(77096999)(33646001)(83072002); DIR:OUT; SFP:1101; SCL:1; SRVR:BY2PR03MB507; H:az84smr01.freescale.net; FPR:AC18F248.8E9687DA.23E13376.68CEE229.20326; MLV:sfv; PTR:gate-az5.freescale.com; MX:1; A:1; LANG:en; MIME-Version: 1.0 X-Forefront-PRVS: 01986AE76B Received-SPF: None (: freescale.com does not designate permitted sender hosts) X-OriginatorOrg: freescale.com Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The commit 1d628af7 "add load inst fixup" made an attempt to handle failures generated by reading the guest current instruction. The fixup code that was added works by chance hiding the real issue. Load external pid (lwepx) instruction, used by KVM to read guest instructions, is executed in a subsituted guest translation context (EPLC[EGS] = 1). In consequence lwepx's TLB error and data storage interrupts need to be handled by KVM, even though these interrupts are generated from host context (MSR[GS] = 0). Currently, KVM hooks only interrupts generated from guest context (MSR[GS] = 1), doing minimal checks on the fast path to avoid host performance degradation. As a result, the host kernel handles lwepx faults searching the faulting guest data address (loaded in DEAR) in its own Logical Partition ID (LPID) 0 context. In case a host translation is found the execution returns to the lwepx instruction instead of the fixup, the host ending up in an infinite loop. Revert the commit "add load inst fixup". lwepx issue will be addressed in a subsequent patch without needing fixup code. Signed-off-by: Mihai Caraman --- v2: - reworked patch description arch/powerpc/kvm/bookehv_interrupts.S | 25 +------------------------ 1 file changed, 1 insertion(+), 24 deletions(-) diff --git a/arch/powerpc/kvm/bookehv_interrupts.S b/arch/powerpc/kvm/bookehv_interrupts.S index a1712b8..925da71 100644 --- a/arch/powerpc/kvm/bookehv_interrupts.S +++ b/arch/powerpc/kvm/bookehv_interrupts.S @@ -164,32 +164,9 @@ PPC_STL r30, VCPU_GPR(R30)(r4) PPC_STL r31, VCPU_GPR(R31)(r4) mtspr SPRN_EPLC, r8 - - /* disable preemption, so we are sure we hit the fixup handler */ - CURRENT_THREAD_INFO(r8, r1) - li r7, 1 - stw r7, TI_PREEMPT(r8) - isync - - /* - * In case the read goes wrong, we catch it and write an invalid value - * in LAST_INST instead. - */ -1: lwepx r9, 0, r5 -2: -.section .fixup, "ax" -3: li r9, KVM_INST_FETCH_FAILED - b 2b -.previous -.section __ex_table,"a" - PPC_LONG_ALIGN - PPC_LONG 1b,3b -.previous - + lwepx r9, 0, r5 mtspr SPRN_EPLC, r3 - li r7, 0 - stw r7, TI_PREEMPT(r8) stw r9, VCPU_LAST_INST(r4) .endif