From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alexander Graf Subject: Re: [PATCH] KVM: PPC: Fix illegal opcode emulation in kvm-pr Date: Thu, 19 May 2016 10:04:41 +0200 Message-ID: <573D7399.9020708@suse.de> References: <1463598080-27643-1-git-send-email-thuth@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Cc: lvivier@redhat.com, kvm@vger.kernel.org To: Thomas Huth , Paul Mackerras , kvm-ppc@vger.kernel.org Return-path: Received: from mx2.suse.de ([195.135.220.15]:38573 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751362AbcESIEn (ORCPT ); Thu, 19 May 2016 04:04:43 -0400 In-Reply-To: <1463598080-27643-1-git-send-email-thuth@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On 05/18/2016 09:01 PM, Thomas Huth wrote: > If kvmppc_handle_exit_pr() calls kvmppc_emulate_instruction() to emulate > one instruction (in the BOOK3S_INTERRUPT_H_EMUL_ASSIST case), it calls > kvmppc_core_queue_program() afterwards if kvmppc_emulate_instruction() > returned EMULATE_FAIL, so the guest gets an program interrupt for the > illegal opcode. > However, the kvmppc_emulate_instruction() also tried to inject a > program exception for this already, so the program interrupt gets > injected twice and the return address in srr0 gets destroyed. > All other callers of kvmppc_emulate_instruction() are also injecting > a program interrupt, and since the callers have the right knowledge > about the srr1 flags that should be used, it is the function > kvmppc_emulate_instruction() that should _not_ inject program > interrupts, so remove the kvmppc_core_queue_program() here. > > This fixes the issue discovered by Laurent Vivier with kvm-unit-tests > where the logs are filled with these messages when the test tries > to execute an illegal instruction: > > Couldn't emulate instruction 0x00000000 (op 0 xop 0) > kvmppc_handle_exit_pr: emulation at 700 failed (00000000) > > Signed-off-by: Thomas Huth I'm surprised you're the first one to encounter this :). Reviewed-by: Alexander Graf Alex