From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH 2/4] Rewrite twisted maze of if() statements with more straightforward switch() Date: Mon, 30 Mar 2009 10:35:46 +0300 Message-ID: <49D07652.30502@redhat.com> References: <20090329141202.30481.91797.stgit@trex.usersys.redhat.com> <20090329141207.30481.33603.stgit@trex.usersys.redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org To: Gleb Natapov Return-path: Received: from mx2.redhat.com ([66.187.237.31]:35732 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750801AbZC3Hft (ORCPT ); Mon, 30 Mar 2009 03:35:49 -0400 Received: from int-mx2.corp.redhat.com (int-mx2.corp.redhat.com [172.16.27.26]) by mx2.redhat.com (8.13.8/8.13.8) with ESMTP id n2U7Zm5q012647 for ; Mon, 30 Mar 2009 03:35:48 -0400 In-Reply-To: <20090329141207.30481.33603.stgit@trex.usersys.redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: Gleb Natapov wrote: > Signed-off-by: Gleb Natapov > This is actually not just a rewrite, but also a bugfix: > INTR_INFO); > @@ -3289,34 +3288,42 @@ static void vmx_complete_interrupts(struct vcpu_vmx *vmx) > vmx->vnmi_blocked_time += > ktime_to_ns(ktime_sub(ktime_get(), vmx->entry_time)); > > + vmx->vcpu.arch.nmi_injected = false; > + kvm_clear_exception_queue(&vmx->vcpu); > + kvm_clear_interrupt_queue(&vmx->vcpu); > + > + if (!idtv_info_valid) > + return; > + > vector = idt_vectoring_info & VECTORING_INFO_VECTOR_MASK; > type = idt_vectoring_info & VECTORING_INFO_TYPE_MASK; > - if (vmx->vcpu.arch.nmi_injected) { > + > + switch(type) { > + case INTR_TYPE_NMI_INTR: > + vmx->vcpu.arch.nmi_injected = true; > /* > The existing code would leave nmi_injected == false if we exit on NMI_INTR, so we drop an NMI here. -- error compiling committee.c: too many arguments to function