From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gleb Natapov Subject: Re: [PATCH 22/24] KVM: x86 emulator: restart string instruction without going back to a guest. Date: Wed, 10 Mar 2010 15:48:11 +0200 Message-ID: <20100310134811.GU16909@redhat.com> References: <1268143762-4000-1-git-send-email-gleb@redhat.com> <1268143762-4000-23-git-send-email-gleb@redhat.com> <4B966035.2050904@redhat.com> <20100309181157.GF9066@redhat.com> <4B97043C.2000603@oss.ntt.co.jp> <20100310090633.GS16909@redhat.com> <4B976282.7020108@oss.ntt.co.jp> <20100310091508.GT16909@redhat.com> <4B976F9F.7090804@oss.ntt.co.jp> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Avi Kivity , kvm@vger.kernel.org To: Takuya Yoshikawa Return-path: Received: from mx1.redhat.com ([209.132.183.28]:7756 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932152Ab0CJNsO (ORCPT ); Wed, 10 Mar 2010 08:48:14 -0500 Content-Disposition: inline In-Reply-To: <4B976F9F.7090804@oss.ntt.co.jp> Sender: kvm-owner@vger.kernel.org List-ID: On Wed, Mar 10, 2010 at 07:08:31PM +0900, Takuya Yoshikawa wrote: > Gleb Natapov wrote: > >>>> > >>>Entering guest from time to time will not change semantics of the > >>>processor (if code is not modified under processor's feet at least). > >>>Currently we reenter guest mode after each iteration of string > >>>instruction for all instruction but ins/outs. > >>> > >>E.g., is there no chance that during the repetitions, in the middle of the > >>repetitions, page faults occur? If it can, without entering the guest, can > >>we handle it? > >> -- I lack some basic assumptions? > >> > >If page fault occurs we inject it to the guest. > > > > Oh, I maight fail to tell what I worried about. > Opposite, I mean, I worried about NOT reentering the guest case. > Are you thinking about something specific here? If we inject exceptions when they occur and we inject interrupt when they arrive what problem do you see? I guess this is how real CPU actually works. I doubt it re-reads string instruction on each iteration. > I know that current implementation with reentrance is OK. Current implementation does not reenter guest on each iteration for pio string, so currently we have both variants. > > To inject a page fault without reentering the guest, we need to add > some more hacks to the emulator IIUC. > No, we just need to enter guest if exception happens. I see that this in handled incorrectly in my current patch series. -- Gleb.