All of lore.kernel.org
 help / color / mirror / Atom feed
* Recording interrupted instruction on ioapic_set_irq
@ 2009-11-07 20:13 Kurt Kiefer
  2009-11-08 12:50 ` Avi Kivity
  0 siblings, 1 reply; 2+ messages in thread
From: Kurt Kiefer @ 2009-11-07 20:13 UTC (permalink / raw)
  To: kvm

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.

Thanks,

Kurt

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Recording interrupted instruction on ioapic_set_irq
  2009-11-07 20:13 Recording interrupted instruction on ioapic_set_irq Kurt Kiefer
@ 2009-11-08 12:50 ` Avi Kivity
  0 siblings, 0 replies; 2+ messages in thread
From: Avi Kivity @ 2009-11-08 12:50 UTC (permalink / raw)
  To: Kurt Kiefer; +Cc: kvm

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-11-08 12:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-07 20:13 Recording interrupted instruction on ioapic_set_irq Kurt Kiefer
2009-11-08 12:50 ` Avi Kivity

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.