From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH] KVM: VMX: Fix race between pending IRQ and NMI Date: Fri, 21 Nov 2008 13:14:31 +0200 Message-ID: <49269817.7040101@redhat.com> References: <491858C8.2040401@siemens.com> <49201213.1080305@redhat.com> <49203513.2080800@web.de> <4920392F.9020303@redhat.com> <49203EAF.3000800@web.de> <49244F20.3030803@redhat.com> <49248514.9020605@redhat.com> <49256649.6060801@siemens.com> <49256D38.4090908@redhat.com> <492687BE.9030307@siemens.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15; format=flowed Content-Transfer-Encoding: 7bit Cc: Jan Kiszka , kvm-devel , "Xu, Jiajun" , "Yang, Sheng" To: Jan Kiszka Return-path: Received: from mx2.redhat.com ([66.187.237.31]:55891 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756095AbYKULOy (ORCPT ); Fri, 21 Nov 2008 06:14:54 -0500 In-Reply-To: <492687BE.9030307@siemens.com> Sender: kvm-owner@vger.kernel.org List-ID: Jan Kiszka wrote: >> enable_nmi_window() should cause an exit once the interrupt has been >> injected (likely before the first interrupt handler instruction was >> executed, but after the stack frame was created). So the nmi will not >> be delayed. >> > > Right now, you only call enable_nmi_window() if that window is currently > closed - and that's not the common case I'm worried about. > That's a thinko. I'll check if requesting it unconditionally is allowed and make it unconditional. >> But I think I see a bigger issue - if we inject an regular interrupt >> while another is pending, then we will encounter this problem. Looks >> like we have to enable the interrupt window after injecting an interrupt >> if there are still pending interrupts. >> > > Yeah, probably. I'm just wondering now if we can set > exit-on-interrupt-window while the vcpu state is interruptible (ie. > _before_ the injection). There is some entry check like this for NMIs, > but maybe no for interrupts. Need to check. > I think that it is allowed. The manual says "These VM exits follow event injection if such injection is specified for VM entry." for both interrupt windows and nmi windows (22.6.5 and 22.6.6). -- I have a truly marvellous patch that fixes the bug which this signature is too narrow to contain.