Skip to content

Commit 43ddbf1

Browse files
Lei Chensean-jc
authored andcommitted
Revert "x86: kvm: introduce periodic global clock updates"
This reverts commit 332967a. Commit 332967a ("x86: kvm: introduce periodic global clock updates") introduced a 300s interval work to sync ntp corrections across all vcpus. Since commit 53fafdb ("KVM: x86: switch KVMCLOCK base to monotonic raw clock"), kvmclock switched to mono raw clock, we can no longer take ntp into consideration. Signed-off-by: Lei Chen <lei.chen@smartx.com> Link: https://patch.msgid.link/20250819152027.1687487-2-lei.chen@smartx.com Signed-off-by: Sean Christopherson <seanjc@google.com>
1 parent a091fe6 commit 43ddbf1

File tree

2 files changed

+0
-26
lines changed

2 files changed

+0
-26
lines changed

arch/x86/include/asm/kvm_host.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1457,7 +1457,6 @@ struct kvm_arch {
14571457
u64 master_kernel_ns;
14581458
u64 master_cycle_now;
14591459
struct delayed_work kvmclock_update_work;
1460-
struct delayed_work kvmclock_sync_work;
14611460

14621461
#ifdef CONFIG_KVM_HYPERV
14631462
struct kvm_hv hyperv;

arch/x86/kvm/x86.c

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,6 @@ EXPORT_SYMBOL_FOR_KVM_INTERNAL(report_ignored_msrs);
159159
unsigned int min_timer_period_us = 200;
160160
module_param(min_timer_period_us, uint, 0644);
161161

162-
static bool __read_mostly kvmclock_periodic_sync = true;
163-
module_param(kvmclock_periodic_sync, bool, 0444);
164-
165162
/* tsc tolerance in parts per million - default to 1/2 of the NTP threshold */
166163
static u32 __read_mostly tsc_tolerance_ppm = 250;
167164
module_param(tsc_tolerance_ppm, uint, 0644);
@@ -3558,20 +3555,6 @@ static void kvm_gen_kvmclock_update(struct kvm_vcpu *v)
35583555
KVMCLOCK_UPDATE_DELAY);
35593556
}
35603557

3561-
#define KVMCLOCK_SYNC_PERIOD (300 * HZ)
3562-
3563-
static void kvmclock_sync_fn(struct work_struct *work)
3564-
{
3565-
struct delayed_work *dwork = to_delayed_work(work);
3566-
struct kvm_arch *ka = container_of(dwork, struct kvm_arch,
3567-
kvmclock_sync_work);
3568-
struct kvm *kvm = container_of(ka, struct kvm, arch);
3569-
3570-
schedule_delayed_work(&kvm->arch.kvmclock_update_work, 0);
3571-
schedule_delayed_work(&kvm->arch.kvmclock_sync_work,
3572-
KVMCLOCK_SYNC_PERIOD);
3573-
}
3574-
35753558
/* These helpers are safe iff @msr is known to be an MCx bank MSR. */
35763559
static bool is_mci_control_msr(u32 msr)
35773560
{
@@ -12757,8 +12740,6 @@ int kvm_arch_vcpu_create(struct kvm_vcpu *vcpu)
1275712740

1275812741
void kvm_arch_vcpu_postcreate(struct kvm_vcpu *vcpu)
1275912742
{
12760-
struct kvm *kvm = vcpu->kvm;
12761-
1276212743
if (mutex_lock_killable(&vcpu->mutex))
1276312744
return;
1276412745
vcpu_load(vcpu);
@@ -12769,10 +12750,6 @@ void kvm_arch_vcpu_postcreate(struct kvm_vcpu *vcpu)
1276912750
vcpu->arch.msr_kvm_poll_control = 1;
1277012751

1277112752
mutex_unlock(&vcpu->mutex);
12772-
12773-
if (kvmclock_periodic_sync && vcpu->vcpu_idx == 0)
12774-
schedule_delayed_work(&kvm->arch.kvmclock_sync_work,
12775-
KVMCLOCK_SYNC_PERIOD);
1277612753
}
1277712754

1277812755
void kvm_arch_vcpu_destroy(struct kvm_vcpu *vcpu)
@@ -13187,7 +13164,6 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type)
1318713164
#endif
1318813165

1318913166
INIT_DELAYED_WORK(&kvm->arch.kvmclock_update_work, kvmclock_update_fn);
13190-
INIT_DELAYED_WORK(&kvm->arch.kvmclock_sync_work, kvmclock_sync_fn);
1319113167

1319213168
kvm_apicv_init(kvm);
1319313169
kvm_hv_init_vm(kvm);
@@ -13295,7 +13271,6 @@ void kvm_arch_pre_destroy_vm(struct kvm *kvm)
1329513271
* is unsafe, i.e. will lead to use-after-free. The PIT also needs to
1329613272
* be stopped before IRQ routing is freed.
1329713273
*/
13298-
cancel_delayed_work_sync(&kvm->arch.kvmclock_sync_work);
1329913274
cancel_delayed_work_sync(&kvm->arch.kvmclock_update_work);
1330013275

1330113276
#ifdef CONFIG_KVM_IOAPIC

0 commit comments

Comments
 (0)