From patchwork Mon Mar 9 11:09:06 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Zijlstra X-Patchwork-Id: 10665 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n29B8kXC016533 for ; Mon, 9 Mar 2009 11:09:14 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753355AbZCILJP (ORCPT ); Mon, 9 Mar 2009 07:09:15 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1753323AbZCILJP (ORCPT ); Mon, 9 Mar 2009 07:09:15 -0400 Received: from bombadil.infradead.org ([18.85.46.34]:35249 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752743AbZCILJO (ORCPT ); Mon, 9 Mar 2009 07:09:14 -0400 Received: from e53227.upc-e.chello.nl ([213.93.53.227] helo=dyad.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.69 #1 (Red Hat Linux)) id 1LgdM3-0002Rq-JK; Mon, 09 Mar 2009 11:09:07 +0000 Received: from [192.168.0.35] (unknown [192.168.0.35]) by dyad.programming.kicks-ass.net (Postfix) with ESMTP id 170F439364; Mon, 9 Mar 2009 12:08:11 +0100 (CET) Subject: Re: KVM: x86: use smp_send_reschedule in kvm_vcpu_kick From: Peter Zijlstra To: Ingo Molnar Cc: Avi Kivity , Marcelo Tosatti , kvm@vger.kernel.org, Gleb Natapov , Peter Zijlstra In-Reply-To: <20090309105855.GA14242@elte.hu> References: <20090303001405.GA5889@amt.cnet> <49B4ECB6.8060505@redhat.com> <20090309105855.GA14242@elte.hu> Date: Mon, 09 Mar 2009 12:09:06 +0100 Message-Id: <1236596946.8389.340.camel@laptop> Mime-Version: 1.0 X-Mailer: Evolution 2.25.92 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org On Mon, 2009-03-09 at 11:58 +0100, Ingo Molnar wrote: > * Avi Kivity wrote: > > > Marcelo Tosatti wrote: > >> KVM uses a function call IPI to cause the exit of a guest running on a > >> physical cpu. For virtual interrupt notification there is no need to > >> wait on IPI receival, or to execute any function. > >> > >> This is exactly what the reschedule IPI does, without the overhead > >> of function IPI. So use it instead of smp_call_function_single in > >> kvm_vcpu_kick. > >> > >> Also change the "guest_mode" variable to a bit in vcpu->requests, and > >> use that to collapse multiple IPI's that would be issued between the > >> first one and zeroing of guest mode. > >> > >> This allows kvm_vcpu_kick to called from interrupt context. > >> > > > > Looks good. The only worry I have is that we depend on > > smp_reschedule_interrupt() being a no-op. I guess that's a > > reasonable assumption though. > > It's a reasonable current assumption - but it might change in > the future - so please also put it into the changelog that KVM > will revert it or fix it differently if the scheduler grows some > functionality there. Alternatively, do something like the below, then anybody poking at that code will know to prod the KVM folks when they change anything. [ I suspect other kvm arches will need to a similar comment ] --- arch/x86/kernel/smp.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) -- To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/arch/x86/kernel/smp.c b/arch/x86/kernel/smp.c index 13f33ea..3b2e55e 100644 --- a/arch/x86/kernel/smp.c +++ b/arch/x86/kernel/smp.c @@ -172,6 +172,9 @@ void smp_reschedule_interrupt(struct pt_regs *regs) { ack_APIC_irq(); inc_irq_stat(irq_resched_count); + /* + * KVM uses this interrupt to force a cpu out of guest mode + */ } void smp_call_function_interrupt(struct pt_regs *regs)