[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v3 18/41] x86/paravirt: Pass sched_clock save/restore helpers during registration
- To: "tglx@xxxxxxxxxx" <tglx@xxxxxxxxxx>, "longli@xxxxxxxxxxxxx" <longli@xxxxxxxxxxxxx>, "luto@xxxxxxxxxx" <luto@xxxxxxxxxx>, "alexey.makhalov@xxxxxxxxxxxx" <alexey.makhalov@xxxxxxxxxxxx>, "jstultz@xxxxxxxxxx" <jstultz@xxxxxxxxxx>, "dave.hansen@xxxxxxxxxxxxxxx" <dave.hansen@xxxxxxxxxxxxxxx>, "ajay.kaher@xxxxxxxxxxxx" <ajay.kaher@xxxxxxxxxxxx>, "jan.kiszka@xxxxxxxxxxx" <jan.kiszka@xxxxxxxxxxx>, "haiyangz@xxxxxxxxxxxxx" <haiyangz@xxxxxxxxxxxxx>, "kas@xxxxxxxxxx" <kas@xxxxxxxxxx>, "seanjc@xxxxxxxxxx" <seanjc@xxxxxxxxxx>, "pbonzini@xxxxxxxxxx" <pbonzini@xxxxxxxxxx>, "kys@xxxxxxxxxxxxx" <kys@xxxxxxxxxxxxx>, "decui@xxxxxxxxxxxxx" <decui@xxxxxxxxxxxxx>, "daniel.lezcano@xxxxxxxxxx" <daniel.lezcano@xxxxxxxxxx>, "wei.liu@xxxxxxxxxx" <wei.liu@xxxxxxxxxx>, "peterz@xxxxxxxxxxxxx" <peterz@xxxxxxxxxxxxx>, "jgross@xxxxxxxx" <jgross@xxxxxxxx>
- From: "Woodhouse, David" <dwmw@xxxxxxxxxxxx>
- Date: Wed, 20 May 2026 22:35:26 +0000
- Accept-language: en-GB, en-US
- Authentication-results: eu.smtp.expurgate.cloud; dkim=pass header.s=amazoncorp2 header.d=amazon.co.uk header.i="@amazon.co.uk" header.h="From:To:CC:Subject:Date:Message-ID:References:In-Reply-To"
- Cc: "boris.ostrovsky@xxxxxxxxxx" <boris.ostrovsky@xxxxxxxxxx>, "linux-coco@xxxxxxxxxxxxxxx" <linux-coco@xxxxxxxxxxxxxxx>, "kvm@xxxxxxxxxxxxxxx" <kvm@xxxxxxxxxxxxxxx>, "mhklinux@xxxxxxxxxxx" <mhklinux@xxxxxxxxxxx>, "thomas.lendacky@xxxxxxx" <thomas.lendacky@xxxxxxx>, "linux-kernel@xxxxxxxxxxxxxxx" <linux-kernel@xxxxxxxxxxxxxxx>, "bcm-kernel-feedback-list@xxxxxxxxxxxx" <bcm-kernel-feedback-list@xxxxxxxxxxxx>, "tglx@xxxxxxxxxxxxx" <tglx@xxxxxxxxxxxxx>, "nikunj@xxxxxxx" <nikunj@xxxxxxx>, "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, "linux-hyperv@xxxxxxxxxxxxxxx" <linux-hyperv@xxxxxxxxxxxxxxx>, "vkuznets@xxxxxxxxxx" <vkuznets@xxxxxxxxxx>, "rick.p.edgecombe@xxxxxxxxx" <rick.p.edgecombe@xxxxxxxxx>, "virtualization@xxxxxxxxxxxxxxx" <virtualization@xxxxxxxxxxxxxxx>, "sboyd@xxxxxxxxxx" <sboyd@xxxxxxxxxx>, "x86@xxxxxxxxxx" <x86@xxxxxxxxxx>
- Delivery-date: Wed, 20 May 2026 22:35:38 +0000
- List-id: Xen developer discussion <xen-devel.lists.xenproject.org>
- Thread-index: AQHc6Kj0fv5ul1kqCk6EoM3O36i5qw==
- Thread-topic: [PATCH v3 18/41] x86/paravirt: Pass sched_clock save/restore helpers during registration
On Fri, 2026-05-15 at 12:19 -0700, Sean Christopherson wrote:
> Pass in a PV clock's save/restore helpers when configuring sched_clock
> instead of relying on each PV clock to manually set the save/restore hooks.
> In addition to bringing sanity to the code, this will allow gracefully
> "rejecting" a PV sched_clock, e.g. when running as a CoCo guest that has
> access to a "secure" TSC.
>
> No functional change intended.
>
> Signed-off-by: Sean Christopherson <seanjc@xxxxxxxxxx>
Nice!
Reviewed-by: David Woodhouse <dwmw@xxxxxxxxxxxx>
> --- a/arch/x86/xen/time.c
> +++ b/arch/x86/xen/time.c
> @@ -567,13 +567,12 @@ static void __init xen_init_time_common(void)
> {
> xen_sched_clock_offset = xen_clocksource_read();
> static_call_update(pv_steal_clock, xen_steal_clock);
> - paravirt_set_sched_clock(xen_sched_clock);
> +
> /*
> * Xen has paravirtualized suspend/resume and so doesn't use the common
> * x86 sched_clock save/restore hooks.
> */
> - x86_platform.save_sched_clock_state = NULL;
> - x86_platform.restore_sched_clock_state = NULL;
> + paravirt_set_sched_clock(xen_sched_clock, NULL, NULL);
>
> tsc_register_calibration_routines(xen_tsc_khz, NULL);
> x86_platform.get_wallclock = xen_get_wallclock;
Same deal here as with kvmclock, FWIW. If the TSC is viable, then it's
the better choice.
Especially now there's a significant chance that a "Xen guest" is
actually running under KVM. Xen never screwed its pvclock up quite as
much as KVM did :)
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
Amazon Development Centre (London) Ltd.Registered in England and Wales with registration number 04543232 with its registered office at 1 Principal Place, Worship Street, London EC2A 2FA, United Kingdom.
|