trace-cmd: Add support for non-qemu VMs

Current host-guest tracing implementation assumes that qemu runs the VMs
and uses qemu specific logic to collect various information:
 - PID of the process, running the guest VM. In case of KVM, this PID
   is used  to get the KVM guest TSC clock parameters, needed for better
   host and guest trace timestamps synchronization.
 - PIDs of each thread, running a guest virtual CPU. This is used for
   better trace visualisation. It helps to map the host task to a vCPU
   and to visualise them together.
In case qemu is not used to run the VMs, host-guest tracing fails. As
that information is not mandatory, we can easily support non-qemu VMs.
Changes, proposed by the patch:
 - if PID of the process, running the guest VM, is not available - fail
   back to a PTP-like algorithm for trace timestamps synchronization.
 - if PIDs of the threads, running guest virtual CPUs, are not available
   write -1 in the trace file metadata.

Link: https://lore.kernel.org/linux-trace-devel/20210426103528.634418-1-tz.stoyanov@gmail.com

Tested-By: Joel Fernandes <joelaf@google.com>
Signed-off-by: Tzvetomir Stoyanov (VMware) <tz.stoyanov@gmail.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
3 files changed