Re: [REGRESSION][BISECTED] Long boot time with Xen HVM guests during PV spinlock initialization

From: Teddy Astie

Date: Fri Jun 12 2026 - 05:02:56 EST


Le 09/06/2026 à 17:17, Thomas Gleixner a écrit :
On Tue, Jun 09 2026 at 11:27, Teddy Astie wrote:
Le 08/06/2026 à 17:15, Thomas Gleixner a écrit :
struct clocksource * __init __weak clocksource_default_clock(void)
{
+ clocksource_register(&clocksource_jiffies);
return &clocksource_jiffies;
}



Hmm, there's a case where clocksource_mutex gets taken twice (both in
__clocksource_register_scale() (through clocksource_register()) and
clocksource_done_booting()).

Bah.

What about making clocksource_jiffies gain ->enable() to setup what ever
needs to be (like calling __clocksource_update_freq_scale()) ?

Doesn't work either.

Updated version below. It's not pretty, but it should cure your
problem. If that's confirmed I think about a less ugly solution.

Thanks,

tglx
---
--- a/kernel/time/jiffies.c
+++ b/kernel/time/jiffies.c
@@ -60,15 +60,14 @@ EXPORT_SYMBOL(get_jiffies_64);
EXPORT_SYMBOL(jiffies);
-static int __init init_jiffies_clocksource(void)
-{
- return __clocksource_register(&clocksource_jiffies);
-}
-
-core_initcall(init_jiffies_clocksource);
+static bool cs_jiffies_registered __initdata;
struct clocksource * __init __weak clocksource_default_clock(void)
{
+ if (!cs_jiffies_registered) {
+ __clocksource_register(&clocksource_jiffies);
+ cs_jiffies_registered = true;
+ }
return &clocksource_jiffies;
}


Yes, that fixes it.

Teddy

Attachment: OpenPGP_0x660FA9D102CBCFD0.asc
Description: OpenPGP public key

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature