From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jan Kiszka Subject: Re: [PATCH 1/1] Disable GUEST_INTR_STATE_STI flag before injecting NMI to guest on VMX Date: Fri, 27 Aug 2010 16:13:38 +0200 Message-ID: <4C77C812.4040103@siemens.com> References: <1282853162-16925-1-git-send-email-Jes.Sorensen@redhat.com> <1282853162-16925-2-git-send-email-Jes.Sorensen@redhat.com> <4C7776F9.4070306@siemens.com> <4C7777CA.4010208@redhat.com> <4C7779D2.9090902@siemens.com> <4C77895A.1000708@redhat.com> <4C779C3D.2070700@siemens.com> <4C77C49A.9000600@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: Jes Sorensen , "kvm@vger.kernel.org" , "gleb@redhat.com" , Joerg Roedel To: Avi Kivity Return-path: Received: from goliath.siemens.de ([192.35.17.28]:20068 "EHLO goliath.siemens.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753900Ab0H0ON4 (ORCPT ); Fri, 27 Aug 2010 10:13:56 -0400 In-Reply-To: <4C77C49A.9000600@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: Avi Kivity wrote: > On 08/27/2010 02:06 PM, Jan Kiszka wrote: >> Avi Kivity wrote: >>> On 08/27/2010 11:39 AM, Jan Kiszka wrote: >>>> AMD does not differentiate between MOV-SS and STI interrupt shadow= s. >>>> >>>> But AMD has its own NMI problems as it does not allow to trap afte= r >>>> IRET-from-NMI and requires magic dances which are partly broken in= KVM. >>>> I'm leaning towards NMI window emulation via the workaround we use= for >>>> older Intel CPUs without NMI window trapping as well. >>> Can you elaborate? >> Basically the issues you found regarding our single-step-based >> workaround. >=20 > I forgot them already. What was that, exception during IRET? Exception during IRET or any instruction under the interrupt shadow wil= l push the TF we set to step over this issue on the guest stack. We do no= t intercept all the possible exceptions, so we can leak TF. Moreover, multiplexing TF users is currently imperfect on AMD but, before fixing that, we have to think about the approach in general. >=20 >> Moreover, we cannot easily prevent that TF set by the NMI >> code leaks onto the guest's stack. >> >> J=F6rg and I stuck heads together about this during LinuxCon. We cam= e to >> the conclusion that we either have to emulate the instruction that >> delays NMIs (ie. _every_ possible instruction for the interrupt shad= ow >> case) or fall back to the VMX workaround based on interrupt window >> trapping and an emergency timeout (much simpler, but not really corr= ect). >=20 > I'd really like to avoid the timer. But I forgot all the details aro= und=20 > this, I'll have to re-learn them so I can actually compare the two op= tions. >=20 Hope the above helps you to get on track, otherwise drop more questions= =2E Also putting Joerg on CC (in the futile hope that the longer the CC lis= t is, the lesser the pain becomes for each individual). Jan --=20 Siemens AG, Corporate Technology, CT T DE IT 1 Corporate Competence Center Embedded Linux