Skip to content

trace-cmd: Align guest TSC calculation with the kernel

Tzvetomir Stoyanov (VMware) linux-trace-devel 2 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest4 patches 1 replyIn review
  2. v13 patches 6 repliesSuperseded

Changes in v2 from the cover letter

- Use strcmp() instead of strncmp() when searching for KVM debug files.
- Added more comments.
- Code clean ups.

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4trace-cmd library: Do not use strncmp() when searching for KVM debug fileslib/trace-cmd/trace-timesync-kvm.c+2 -40 replies
2/4trace-cmd library: Extend host-guest time sync with fraction bitslib/trace-cmd/include/private/trace-cmd-private.h lib/trace-cmd/include/trace-tsync-local.h lib/trace-cmd/trace-timesync-kvm.c +2 more+96 -300 replies
3/4trace-cmd library: Read and use fraction bits from TRACECMD_OPTION_TIME_SHIFTlib/trace-cmd/trace-input.c+39 -400 replies
4/4trace-cmd: Dump fraction bits from TRACECMD_OPTION_TIME_SHIFTtracecmd/trace-dump.c+73 -291 reply

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH v2 0/4] trace-cmd: Align guest TSC calculation with the kernel

The formula for calculating guest TSC clock, used in the kernel is:
guest_tsc = tsc-offset + (host_tsc * tsc-scaling-ratio) >> tsc-scaling-ratio-frac-bits
Current trace-cmd implementation does not take into account fraction bits, when calculating guest clock offset in case of a clock scaling. Additional logic is added, to use the same formula in trace-cmd. The changes are backward compatible with trace-cmd 2.9.

The changes are not tested with a kernel that has guest clock scaling enabled. The goal of the patch set is to extend the time sync option, saved in the guest trace.dat file, with all needed data used in the kernel for guest TSC calculations.

v2 changes:
- Use strcmp() instead of strncmp() when searching for KVM debug files.
- Added more comments.
- Code clean ups.

Tzvetomir Stoyanov (VMware) (4):
trace-cmd library: Do not use strncmp() when searching for KVM debug
files
trace-cmd library: Extend host-guest time sync with fraction bits trace-cmd library: Read and use fraction bits from
TRACECMD_OPTION_TIME_SHIFT
trace-cmd: Dump fraction bits from TRACECMD_OPTION_TIME_SHIFT

 .../include/private/trace-cmd-private.h       |   4 +-
 lib/trace-cmd/include/trace-tsync-local.h     |   7 +-
 lib/trace-cmd/trace-input.c                   |  79 +++++++-------
 lib/trace-cmd/trace-timesync-kvm.c            |  62 +++++++----
 lib/trace-cmd/trace-timesync-ptp.c            |   4 +-
 lib/trace-cmd/trace-timesync.c                |  55 ++++++++--
 tracecmd/trace-dump.c                         | 102 +++++++++++++-----
 7 files changed, 210 insertions(+), 103 deletions(-)
Signature · 1 line
2.31.1