From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alexander Graf Subject: Re: [PATCH v2 1/4] KVM: PPC: e500mc: Revert "add load inst fixup" Date: Fri, 02 May 2014 11:24:06 +0200 Message-ID: <53636436.60002@suse.de> References: <1398905152-18091-1-git-send-email-mihai.caraman@freescale.com> <1398905152-18091-2-git-send-email-mihai.caraman@freescale.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: kvm-ppc@vger.kernel.org, kvm@vger.kernel.org, linuxppc-dev@lists.ozlabs.org To: Mihai Caraman Return-path: In-Reply-To: <1398905152-18091-2-git-send-email-mihai.caraman@freescale.com> Sender: kvm-ppc-owner@vger.kernel.org List-Id: kvm.vger.kernel.org On 05/01/2014 02:45 AM, Mihai Caraman wrote: > 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 Just a random idea: Could we just switch IVOR2 during the critical lwepx phase? In fact, we could even do that later when we're already in C code and try to recover the last instruction. The code IVOR2 would point to would simply set the register we're trying to read to as LAST_INST_FAIL and rfi. Alex From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx2.suse.de (cantor2.suse.de [195.135.220.15]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 7DDFE140132 for ; Fri, 2 May 2014 19:24:12 +1000 (EST) Message-ID: <53636436.60002@suse.de> Date: Fri, 02 May 2014 11:24:06 +0200 From: Alexander Graf MIME-Version: 1.0 To: Mihai Caraman Subject: Re: [PATCH v2 1/4] KVM: PPC: e500mc: Revert "add load inst fixup" References: <1398905152-18091-1-git-send-email-mihai.caraman@freescale.com> <1398905152-18091-2-git-send-email-mihai.caraman@freescale.com> In-Reply-To: <1398905152-18091-2-git-send-email-mihai.caraman@freescale.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Cc: linuxppc-dev@lists.ozlabs.org, kvm@vger.kernel.org, kvm-ppc@vger.kernel.org List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , On 05/01/2014 02:45 AM, Mihai Caraman wrote: > 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 Just a random idea: Could we just switch IVOR2 during the critical lwepx phase? In fact, we could even do that later when we're already in C code and try to recover the last instruction. The code IVOR2 would point to would simply set the register we're trying to read to as LAST_INST_FAIL and rfi. Alex From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alexander Graf Date: Fri, 02 May 2014 09:24:06 +0000 Subject: Re: [PATCH v2 1/4] KVM: PPC: e500mc: Revert "add load inst fixup" Message-Id: <53636436.60002@suse.de> List-Id: References: <1398905152-18091-1-git-send-email-mihai.caraman@freescale.com> <1398905152-18091-2-git-send-email-mihai.caraman@freescale.com> In-Reply-To: <1398905152-18091-2-git-send-email-mihai.caraman@freescale.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Mihai Caraman Cc: kvm-ppc@vger.kernel.org, kvm@vger.kernel.org, linuxppc-dev@lists.ozlabs.org On 05/01/2014 02:45 AM, Mihai Caraman wrote: > 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 Just a random idea: Could we just switch IVOR2 during the critical lwepx phase? In fact, we could even do that later when we're already in C code and try to recover the last instruction. The code IVOR2 would point to would simply set the register we're trying to read to as LAST_INST_FAIL and rfi. Alex