LTTng: Add user documentation for the virtual machine analysis
authorGeneviève Bastien <gbastien+lttng@versatic.net>
Wed, 21 Jan 2015 21:16:21 +0000 (16:16 -0500)
committerGenevieve Bastien <gbastien+lttng@versatic.net>
Tue, 9 Feb 2016 20:32:04 +0000 (15:32 -0500)
Change-Id: I608fb10e85ac21017f44542a2f4ddda743f33247
Signed-off-by: Geneviève Bastien <gbastien+lttng@versatic.net>
Reviewed-on: https://git.eclipse.org/r/40089
Reviewed-by: Hudson CI
Reviewed-by: Bernd Hufmann <bernd.hufmann@ericsson.com>
Tested-by: Bernd Hufmann <bernd.hufmann@ericsson.com>
doc/org.eclipse.tracecompass.doc.user/doc/User-Guide.mediawiki
doc/org.eclipse.tracecompass.doc.user/doc/images/vmAnalysis/VM_CPU_view.png [new file with mode: 0644]
doc/org.eclipse.tracecompass.doc.user/doc/images/vmAnalysis/VM_experiment.png [new file with mode: 0644]

index dff328389d7f9fc56c6da3abc547e83d9d489a25..da969158a3908b8b4b353994214c8c951fe843f3 100644 (file)
@@ -2604,11 +2604,84 @@ A view of the total '''statistics''' of the latencies. These show the ''minimum'
 [[Image:images/LatenciesStatistics.png| Latency Statistics example - System Call Latency Statistics]]
 
 
-* System Call Density 
+* System Call Density
 A '''density''' view, analyzing the current time range. This is useful to find global outliers.
 
 [[Image:images/LatenciesDensity.png| Latency Densities example - System Call Density]]
 
+= Virtual Machine Analysis =
+
+Virtual environments are usually composed of host machines, who each run an hypervisor program on which one or many guests can be run. Tracing a guest machine alone can often yield some strange results as from its point of view, it has full use of the resources, but in reality, most resources are shared with the host and other guests.
+
+To better understand what is happening in such an environment, it is necessary to trace all the machines involved, guests and hosts, and correlate this information in an experiment that will display a complete view of the virtualized environment.
+
+== Virtual Machine Experiment ==
+
+A trace has to be taken for each machine, guest and host, in the virtualized environment. The host trace is the most important to have, as missing guests will only give an incomplete view of the system, but missing hosts usually won't allow to identify the hypervisor, nor determine when a guest is preempted from the host CPUs. The virtual machine analysis only makes sense if the host trace is available.
+
+Once all the traces are imported in Trace Compass, they can be [[#Creating a Experiment | added to an experiment]]. The type of the experiment should by set to '''Virtual Machine Experiment''' by clicking on the right mouse button over the experiment name, then selecting '''Select Experiment Type...'''.
+
+[[Image:images/vmAnalysis/VM_experiment.png | Virtual Machine Experiment]]
+
+Depending on the hypervisor used, traces might need to be [[#Trace synchronization | synchronized]] so that they have the same time reference and their events can be correctly correlated.
+
+== Virtual CPU View ==
+
+The Virtual CPU view shows the status of CPUs and threads on guests augmented with the preemption and hypervisor data we get from the host.
+
+In the image below, we see for the virtual CPU status that it has a few more states than the CPUs in the [[#Resources View | Resources View]]: in red and purple respectively, when the virtual CPU is running hypervisor code and when the CPU is preempted on the host.
+
+The entries for each thread of the machine corresponds to the one from the [[#Control flow | Control Flow View]], augmented with the data from the Virtual CPU, so that we see that even though it is running from the guest's point of view, it is actually not running when the Virtual CPU it runs on is in preempted or hypervisor mode.
+
+[[Image:images/vmAnalysis/VM_CPU_view.png | Virtual CPU view]]
+
+== Hypervisor-specific Tracing ==
+
+In order to be able to correlate data from the guests and hosts traces, each hypervisor supported by Trace Compass requires some specific events, that are sometimes not available in the default installation of the tracer.
+
+The following sections describe how to obtain traces for each hypervisor.
+
+=== Qemu/KVM ===
+
+The Qemu/KVM hypervisor require extra tracepoints not yet shipped in LTTng for both guests and hosts, as well as compilation with the full kernel source tree on the host, to have access to kvm_entry/kvm_exit events on x86.
+
+Obtain the source code with extra tracepoints, along with lttng-modules
+
+    # git clone https://github.com/giraldeau/lttng-modules.git
+    # cd lttng-modules
+
+Checkout the addons branch, compile and install lttng-modules as per the lttng-modules documentation.
+
+    # git checkout addons
+    # make
+    # sudo make modules_install
+    # sudo depmod -a
+
+On the host, to have complete kvm tracepoints support, the make command has to include the full kernel tree. So first, you'll need to obtain the kernel source tree. See your distribution's documentation on how to get it. This will compile extra modules, including lttng-probe-kvm-x86, which we need.
+
+    # make KERNELDIR=/path/to/kernel/dir
+
+The lttng addons modules must be inserted manually for the virtual machine extra tracepoints to be available:
+
+    # sudo modprobe lttng-addons
+    # sudo modprobe lttng-vmsync-host # on the host
+    # sudo modprobe lttng-vmsync-guest # on the guest
+
+The following tracepoints will be available
+
+    # sudo lttng list -k
+    Kernel events:
+    -------------
+      ...
+      kvm_entry (loglevel: TRACE_EMERG (0)) (type: tracepoint)
+      kvm_exit (loglevel: TRACE_EMERG (0)) (type: tracepoint)
+      vmsync_gh_guest (loglevel: TRACE_EMERG (0)) (type: tracepoint) # on the guest
+      vmsync_hg_guest (loglevel: TRACE_EMERG (0)) (type: tracepoint) # on the guest
+      vmsync_gh_host (loglevel: TRACE_EMERG (0)) (type: tracepoint) # on the host
+      vmsync_hg_host (loglevel: TRACE_EMERG (0)) (type: tracepoint) # on the host
+      ...
+
+Host and guests can now be traced together and their traces added to an experiment. Because each guest has a different clock than the host, it is necessary to synchronize the traces together. Unfortunately, automatic synchronization with the virtual machine events is not completely implemented yet, so another kind of synchronization needs to be done, with TCP packets for instance. See section on [[#Trace synchronization | trace synchronization]] for information on how to obtain synchronizable traces.
 
 = Limitations =
 
diff --git a/doc/org.eclipse.tracecompass.doc.user/doc/images/vmAnalysis/VM_CPU_view.png b/doc/org.eclipse.tracecompass.doc.user/doc/images/vmAnalysis/VM_CPU_view.png
new file mode 100644 (file)
index 0000000..dc728b0
Binary files /dev/null and b/doc/org.eclipse.tracecompass.doc.user/doc/images/vmAnalysis/VM_CPU_view.png differ
diff --git a/doc/org.eclipse.tracecompass.doc.user/doc/images/vmAnalysis/VM_experiment.png b/doc/org.eclipse.tracecompass.doc.user/doc/images/vmAnalysis/VM_experiment.png
new file mode 100644 (file)
index 0000000..157ad28
Binary files /dev/null and b/doc/org.eclipse.tracecompass.doc.user/doc/images/vmAnalysis/VM_experiment.png differ
This page took 0.028424 seconds and 5 git commands to generate.