[PATCH v2] x86/tsc: Disable clocksource watchdog for TSC on recent UV

Dimitri Sivanich posted 1 patch 2 months ago
There is a newer version of this series
arch/x86/include/asm/uv/uv_hub.h | 8 ++++++++
arch/x86/kernel/tsc.c            | 4 ++--
2 files changed, 10 insertions(+), 2 deletions(-)
[PATCH v2] x86/tsc: Disable clocksource watchdog for TSC on recent UV
Posted by Dimitri Sivanich 2 months ago
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.

Signed-off-by: Dimitri Sivanich <sivanich@hpe.com>
---

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

 arch/x86/include/asm/uv/uv_hub.h | 8 ++++++++
 arch/x86/kernel/tsc.c            | 4 ++--
 2 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/arch/x86/include/asm/uv/uv_hub.h b/arch/x86/include/asm/uv/uv_hub.h
index ea877fd83114..0ac079e820b0 100644
--- a/arch/x86/include/asm/uv/uv_hub.h
+++ b/arch/x86/include/asm/uv/uv_hub.h
@@ -26,6 +26,7 @@
 #include <asm/irq_vectors.h>
 #include <asm/io_apic.h>
 
+#ifdef CONFIG_X86_UV
 
 /*
  * Addressing Terminology
@@ -785,5 +786,12 @@ static inline int uv_get_min_hub_revision_id(void)
 	return uv_hub_info->hub_revision;
 }
 
+#else /* !X86_UV */
+
+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 */
 #endif /* CONFIG_X86_64 */
 #endif /* _ASM_X86_UV_UV_HUB_H */
diff --git a/arch/x86/kernel/tsc.c b/arch/x86/kernel/tsc.c
index 87e749106dda..23727d7214e6 100644
--- a/arch/x86/kernel/tsc.c
+++ b/arch/x86/kernel/tsc.c
@@ -31,7 +31,7 @@
 #include <asm/i8259.h>
 #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 +1261,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();
 }
 
-- 
2.43.0
Re: [PATCH v2] x86/tsc: Disable clocksource watchdog for TSC on recent UV
Posted by kernel test robot 1 month, 4 weeks ago
Hi Dimitri,

kernel test robot noticed the following build errors:

[auto build test ERROR on tip/x86/core]
[also build test ERROR on tip/master linus/master v6.16 next-20250807]
[cannot apply to tip/auto-latest]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Dimitri-Sivanich/x86-tsc-Disable-clocksource-watchdog-for-TSC-on-recent-UV/20250806-120227
base:   tip/x86/core
patch link:    https://lore.kernel.org/r/aJH9ke0k0HnL8g6h%40hpe.com
patch subject: [PATCH v2] x86/tsc: Disable clocksource watchdog for TSC on recent UV
config: i386-randconfig-011-20250808 (https://download.01.org/0day-ci/archive/20250808/202508081446.3ZnRCG1T-lkp@intel.com/config)
compiler: clang version 20.1.8 (https://github.com/llvm/llvm-project 87f0227cb60147a26a1eeb4fb06e3b505e9c7261)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250808/202508081446.3ZnRCG1T-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202508081446.3ZnRCG1T-lkp@intel.com/

All errors (new ones prefixed by >>):

>> arch/x86/kernel/tsc.c:1264:39: error: call to undeclared function 'is_uvy_hub'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
    1264 |             (topology_max_packages() <= 4 || is_uvy_hub()))
         |                                              ^
   arch/x86/kernel/tsc.c:1517:6: error: call to undeclared function 'is_early_uv_system'; ISO C99 and later do not support implicit function declarations [-Wimplicit-function-declaration]
    1517 |         if (is_early_uv_system())
         |             ^
   2 errors generated.


vim +/is_uvy_hub +1264 arch/x86/kernel/tsc.c

  1235	
  1236	static void __init check_system_tsc_reliable(void)
  1237	{
  1238	#if defined(CONFIG_MGEODEGX1) || defined(CONFIG_MGEODE_LX) || defined(CONFIG_X86_GENERIC)
  1239		if (is_geode_lx()) {
  1240			/* RTSC counts during suspend */
  1241	#define RTSC_SUSP 0x100
  1242			unsigned long res_low, res_high;
  1243	
  1244			rdmsr_safe(MSR_GEODE_BUSCONT_CONF0, &res_low, &res_high);
  1245			/* Geode_LX - the OLPC CPU has a very reliable TSC */
  1246			if (res_low & RTSC_SUSP)
  1247				tsc_clocksource_reliable = 1;
  1248		}
  1249	#endif
  1250		if (boot_cpu_has(X86_FEATURE_TSC_RELIABLE))
  1251			tsc_clocksource_reliable = 1;
  1252	
  1253		/*
  1254		 * Disable the clocksource watchdog when the system has:
  1255		 *  - TSC running at constant frequency
  1256		 *  - TSC which does not stop in C-States
  1257		 *  - the TSC_ADJUST register which allows to detect even minimal
  1258		 *    modifications
  1259		 *  - not more than four packages
  1260		 */
  1261		if (boot_cpu_has(X86_FEATURE_CONSTANT_TSC) &&
  1262		    boot_cpu_has(X86_FEATURE_NONSTOP_TSC) &&
  1263		    boot_cpu_has(X86_FEATURE_TSC_ADJUST) &&
> 1264		    (topology_max_packages() <= 4 || is_uvy_hub()))
  1265			tsc_disable_clocksource_watchdog();
  1266	}
  1267	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki