Skip to contentSkip to conversation

Enlarge the dalta of TSC match window from one second to five second

RFC xiexiangyou 2 participants 2 messages Aug 11, 2014 – Aug 18, 2014 KVM

lore
Share & tools
lore
#0 lore raw

hi,

In kvm_write_tsc() func of kvm, The TSCs will be synchronized unless the time diff of creating vcpus small than one second. However, In my enviroment, stress is large, the vcpu creating time is delay, sometimes the diff time between vcpu creating is more than one second. In this case, TSCs in VM are not the same with each other when it boot.
(1)To solve the issue, should we enlarge the dalta of TSC match window from one second to five second?

as follows:

	 * it's better to try to match offsets from the beginning.
          */
-	if (nsdiff < NSEC_PER_SEC &&
+	if (nsdiff < 5 *NSEC_PER_SEC &&
	    vcpu->arch.virtual_tsc_khz == kvm->arch.last_tsc_khz) {

if (!check_tsc_unstable()) {

(2)Another way to solve the issue: setting all VPUs' tsc_offset equal to the first boot VCPU's. So in special case, hotpluging VCPU, we can ensure TSC clocksource is stable.

Thanks.
xiexiangyou

#1 lore raw
Quoted 19 lines · xiexiangyou

hi,

In kvm_write_tsc() func of kvm, The TSCs will be synchronized unless the time diff of creating vcpus small than one second. However, In my enviroment, stress is large, the vcpu creating time is delay, sometimes the diff time between vcpu creating is more than one second. In this case, TSCs in VM are not the same with each other when it boot.
(1)To solve the issue, should we enlarge the dalta of TSC match window from one second to five second?

as follows:

	 * it's better to try to match offsets from the beginning.
          */
(quoted diff) +1 -1
-	if (nsdiff < NSEC_PER_SEC &&
+	if (nsdiff < 5 *NSEC_PER_SEC &&
	    vcpu->arch.virtual_tsc_khz == kvm->arch.last_tsc_khz) {

if (!check_tsc_unstable()) {

(2)Another way to solve the issue: setting all VPUs' tsc_offset equal to the first boot VCPU's. So in special case, hotpluging VCPU, we can ensure TSC clocksource is stable.

Quoted 7 lines

Thanks.
xiexiangyou

--
To unsubscribe from this list: send the line "unsubscribe kvm" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Its OK to increase the matching window to 5 seconds.

Please send a proper patch.