public inbox for systemtap@sourceware.org
 help / color / mirror / Atom feed
* Best way getting guest_rip from newer versions of kernel.trace("kvm_exit")?
@ 2011-09-23 16:02 William Cohen
  2011-09-23 19:17 ` Frank Ch. Eigler
  0 siblings, 1 reply; 2+ messages in thread
From: William Cohen @ 2011-09-23 16:02 UTC (permalink / raw)
  To: SystemTAP

I have been working on instrumenting kvm. The arguments for one of the tracepoints has changed.In RHEL-6 kernel:

kernel.trace("kvm_exit") $exit_reason:unsigned int $guest_rip:long unsigned int

In Fedora-15 kernel:

kernel.trace("kvm_exit") $exit_reason:unsigned int $vcpu:struct kvm_vcpu* $isa:u32


The $guest_rip is used in https://github.com/wcohen/qemu_systemtap/blob/master/guest_exits.stp to point out which instructions in the guests are causing vm_exits. I would like to make this script work on Fedora without resorting to guru mode. The following link shows kvm_rip_read(vcpu) being used get the value:

http://lxr.linux.no/#linux+v3.0.4/arch/x86/kvm/trace.h#L187

The kvm_rip_read() function is not in general include file; it is in arch/x86/kvm/kvm_cache_regs.h. Another complication is that   VCPU_REGS_RIP varies depending on CONFIG_X86_64:

http://lxr.linux.no/#linux+v3.0.4/arch/x86/include/asm/kvm_host.h#L120

Any suggestions on how to best handle this?

-Will

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

* Re: Best way getting guest_rip from newer versions of kernel.trace("kvm_exit")?
  2011-09-23 16:02 Best way getting guest_rip from newer versions of kernel.trace("kvm_exit")? William Cohen
@ 2011-09-23 19:17 ` Frank Ch. Eigler
  0 siblings, 0 replies; 2+ messages in thread
From: Frank Ch. Eigler @ 2011-09-23 19:17 UTC (permalink / raw)
  To: William Cohen; +Cc: SystemTAP

William Cohen <wcohen@redhat.com> writes:

> [...]
> In Fedora-15 kernel:
> kernel.trace("kvm_exit") $exit_reason:unsigned int $vcpu:struct kvm_vcpu* $isa:u32
> [...]

We almost certainly wouldn't want to call kvm_rip_read(), even if we could.
How about ...

probe kvm.exit = kernel.trace("kvm_exit") {
  if (@defined($guest_rip)) guest_rip = $guest_rip
  else if (@defined($vcpu)) guest_rip = $vcpu->arch.regs[%{VCPU_REGS_RIP%}]
  ...
}

- FChE

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

end of thread, other threads:[~2011-09-23 19:17 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-23 16:02 Best way getting guest_rip from newer versions of kernel.trace("kvm_exit")? William Cohen
2011-09-23 19:17 ` Frank Ch. Eigler

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 read-only IMAP folder(s) and NNTP newsgroup(s).