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

Thomas Gleixner <[email protected]>
Newsgroups dev.linux.lists.regressions,org.kernel.vger.linux-kernel,org.xenproject.lists.xen-devel
Message-ID <87y0gn3fve.ffs@fw13>
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;
 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.