linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] kvm: export TSC offset to user-space
@ 2016-08-31 17:05 Luiz Capitulino
  2016-08-31 17:05 ` [PATCH 1/4] kvm: kvm_destroy_vm_debugfs(): check debugs_stat_data pointer Luiz Capitulino
                   ` (3 more replies)
  0 siblings, 4 replies; 20+ messages in thread
From: Luiz Capitulino @ 2016-08-31 17:05 UTC (permalink / raw)
  To: kvm; +Cc: linux-kernel, pbonzini, rkrcmar, rostedt, mhiramat, mtosatti

Hi,

We need to retrieve a VM's TSC offset in order to use
the host's TSC to merge host and guest traces. This is
explained in detail in this thread:

  [Qemu-devel] [RFC] host and guest kernel trace merging
  https://lists.nongnu.org/archive/html/qemu-devel/2016-03/msg00887.html

Today, the only way to retrieve a VM's TSC offset is
by using the kvm_write_tsc_offset tracepoint. This has
a few problems. First, the tracepoint is only emitted
when the VM boots, which requires a reboot to get it if
the VM is already running. Second, tracepoints are not
supposed to be ABIs in case they need to be consumed by
user-space tools.

This series exports a VM's TSC offset to user-space via
debugfs. A new file called "tsc-offset" is created in
the VM's debugfs directory. For example:

  /sys/kernel/debug/kvm/51696-10/tsc-offset

This file contains one TSC offset per line, for each
vCPU. For example:

  vcpu0: 18446742405270834952
  vcpu1: 18446742405270834952
  vcpu2: 18446742405270834952
  vcpu3: 18446742405270834952

Please, see patch 4/4 for additional details.

Luiz Capitulino (4):
  kvm: kvm_destroy_vm_debugfs(): check debugs_stat_data pointer
  kvm: kvm_create_vm_debugfs(): cleanup on error
  kvm: add stub for arch specific debugfs support
  kvm: x86: export TSC offset to user-space

 arch/arm/kvm/arm.c              |  5 +++++
 arch/mips/kvm/mips.c            |  5 +++++
 arch/powerpc/kvm/powerpc.c      |  5 +++++
 arch/s390/kvm/kvm-s390.c        |  5 +++++
 arch/x86/include/asm/kvm_host.h |  1 +
 arch/x86/kvm/svm.c              |  1 +
 arch/x86/kvm/vmx.c              |  8 ++++++++
 arch/x86/kvm/x86.c              | 35 +++++++++++++++++++++++++++++++++++
 include/linux/kvm_host.h        |  2 ++
 virt/kvm/kvm_main.c             | 22 ++++++++++++++++------
 10 files changed, 83 insertions(+), 6 deletions(-)

-- 
2.5.5

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

end of thread, other threads:[~2016-09-05  8:10 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-31 17:05 [PATCH 0/4] kvm: export TSC offset to user-space Luiz Capitulino
2016-08-31 17:05 ` [PATCH 1/4] kvm: kvm_destroy_vm_debugfs(): check debugs_stat_data pointer Luiz Capitulino
2016-09-02 13:51   ` Paolo Bonzini
2016-08-31 17:05 ` [PATCH 2/4] kvm: kvm_create_vm_debugfs(): cleanup on error Luiz Capitulino
2016-09-02 13:53   ` Paolo Bonzini
2016-08-31 17:05 ` [PATCH 3/4] kvm: add stub for arch specific debugfs support Luiz Capitulino
2016-09-02 13:53   ` Paolo Bonzini
2016-09-03  3:34   ` Masami Hiramatsu
2016-08-31 17:05 ` [PATCH 4/4] kvm: x86: export TSC offset to user-space Luiz Capitulino
2016-09-02 13:43   ` Stefan Hajnoczi
2016-09-02 14:15     ` Steven Rostedt
2016-09-03  0:23       ` Marcelo Tosatti
2016-09-03  4:04         ` Masami Hiramatsu
2016-09-02 16:26     ` Luiz Capitulino
2016-09-02 16:29       ` Luiz Capitulino
2016-09-02 23:49     ` Marcelo Tosatti
2016-09-03  1:29       ` Luiz Capitulino
2016-09-02 17:00   ` Paolo Bonzini
2016-09-02 17:31     ` Luiz Capitulino
2016-09-05  8:10       ` Paolo Bonzini

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).