From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH 2/2] x86: Bail out on unemulated instructions Date: Sun, 15 Aug 2010 18:40:49 +0300 Message-ID: <4C680A81.5030103@redhat.com> References: <1281801094-4515-1-git-send-email-m.gamal005@gmail.com> <1281801094-4515-2-git-send-email-m.gamal005@gmail.com> <20100815073236.GP10499@redhat.com> <20100815124112.GR10499@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Gleb Natapov , mtosatti@redhat.com, kvm@vger.kernel.org To: Mohammed Gamal Return-path: Received: from mx1.redhat.com ([209.132.183.28]:28077 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757429Ab0HOPkx (ORCPT ); Sun, 15 Aug 2010 11:40:53 -0400 In-Reply-To: Sender: kvm-owner@vger.kernel.org List-ID: On 08/15/2010 03:43 PM, Mohammed Gamal wrote: > 2010/8/15 Gleb Natapov: >> On Sun, Aug 15, 2010 at 03:40:00PM +0300, Mohammed Gamal wrote: >>> On Sun, Aug 15, 2010 at 10:32 AM, Gleb Natapov wrote: >>>> On Sat, Aug 14, 2010 at 06:51:34PM +0300, Mohammed Gamal wrote: >>>>> If emulation fails due to the instruction being unemulated. Return immediately >>>>> instead of restarting the instruction and infinitely trying to execute it. >>>>> >>>> This is already handled correctly as far as I can see. Sometimes >>>> instruction should be retried and reexecute_instruction() checks >>>> for that case. If instruction emulation fails in big real mode >>>> re-executing instruction will be useless though, so what should be done >>>> is to make reexecute_instruction() return false if vcpu is in big real >>>> mode and cpu relies on emulation to handle it. >>> We don't have a separate mode for big real mode. The emulation modes >>> we have are real and vm86 >>> >> That doesn't makes the patch right. So we will have to figure something >> out. > True. Can we do it for real mode in general (i.e. X86EMUL_MODE_REAL)? We can do it conditionally for CPL=0. That includes real mode (and excludes vm86). However, there's a race involved (see a895e576cfd96). I don't see how we can call handle_emulation_failure() without opening the race again. -- error compiling committee.c: too many arguments to function