kvm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Trouble adding kvm clock trace to qemu-kvm
@ 2011-04-30 17:00 Chris Thompson
  2011-05-09  9:12 ` Avi Kivity
  2011-05-09 12:27 ` Stefan Hajnoczi
  0 siblings, 2 replies; 3+ messages in thread
From: Chris Thompson @ 2011-04-30 17:00 UTC (permalink / raw)
  To: kvm

I'm trying to add a trace to qemu-kvm that will log the value of the 
vcpu's clock when a specific interrupt gets pushed. I'm working with 
qemu-kvm-0.14.0 on the 2.6.32-31 kernel. I've added the following to 
kvm_arch_try_push_interrupts in qemu-kvm-x86.c:

if (irq == 41) {
     // Get the VCPU's TSC
     struct kvm_clock_data clock;
     kvm_vcpu_ioctl(env, KVM_GET_CLOCK, &clock);
     uint64_t ticks = clock.clock;
     trace_kvm_clock_at_injection(ticks);
}

And here's the trace event I added:

kvm_clock_at_injection(uint64_t ticks) "interrupt 41 at clock %"PRIu64""

I have that trace and the virtio_blk_req_complete trace enabled. An 
excerpt from the resulting trace output from simpletrace.py:

virtio_blk_req_complete 288390365546367 30461.681 req=46972352 status=0
kvm_clock_at_injection 288390365546578 0.211 ticks=46972352
virtio_blk_req_complete 288390394870065 29323.487 req=46972352 status=0
kvm_clock_at_injection 288390394870276 0.211 ticks=46972352

Am I getting the guest's clock incorrectly? And even if so, why is it 
the same as the request pointer that virtio_blk_req_complete reports?

Any ideas are appreciated.

Thanks,

Chris

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

* Re: Trouble adding kvm clock trace to qemu-kvm
  2011-04-30 17:00 Trouble adding kvm clock trace to qemu-kvm Chris Thompson
@ 2011-05-09  9:12 ` Avi Kivity
  2011-05-09 12:27 ` Stefan Hajnoczi
  1 sibling, 0 replies; 3+ messages in thread
From: Avi Kivity @ 2011-05-09  9:12 UTC (permalink / raw)
  To: Chris Thompson; +Cc: kvm

On 04/30/2011 08:00 PM, Chris Thompson wrote:
> I'm trying to add a trace to qemu-kvm that will log the value of the 
> vcpu's clock when a specific interrupt gets pushed. I'm working with 
> qemu-kvm-0.14.0 on the 2.6.32-31 kernel. I've added the following to 
> kvm_arch_try_push_interrupts in qemu-kvm-x86.c:
>
> if (irq == 41) {
>     // Get the VCPU's TSC
>     struct kvm_clock_data clock;
>     kvm_vcpu_ioctl(env, KVM_GET_CLOCK, &clock);
>     uint64_t ticks = clock.clock;
>     trace_kvm_clock_at_injection(ticks);
> }
>

This mechanism is only active with -no-kvm-irqchip; otherwise interrupt 
injection happens in the kernel.

> And here's the trace event I added:
>
> kvm_clock_at_injection(uint64_t ticks) "interrupt 41 at clock %"PRIu64""
>
> I have that trace and the virtio_blk_req_complete trace enabled. An 
> excerpt from the resulting trace output from simpletrace.py:
>
> virtio_blk_req_complete 288390365546367 30461.681 req=46972352 status=0
> kvm_clock_at_injection 288390365546578 0.211 ticks=46972352
> virtio_blk_req_complete 288390394870065 29323.487 req=46972352 status=0
> kvm_clock_at_injection 288390394870276 0.211 ticks=46972352
>
> Am I getting the guest's clock incorrectly? And even if so, why is it 
> the same as the request pointer that virtio_blk_req_complete reports?
>
> Any ideas are appreciated.

What is the 'ticks' field?

-- 
I have a truly marvellous patch that fixes the bug which this
signature is too narrow to contain.


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

* Re: Trouble adding kvm clock trace to qemu-kvm
  2011-04-30 17:00 Trouble adding kvm clock trace to qemu-kvm Chris Thompson
  2011-05-09  9:12 ` Avi Kivity
@ 2011-05-09 12:27 ` Stefan Hajnoczi
  1 sibling, 0 replies; 3+ messages in thread
From: Stefan Hajnoczi @ 2011-05-09 12:27 UTC (permalink / raw)
  To: Chris Thompson; +Cc: kvm

On Sat, Apr 30, 2011 at 6:00 PM, Chris Thompson <cthomp@cs.umn.edu> wrote:
> I'm trying to add a trace to qemu-kvm that will log the value of the vcpu's
> clock when a specific interrupt gets pushed. I'm working with
> qemu-kvm-0.14.0 on the 2.6.32-31 kernel. I've added the following to
> kvm_arch_try_push_interrupts in qemu-kvm-x86.c:
>
> if (irq == 41) {
>    // Get the VCPU's TSC
>    struct kvm_clock_data clock;
>    kvm_vcpu_ioctl(env, KVM_GET_CLOCK, &clock);
>    uint64_t ticks = clock.clock;
>    trace_kvm_clock_at_injection(ticks);
> }
>
> And here's the trace event I added:
>
> kvm_clock_at_injection(uint64_t ticks) "interrupt 41 at clock %"PRIu64""
>
> I have that trace and the virtio_blk_req_complete trace enabled. An excerpt
> from the resulting trace output from simpletrace.py:
>
> virtio_blk_req_complete 288390365546367 30461.681 req=46972352 status=0
> kvm_clock_at_injection 288390365546578 0.211 ticks=46972352
> virtio_blk_req_complete 288390394870065 29323.487 req=46972352 status=0
> kvm_clock_at_injection 288390394870276 0.211 ticks=46972352

Did you modify simpletrace.py?  The 288390365546367 field is should
not be there.  The output format should be:
<trace-event-name> <delta-microseconds> [<arg0>=<val0>...]

It looks like your simpletrace.py may be pretty-printing trace records
incorrectly.

If you have a public git tree you can link to I'd be happy to check
that simpletrace.py is working.

Stefan

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

end of thread, other threads:[~2011-05-09 12:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-30 17:00 Trouble adding kvm clock trace to qemu-kvm Chris Thompson
2011-05-09  9:12 ` Avi Kivity
2011-05-09 12:27 ` Stefan Hajnoczi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).