From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gleb Natapov Subject: Re: [PATCH 19/24] KVM: x86 emulator: fix in/out emulation. Date: Wed, 10 Mar 2010 16:41:35 +0200 Message-ID: <20100310144135.GW16909@redhat.com> References: <1268143762-4000-1-git-send-email-gleb@redhat.com> <1268143762-4000-20-git-send-email-gleb@redhat.com> <4B965F7C.5070407@redhat.com> <20100309180938.GE9066@redhat.com> <4B976282.70406@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: kvm@vger.kernel.org To: Avi Kivity Return-path: Received: from mx1.redhat.com ([209.132.183.28]:10573 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755639Ab0CJOli (ORCPT ); Wed, 10 Mar 2010 09:41:38 -0500 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o2AEfctA031904 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 10 Mar 2010 09:41:38 -0500 Content-Disposition: inline In-Reply-To: <4B976282.70406@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On Wed, Mar 10, 2010 at 11:12:34AM +0200, Avi Kivity wrote: > On 03/09/2010 08:09 PM, Gleb Natapov wrote: > > > >>We don't want to enter the emulator for non-string in/out. Leftover > >>test code? > >> > >No, unfortunately this is not leftover. I just don't see a way how we > >can bypass emulator and still have emulator be able to emulate in/out > >(for big real mode for instance). The problem is basically described in > >the commit message. If we have function outside of emulator that does > >in/out emulation on vcpu directly, then emulator can't use it since > >committing shadowed registers will overwrite the result of emulation. > >Having two different emulations (one outside of emulator and another in > >emulator) is also problematic since when userspace returns after IO exit > >we don't know which emulation to continue. If we want to avoid > >instruction decoding we can fill in emulation context from exit info as > >if instruction was already decoded and call emulator. > > > > Alternatively, another entry point would be fine. in/out is a fast > path (used for virtio for example). > You mean another entry point into emulator, not separate implementation for emulated in/out and intercepted one. If yes this is what I mean by "faking" decoding stage. -- Gleb.