Re: [v2 PATCH 3/4] x86/kvm: Add host side support for virtual suspend time injection
From: Thomas Gleixner <hidden>
Date: 2021-08-10 15:24:56
Also in:
lkml
From: Thomas Gleixner <hidden>
Date: 2021-08-10 15:24:56
Also in:
lkml
On Fri, Aug 06 2021 at 19:07, Hikaru Nishida wrote:
+#ifdef CONFIG_KVM_VIRT_SUSPEND_TIMING
+void kvm_arch_timekeeping_inject_sleeptime(const struct timespec64 *delta)
+{
+ struct kvm_vcpu *vcpu;
+ u64 suspend_time_ns;
+ struct kvm *kvm;
+ s64 adj;
+ int i;
+
+ suspend_time_ns = timespec64_to_ns(delta);
+ adj = tsc_khz * (suspend_time_ns / 1000000);
+ /*
+ * Adjust TSCs on all vcpus and kvmclock as if they are stopped
+ * during host's suspension.
+ * Also, cummulative suspend time is recorded in kvm structure and
+ * the update will be notified via an interrupt for each vcpu.
+ */
+ mutex_lock(&kvm_lock);
This is invoked from with timekeeper_lock held with interrupts
disabled. How is a mutex_lock() supposed to work here?
Thanks,
tglx