Skip to contentSkip to conversation

trace-cmd library: Do not record TSC frac bits if scaling is default

PATCH In review Tzvetomir Stoyanov (VMware) 2 participants 3 messages Dec 10, 2021 – Feb 16, 2022

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 trace-cmd library: Do not record TSC frac bits if scaling is default

Guest's TSC fraction bits have sens only if there is TSC scaling. In case of default value for TSC scaling, fraction bits should not be used in TSC guest clock calculation.

Fixes: https://lore.kernel.org/linux-trace-devel/[email protected]/
(trace-cmd library: Extend host-guest time sync with fraction bits)

---
 lib/trace-cmd/trace-timesync-kvm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/trace-cmd/trace-timesync-kvm.c +1 -1
index 8d531922..12a22d4c 100644
@@ -415,7 +415,7 @@ static int kvm_clock_host(struct tracecmd_time_sync *tsync,
 			kvm_scaling = 1;
 	}
 
-	if (kvm->vcpu_frac && kvm->vcpu_frac[cpu])
+	if (kvm->vcpu_frac && kvm->vcpu_frac[cpu] && kvm_scaling != 1)
 		ret = read_ll_from_file(kvm->vcpu_frac[cpu], &kvm_frac);
 	msg = (char *)&packet;
 	size = sizeof(packet);
Signature · 1 line
2.33.1
#1 lore raw

ping
Just to remind, this one is an important bugfix. It fixes host-guest tracing with the latest kernels, where new KVM debug info is exposed through the debugfs.

Quoted 29 lines · Tzvetomir Stoyanov (VMware)

Guest's TSC fraction bits have sens only if there is TSC scaling. In case of default value for TSC scaling, fraction bits should not be used in TSC guest clock calculation.

Fixes: https://lore.kernel.org/linux-trace-devel/[email protected]/
(trace-cmd library: Extend host-guest time sync with fraction bits)

---
 lib/trace-cmd/trace-timesync-kvm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
lib/trace-cmd/trace-timesync-kvm.c +1 -2
index 8d531922..12a22d4c 100644
@@ -415,7 +415,7 @@ static int kvm_clock_host(struct tracecmd_time_sync *tsync,
                        kvm_scaling = 1;
        }
 
-       if (kvm->vcpu_frac && kvm->vcpu_frac[cpu])
+       if (kvm->vcpu_frac && kvm->vcpu_frac[cpu] && kvm_scaling != 1)
                ret = read_ll_from_file(kvm->vcpu_frac[cpu], &kvm_frac);
        msg = (char *)&packet;
        size = sizeof(packet);
--

2.33.1

Signature · 2 lines
Tzvetomir (Ceco) Stoyanov
VMware Open Source Technology Center
#2 lore raw
Quoted 4 lines · On Wed, 16 Feb 2022 17:43:46 +0200 Tzvetomir Stoyanov <[email protected]>…

ping
Just to remind, this one is an important bugfix. It fixes host-guest tracing with the latest kernels, where new KVM debug info is exposed through the debugfs.

Hi Tzvetomir,

It's actually already in my local queue. I just haven't had a chance to push it up yet.

Thanks,

-- Steve