Skip to contentSkip to conversation

KVM: x86: remove always-false condition in kvmclock_sync_fn

PATCH Applied Dongli Zhang 2 participants 2 messages Oct 1, 2023 – Oct 20, 2023

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 KVM: x86: remove always-false condition in kvmclock_sync_fn

The 'kvmclock_periodic_sync' is a readonly param that cannot change after bootup.

The kvm_arch_vcpu_postcreate() is not going to schedule the kvmclock_sync_work if kvmclock_periodic_sync == false.

As a result, the "if (!kvmclock_periodic_sync)" can never be true if the kvmclock_sync_work = kvmclock_sync_fn() is scheduled.

Inspired by: https://lore.kernel.org/kvm/[email protected]/

---
 arch/x86/kvm/x86.c | 3 ---
 1 file changed, 3 deletions(-)
arch/x86/kvm/x86.c +0 -3
index 9f18b06bbda6..38fd04a286c7 100644
@@ -3290,9 +3290,6 @@ static void kvmclock_sync_fn(struct work_struct *work)
 					   kvmclock_sync_work);
 	struct kvm *kvm = container_of(ka, struct kvm, arch);
 
-	if (!kvmclock_periodic_sync)
-		return;
-
 	schedule_delayed_work(&kvm->arch.kvmclock_update_work, 0);
 	schedule_delayed_work(&kvm->arch.kvmclock_sync_work,
 					KVMCLOCK_SYNC_PERIOD);
Signature · 1 line
2.34.1
maintainer Applied
#1 lore raw
Quoted 10 lines · Dongli Zhang

The 'kvmclock_periodic_sync' is a readonly param that cannot change after bootup.

The kvm_arch_vcpu_postcreate() is not going to schedule the kvmclock_sync_work if kvmclock_periodic_sync == false.

As a result, the "if (!kvmclock_periodic_sync)" can never be true if the kvmclock_sync_work = kvmclock_sync_fn() is scheduled.

[...]

Applied to kvm-x86 misc, thanks!

[1/1] KVM: x86: remove always-false condition in kvmclock_sync_fn

      https://github.com/kvm-x86/linux/commit/2081a8450ef8

--
https://github.com/kvm-x86/linux/tree/next