From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: Recording interrupted instruction on ioapic_set_irq Date: Sun, 08 Nov 2009 14:50:33 +0200 Message-ID: <4AF6BE99.5050107@redhat.com> References: <467FDE56-7E94-4144-85C8-B8082C009A4C@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: kvm@vger.kernel.org To: Kurt Kiefer Return-path: Received: from mx1.redhat.com ([209.132.183.28]:42859 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751241AbZKHMua (ORCPT ); Sun, 8 Nov 2009 07:50:30 -0500 In-Reply-To: <467FDE56-7E94-4144-85C8-B8082C009A4C@gmail.com> Sender: kvm-owner@vger.kernel.org List-ID: On 11/07/2009 10:13 PM, Kurt Kiefer wrote: > Hi guys, > > I'm trying to record the instruction pointer at the exact time a guest > was delivered an IOAPIC interrupt. Take for example a PS2 keyboard > press. Clearly, when I read IP during the subsequent exit for > IO_INSTRUCTION I'm just recording the IP of io_read in the handler, > and not the IP at actual interrupt delivery. > > Maybe I'm missing something fundamental. It doesn't look like exits > for EXTERNAL_INTERRUPT (shouldn't it?) or INTERRUPT_WINDOW correspond > one-to-one with delivery of these PS2 interrupts. > > Just setting request_interrupt_window for these IRQs didn't give me an > INTERRUPT_WINDOW for each key. I guess since the guest doesn't usually > have interrupts masked when I press a key means delivery won't wait > for the window. > > Could I record during delivery? I figure I could look at the stack > during the IO_INSTRUCTION exit and figure out what instruction was > actually interrupted, but this would be a Linux-specific solution. Any > other ideas? I think even a simple description of how these interrupts > are being delivered to the guest would help me out a lot. > This is all available now in 2.6.32 or later with the new trace infrastructure. If you enable ftrace and echo kvm > /sys/kernel/tracing/set_event, you should get a trace of all interrupt injections. Of course, you need to figure out which vector is associated with your irq; you can even have the trace infrastructure filter this for you. Note you can only get the ip at the time the interrupt is delivered, rather than the time the irq is asserted on the ioapic pin. -- error compiling committee.c: too many arguments to function