From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH 5/9] [VMX] Do not re-execute INTn instruction. Date: Wed, 06 May 2009 12:30:47 +0300 Message-ID: <4A0158C7.4090507@redhat.com> References: <1241511275-2261-1-git-send-email-gleb@redhat.com> <1241511275-2261-5-git-send-email-gleb@redhat.com> <200905061457.11209.sheng@linux.intel.com> <20090506092724.GV9795@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Sheng Yang , kvm@vger.kernel.org To: Gleb Natapov Return-path: Received: from mx2.redhat.com ([66.187.237.31]:33660 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754467AbZEFJbV (ORCPT ); Wed, 6 May 2009 05:31:21 -0400 In-Reply-To: <20090506092724.GV9795@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: Gleb Natapov wrote: >>> + u8 event_exit_inst_len; >>> + >>> >> Can we simply read the field when we need, instead of a new field? >> >> > Usually relying on vm exit information to be valid before vm entry > is wrong because migration can happen in a meantime. In this particular > case it is not so obvious since we don't want to migrate pending soft > interrupt, but re-execute instruction instead (we could migrate it > theoretically and may be we should, but when migrating from AMD to > Intel we don't have this info anyway). Another case where instruction > length as read from vmx may be outdated at interrupt injection time is > if exception happened during interrupt delivery and exception should be > re-injected first. > Note that in some cases we do keep things in vmcs/vmcb fields -- the registers, segments, etc. This is because we have per-vendor accessors for them, so we maintain a "virtual data structure" that common code can access. We could do something similar with the interrupt queue - keep part of it in the vmcs/vmcb and use accessors to modify it. But I don't think it's worthwhile; for vmx we have to read and write it anyway (since, unlike the registers, the exit and entry fields are different) and for svm it's in memory anyway so reading and writing it back is very cheap. -- Do not meddle in the internals of kernels, for they are subtle and quick to panic.