From mboxrd@z Thu Jan 1 00:00:00 1970 From: Gleb Natapov Subject: Re: [PATCH 2/3] Consolidate userspace and kernel interrupt injection for VMX. Date: Sat, 11 Apr 2009 22:53:53 +0300 Message-ID: <20090411195353.GB24630@redhat.com> References: <20090407090811.2074.19043.stgit@trex.usersys.redhat.com> <20090407090817.2074.76611.stgit@trex.usersys.redhat.com> <49E07F18.4070609@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: kvm@vger.kernel.org To: Avi Kivity Return-path: Received: from mx2.redhat.com ([66.187.237.31]:43136 "EHLO mx2.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756122AbZDKTxz (ORCPT ); Sat, 11 Apr 2009 15:53:55 -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 n3BJrtaK026697 for ; Sat, 11 Apr 2009 15:53:55 -0400 Content-Disposition: inline In-Reply-To: <49E07F18.4070609@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: On Sat, Apr 11, 2009 at 02:29:28PM +0300, Avi Kivity wrote: > Gleb Natapov wrote: >> Use the same callback to inject irq/nmi events no matter what irqchip is >> in use. Only from VMX for now. >> >> Signed-off-by: Gleb Natapov >> --- >> >> arch/x86/include/asm/kvm_host.h | 2 + >> arch/x86/kvm/svm.c | 2 + >> arch/x86/kvm/vmx.c | 71 +++++++++------------------------------ >> arch/x86/kvm/x86.c | 2 + >> 4 files changed, 19 insertions(+), 58 deletions(-) >> >> diff --git a/arch/x86/include/asm/kvm_host.h b/arch/x86/include/asm/kvm_host.h >> index e672ca5..4e39c40 100644 >> --- a/arch/x86/include/asm/kvm_host.h >> +++ b/arch/x86/include/asm/kvm_host.h >> @@ -520,7 +520,7 @@ struct kvm_x86_ops { >> void (*queue_exception)(struct kvm_vcpu *vcpu, unsigned nr, >> bool has_error_code, u32 error_code); >> bool (*exception_injected)(struct kvm_vcpu *vcpu); >> - void (*inject_pending_irq)(struct kvm_vcpu *vcpu); >> + void (*inject_pending_irq)(struct kvm_vcpu *vcpu, struct kvm_run *run); >> > > kvm_run is available as vcpu->run, so this isn't needed. But better to > keep it for now and drop it in a later patch. > >> static int vmx_set_tss_addr(struct kvm *kvm, unsigned int addr) >> { >> int ret; >> @@ -3351,8 +3309,11 @@ static void vmx_complete_interrupts(struct vcpu_vmx *vmx) >> } >> } >> -static void vmx_intr_assist(struct kvm_vcpu *vcpu) >> +static void vmx_intr_assist(struct kvm_vcpu *vcpu, struct kvm_run *kvm_run) >> { >> + bool req_int_win = !irqchip_in_kernel(vcpu->kvm) && >> + kvm_run->request_interrupt_window; >> + >> update_tpr_threshold(vcpu); >> vmx_update_window_states(vcpu); >> @@ -3373,25 +3334,25 @@ static void vmx_intr_assist(struct kvm_vcpu *vcpu) >> return; >> } >> } >> > > Why not convert the 'enable_nmi_window(); return;' above to a 'goto out' > like you do elsewhere? > > Mainly because of the next patch in the series that reworks this code anyway. -- Gleb.