From mboxrd@z Thu Jan 1 00:00:00 1970 From: Emre Can Sezer Subject: Re: Interrupt for HVM guests Date: Mon, 08 Jun 2009 15:24:58 -0400 Message-ID: <4A2D658A.7030707@ncsu.edu> References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com Cc: Xen Devel List-Id: xen-devel@lists.xenproject.org Keir Fraser wrote: > On 05/06/2009 19:43, "Emre Can Sezer" wrote: > > >> I am trying to figure out how an HVM guest is passed an interrupt. Say >> that a network packet has arrived and the QEMU driver in dom0 has to >> notify an HVM guest of the packet's arrival. Could someone please give >> a brief, high-level description of this process? I read the Intel >> Architectures Software Developer's Guide on VM Execution bits and >> Virtual interrupts and also some Xenwiki stuff about it but I'm still >> not sure what's going on. I don't have any device pass-through or >> stubdom or PV Drivers for my HVM guest. I would also appreciate >> references to some Xen files/functions related to this process. >> > > Following will give you enough to grep around for the details: > Hypercall is HVMOP_set_pci_intx_level: qemu-dm uses this to assert a PCI > INTx virtual interrupt line. Handled by hvm_pci_intx_assert() -> > vioapic_irq_positive_edge() -> vioapic_deliver() -> ioapic_inj_irq() -> > vlapic_set_irq()&vcpu_kick(). Final function there wakes the guest vcpu > which on vmentry calls vmx_intr_assist() -> hvm_vcpu_has_pending_irq() -> > vlapic_has_pending_irq(), which will return a pending vector. > Vmx_intr_assist() then delivers that vector via vmx_inject_extint(). > Hardware then delivers the interrupt automatically during vmentry. > > -- Keir > > Thanks Keir. I do have another question though. I am trying to find out whether a page fault occurred during an interrupt handling. I implemented two page tables for HVM guests that help me track execution within the guest kernel. So there is a very good chance that an interrupt might also result in a page fault as soon as it is injected. I tried counting these events by checking the IF flags in regs->rflags and also looking at VIF and VIP flags without success. Is this a viable method for determining whether a page fault was caused during interrupt handling? If not, is there any VM state I can check? Thanks, John