From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ingo Molnar Subject: Re: [PATCH v5 2/5] KVM: VMX: Register a new IPI for posted interrupt Date: Fri, 8 Mar 2013 16:40:28 +0100 Message-ID: <20130308154028.GA30298@gmail.com> References: <1362705801-4467-1-git-send-email-yang.z.zhang@intel.com> <1362705801-4467-3-git-send-email-yang.z.zhang@intel.com> <20130308132625.GA27750@gmail.com> <20130308134719.GH24444@redhat.com> <20130308140545.GA28860@gmail.com> <20130308142129.GI24444@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Yang Zhang , kvm@vger.kernel.org, mtosatti@redhat.com, xiantao.zhang@intel.com, hpa@linux.intel.com To: Gleb Natapov Return-path: Received: from mail-ee0-f52.google.com ([74.125.83.52]:46823 "EHLO mail-ee0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758816Ab3CHPkc (ORCPT ); Fri, 8 Mar 2013 10:40:32 -0500 Received: by mail-ee0-f52.google.com with SMTP id b15so1095291eek.11 for ; Fri, 08 Mar 2013 07:40:31 -0800 (PST) Content-Disposition: inline In-Reply-To: <20130308142129.GI24444@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: * Gleb Natapov wrote: > On Fri, Mar 08, 2013 at 03:05:45PM +0100, Ingo Molnar wrote: > > > > * Gleb Natapov wrote: > > > > > On Fri, Mar 08, 2013 at 02:26:25PM +0100, Ingo Molnar wrote: > > > > > > > > * Yang Zhang wrote: > > > > > > > > > diff --git a/arch/x86/kernel/irqinit.c b/arch/x86/kernel/irqinit.c > > > > > index 6e03b0d..2329a54 100644 > > > > > --- a/arch/x86/kernel/irqinit.c > > > > > +++ b/arch/x86/kernel/irqinit.c > > > > > @@ -205,6 +205,10 @@ static void __init apic_intr_init(void) > > > > > > > > > > /* IPI for X86 platform specific use */ > > > > > alloc_intr_gate(X86_PLATFORM_IPI_VECTOR, x86_platform_ipi); > > > > > +#ifdef CONFIG_HAVE_KVM > > > > > + /* IPI for KVM to deliver posted interrupt */ > > > > > + alloc_intr_gate(POSTED_INTR_VECTOR, kvm_posted_intr_ipi); > > > > > +#endif > > > > > > > > Please avoid wasting an IDT entry by reusing x86_platform_ipi. > > > > > > > > A KVM guest is in essence one type of 'x86 platform', and this callback is used > > > > by hardware platforms, so collision is not an issue AFAICS. > > > > > > This is IPI send by a host though. > > > > But received on the guest side, right? > > Not directly. If CPU that receives it happens to run in a guest mode it makes VMX > to re-evaluate pending interrupt and inject one if possible without vmexit. If > CPU is not in a guest mode the handler for the IPI is called in a host mode and > does nothing. Guest code is unaware of the existence of that IPI. Ok, I guess a separate IPI is fine (and better) in this case then. Thanks, Ingo