Skip to contentSkip to conversation

x86/tsc: Disable clocksource watchdog for TSC on recent UV

PATCH In review Dimitri Sivanich 3 participants 5 messages Oct 7, 2025 – May 19

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 x86/tsc: Disable clocksource watchdog for TSC on recent UV

Disable clocksource watchdog checking on recent and future UV platforms to avoid false positives.

Commits 'b50db7095fe0 ("x86/tsc: Disable clocksource watchdog for TSC on qualified platforms")' and '233756a640be ("Extend watchdog check exemption to 4-Sockets platform")' were introduced to avoid an issue where the TSC is falsely declared unstable by exempting qualified platforms of up to 4-sockets from TSC clocksource watchdog checking. Extend that exemption to include recent and future UV platforms.

---

Version 3: Fixes a build error in the X86 32-bit build.

Version 2: Fixes a build error that occurs when UV is not configured.

 arch/x86/include/asm/uv/uv.h     | 3 +++
 arch/x86/include/asm/uv/uv_hub.h | 2 ++
 arch/x86/kernel/tsc.c            | 3 ++-
 3 files changed, 7 insertions(+), 1 deletion(-)
arch/x86/include/asm/uv/uv.h +3 -0
index 648eb23fe7f0..f1aebdf85e68 100644
@@ -38,6 +38,9 @@ static inline int is_uv_system(void)	{ return 0; }
 static inline int is_uv_hubbed(int uv)	{ return 0; }
 static inline void uv_cpu_init(void)	{ }
 static inline void uv_system_init(void)	{ }
+static inline int is_uvx_hub(void) { return 0; }
+static inline int is_uvy_hub(void) { return 0; }
+static inline int is_uv_hub(void) { return 0; }
 
 #endif	/* X86_UV */
 
arch/x86/include/asm/uv/uv_hub.h +2 -0
index ea877fd83114..6e085ce8fc02 100644
@@ -246,6 +246,7 @@ static inline int is_uv5_hub(void) { return is_uv(UV5); }
  * then test if is UV4.
  */
 
+#ifdef CONFIG_X86_UV
 /* UVX class: UV2,3,4 */
 static inline int is_uvx_hub(void) { return is_uv(UVX); }
 
@@ -254,6 +255,7 @@ static inline int is_uvy_hub(void) { return is_uv(UVY); }
 
 /* Any UV Hubbed System */
 static inline int is_uv_hub(void) { return is_uv(UV_ANY); }
+#endif
 
 union uvh_apicid {
     unsigned long       v;
arch/x86/kernel/tsc.c +2 -1
index 87e749106dda..a9f97d423ab0 100644
@@ -32,6 +32,7 @@
 #include <asm/msr.h>
 #include <asm/topology.h>
 #include <asm/uv/uv.h>
+#include <asm/uv/uv_hub.h>
 #include <asm/sev.h>
 
 unsigned int __read_mostly cpu_khz;	/* TSC clocks / usec, not used here */
@@ -1261,7 +1262,7 @@ static void __init check_system_tsc_reliable(void)
 	if (boot_cpu_has(X86_FEATURE_CONSTANT_TSC) &&
 	    boot_cpu_has(X86_FEATURE_NONSTOP_TSC) &&
 	    boot_cpu_has(X86_FEATURE_TSC_ADJUST) &&
-	    topology_max_packages() <= 4)
+	    (topology_max_packages() <= 4 || is_uvy_hub()))
 		tsc_disable_clocksource_watchdog();
 }
 
Signature · 1 line
2.43.0
#1 lore raw
Quoted 19 lines · Dimitri Sivanich
arch/x86/include/asm/uv/uv.h +3 -0
+static inline int is_uvx_hub(void) { return 0; }
+static inline int is_uvy_hub(void) { return 0; }
+static inline int is_uv_hub(void) { return 0; }
 
 #endif	/* X86_UV */
arch/x86/include/asm/uv/uv_hub.h +1 -0
index ea877fd83114..6e085ce8fc02 100644
@@ -246,6 +246,7 @@ static inline int is_uv5_hub(void) { return is_uv(UV5); }
  * then test if is UV4.
  */
 
+#ifdef CONFIG_X86_UV
 /* UVX class: UV2,3,4 */
 static inline int is_uvx_hub(void) { return is_uv(UVX); }
 

arch/x86/include/asm/uv/uv_hub.h static inline int is_uvy_hub(void) { return is_uv(UVY); } · line 258

