Patch "kvm: x86: Disable KVM_HC_CLOCK_PAIRING if tsc is in always catchup mode" has been added to the 5.15-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    kvm: x86: Disable KVM_HC_CLOCK_PAIRING if tsc is in always catchup mode

to the 5.15-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     kvm-x86-disable-kvm_hc_clock_pairing-if-tsc-is-in-al.patch
and it can be found in the queue-5.15 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 92c4d9b9450ebc1e7b9c38576bf10847f33b64cf
Author: Anton Romanov <romanton@xxxxxxxxxx>
Date:   Wed Feb 16 18:26:54 2022 +0000

    kvm: x86: Disable KVM_HC_CLOCK_PAIRING if tsc is in always catchup mode
    
    [ Upstream commit 3a55f729240a686aa8af00af436306c0cd532522 ]
    
    If vcpu has tsc_always_catchup set each request updates pvclock data.
    KVM_HC_CLOCK_PAIRING consumers such as ptp_kvm_x86 rely on tsc read on
    host's side and do hypercall inside pvclock_read_retry loop leading to
    infinite loop in such situation.
    
    v3:
        Removed warn
        Changed return code to KVM_EFAULT
    v2:
        Added warn
    
    Signed-off-by: Anton Romanov <romanton@xxxxxxxxxx>
    Message-Id: <20220216182653.506850-1-romanton@xxxxxxxxxx>
    Signed-off-by: Paolo Bonzini <pbonzini@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
index 8213f7fb71a7..61bc54748f22 100644
--- a/arch/x86/kvm/x86.c
+++ b/arch/x86/kvm/x86.c
@@ -8666,6 +8666,13 @@ static int kvm_pv_clock_pairing(struct kvm_vcpu *vcpu, gpa_t paddr,
 	if (clock_type != KVM_CLOCK_PAIRING_WALLCLOCK)
 		return -KVM_EOPNOTSUPP;
 
+	/*
+	 * When tsc is in permanent catchup mode guests won't be able to use
+	 * pvclock_read_retry loop to get consistent view of pvclock
+	 */
+	if (vcpu->arch.tsc_always_catchup)
+		return -KVM_EOPNOTSUPP;
+
 	if (!kvm_get_walltime_and_clockread(&ts, &cycle))
 		return -KVM_EOPNOTSUPP;
 



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux