Re: [PATCH 2/2] KVM: selftests: Add KVM/PV clock selftest to prove timer drift correction
From: David Woodhouse
Date: Sat Apr 20 2024 - 12:03:58 EST
On Fri, 2024-04-19 at 16:54 -0700, Chen, Zide wrote:
>
> However, the selftest hangs:
>
> [Apr19 16:15] kselftest: Running tests in kvm
> [Apr19 16:16] rcu: INFO: rcu_preempt detected stalls on CPUs/tasks:
> [ +0.000628] rcu: 78-...0: (1 GPs behind) idle=3c8c/1/0x4000000000000000 softirq=5908/5913 fqs=14025
> [ +0.000468] rcu: (detected by 104, t=60003 jiffies, g=60073, q=3100 ncpus=128)
> [ +0.000389] Sending NMI from CPU 104 to CPUs 78:
> [ +0.000360] NMI backtrace for cpu 78
> [ +0.000004] CPU: 78 PID: 33515 Comm: pvclock_test Tainted: G O 6.9.0-rc1zide-l0+ #194
> [ +0.000003] Hardware name: Inspur NF5280M7/NF5280M7, BIOS 05.08.01 08/18/2023
> [ +0.000002] RIP: 0010:pvclock_update_vm_gtod_copy+0xb5/0x200 [kvm]
Ah, kvm_get_time_scale() doesn't much like being asked to scale to zero.
diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index a07b60351894..45fb99986cf9 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -3046,7 +3046,8 @@ static void pvclock_update_vm_gtod_copy(struct kvm *kvm)
* Copy from the field protected solely by ka->tsc_write_lock,
* to the field protected by the ka->pvclock_sc seqlock.
*/
- ka->master_tsc_scaling_ratio = ka->last_tsc_scaling_ratio;
+ ka->master_tsc_scaling_ratio = ka->last_tsc_scaling_ratio ? :
+ kvm_caps.default_tsc_scaling_ratio;
/*
* Calculate the scaling factors precisely the same way
Attachment:
smime.p7s
Description: S/MIME cryptographic signature