Quoted 4 lines
arch/x86/include/asm/uv/uv_hub.h +1 -0
@@ -254,6 +255,7 @@ static inline int is_uvy_hub(void) { return is_uv(UVY); }
 
 /* Any UV Hubbed System */
 static inline int is_uv_hub(void) { return is_uv(UV_ANY); }
+#endif

Defining those helpers across two different headers seems like a recipe for pain.

I suspect a big chunk of those stubs (and their #ifdefs could completely go away if you _just_ did:

#ifdef CONFIG_X86_UV
static inline int uv_hub_type(void)

{
        return uv_hub_info->hub_type;
}
#else
static inline int uv_hub_type(void)
{
	return 0;
}

#endif

In any case, this is precisely the kind of patch that would be best refactored into two piece: one to expose the is_uv...() function and another to actually use it.

Also, at this point, this:

arch/x86/include/asm/uv/uv_hub.h static inline int is_uvy_hub(void) { return is_uv(UVY); }

Quoted 6 lines
arch/x86/include/asm/uv/uv_hub.h +1 -1
 	if (boot_cpu_has(X86_FEATURE_CONSTANT_TSC) &&
 	    boot_cpu_has(X86_FEATURE_NONSTOP_TSC) &&
 	    boot_cpu_has(X86_FEATURE_TSC_ADJUST) &&
-	    topology_max_packages() <= 4)
+	    (topology_max_packages() <= 4 || is_uvy_hub()))
 		tsc_disable_clocksource_watchdog();

has IMNHO gotten out of hand.

It should probably be:

if (boot_cpu_has(X86_FEATURE_CONSTANT_TSC) &&
boot_cpu_has(X86_FEATURE_NONSTOP_TSC) && boot_cpu_has(X86_FEATURE_TSC_ADJUST) && platform_is_exempt_from_watchdog())
tsc_disable_clocksource_watchdog();

In addition, 233756a640be talked quite a bit about *why* the 4-socket line was chosen. This needs to have a similar explanation for UV systems.

#2 lore raw
Quoted 66 lines · Dave Hansen
Quoted 19 lines · Dimitri Sivanich
arch/x86/include/asm/uv/uv.h +3 -0
+static inline int is_uvx_hub(void) { return 0; }
+static inline int is_uvy_hub(void) { return 0; }
+static inline int is_uv_hub(void) { return 0; }
 
 #endif	/* X86_UV */
arch/x86/include/asm/uv/uv_hub.h +1 -0
index ea877fd83114..6e085ce8fc02 100644
@@ -246,6 +246,7 @@ static inline int is_uv5_hub(void) { return is_uv(UV5); }
  * then test if is UV4.
  */
 
+#ifdef CONFIG_X86_UV
 /* UVX class: UV2,3,4 */
 static inline int is_uvx_hub(void) { return is_uv(UVX); }
 

arch/x86/include/asm/uv/uv_hub.h static inline int is_uvy_hub(void) { return is_uv(UVY); } · line 258

Quoted 4 lines
arch/x86/include/asm/uv/uv_hub.h +1 -0
@@ -254,6 +255,7 @@ static inline int is_uvy_hub(void) { return is_uv(UVY); }
 
 /* Any UV Hubbed System */
 static inline int is_uv_hub(void) { return is_uv(UV_ANY); }
+#endif

Defining those helpers across two different headers seems like a recipe for pain.

I suspect a big chunk of those stubs (and their #ifdefs could completely go away if you _just_ did:

#ifdef CONFIG_X86_UV
static inline int uv_hub_type(void)

{
        return uv_hub_info->hub_type;
}
#else
static inline int uv_hub_type(void)
{
	return 0;
}

#endif

In any case, this is precisely the kind of patch that would be best refactored into two piece: one to expose the is_uv...() function and another to actually use it.

Also, at this point, this:

arch/x86/include/asm/uv/uv_hub.h static inline int is_uvy_hub(void) { return is_uv(UVY); }

Quoted 6 lines
arch/x86/include/asm/uv/uv_hub.h +1 -1
 	if (boot_cpu_has(X86_FEATURE_CONSTANT_TSC) &&
 	    boot_cpu_has(X86_FEATURE_NONSTOP_TSC) &&
 	    boot_cpu_has(X86_FEATURE_TSC_ADJUST) &&
-	    topology_max_packages() <= 4)
+	    (topology_max_packages() <= 4 || is_uvy_hub()))
 		tsc_disable_clocksource_watchdog();

