From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=56050 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OHuOk-0001DR-9n for qemu-devel@nongnu.org; Fri, 28 May 2010 03:54:33 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OHuOg-0008T6-DV for qemu-devel@nongnu.org; Fri, 28 May 2010 03:54:27 -0400 Received: from tx2ehsobe003.messaging.microsoft.com ([65.55.88.13]:8561 helo=TX2EHSOBE005.bigfish.com) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OHuOg-0008Sk-9P for qemu-devel@nongnu.org; Fri, 28 May 2010 03:54:26 -0400 Date: Fri, 28 May 2010 09:24:05 +0200 From: "Roedel, Joerg" Message-ID: <20100528072405.GB3266@amd.com> References: <4BFE8F13.2000009@cs.vu.nl> <4BFEBF9E.90600@web.de> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Disposition: inline In-Reply-To: <4BFEBF9E.90600@web.de> Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] Re: SVM emulation: EVENTINJ marked valid when a pagefault happens while issuing a software interrupt List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jan Kiszka Cc: Gleb Natapov , "qemu-devel@nongnu.org" , Erik van der Kouwe On Thu, May 27, 2010 at 02:53:18PM -0400, Jan Kiszka wrote: > Based on the KVM code (which is known to work perfectly :) ), I think > you are right: SVM apparently clears the valid bit in EVENTINJ during > VMRUN once it starts processing the injection, not after it as it's the > case in current QEMU. But better ask the experts: J=F6rg, Gleb? SVM always clears the vmcb.eventinj on vmrun because every exception is injected right after vmrun finished and cpu is in guest mode. It can happen (for example if taking the exception causes a page fault) that the vmcb.eventinj field is copied to vmcb.exit_int_info. Also note that at this point there is a difference between hardware svm and the nested-svm implementation in kvm. The hardware always takes the exception first before checking for any other intercept condition. This basically means that exit_int_info is only set when the injected event could not be delivered due to other conditions in the guest (page fault, nested page-fault, ...). In nested-svm you can get a valid exit_int_info when an interrupt or nmi is pending too. In the software implementation these intercepts are taken before the event is delivered and you find the event in vmcb.exit_int_info. This is not forbidden in the svm architecture and I have not found a hypervisor that has a problem with this different behavior. I have a patch here which changes this in nested-svm, but it introduces more problems than it fixes. Joerg