[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ab4f9fab-1137-72f8-5020-f4041d2b4c06@redhat.com>
Date: Tue, 1 Mar 2022 21:17:53 +0100
From: Paolo Bonzini <pbonzini@...hat.com>
To: Sasha Levin <sashal@...nel.org>, linux-kernel@...r.kernel.org,
stable@...r.kernel.org
Cc: Anton Romanov <romanton@...gle.com>, tglx@...utronix.de,
mingo@...hat.com, bp@...en8.de, dave.hansen@...ux.intel.com,
x86@...nel.org, kvm@...r.kernel.org
Subject: Re: [PATCH AUTOSEL 5.15 06/23] kvm: x86: Disable KVM_HC_CLOCK_PAIRING
if tsc is in always catchup mode
On 3/1/22 21:16, Sasha Levin wrote:
> From: Anton Romanov <romanton@...gle.com>
>
> [ 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@...gle.com>
> Message-Id: <20220216182653.506850-1-romanton@...gle.com>
> Signed-off-by: Paolo Bonzini <pbonzini@...hat.com>
> Signed-off-by: Sasha Levin <sashal@...nel.org>
> ---
> arch/x86/kvm/x86.c | 7 +++++++
> 1 file changed, 7 insertions(+)
>
> diff --git a/arch/x86/kvm/x86.c b/arch/x86/kvm/x86.c
> index 33cb065181248..c804122bb6e3a 100644
> --- a/arch/x86/kvm/x86.c
> +++ b/arch/x86/kvm/x86.c
> @@ -8657,6 +8657,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;
>
Acked-by: Paolo Bonzini <pbonzini@...hat.com>
Powered by blists - more mailing lists