Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932372AbaAHX0i (ORCPT ); Wed, 8 Jan 2014 18:26:38 -0500 Received: from mx1.redhat.com ([209.132.183.28]:54848 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932337AbaAHX0f (ORCPT ); Wed, 8 Jan 2014 18:26:35 -0500 Date: Wed, 8 Jan 2014 21:25:27 -0200 From: Marcelo Tosatti To: Hu Yaohui Cc: Chen Fan , "linux-kernel@vger.kernel.org" , kvm , gleb@redhat.com, pbonzini@redhat.com Subject: Re: [PATCH] kvm: x86: Fix debug typo error in lapic Message-ID: <20140108232527.GA17874@amt.cnet> References: <1388654051-5968-1-git-send-email-chen.fan.fnst@cn.fujitsu.com> <20140108211009.GD20624@amt.cnet> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jan 08, 2014 at 06:14:15PM -0500, Hu Yaohui wrote: > Hi guys, > I think you should be pretty familiar with lapic. I would really > appreciate it if someone could shed some lights on my problem > regarding Guest TLB flush IPI. > Supposed we get two vcpus 0 and 1. > When vcpu#0 wants to invalidate the tlb entry on vcpu#1. An IPI will > be generated by lapic on vcpu#0 by writing to ICR which will cause a > vmexit. > apic_send_ipi->kvm_irq_delivery_to_apic->kvm_apic_set_irq->__apic_accept_irq > In __apic_accept_irq, it will call kvm_make_request, kvm_vcpu_kick. > If vcpu#1 in guest mode, how can it receives this IPI immediately, or > the stale tlb entry could be accessed. Thanks for your time! Two possibilities: 2) Hardware does not support APIC virtualization: kvm_vcpu_kick sends an host-IPI to the remote vcpu, and if that vcpu is in guest mode, a VM-exit (exit reason: external interrupt) will be triggered due to the host-IPI. Then on VM-entry (inject_pending_event) the guest-IPI is injected. 2) Host CPU supports APIC virtualization (see commit 83d4c286931c and Intel's documentation): A bit is set in the posted interrupt section, and a special host-IPI is delivered to the target cpu where the guest vcpu is scheduled (vmx_deliver_posted_interrupt) which causes the hardware to inject the vector (without VM-exit). -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/