public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
From: Marcelo Tosatti <mtosatti@redhat.com>
To: Hu Yaohui <loki2441@gmail.com>
Cc: Chen Fan <chen.fan.fnst@cn.fujitsu.com>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	kvm <kvm@vger.kernel.org>,
	gleb@redhat.com, pbonzini@redhat.com
Subject: Re: [PATCH] kvm: x86: Fix debug typo error in lapic
Date: Wed, 8 Jan 2014 21:25:27 -0200	[thread overview]
Message-ID: <20140108232527.GA17874@amt.cnet> (raw)
In-Reply-To: <CAHqbYQt0ERa4kgK97D0NWZnZdF9TtdskaH0as7fZyO7N=5AzPw@mail.gmail.com>

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).

  reply	other threads:[~2014-01-08 23:25 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-02  9:14 [PATCH] kvm: x86: Fix debug typo error in lapic Chen Fan
2014-01-08 21:10 ` Marcelo Tosatti
2014-01-08 23:14   ` Hu Yaohui
2014-01-08 23:25     ` Marcelo Tosatti [this message]
2014-01-08 23:35       ` Hu Yaohui
2014-01-09 16:28         ` Hu Yaohui
     [not found]           ` <20140109184711.GB2309@amt.cnet>
2014-01-09 20:08             ` Hu Yaohui
2014-01-11 12:27               ` Marcelo Tosatti
2014-01-12 19:40                 ` Hu Yaohui
2014-01-09 18:46         ` Marcelo Tosatti
2014-01-09 18:58           ` Hu Yaohui

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140108232527.GA17874@amt.cnet \
    --to=mtosatti@redhat.com \
    --cc=chen.fan.fnst@cn.fujitsu.com \
    --cc=gleb@redhat.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=loki2441@gmail.com \
    --cc=pbonzini@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox