Skip to content

Commit 446fcce

Browse files
Lei Chensean-jc
authored andcommitted
Revert "x86: kvm: rate-limit global clock updates"
This reverts commit 7e44e44. Commit 7e44e44 ("x86: kvm: rate-limit global clock updates") intends to use a kvmclock_update_work to sync ntp corretion across all vcpus kvmclock, which is based on commit 0061d53 ("KVM: x86: limit difference between kvmclock updates") Since kvmclock has been switched to mono raw, this commit can be reverted. Signed-off-by: Lei Chen <lei.chen@smartx.com> Link: https://patch.msgid.link/20250819152027.1687487-3-lei.chen@smartx.com Signed-off-by: Sean Christopherson <seanjc@google.com>
1 parent 43ddbf1 commit 446fcce

File tree

2 files changed

+4
-26
lines changed

2 files changed

+4
-26
lines changed

arch/x86/include/asm/kvm_host.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1456,7 +1456,6 @@ struct kvm_arch {
14561456
bool use_master_clock;
14571457
u64 master_kernel_ns;
14581458
u64 master_cycle_now;
1459-
struct delayed_work kvmclock_update_work;
14601459

14611460
#ifdef CONFIG_KVM_HYPERV
14621461
struct kvm_hv hyperv;

arch/x86/kvm/x86.c

Lines changed: 4 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3523,38 +3523,21 @@ uint64_t kvm_get_wall_clock_epoch(struct kvm *kvm)
35233523
* the others.
35243524
*
35253525
* So in those cases, request a kvmclock update for all vcpus.
3526-
* We need to rate-limit these requests though, as they can
3527-
* considerably slow guests that have a large number of vcpus.
3528-
* The time for a remote vcpu to update its kvmclock is bound
3529-
* by the delay we use to rate-limit the updates.
3526+
* The worst case for a remote vcpu to update its kvmclock
3527+
* is then bounded by maximum nohz sleep latency.
35303528
*/
3531-
3532-
#define KVMCLOCK_UPDATE_DELAY msecs_to_jiffies(100)
3533-
3534-
static void kvmclock_update_fn(struct work_struct *work)
3529+
static void kvm_gen_kvmclock_update(struct kvm_vcpu *v)
35353530
{
35363531
unsigned long i;
3537-
struct delayed_work *dwork = to_delayed_work(work);
3538-
struct kvm_arch *ka = container_of(dwork, struct kvm_arch,
3539-
kvmclock_update_work);
3540-
struct kvm *kvm = container_of(ka, struct kvm, arch);
35413532
struct kvm_vcpu *vcpu;
3533+
struct kvm *kvm = v->kvm;
35423534

35433535
kvm_for_each_vcpu(i, vcpu, kvm) {
35443536
kvm_make_request(KVM_REQ_CLOCK_UPDATE, vcpu);
35453537
kvm_vcpu_kick(vcpu);
35463538
}
35473539
}
35483540

3549-
static void kvm_gen_kvmclock_update(struct kvm_vcpu *v)
3550-
{
3551-
struct kvm *kvm = v->kvm;
3552-
3553-
kvm_make_request(KVM_REQ_CLOCK_UPDATE, v);
3554-
schedule_delayed_work(&kvm->arch.kvmclock_update_work,
3555-
KVMCLOCK_UPDATE_DELAY);
3556-
}
3557-
35583541
/* These helpers are safe iff @msr is known to be an MCx bank MSR. */
35593542
static bool is_mci_control_msr(u32 msr)
35603543
{
@@ -13163,8 +13146,6 @@ int kvm_arch_init_vm(struct kvm *kvm, unsigned long type)
1316313146
kvm->arch.hv_root_tdp = INVALID_PAGE;
1316413147
#endif
1316513148

13166-
INIT_DELAYED_WORK(&kvm->arch.kvmclock_update_work, kvmclock_update_fn);
13167-
1316813149
kvm_apicv_init(kvm);
1316913150
kvm_hv_init_vm(kvm);
1317013151
kvm_xen_init_vm(kvm);
@@ -13271,8 +13252,6 @@ void kvm_arch_pre_destroy_vm(struct kvm *kvm)
1327113252
* is unsafe, i.e. will lead to use-after-free. The PIT also needs to
1327213253
* be stopped before IRQ routing is freed.
1327313254
*/
13274-
cancel_delayed_work_sync(&kvm->arch.kvmclock_update_work);
13275-
1327613255
#ifdef CONFIG_KVM_IOAPIC
1327713256
kvm_free_pit(kvm);
1327813257
#endif

0 commit comments

Comments
 (0)