From mboxrd@z Thu Jan 1 00:00:00 1970 From: Alexander Graf Subject: Re: [RFC PATCH 0/5] Improve PPC instruction emulation Date: Mon, 28 Jul 2014 13:46:43 +0200 Message-ID: <53D63823.1060500@suse.de> References: <1405764872-8744-1-git-send-email-paulus@samba.org> Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org To: Paul Mackerras , kvm-ppc@vger.kernel.org Return-path: In-Reply-To: <1405764872-8744-1-git-send-email-paulus@samba.org> Sender: kvm-ppc-owner@vger.kernel.org List-Id: kvm.vger.kernel.org On 19.07.14 12:14, Paul Mackerras wrote: > This series aims to increase the range of instructions that KVM on PPC > can emulate and reduce code duplication by using the existing > instruction emulation code from arch/powerpc/lib/sstep.c for KVM. > > The ultimate goal is to make PR KVM run faster on the kind of > instruction sequences that we get in Linux's first-level interrupt > handlers, where we have privileged instructions such as move to/from > SPR, mtmsrd, rfid, etc., intermingled with ordinary unprivileged > loads, stores, arithmetic instructions, etc. If KVM could emulate > those ordinary instructions as well as the privileged ones, we could > emulate these code sequences without incurring the cost to exit and > re-enter the guest for every single privileged instruction. That > would be a speedup provided the guest entry/exit cost was greater than > the cost of emulating a few ordinary instructions. > > This series doesn't get to that ultimate goal but does lay the > groundwork. It splits the emulate_step() function into two parts, > analyse_instr() and emulate_step(), and uses analyse_instr() in > kvmppc_emulate_instruction(). This means that KVM needs to store its > vcpu integer register state in a struct pt_regs like the rest of the > kernel does. We also need to make kvmppc_handle_load() and > kvmppc_handle_store() handle loads and stores to ordinary guest memory > as well as emulated MMIO. Please take a look at my other patch set that implemented instruction emulation. There we split the code paths between MMIO emulation and normal instruction emulation. I really think that approach is a prerequisite to doing full instruction emulation in longer code snippets. Obviously the generic load/store should then handle MMIO as well as generic memory operations. Alex