has IMNHO gotten out of hand.

It should probably be:

arch/x86/kernel/tsc.c +0 -0
 	if (boot_cpu_has(X86_FEATURE_CONSTANT_TSC) &&
 	    boot_cpu_has(X86_FEATURE_NONSTOP_TSC) &&
 	    boot_cpu_has(X86_FEATURE_TSC_ADJUST) &&

platform_is_exempt_from_watchdog())
tsc_disable_clocksource_watchdog();

Quoted 2 lines

In addition, 233756a640be talked quite a bit about *why* the 4-socket line was chosen. This needs to have a similar explanation for UV systems.

I will add the following to the description:

"HPE UV hardware and firmware is designed to ensure a reliable and synchronized
TSC mechanism. Comparing the TSC against secondary clocksources can result in false positives due to variable access latency caused by system traffic. The best course of action against these false positives has been found to simply disable watchdog checking of the TSC. Currently we recommend that customers apply 'tsc=nowatchdog' to the kernel command line."

The requested code changes will be forthcoming.

#3 lore raw
In reply to Dimitri Sivanich

Hello,

Quoted 9 lines · Dimitri Sivanich

Disable clocksource watchdog checking on recent and future UV platforms to avoid false positives.

Commits 'b50db7095fe0 ("x86/tsc: Disable clocksource watchdog for TSC on qualified platforms")' and '233756a640be ("Extend watchdog check exemption to 4-Sockets platform")' were introduced to avoid an issue where the TSC is falsely declared unstable by exempting qualified platforms of up to 4-sockets from TSC clocksource watchdog checking. Extend that exemption to include recent and future UV platforms.

I am sorry for being MIA for all this time. Apart from HPE customers who do not follow the instruction to add tsc=nowatchdog to the kernel command line, there is another use case for this patch. It has to do with SUSE's efforts to ship a single image per product for deploying machines in the cloud. HPE UV systems that will be used as bare metal are one of the planned instances. The old implementation of the clocksource watchdog needs to be switched off on those UV systems. So, the intention is to backport this patch to all SLES releases that are in active use in the cloud.

A new implementation of the clocksource watchdog has been merged into the upstream kernel. One of the changes made by the new clocksource watchdog implementation is that reference clocksource reads are made on the boot CPU only. Perhaps, the sgi_rtc clocksource would work well with this implementation. So, testing is needed in order to find out if this patch are any future in the upstream Linux. Dimitri, would you be able to run tests on UV systems to check if the new clocksource watchdog implementation works and the hardware limitations of sgi_rtc do not get in the way?

Signature · 2 lines
Jiri Wiesner
SUSE Labs
#4 lore raw
Quoted 13 lines · Jiri Wiesner

Hello,

Quoted 9 lines · Dimitri Sivanich

Disable clocksource watchdog checking on recent and future UV platforms to avoid false positives.

Commits 'b50db7095fe0 ("x86/tsc: Disable clocksource watchdog for TSC on qualified platforms")' and '233756a640be ("Extend watchdog check exemption to 4-Sockets platform")' were introduced to avoid an issue where the TSC is falsely declared unstable by exempting qualified platforms of up to 4-sockets from TSC clocksource watchdog checking. Extend that exemption to include recent and future UV platforms.

Quoted 3 lines

I am sorry for being MIA for all this time. Apart from HPE customers who do not follow the instruction to add tsc=nowatchdog to the kernel command line, there is another use case for this patch. It has to do with SUSE's efforts to ship a single image per product for deploying machines in the cloud. HPE UV systems that will be used as bare metal are one of the planned instances. The old implementation of the clocksource watchdog needs to be switched off on those UV systems. So, the intention is to backport this patch to all SLES releases that are in active use in the cloud.

A new implementation of the clocksource watchdog has been merged into the upstream kernel. One of the changes made by the new clocksource watchdog implementation is that reference clocksource reads are made on the boot CPU only. Perhaps, the sgi_rtc clocksource would work well with this implementation. So, testing is needed in order to find out if this patch are any future in the upstream Linux. Dimitri, would you be able to run tests on UV systems to check if the new clocksource watchdog implementation works and the hardware limitations of sgi_rtc do not get in the way?

Jiri, I'll be submitting a V4 patch to address this.