From: Paul Durrant <xadimgnik@gmail.com>
To: Sean Christopherson <seanjc@google.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
Jonathan Corbet <corbet@lwn.net>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>,
x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
David Woodhouse <dwmw2@infradead.org>,
kvm@vger.kernel.org, linux-doc@vger.kernel.org,
linux-kernel@vger.kernel.org,
Andrew Cooper <andrew.cooper3@citrix.com>
Subject: Re: [PATCH v5] KVM x86/xen: add an override for PVCLOCK_TSC_STABLE_BIT
Date: Thu, 30 Nov 2023 16:41:43 +0000 [thread overview]
Message-ID: <504ca757-c5b9-4d3b-900c-c5f401a02027@xen.org> (raw)
In-Reply-To: <ZWi6IKGFtQGpu6oR@google.com>
On 30/11/2023 16:36, Sean Christopherson wrote:
> +Andrew
>
> On Thu, Nov 02, 2023, Paul Durrant wrote:
>> From: Paul Durrant <pdurrant@amazon.com>
>>
>> Unless explicitly told to do so (by passing 'clocksource=tsc' and
>> 'tsc=stable:socket', and then jumping through some hoops concerning
>> potential CPU hotplug) Xen will never use TSC as its clocksource.
>> Hence, by default, a Xen guest will not see PVCLOCK_TSC_STABLE_BIT set
>> in either the primary or secondary pvclock memory areas. This has
>> led to bugs in some guest kernels which only become evident if
>> PVCLOCK_TSC_STABLE_BIT *is* set in the pvclocks. Hence, to support
>> such guests, give the VMM a new Xen HVM config flag to tell KVM to
>> forcibly clear the bit in the Xen pvclocks.
>
> ...
>
>> diff --git a/Documentation/virt/kvm/api.rst b/Documentation/virt/kvm/api.rst
>> index 7025b3751027..a9bdd25826d1 100644
>> --- a/Documentation/virt/kvm/api.rst
>> +++ b/Documentation/virt/kvm/api.rst
>> @@ -8374,6 +8374,7 @@ PVHVM guests. Valid flags are::
>> #define KVM_XEN_HVM_CONFIG_EVTCHN_2LEVEL (1 << 4)
>> #define KVM_XEN_HVM_CONFIG_EVTCHN_SEND (1 << 5)
>> #define KVM_XEN_HVM_CONFIG_RUNSTATE_UPDATE_FLAG (1 << 6)
>> + #define KVM_XEN_HVM_CONFIG_PVCLOCK_TSC_UNSTABLE (1 << 7)
>
> Does Xen actually support PVCLOCK_TSC_STABLE_BIT? I.e. do we need new uAPI to
> fix this, or can/should KVM simply _never_ set PVCLOCK_TSC_STABLE_BIT for Xen
> clocks? At a glance, PVCLOCK_TSC_STABLE_BIT looks like it was added as a purely
> Linux/KVM-only thing.
It's certainly tested in arch/x86/xen/time.c, in
xen_setup_vsyscall_time_info() and xen_time_init(), so I'd guess it is
considered to be supported.
Paul
next prev parent reply other threads:[~2023-11-30 16:57 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-02 16:21 [PATCH v5] KVM x86/xen: add an override for PVCLOCK_TSC_STABLE_BIT Paul Durrant
2023-11-08 18:39 ` David Woodhouse
2023-11-30 15:49 ` Paul Durrant
2023-11-30 16:36 ` Sean Christopherson
2023-11-30 16:41 ` Paul Durrant [this message]
2023-11-30 19:41 ` David Woodhouse
2023-12-01 22:42 ` Sean Christopherson
2023-12-08 2:17 ` Sean Christopherson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=504ca757-c5b9-4d3b-900c-c5f401a02027@xen.org \
--to=xadimgnik@gmail.com \
--cc=andrew.cooper3@citrix.com \
--cc=bp@alien8.de \
--cc=corbet@lwn.net \
--cc=dave.hansen@linux.intel.com \
--cc=dwmw2@infradead.org \
--cc=hpa@zytor.com \
--cc=kvm@vger.kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=paul@xen.org \
--cc=pbonzini@redhat.com \
--cc=seanjc@google.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox